diff --git a/packages/google-api-cloudquotas/README.md b/packages/google-api-cloudquotas/README.md index 826a4dccdb5..06c29d6c520 100644 --- a/packages/google-api-cloudquotas/README.md +++ b/packages/google-api-cloudquotas/README.md @@ -139,6 +139,14 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Cloud_quotas.list_quota_infos | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1/cloud_quotas.list_quota_infos.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1/cloud_quotas.list_quota_infos.js,packages/google-api-cloudquotas/samples/README.md) | | Cloud_quotas.list_quota_preferences | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1/cloud_quotas.list_quota_preferences.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1/cloud_quotas.list_quota_preferences.js,packages/google-api-cloudquotas/samples/README.md) | | Cloud_quotas.update_quota_preference | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1/cloud_quotas.update_quota_preference.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1/cloud_quotas.update_quota_preference.js,packages/google-api-cloudquotas/samples/README.md) | +| Cloud_quotas.create_quota_preference | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.create_quota_preference.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.create_quota_preference.js,packages/google-api-cloudquotas/samples/README.md) | +| Cloud_quotas.get_quota_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_info.js,packages/google-api-cloudquotas/samples/README.md) | +| Cloud_quotas.get_quota_preference | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_preference.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_preference.js,packages/google-api-cloudquotas/samples/README.md) | +| Cloud_quotas.list_quota_infos | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_infos.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_infos.js,packages/google-api-cloudquotas/samples/README.md) | +| Cloud_quotas.list_quota_preferences | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_preferences.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_preferences.js,packages/google-api-cloudquotas/samples/README.md) | +| Cloud_quotas.update_quota_preference | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.update_quota_preference.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.update_quota_preference.js,packages/google-api-cloudquotas/samples/README.md) | +| Quota_adjuster_settings_manager.get_quota_adjuster_settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js,packages/google-api-cloudquotas/samples/README.md) | +| Quota_adjuster_settings_manager.update_quota_adjuster_settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js,packages/google-api-cloudquotas/samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/quickstart.js,packages/google-api-cloudquotas/samples/README.md) | diff --git a/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/cloudquotas.proto b/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/cloudquotas.proto new file mode 100644 index 00000000000..df1d68833fc --- /dev/null +++ b/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/cloudquotas.proto @@ -0,0 +1,322 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.cloudquotas.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/cloudquotas/v1beta/resources.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.CloudQuotas.V1Beta"; +option go_package = "cloud.google.com/go/cloudquotas/apiv1beta/cloudquotaspb;cloudquotaspb"; +option java_multiple_files = true; +option java_outer_classname = "CloudquotasProto"; +option java_package = "com.google.api.cloudquotas.v1beta"; +option php_namespace = "Google\\Cloud\\CloudQuotas\\V1beta"; +option ruby_package = "Google::Cloud::CloudQuotas::V1beta"; +option (google.api.resource_definition) = { + type: "cloudquotas.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/services/{service}" + pattern: "folders/{folder}/locations/{location}/services/{service}" + pattern: "organizations/{organization}/locations/{location}/services/{service}" +}; +option (google.api.resource_definition) = { + type: "cloudquotas.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" + pattern: "folders/{folder}/locations/{location}" + pattern: "organizations/{organization}/locations/{location}" +}; + +// The Cloud Quotas API is an infrastructure service for Google Cloud that lets +// service consumers list and manage their resource usage limits. +// +// - List/Get the metadata and current status of the quotas for a service. +// - Create/Update quota preferencess that declare the preferred quota values. +// - Check the status of a quota preference request. +// - List/Get pending and historical quota preference. +service CloudQuotas { + option (google.api.default_host) = "cloudquotas.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists QuotaInfos of all quotas for a given project, folder or organization. + rpc ListQuotaInfos(ListQuotaInfosRequest) returns (ListQuotaInfosResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*/services/*}/quotaInfos" + additional_bindings { + get: "/v1beta/{parent=organizations/*/locations/*/services/*}/quotaInfos" + } + additional_bindings { + get: "/v1beta/{parent=folders/*/locations/*/services/*}/quotaInfos" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieve the QuotaInfo of a quota for a project, folder or organization. + rpc GetQuotaInfo(GetQuotaInfoRequest) returns (QuotaInfo) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/services/*/quotaInfos/*}" + additional_bindings { + get: "/v1beta/{name=organizations/*/locations/*/services/*/quotaInfos/*}" + } + additional_bindings { + get: "/v1beta/{name=folders/*/locations/*/services/*/quotaInfos/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists QuotaPreferences in a given project, folder or organization. + rpc ListQuotaPreferences(ListQuotaPreferencesRequest) + returns (ListQuotaPreferencesResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/locations/*}/quotaPreferences" + additional_bindings { + get: "/v1beta/{parent=folders/*/locations/*}/quotaPreferences" + } + additional_bindings { + get: "/v1beta/{parent=organizations/*/locations/*}/quotaPreferences" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single QuotaPreference. + rpc GetQuotaPreference(GetQuotaPreferenceRequest) returns (QuotaPreference) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/quotaPreferences/*}" + additional_bindings { + get: "/v1beta/{name=organizations/*/locations/*/quotaPreferences/*}" + } + additional_bindings { + get: "/v1beta/{name=folders/*/locations/*/quotaPreferences/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new QuotaPreference that declares the desired value for a quota. + rpc CreateQuotaPreference(CreateQuotaPreferenceRequest) + returns (QuotaPreference) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*/locations/*}/quotaPreferences" + body: "quota_preference" + additional_bindings { + post: "/v1beta/{parent=folders/*/locations/*}/quotaPreferences" + body: "quota_preference" + } + additional_bindings { + post: "/v1beta/{parent=organizations/*/locations/*}/quotaPreferences" + body: "quota_preference" + } + }; + option (google.api.method_signature) = + "parent,quota_preference,quota_preference_id"; + option (google.api.method_signature) = "parent,quota_preference"; + } + + // Updates the parameters of a single QuotaPreference. It can updates the + // config in any states, not just the ones pending approval. + rpc UpdateQuotaPreference(UpdateQuotaPreferenceRequest) + returns (QuotaPreference) { + option (google.api.http) = { + patch: "/v1beta/{quota_preference.name=projects/*/locations/*/quotaPreferences/*}" + body: "quota_preference" + additional_bindings { + patch: "/v1beta/{quota_preference.name=folders/*/locations/*/quotaPreferences/*}" + body: "quota_preference" + } + additional_bindings { + patch: "/v1beta/{quota_preference.name=organizations/*/locations/*/quotaPreferences/*}" + body: "quota_preference" + } + }; + option (google.api.method_signature) = "quota_preference,update_mask"; + } +} + +// Message for requesting list of QuotaInfos +message ListQuotaInfosRequest { + // Required. Parent value of QuotaInfo resources. + // Listing across different resource containers (such as 'projects/-') is not + // allowed. + // + // Example names: + // `projects/123/locations/global/services/compute.googleapis.com` + // `folders/234/locations/global/services/compute.googleapis.com` + // `organizations/345/locations/global/services/compute.googleapis.com` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudquotas.googleapis.com/QuotaInfo" + } + ]; + + // 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]; +} + +// Message for response to listing QuotaInfos +message ListQuotaInfosResponse { + // The list of QuotaInfo + repeated QuotaInfo quota_infos = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Message for getting a QuotaInfo +message GetQuotaInfoRequest { + // Required. The resource name of the quota info. + // + // An example name: + // `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudquotas.googleapis.com/QuotaInfo" + } + ]; +} + +// Message for requesting list of QuotaPreferences +message ListQuotaPreferencesRequest { + // Required. Parent value of QuotaPreference resources. + // Listing across different resource containers (such as 'projects/-') is not + // allowed. + // + // When the value starts with 'folders' or 'organizations', it lists the + // QuotaPreferences for org quotas in the container. It does not list the + // QuotaPreferences in the descendant projects of the container. + // + // Example parents: + // `projects/123/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudquotas.googleapis.com/QuotaPreference" + } + ]; + + // 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. Filter result QuotaPreferences by their state, type, + // create/update time range. + // + // Example filters: + // `reconciling=true AND request_type=CLOUD_CONSOLE`, + // `reconciling=true OR creation_time>2022-12-03T10:30:00` + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. How to order of the results. By default, the results are ordered + // by create time. + // + // Example orders: + // `quota_id`, + // `service, create_time` + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Message for response to listing QuotaPreferences +message ListQuotaPreferencesResponse { + // The list of QuotaPreference + repeated QuotaPreference quota_preferences = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Message for getting a QuotaPreference +message GetQuotaPreferenceRequest { + // Required. Name of the resource + // + // Example name: + // `projects/123/locations/global/quota_preferences/my-config-for-us-east1` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudquotas.googleapis.com/QuotaPreference" + } + ]; +} + +// Message for creating a QuotaPreference +message CreateQuotaPreferenceRequest { + // Required. Value for parent. + // + // Example: + // `projects/123/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudquotas.googleapis.com/QuotaPreference" + } + ]; + + // Optional. Id of the requesting object, must be unique under its parent. + // If client does not set this field, the service will generate one. + string quota_preference_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The resource being created + QuotaPreference quota_preference = 3 [(google.api.field_behavior) = REQUIRED]; + + // The list of quota safety checks to be ignored. + repeated QuotaSafetyCheck ignore_safety_checks = 4; +} + +// Message for updating a QuotaPreference +message UpdateQuotaPreferenceRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // QuotaPreference 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. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The resource being updated + QuotaPreference quota_preference = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. If set to true, and the quota preference is not found, a new one + // will be created. In this situation, `update_mask` is ignored. + bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, validate the request, but do not actually update. + // Note that a request being valid does not mean that the request is + // guaranteed to be fulfilled. + bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; + + // The list of quota safety checks to be ignored. + repeated QuotaSafetyCheck ignore_safety_checks = 5; +} diff --git a/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/quota_adjuster_settings.proto b/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/quota_adjuster_settings.proto new file mode 100644 index 00000000000..ac887ed6e03 --- /dev/null +++ b/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/quota_adjuster_settings.proto @@ -0,0 +1,134 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.cloudquotas.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.CloudQuotas.V1Beta"; +option go_package = "cloud.google.com/go/cloudquotas/apiv1beta/cloudquotaspb;cloudquotaspb"; +option java_multiple_files = true; +option java_outer_classname = "QuotaAdjusterSettingsProto"; +option java_package = "com.google.api.cloudquotas.v1beta"; +option php_namespace = "Google\\Cloud\\CloudQuotas\\V1beta"; +option ruby_package = "Google::Cloud::CloudQuotas::V1beta"; + +// The Quotas Adjuster Settings API is an infrastructure service for Google +// Cloud that lets service consumers view and update their quota adjuster +// settings. +// +// - Update quota adjuster settings. +// - Get the name of the configurations. +service QuotaAdjusterSettingsManager { + option (google.api.default_host) = "cloudquotas.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // RPC Method for updating QuotaAdjusterSettings based on the request + rpc UpdateQuotaAdjusterSettings(UpdateQuotaAdjusterSettingsRequest) + returns (QuotaAdjusterSettings) { + option (google.api.http) = { + patch: "/v1beta/{quota_adjuster_settings.name=projects/*/locations/*/quotaAdjusterSettings}" + body: "quota_adjuster_settings" + }; + option (google.api.method_signature) = + "quota_adjuster_settings,update_mask"; + } + + // RPC Method for getting QuotaAdjusterSettings based on the request + rpc GetQuotaAdjusterSettings(GetQuotaAdjusterSettingsRequest) + returns (QuotaAdjusterSettings) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/locations/*/quotaAdjusterSettings}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request for getting QuotaAdjusterSettings +message GetQuotaAdjusterSettingsRequest { + // Required. Name of the config. Required to be “settings”, as only a single + // setting per container will be supported initially. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudquotas.googleapis.com/QuotaAdjusterSettings" + } + ]; +} + +// Request for updating QuotaAdjusterSettings +message UpdateQuotaAdjusterSettingsRequest { + // Required. The QuotaAdjusterSettings to update. + QuotaAdjusterSettings quota_adjuster_settings = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The list of fields to update. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, validate the request, but do not actually update. + // Note that a request being valid does not mean that the request is + // guaranteed to be fulfilled. + bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The QuotaAdjusterSettings resource defines the settings for the Quota +// Adjuster. +message QuotaAdjusterSettings { + option (google.api.resource) = { + type: "cloudquotas.googleapis.com/QuotaAdjusterSettings" + pattern: "projects/{project}/locations/{location}/quotaAdjusterSettings" + plural: "quotaAdjusterSettings" + singular: "quotaAdjusterSettings" + style: DECLARATIVE_FRIENDLY + }; + + // The enablement status of the quota adjuster. + enum Enablement { + // The quota adjuster is in an unknown state. + ENABLEMENT_UNSPECIFIED = 0; + + // The quota adjuster is enabled. + ENABLED = 2; + + // The quota adjuster is disabled. + DISABLED = 3; + } + + // Identifier. Name of the config would be of the format: + // projects/12345/locations/global/quotaAdjusterSettings + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Required. The configured value of the enablement at the given resource. + Enablement enablement = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The timestamp when the QuotaAdjusterSettings was last updated. + google.protobuf.Timestamp update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The current etag of the QuotaAdjusterSettings. If an etag is + // provided on update and does not match the current server's etag of the + // QuotaAdjusterSettings, the request will be blocked and an ABORTED error + // will be returned. See https://google.aip.dev/134#etags for more details on + // etags. + string etag = 6 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/resources.proto b/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/resources.proto new file mode 100644 index 00000000000..387a91dbe8d --- /dev/null +++ b/packages/google-api-cloudquotas/protos/google/api/cloudquotas/v1beta/resources.proto @@ -0,0 +1,321 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api.cloudquotas.v1beta; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.CloudQuotas.V1Beta"; +option go_package = "cloud.google.com/go/cloudquotas/apiv1beta/cloudquotaspb;cloudquotaspb"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.api.cloudquotas.v1beta"; +option php_namespace = "Google\\Cloud\\CloudQuotas\\V1beta"; +option ruby_package = "Google::Cloud::CloudQuotas::V1beta"; + +// Enumerations of quota safety checks. +enum QuotaSafetyCheck { + // Unspecified quota safety check. + QUOTA_SAFETY_CHECK_UNSPECIFIED = 0; + + // Validates that a quota mutation would not cause the consumer's effective + // limit to be lower than the consumer's quota usage. + QUOTA_DECREASE_BELOW_USAGE = 1; + + // Validates that a quota mutation would not cause the consumer's effective + // limit to decrease by more than 10 percent. + QUOTA_DECREASE_PERCENTAGE_TOO_HIGH = 2; +} + +// QuotaInfo represents information about a particular quota for a given +// project, folder or organization. +message QuotaInfo { + option (google.api.resource) = { + type: "cloudquotas.googleapis.com/QuotaInfo" + pattern: "projects/{project}/locations/{location}/services/{service}/quotaInfos/{quota_info}" + pattern: "folders/{folder}/locations/{location}/services/{service}/quotaInfos/{quota_info}" + pattern: "organizations/{organization}/locations/{location}/services/{service}/quotaInfos/{quota_info}" + }; + + // The enumeration of the types of a cloud resource container. + enum ContainerType { + // Unspecified container type. + CONTAINER_TYPE_UNSPECIFIED = 0; + + // consumer project + PROJECT = 1; + + // folder + FOLDER = 2; + + // organization + ORGANIZATION = 3; + } + + // Resource name of this QuotaInfo. + // The ID component following "locations/" must be "global". + // Example: + // `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion` + string name = 1; + + // The id of the quota, which is unquie within the service. + // Example: `CpusPerProjectPerRegion` + string quota_id = 2; + + // The metric of the quota. It specifies the resources consumption the quota + // is defined for. + // Example: `compute.googleapis.com/cpus` + string metric = 3; + + // The name of the service in which the quota is defined. + // Example: `compute.googleapis.com` + string service = 4; + + // Whether this is a precise quota. A precise quota is tracked with absolute + // precision. In contrast, an imprecise quota is not tracked with precision. + bool is_precise = 5; + + // The reset time interval for the quota. Refresh interval applies to rate + // quota only. + // Example: "minute" for per minute, "day" for per day, or "10 seconds" for + // every 10 seconds. + string refresh_interval = 6; + + // The container type of the QuotaInfo. + ContainerType container_type = 7; + + // The dimensions the quota is defined on. + repeated string dimensions = 8; + + // The display name of the quota metric + string metric_display_name = 9; + + // The display name of the quota. + string quota_display_name = 10; + + // The unit in which the metric value is reported, e.g., "MByte". + string metric_unit = 11; + + // Whether it is eligible to request a higher quota value for this quota. + QuotaIncreaseEligibility quota_increase_eligibility = 12; + + // Whether the quota value is fixed or adjustable + bool is_fixed = 13; + + // The collection of dimensions info ordered by their dimensions from more + // specific ones to less specific ones. + repeated DimensionsInfo dimensions_infos = 14; + + // Whether the quota is a concurrent quota. Concurrent quotas are enforced + // on the total number of concurrent operations in flight at any given time. + bool is_concurrent = 15; + + // URI to the page where users can request more quota for the cloud + // service—for example, + // https://console.cloud.google.com/iam-admin/quotas. + string service_request_quota_uri = 17; +} + +// Eligibility information regarding requesting increase adjustment of a quota. +message QuotaIncreaseEligibility { + // The enumeration of reasons when it is ineligible to request increase + // adjustment. + enum IneligibilityReason { + // Default value when is_eligible is true. + INELIGIBILITY_REASON_UNSPECIFIED = 0; + + // The container is not linked with a valid billing account. + NO_VALID_BILLING_ACCOUNT = 1; + + // Quota increase is not supported for the quota. + NOT_SUPPORTED = 3; + + // There is not enough usage history to determine the eligibility. + NOT_ENOUGH_USAGE_HISTORY = 4; + + // Other reasons. + OTHER = 2; + } + + // Whether a higher quota value can be requested for the quota. + bool is_eligible = 1; + + // The reason of why it is ineligible to request increased value of the quota. + // If the is_eligible field is true, it defaults to + // INELIGIBILITY_REASON_UNSPECIFIED. + IneligibilityReason ineligibility_reason = 2; +} + +// QuotaPreference represents the preferred quota configuration specified for +// a project, folder or organization. There is only one QuotaPreference +// resource for a quota value targeting a unique set of dimensions. +message QuotaPreference { + option (google.api.resource) = { + type: "cloudquotas.googleapis.com/QuotaPreference" + pattern: "projects/{project}/locations/{location}/quotaPreferences/{quota_preference}" + pattern: "folders/{folder}/locations/{location}/quotaPreferences/{quota_preference}" + pattern: "organizations/{organization}/locations/{location}/quotaPreferences/{quota_preference}" + }; + + // Required except in the CREATE requests. + // The resource name of the quota preference. + // The ID component following "locations/" must be "global". + // Example: + // `projects/123/locations/global/quotaPreferences/my-config-for-us-east1` + string name = 1; + + // Immutable. The dimensions that this quota preference applies to. The key of + // the map entry is the name of a dimension, such as "region", "zone", + // "network_id", and the value of the map entry is the dimension value. + // + // If a dimension is missing from the map of dimensions, the quota preference + // applies to all the dimension values except for those that have other quota + // preferences configured for the specific value. + // + // NOTE: QuotaPreferences can only be applied across all values of "user" and + // "resource" dimension. Do not set values for "user" or "resource" in the + // dimension map. + // + // Example: {"provider", "Foo Inc"} where "provider" is a service specific + // dimension. + map dimensions = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Required. Preferred quota configuration. + QuotaConfig quota_config = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The current etag of the quota preference. If an etag is provided + // on update and does not match the current server's etag of the quota + // preference, the request will be blocked and an ABORTED error will be + // returned. See https://google.aip.dev/134#etags for more details on etags. + string etag = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Create time stamp + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Update time stamp + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The name of the service to which the quota preference is applied. + string service = 7 [(google.api.field_behavior) = REQUIRED]; + + // Required. The id of the quota to which the quota preference is applied. A + // quota name is unique in the service. Example: `CpusPerProjectPerRegion` + string quota_id = 8 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Is the quota preference pending Google Cloud approval and + // fulfillment. + bool reconciling = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The reason / justification for this quota preference. + string justification = 11; + + // Input only. An email address that can be used to contact the the user, in + // case Google Cloud needs more information to make a decision before + // additional quota can be granted. + // + // When requesting a quota increase, the email address is required. + // When requesting a quota decrease, the email address is optional. + // For example, the email address is optional when the + // `QuotaConfig.preferred_value` is smaller than the + // `QuotaDetails.reset_value`. + string contact_email = 12 [(google.api.field_behavior) = INPUT_ONLY]; +} + +// The preferred quota configuration. +message QuotaConfig { + // The enumeration of the origins of quota preference requests. + enum Origin { + // The unspecified value. + ORIGIN_UNSPECIFIED = 0; + + // Created through Cloud Console. + CLOUD_CONSOLE = 1; + + // Generated by automatic quota adjustment. + AUTO_ADJUSTER = 2; + } + + // Required. The preferred value. Must be greater than or equal to -1. If set + // to -1, it means the value is "unlimited". + int64 preferred_value = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Optional details about the state of this quota preference. + string state_detail = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Granted quota value. + google.protobuf.Int64Value granted_value = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The trace id that the Google Cloud uses to provision the + // requested quota. This trace id may be used by the client to contact Cloud + // support to track the state of a quota preference request. The trace id is + // only produced for increase requests and is unique for each request. The + // quota decrease requests do not have a trace id. + string trace_id = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The annotations map for clients to store small amounts of + // arbitrary data. Do not put PII or other sensitive information here. See + // https://google.aip.dev/128#annotations + map annotations = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The origin of the quota preference request. + Origin request_origin = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The detailed quota information such as effective quota value for a +// combination of dimensions. +message DimensionsInfo { + // The map of dimensions for this dimensions info. The key of a map entry + // is "region", "zone" or the name of a service specific dimension, and the + // value of a map entry is the value of the dimension. If a dimension does + // not appear in the map of dimensions, the dimensions info applies to all + // the dimension values except for those that have another DimenisonInfo + // instance configured for the specific value. + // Example: {"provider" : "Foo Inc"} where "provider" is a service specific + // dimension of a quota. + map dimensions = 1; + + // Quota details for the specified dimensions. + QuotaDetails details = 2; + + // The applicable regions or zones of this dimensions info. The field will be + // set to ['global'] for quotas that are not per region or per zone. + // Otherwise, it will be set to the list of locations this dimension info is + // applicable to. + repeated string applicable_locations = 3; +} + +// The quota details for a map of dimensions. +message QuotaDetails { + // The value currently in effect and being enforced. + int64 value = 1; + + // Rollout information of this quota. + // This field is present only if the effective limit will change due to the + // ongoing rollout of the service config. + RolloutInfo rollout_info = 3; +} + +// [Output only] Rollout information of a quota. +message RolloutInfo { + // Whether there is an ongoing rollout for a quota or not. + bool ongoing_rollout = 1; +} diff --git a/packages/google-api-cloudquotas/protos/protos.d.ts b/packages/google-api-cloudquotas/protos/protos.d.ts index 5df5a4ebb59..ff577165349 100644 --- a/packages/google-api-cloudquotas/protos/protos.d.ts +++ b/packages/google-api-cloudquotas/protos/protos.d.ts @@ -1971,6 +1971,2352 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } } + + /** Namespace v1beta. */ + namespace v1beta { + + /** Represents a CloudQuotas */ + class CloudQuotas extends $protobuf.rpc.Service { + + /** + * Constructs a new CloudQuotas 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 CloudQuotas 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): CloudQuotas; + + /** + * Calls ListQuotaInfos. + * @param request ListQuotaInfosRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListQuotaInfosResponse + */ + public listQuotaInfos(request: google.api.cloudquotas.v1beta.IListQuotaInfosRequest, callback: google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaInfosCallback): void; + + /** + * Calls ListQuotaInfos. + * @param request ListQuotaInfosRequest message or plain object + * @returns Promise + */ + public listQuotaInfos(request: google.api.cloudquotas.v1beta.IListQuotaInfosRequest): Promise; + + /** + * Calls GetQuotaInfo. + * @param request GetQuotaInfoRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QuotaInfo + */ + public getQuotaInfo(request: google.api.cloudquotas.v1beta.IGetQuotaInfoRequest, callback: google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaInfoCallback): void; + + /** + * Calls GetQuotaInfo. + * @param request GetQuotaInfoRequest message or plain object + * @returns Promise + */ + public getQuotaInfo(request: google.api.cloudquotas.v1beta.IGetQuotaInfoRequest): Promise; + + /** + * Calls ListQuotaPreferences. + * @param request ListQuotaPreferencesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListQuotaPreferencesResponse + */ + public listQuotaPreferences(request: google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, callback: google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaPreferencesCallback): void; + + /** + * Calls ListQuotaPreferences. + * @param request ListQuotaPreferencesRequest message or plain object + * @returns Promise + */ + public listQuotaPreferences(request: google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest): Promise; + + /** + * Calls GetQuotaPreference. + * @param request GetQuotaPreferenceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QuotaPreference + */ + public getQuotaPreference(request: google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest, callback: google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaPreferenceCallback): void; + + /** + * Calls GetQuotaPreference. + * @param request GetQuotaPreferenceRequest message or plain object + * @returns Promise + */ + public getQuotaPreference(request: google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest): Promise; + + /** + * Calls CreateQuotaPreference. + * @param request CreateQuotaPreferenceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QuotaPreference + */ + public createQuotaPreference(request: google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest, callback: google.api.cloudquotas.v1beta.CloudQuotas.CreateQuotaPreferenceCallback): void; + + /** + * Calls CreateQuotaPreference. + * @param request CreateQuotaPreferenceRequest message or plain object + * @returns Promise + */ + public createQuotaPreference(request: google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest): Promise; + + /** + * Calls UpdateQuotaPreference. + * @param request UpdateQuotaPreferenceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QuotaPreference + */ + public updateQuotaPreference(request: google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest, callback: google.api.cloudquotas.v1beta.CloudQuotas.UpdateQuotaPreferenceCallback): void; + + /** + * Calls UpdateQuotaPreference. + * @param request UpdateQuotaPreferenceRequest message or plain object + * @returns Promise + */ + public updateQuotaPreference(request: google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest): Promise; + } + + namespace CloudQuotas { + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|listQuotaInfos}. + * @param error Error, if any + * @param [response] ListQuotaInfosResponse + */ + type ListQuotaInfosCallback = (error: (Error|null), response?: google.api.cloudquotas.v1beta.ListQuotaInfosResponse) => void; + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|getQuotaInfo}. + * @param error Error, if any + * @param [response] QuotaInfo + */ + type GetQuotaInfoCallback = (error: (Error|null), response?: google.api.cloudquotas.v1beta.QuotaInfo) => void; + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|listQuotaPreferences}. + * @param error Error, if any + * @param [response] ListQuotaPreferencesResponse + */ + type ListQuotaPreferencesCallback = (error: (Error|null), response?: google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse) => void; + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|getQuotaPreference}. + * @param error Error, if any + * @param [response] QuotaPreference + */ + type GetQuotaPreferenceCallback = (error: (Error|null), response?: google.api.cloudquotas.v1beta.QuotaPreference) => void; + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|createQuotaPreference}. + * @param error Error, if any + * @param [response] QuotaPreference + */ + type CreateQuotaPreferenceCallback = (error: (Error|null), response?: google.api.cloudquotas.v1beta.QuotaPreference) => void; + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|updateQuotaPreference}. + * @param error Error, if any + * @param [response] QuotaPreference + */ + type UpdateQuotaPreferenceCallback = (error: (Error|null), response?: google.api.cloudquotas.v1beta.QuotaPreference) => void; + } + + /** Properties of a ListQuotaInfosRequest. */ + interface IListQuotaInfosRequest { + + /** ListQuotaInfosRequest parent */ + parent?: (string|null); + + /** ListQuotaInfosRequest pageSize */ + pageSize?: (number|null); + + /** ListQuotaInfosRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListQuotaInfosRequest. */ + class ListQuotaInfosRequest implements IListQuotaInfosRequest { + + /** + * Constructs a new ListQuotaInfosRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IListQuotaInfosRequest); + + /** ListQuotaInfosRequest parent. */ + public parent: string; + + /** ListQuotaInfosRequest pageSize. */ + public pageSize: number; + + /** ListQuotaInfosRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListQuotaInfosRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListQuotaInfosRequest instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IListQuotaInfosRequest): google.api.cloudquotas.v1beta.ListQuotaInfosRequest; + + /** + * Encodes the specified ListQuotaInfosRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaInfosRequest.verify|verify} messages. + * @param message ListQuotaInfosRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IListQuotaInfosRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListQuotaInfosRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaInfosRequest.verify|verify} messages. + * @param message ListQuotaInfosRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IListQuotaInfosRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListQuotaInfosRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListQuotaInfosRequest + * @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.cloudquotas.v1beta.ListQuotaInfosRequest; + + /** + * Decodes a ListQuotaInfosRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListQuotaInfosRequest + * @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.cloudquotas.v1beta.ListQuotaInfosRequest; + + /** + * Verifies a ListQuotaInfosRequest 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 ListQuotaInfosRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListQuotaInfosRequest + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.ListQuotaInfosRequest; + + /** + * Creates a plain object from a ListQuotaInfosRequest message. Also converts values to other types if specified. + * @param message ListQuotaInfosRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.ListQuotaInfosRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListQuotaInfosRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListQuotaInfosRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListQuotaInfosResponse. */ + interface IListQuotaInfosResponse { + + /** ListQuotaInfosResponse quotaInfos */ + quotaInfos?: (google.api.cloudquotas.v1beta.IQuotaInfo[]|null); + + /** ListQuotaInfosResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListQuotaInfosResponse. */ + class ListQuotaInfosResponse implements IListQuotaInfosResponse { + + /** + * Constructs a new ListQuotaInfosResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IListQuotaInfosResponse); + + /** ListQuotaInfosResponse quotaInfos. */ + public quotaInfos: google.api.cloudquotas.v1beta.IQuotaInfo[]; + + /** ListQuotaInfosResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListQuotaInfosResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListQuotaInfosResponse instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IListQuotaInfosResponse): google.api.cloudquotas.v1beta.ListQuotaInfosResponse; + + /** + * Encodes the specified ListQuotaInfosResponse message. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaInfosResponse.verify|verify} messages. + * @param message ListQuotaInfosResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IListQuotaInfosResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListQuotaInfosResponse message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaInfosResponse.verify|verify} messages. + * @param message ListQuotaInfosResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IListQuotaInfosResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListQuotaInfosResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListQuotaInfosResponse + * @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.cloudquotas.v1beta.ListQuotaInfosResponse; + + /** + * Decodes a ListQuotaInfosResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListQuotaInfosResponse + * @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.cloudquotas.v1beta.ListQuotaInfosResponse; + + /** + * Verifies a ListQuotaInfosResponse 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 ListQuotaInfosResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListQuotaInfosResponse + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.ListQuotaInfosResponse; + + /** + * Creates a plain object from a ListQuotaInfosResponse message. Also converts values to other types if specified. + * @param message ListQuotaInfosResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.ListQuotaInfosResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListQuotaInfosResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListQuotaInfosResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetQuotaInfoRequest. */ + interface IGetQuotaInfoRequest { + + /** GetQuotaInfoRequest name */ + name?: (string|null); + } + + /** Represents a GetQuotaInfoRequest. */ + class GetQuotaInfoRequest implements IGetQuotaInfoRequest { + + /** + * Constructs a new GetQuotaInfoRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IGetQuotaInfoRequest); + + /** GetQuotaInfoRequest name. */ + public name: string; + + /** + * Creates a new GetQuotaInfoRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetQuotaInfoRequest instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IGetQuotaInfoRequest): google.api.cloudquotas.v1beta.GetQuotaInfoRequest; + + /** + * Encodes the specified GetQuotaInfoRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaInfoRequest.verify|verify} messages. + * @param message GetQuotaInfoRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IGetQuotaInfoRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetQuotaInfoRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaInfoRequest.verify|verify} messages. + * @param message GetQuotaInfoRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IGetQuotaInfoRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetQuotaInfoRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetQuotaInfoRequest + * @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.cloudquotas.v1beta.GetQuotaInfoRequest; + + /** + * Decodes a GetQuotaInfoRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetQuotaInfoRequest + * @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.cloudquotas.v1beta.GetQuotaInfoRequest; + + /** + * Verifies a GetQuotaInfoRequest 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 GetQuotaInfoRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetQuotaInfoRequest + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.GetQuotaInfoRequest; + + /** + * Creates a plain object from a GetQuotaInfoRequest message. Also converts values to other types if specified. + * @param message GetQuotaInfoRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.GetQuotaInfoRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetQuotaInfoRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetQuotaInfoRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListQuotaPreferencesRequest. */ + interface IListQuotaPreferencesRequest { + + /** ListQuotaPreferencesRequest parent */ + parent?: (string|null); + + /** ListQuotaPreferencesRequest pageSize */ + pageSize?: (number|null); + + /** ListQuotaPreferencesRequest pageToken */ + pageToken?: (string|null); + + /** ListQuotaPreferencesRequest filter */ + filter?: (string|null); + + /** ListQuotaPreferencesRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListQuotaPreferencesRequest. */ + class ListQuotaPreferencesRequest implements IListQuotaPreferencesRequest { + + /** + * Constructs a new ListQuotaPreferencesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest); + + /** ListQuotaPreferencesRequest parent. */ + public parent: string; + + /** ListQuotaPreferencesRequest pageSize. */ + public pageSize: number; + + /** ListQuotaPreferencesRequest pageToken. */ + public pageToken: string; + + /** ListQuotaPreferencesRequest filter. */ + public filter: string; + + /** ListQuotaPreferencesRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListQuotaPreferencesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListQuotaPreferencesRequest instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest): google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest; + + /** + * Encodes the specified ListQuotaPreferencesRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest.verify|verify} messages. + * @param message ListQuotaPreferencesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListQuotaPreferencesRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest.verify|verify} messages. + * @param message ListQuotaPreferencesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListQuotaPreferencesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListQuotaPreferencesRequest + * @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.cloudquotas.v1beta.ListQuotaPreferencesRequest; + + /** + * Decodes a ListQuotaPreferencesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListQuotaPreferencesRequest + * @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.cloudquotas.v1beta.ListQuotaPreferencesRequest; + + /** + * Verifies a ListQuotaPreferencesRequest 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 ListQuotaPreferencesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListQuotaPreferencesRequest + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest; + + /** + * Creates a plain object from a ListQuotaPreferencesRequest message. Also converts values to other types if specified. + * @param message ListQuotaPreferencesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListQuotaPreferencesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListQuotaPreferencesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListQuotaPreferencesResponse. */ + interface IListQuotaPreferencesResponse { + + /** ListQuotaPreferencesResponse quotaPreferences */ + quotaPreferences?: (google.api.cloudquotas.v1beta.IQuotaPreference[]|null); + + /** ListQuotaPreferencesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListQuotaPreferencesResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListQuotaPreferencesResponse. */ + class ListQuotaPreferencesResponse implements IListQuotaPreferencesResponse { + + /** + * Constructs a new ListQuotaPreferencesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse); + + /** ListQuotaPreferencesResponse quotaPreferences. */ + public quotaPreferences: google.api.cloudquotas.v1beta.IQuotaPreference[]; + + /** ListQuotaPreferencesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListQuotaPreferencesResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListQuotaPreferencesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListQuotaPreferencesResponse instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse): google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse; + + /** + * Encodes the specified ListQuotaPreferencesResponse message. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse.verify|verify} messages. + * @param message ListQuotaPreferencesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListQuotaPreferencesResponse message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse.verify|verify} messages. + * @param message ListQuotaPreferencesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListQuotaPreferencesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListQuotaPreferencesResponse + * @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.cloudquotas.v1beta.ListQuotaPreferencesResponse; + + /** + * Decodes a ListQuotaPreferencesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListQuotaPreferencesResponse + * @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.cloudquotas.v1beta.ListQuotaPreferencesResponse; + + /** + * Verifies a ListQuotaPreferencesResponse 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 ListQuotaPreferencesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListQuotaPreferencesResponse + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse; + + /** + * Creates a plain object from a ListQuotaPreferencesResponse message. Also converts values to other types if specified. + * @param message ListQuotaPreferencesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListQuotaPreferencesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListQuotaPreferencesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetQuotaPreferenceRequest. */ + interface IGetQuotaPreferenceRequest { + + /** GetQuotaPreferenceRequest name */ + name?: (string|null); + } + + /** Represents a GetQuotaPreferenceRequest. */ + class GetQuotaPreferenceRequest implements IGetQuotaPreferenceRequest { + + /** + * Constructs a new GetQuotaPreferenceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest); + + /** GetQuotaPreferenceRequest name. */ + public name: string; + + /** + * Creates a new GetQuotaPreferenceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetQuotaPreferenceRequest instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest): google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest; + + /** + * Encodes the specified GetQuotaPreferenceRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest.verify|verify} messages. + * @param message GetQuotaPreferenceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetQuotaPreferenceRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest.verify|verify} messages. + * @param message GetQuotaPreferenceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetQuotaPreferenceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetQuotaPreferenceRequest + * @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.cloudquotas.v1beta.GetQuotaPreferenceRequest; + + /** + * Decodes a GetQuotaPreferenceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetQuotaPreferenceRequest + * @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.cloudquotas.v1beta.GetQuotaPreferenceRequest; + + /** + * Verifies a GetQuotaPreferenceRequest 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 GetQuotaPreferenceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetQuotaPreferenceRequest + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest; + + /** + * Creates a plain object from a GetQuotaPreferenceRequest message. Also converts values to other types if specified. + * @param message GetQuotaPreferenceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetQuotaPreferenceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetQuotaPreferenceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateQuotaPreferenceRequest. */ + interface ICreateQuotaPreferenceRequest { + + /** CreateQuotaPreferenceRequest parent */ + parent?: (string|null); + + /** CreateQuotaPreferenceRequest quotaPreferenceId */ + quotaPreferenceId?: (string|null); + + /** CreateQuotaPreferenceRequest quotaPreference */ + quotaPreference?: (google.api.cloudquotas.v1beta.IQuotaPreference|null); + + /** CreateQuotaPreferenceRequest ignoreSafetyChecks */ + ignoreSafetyChecks?: (google.api.cloudquotas.v1beta.QuotaSafetyCheck[]|null); + } + + /** Represents a CreateQuotaPreferenceRequest. */ + class CreateQuotaPreferenceRequest implements ICreateQuotaPreferenceRequest { + + /** + * Constructs a new CreateQuotaPreferenceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest); + + /** CreateQuotaPreferenceRequest parent. */ + public parent: string; + + /** CreateQuotaPreferenceRequest quotaPreferenceId. */ + public quotaPreferenceId: string; + + /** CreateQuotaPreferenceRequest quotaPreference. */ + public quotaPreference?: (google.api.cloudquotas.v1beta.IQuotaPreference|null); + + /** CreateQuotaPreferenceRequest ignoreSafetyChecks. */ + public ignoreSafetyChecks: google.api.cloudquotas.v1beta.QuotaSafetyCheck[]; + + /** + * Creates a new CreateQuotaPreferenceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateQuotaPreferenceRequest instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest): google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest; + + /** + * Encodes the specified CreateQuotaPreferenceRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest.verify|verify} messages. + * @param message CreateQuotaPreferenceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateQuotaPreferenceRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest.verify|verify} messages. + * @param message CreateQuotaPreferenceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateQuotaPreferenceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateQuotaPreferenceRequest + * @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.cloudquotas.v1beta.CreateQuotaPreferenceRequest; + + /** + * Decodes a CreateQuotaPreferenceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateQuotaPreferenceRequest + * @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.cloudquotas.v1beta.CreateQuotaPreferenceRequest; + + /** + * Verifies a CreateQuotaPreferenceRequest 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 CreateQuotaPreferenceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateQuotaPreferenceRequest + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest; + + /** + * Creates a plain object from a CreateQuotaPreferenceRequest message. Also converts values to other types if specified. + * @param message CreateQuotaPreferenceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateQuotaPreferenceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateQuotaPreferenceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateQuotaPreferenceRequest. */ + interface IUpdateQuotaPreferenceRequest { + + /** UpdateQuotaPreferenceRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateQuotaPreferenceRequest quotaPreference */ + quotaPreference?: (google.api.cloudquotas.v1beta.IQuotaPreference|null); + + /** UpdateQuotaPreferenceRequest allowMissing */ + allowMissing?: (boolean|null); + + /** UpdateQuotaPreferenceRequest validateOnly */ + validateOnly?: (boolean|null); + + /** UpdateQuotaPreferenceRequest ignoreSafetyChecks */ + ignoreSafetyChecks?: (google.api.cloudquotas.v1beta.QuotaSafetyCheck[]|null); + } + + /** Represents an UpdateQuotaPreferenceRequest. */ + class UpdateQuotaPreferenceRequest implements IUpdateQuotaPreferenceRequest { + + /** + * Constructs a new UpdateQuotaPreferenceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest); + + /** UpdateQuotaPreferenceRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateQuotaPreferenceRequest quotaPreference. */ + public quotaPreference?: (google.api.cloudquotas.v1beta.IQuotaPreference|null); + + /** UpdateQuotaPreferenceRequest allowMissing. */ + public allowMissing: boolean; + + /** UpdateQuotaPreferenceRequest validateOnly. */ + public validateOnly: boolean; + + /** UpdateQuotaPreferenceRequest ignoreSafetyChecks. */ + public ignoreSafetyChecks: google.api.cloudquotas.v1beta.QuotaSafetyCheck[]; + + /** + * Creates a new UpdateQuotaPreferenceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateQuotaPreferenceRequest instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest): google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest; + + /** + * Encodes the specified UpdateQuotaPreferenceRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest.verify|verify} messages. + * @param message UpdateQuotaPreferenceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateQuotaPreferenceRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest.verify|verify} messages. + * @param message UpdateQuotaPreferenceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateQuotaPreferenceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateQuotaPreferenceRequest + * @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.cloudquotas.v1beta.UpdateQuotaPreferenceRequest; + + /** + * Decodes an UpdateQuotaPreferenceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateQuotaPreferenceRequest + * @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.cloudquotas.v1beta.UpdateQuotaPreferenceRequest; + + /** + * Verifies an UpdateQuotaPreferenceRequest 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 UpdateQuotaPreferenceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateQuotaPreferenceRequest + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest; + + /** + * Creates a plain object from an UpdateQuotaPreferenceRequest message. Also converts values to other types if specified. + * @param message UpdateQuotaPreferenceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateQuotaPreferenceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateQuotaPreferenceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** QuotaSafetyCheck enum. */ + enum QuotaSafetyCheck { + QUOTA_SAFETY_CHECK_UNSPECIFIED = 0, + QUOTA_DECREASE_BELOW_USAGE = 1, + QUOTA_DECREASE_PERCENTAGE_TOO_HIGH = 2 + } + + /** Properties of a QuotaInfo. */ + interface IQuotaInfo { + + /** QuotaInfo name */ + name?: (string|null); + + /** QuotaInfo quotaId */ + quotaId?: (string|null); + + /** QuotaInfo metric */ + metric?: (string|null); + + /** QuotaInfo service */ + service?: (string|null); + + /** QuotaInfo isPrecise */ + isPrecise?: (boolean|null); + + /** QuotaInfo refreshInterval */ + refreshInterval?: (string|null); + + /** QuotaInfo containerType */ + containerType?: (google.api.cloudquotas.v1beta.QuotaInfo.ContainerType|keyof typeof google.api.cloudquotas.v1beta.QuotaInfo.ContainerType|null); + + /** QuotaInfo dimensions */ + dimensions?: (string[]|null); + + /** QuotaInfo metricDisplayName */ + metricDisplayName?: (string|null); + + /** QuotaInfo quotaDisplayName */ + quotaDisplayName?: (string|null); + + /** QuotaInfo metricUnit */ + metricUnit?: (string|null); + + /** QuotaInfo quotaIncreaseEligibility */ + quotaIncreaseEligibility?: (google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility|null); + + /** QuotaInfo isFixed */ + isFixed?: (boolean|null); + + /** QuotaInfo dimensionsInfos */ + dimensionsInfos?: (google.api.cloudquotas.v1beta.IDimensionsInfo[]|null); + + /** QuotaInfo isConcurrent */ + isConcurrent?: (boolean|null); + + /** QuotaInfo serviceRequestQuotaUri */ + serviceRequestQuotaUri?: (string|null); + } + + /** Represents a QuotaInfo. */ + class QuotaInfo implements IQuotaInfo { + + /** + * Constructs a new QuotaInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IQuotaInfo); + + /** QuotaInfo name. */ + public name: string; + + /** QuotaInfo quotaId. */ + public quotaId: string; + + /** QuotaInfo metric. */ + public metric: string; + + /** QuotaInfo service. */ + public service: string; + + /** QuotaInfo isPrecise. */ + public isPrecise: boolean; + + /** QuotaInfo refreshInterval. */ + public refreshInterval: string; + + /** QuotaInfo containerType. */ + public containerType: (google.api.cloudquotas.v1beta.QuotaInfo.ContainerType|keyof typeof google.api.cloudquotas.v1beta.QuotaInfo.ContainerType); + + /** QuotaInfo dimensions. */ + public dimensions: string[]; + + /** QuotaInfo metricDisplayName. */ + public metricDisplayName: string; + + /** QuotaInfo quotaDisplayName. */ + public quotaDisplayName: string; + + /** QuotaInfo metricUnit. */ + public metricUnit: string; + + /** QuotaInfo quotaIncreaseEligibility. */ + public quotaIncreaseEligibility?: (google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility|null); + + /** QuotaInfo isFixed. */ + public isFixed: boolean; + + /** QuotaInfo dimensionsInfos. */ + public dimensionsInfos: google.api.cloudquotas.v1beta.IDimensionsInfo[]; + + /** QuotaInfo isConcurrent. */ + public isConcurrent: boolean; + + /** QuotaInfo serviceRequestQuotaUri. */ + public serviceRequestQuotaUri: string; + + /** + * Creates a new QuotaInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns QuotaInfo instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IQuotaInfo): google.api.cloudquotas.v1beta.QuotaInfo; + + /** + * Encodes the specified QuotaInfo message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaInfo.verify|verify} messages. + * @param message QuotaInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IQuotaInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuotaInfo message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaInfo.verify|verify} messages. + * @param message QuotaInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IQuotaInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuotaInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuotaInfo + * @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.cloudquotas.v1beta.QuotaInfo; + + /** + * Decodes a QuotaInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuotaInfo + * @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.cloudquotas.v1beta.QuotaInfo; + + /** + * Verifies a QuotaInfo 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 QuotaInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuotaInfo + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.QuotaInfo; + + /** + * Creates a plain object from a QuotaInfo message. Also converts values to other types if specified. + * @param message QuotaInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.QuotaInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuotaInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QuotaInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace QuotaInfo { + + /** ContainerType enum. */ + enum ContainerType { + CONTAINER_TYPE_UNSPECIFIED = 0, + PROJECT = 1, + FOLDER = 2, + ORGANIZATION = 3 + } + } + + /** Properties of a QuotaIncreaseEligibility. */ + interface IQuotaIncreaseEligibility { + + /** QuotaIncreaseEligibility isEligible */ + isEligible?: (boolean|null); + + /** QuotaIncreaseEligibility ineligibilityReason */ + ineligibilityReason?: (google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason|keyof typeof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason|null); + } + + /** Represents a QuotaIncreaseEligibility. */ + class QuotaIncreaseEligibility implements IQuotaIncreaseEligibility { + + /** + * Constructs a new QuotaIncreaseEligibility. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility); + + /** QuotaIncreaseEligibility isEligible. */ + public isEligible: boolean; + + /** QuotaIncreaseEligibility ineligibilityReason. */ + public ineligibilityReason: (google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason|keyof typeof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason); + + /** + * Creates a new QuotaIncreaseEligibility instance using the specified properties. + * @param [properties] Properties to set + * @returns QuotaIncreaseEligibility instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility): google.api.cloudquotas.v1beta.QuotaIncreaseEligibility; + + /** + * Encodes the specified QuotaIncreaseEligibility message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.verify|verify} messages. + * @param message QuotaIncreaseEligibility message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuotaIncreaseEligibility message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.verify|verify} messages. + * @param message QuotaIncreaseEligibility message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuotaIncreaseEligibility message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuotaIncreaseEligibility + * @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.cloudquotas.v1beta.QuotaIncreaseEligibility; + + /** + * Decodes a QuotaIncreaseEligibility message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuotaIncreaseEligibility + * @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.cloudquotas.v1beta.QuotaIncreaseEligibility; + + /** + * Verifies a QuotaIncreaseEligibility 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 QuotaIncreaseEligibility message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuotaIncreaseEligibility + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.QuotaIncreaseEligibility; + + /** + * Creates a plain object from a QuotaIncreaseEligibility message. Also converts values to other types if specified. + * @param message QuotaIncreaseEligibility + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.QuotaIncreaseEligibility, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuotaIncreaseEligibility to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QuotaIncreaseEligibility + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace QuotaIncreaseEligibility { + + /** IneligibilityReason enum. */ + enum IneligibilityReason { + INELIGIBILITY_REASON_UNSPECIFIED = 0, + NO_VALID_BILLING_ACCOUNT = 1, + NOT_SUPPORTED = 3, + NOT_ENOUGH_USAGE_HISTORY = 4, + OTHER = 2 + } + } + + /** Properties of a QuotaPreference. */ + interface IQuotaPreference { + + /** QuotaPreference name */ + name?: (string|null); + + /** QuotaPreference dimensions */ + dimensions?: ({ [k: string]: string }|null); + + /** QuotaPreference quotaConfig */ + quotaConfig?: (google.api.cloudquotas.v1beta.IQuotaConfig|null); + + /** QuotaPreference etag */ + etag?: (string|null); + + /** QuotaPreference createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** QuotaPreference updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** QuotaPreference service */ + service?: (string|null); + + /** QuotaPreference quotaId */ + quotaId?: (string|null); + + /** QuotaPreference reconciling */ + reconciling?: (boolean|null); + + /** QuotaPreference justification */ + justification?: (string|null); + + /** QuotaPreference contactEmail */ + contactEmail?: (string|null); + } + + /** Represents a QuotaPreference. */ + class QuotaPreference implements IQuotaPreference { + + /** + * Constructs a new QuotaPreference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IQuotaPreference); + + /** QuotaPreference name. */ + public name: string; + + /** QuotaPreference dimensions. */ + public dimensions: { [k: string]: string }; + + /** QuotaPreference quotaConfig. */ + public quotaConfig?: (google.api.cloudquotas.v1beta.IQuotaConfig|null); + + /** QuotaPreference etag. */ + public etag: string; + + /** QuotaPreference createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** QuotaPreference updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** QuotaPreference service. */ + public service: string; + + /** QuotaPreference quotaId. */ + public quotaId: string; + + /** QuotaPreference reconciling. */ + public reconciling: boolean; + + /** QuotaPreference justification. */ + public justification: string; + + /** QuotaPreference contactEmail. */ + public contactEmail: string; + + /** + * Creates a new QuotaPreference instance using the specified properties. + * @param [properties] Properties to set + * @returns QuotaPreference instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IQuotaPreference): google.api.cloudquotas.v1beta.QuotaPreference; + + /** + * Encodes the specified QuotaPreference message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaPreference.verify|verify} messages. + * @param message QuotaPreference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IQuotaPreference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuotaPreference message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaPreference.verify|verify} messages. + * @param message QuotaPreference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IQuotaPreference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuotaPreference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuotaPreference + * @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.cloudquotas.v1beta.QuotaPreference; + + /** + * Decodes a QuotaPreference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuotaPreference + * @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.cloudquotas.v1beta.QuotaPreference; + + /** + * Verifies a QuotaPreference 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 QuotaPreference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuotaPreference + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.QuotaPreference; + + /** + * Creates a plain object from a QuotaPreference message. Also converts values to other types if specified. + * @param message QuotaPreference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.QuotaPreference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuotaPreference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QuotaPreference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QuotaConfig. */ + interface IQuotaConfig { + + /** QuotaConfig preferredValue */ + preferredValue?: (number|Long|string|null); + + /** QuotaConfig stateDetail */ + stateDetail?: (string|null); + + /** QuotaConfig grantedValue */ + grantedValue?: (google.protobuf.IInt64Value|null); + + /** QuotaConfig traceId */ + traceId?: (string|null); + + /** QuotaConfig annotations */ + annotations?: ({ [k: string]: string }|null); + + /** QuotaConfig requestOrigin */ + requestOrigin?: (google.api.cloudquotas.v1beta.QuotaConfig.Origin|keyof typeof google.api.cloudquotas.v1beta.QuotaConfig.Origin|null); + } + + /** Represents a QuotaConfig. */ + class QuotaConfig implements IQuotaConfig { + + /** + * Constructs a new QuotaConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IQuotaConfig); + + /** QuotaConfig preferredValue. */ + public preferredValue: (number|Long|string); + + /** QuotaConfig stateDetail. */ + public stateDetail: string; + + /** QuotaConfig grantedValue. */ + public grantedValue?: (google.protobuf.IInt64Value|null); + + /** QuotaConfig traceId. */ + public traceId: string; + + /** QuotaConfig annotations. */ + public annotations: { [k: string]: string }; + + /** QuotaConfig requestOrigin. */ + public requestOrigin: (google.api.cloudquotas.v1beta.QuotaConfig.Origin|keyof typeof google.api.cloudquotas.v1beta.QuotaConfig.Origin); + + /** + * Creates a new QuotaConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns QuotaConfig instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IQuotaConfig): google.api.cloudquotas.v1beta.QuotaConfig; + + /** + * Encodes the specified QuotaConfig message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaConfig.verify|verify} messages. + * @param message QuotaConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IQuotaConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuotaConfig message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaConfig.verify|verify} messages. + * @param message QuotaConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IQuotaConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuotaConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuotaConfig + * @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.cloudquotas.v1beta.QuotaConfig; + + /** + * Decodes a QuotaConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuotaConfig + * @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.cloudquotas.v1beta.QuotaConfig; + + /** + * Verifies a QuotaConfig 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 QuotaConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuotaConfig + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.QuotaConfig; + + /** + * Creates a plain object from a QuotaConfig message. Also converts values to other types if specified. + * @param message QuotaConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.QuotaConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuotaConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QuotaConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace QuotaConfig { + + /** Origin enum. */ + enum Origin { + ORIGIN_UNSPECIFIED = 0, + CLOUD_CONSOLE = 1, + AUTO_ADJUSTER = 2 + } + } + + /** Properties of a DimensionsInfo. */ + interface IDimensionsInfo { + + /** DimensionsInfo dimensions */ + dimensions?: ({ [k: string]: string }|null); + + /** DimensionsInfo details */ + details?: (google.api.cloudquotas.v1beta.IQuotaDetails|null); + + /** DimensionsInfo applicableLocations */ + applicableLocations?: (string[]|null); + } + + /** Represents a DimensionsInfo. */ + class DimensionsInfo implements IDimensionsInfo { + + /** + * Constructs a new DimensionsInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IDimensionsInfo); + + /** DimensionsInfo dimensions. */ + public dimensions: { [k: string]: string }; + + /** DimensionsInfo details. */ + public details?: (google.api.cloudquotas.v1beta.IQuotaDetails|null); + + /** DimensionsInfo applicableLocations. */ + public applicableLocations: string[]; + + /** + * Creates a new DimensionsInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns DimensionsInfo instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IDimensionsInfo): google.api.cloudquotas.v1beta.DimensionsInfo; + + /** + * Encodes the specified DimensionsInfo message. Does not implicitly {@link google.api.cloudquotas.v1beta.DimensionsInfo.verify|verify} messages. + * @param message DimensionsInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IDimensionsInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DimensionsInfo message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.DimensionsInfo.verify|verify} messages. + * @param message DimensionsInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IDimensionsInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DimensionsInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DimensionsInfo + * @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.cloudquotas.v1beta.DimensionsInfo; + + /** + * Decodes a DimensionsInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DimensionsInfo + * @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.cloudquotas.v1beta.DimensionsInfo; + + /** + * Verifies a DimensionsInfo 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 DimensionsInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DimensionsInfo + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.DimensionsInfo; + + /** + * Creates a plain object from a DimensionsInfo message. Also converts values to other types if specified. + * @param message DimensionsInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.DimensionsInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DimensionsInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DimensionsInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QuotaDetails. */ + interface IQuotaDetails { + + /** QuotaDetails value */ + value?: (number|Long|string|null); + + /** QuotaDetails rolloutInfo */ + rolloutInfo?: (google.api.cloudquotas.v1beta.IRolloutInfo|null); + } + + /** Represents a QuotaDetails. */ + class QuotaDetails implements IQuotaDetails { + + /** + * Constructs a new QuotaDetails. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IQuotaDetails); + + /** QuotaDetails value. */ + public value: (number|Long|string); + + /** QuotaDetails rolloutInfo. */ + public rolloutInfo?: (google.api.cloudquotas.v1beta.IRolloutInfo|null); + + /** + * Creates a new QuotaDetails instance using the specified properties. + * @param [properties] Properties to set + * @returns QuotaDetails instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IQuotaDetails): google.api.cloudquotas.v1beta.QuotaDetails; + + /** + * Encodes the specified QuotaDetails message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaDetails.verify|verify} messages. + * @param message QuotaDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IQuotaDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuotaDetails message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaDetails.verify|verify} messages. + * @param message QuotaDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IQuotaDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuotaDetails message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuotaDetails + * @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.cloudquotas.v1beta.QuotaDetails; + + /** + * Decodes a QuotaDetails message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuotaDetails + * @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.cloudquotas.v1beta.QuotaDetails; + + /** + * Verifies a QuotaDetails 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 QuotaDetails message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuotaDetails + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.QuotaDetails; + + /** + * Creates a plain object from a QuotaDetails message. Also converts values to other types if specified. + * @param message QuotaDetails + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.QuotaDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuotaDetails to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QuotaDetails + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RolloutInfo. */ + interface IRolloutInfo { + + /** RolloutInfo ongoingRollout */ + ongoingRollout?: (boolean|null); + } + + /** Represents a RolloutInfo. */ + class RolloutInfo implements IRolloutInfo { + + /** + * Constructs a new RolloutInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IRolloutInfo); + + /** RolloutInfo ongoingRollout. */ + public ongoingRollout: boolean; + + /** + * Creates a new RolloutInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns RolloutInfo instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IRolloutInfo): google.api.cloudquotas.v1beta.RolloutInfo; + + /** + * Encodes the specified RolloutInfo message. Does not implicitly {@link google.api.cloudquotas.v1beta.RolloutInfo.verify|verify} messages. + * @param message RolloutInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IRolloutInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RolloutInfo message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.RolloutInfo.verify|verify} messages. + * @param message RolloutInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IRolloutInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RolloutInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RolloutInfo + * @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.cloudquotas.v1beta.RolloutInfo; + + /** + * Decodes a RolloutInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RolloutInfo + * @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.cloudquotas.v1beta.RolloutInfo; + + /** + * Verifies a RolloutInfo 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 RolloutInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RolloutInfo + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.RolloutInfo; + + /** + * Creates a plain object from a RolloutInfo message. Also converts values to other types if specified. + * @param message RolloutInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.RolloutInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RolloutInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RolloutInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a QuotaAdjusterSettingsManager */ + class QuotaAdjusterSettingsManager extends $protobuf.rpc.Service { + + /** + * Constructs a new QuotaAdjusterSettingsManager 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 QuotaAdjusterSettingsManager 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): QuotaAdjusterSettingsManager; + + /** + * Calls UpdateQuotaAdjusterSettings. + * @param request UpdateQuotaAdjusterSettingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QuotaAdjusterSettings + */ + public updateQuotaAdjusterSettings(request: google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest, callback: google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.UpdateQuotaAdjusterSettingsCallback): void; + + /** + * Calls UpdateQuotaAdjusterSettings. + * @param request UpdateQuotaAdjusterSettingsRequest message or plain object + * @returns Promise + */ + public updateQuotaAdjusterSettings(request: google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest): Promise; + + /** + * Calls GetQuotaAdjusterSettings. + * @param request GetQuotaAdjusterSettingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QuotaAdjusterSettings + */ + public getQuotaAdjusterSettings(request: google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest, callback: google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.GetQuotaAdjusterSettingsCallback): void; + + /** + * Calls GetQuotaAdjusterSettings. + * @param request GetQuotaAdjusterSettingsRequest message or plain object + * @returns Promise + */ + public getQuotaAdjusterSettings(request: google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest): Promise; + } + + namespace QuotaAdjusterSettingsManager { + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager|updateQuotaAdjusterSettings}. + * @param error Error, if any + * @param [response] QuotaAdjusterSettings + */ + type UpdateQuotaAdjusterSettingsCallback = (error: (Error|null), response?: google.api.cloudquotas.v1beta.QuotaAdjusterSettings) => void; + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager|getQuotaAdjusterSettings}. + * @param error Error, if any + * @param [response] QuotaAdjusterSettings + */ + type GetQuotaAdjusterSettingsCallback = (error: (Error|null), response?: google.api.cloudquotas.v1beta.QuotaAdjusterSettings) => void; + } + + /** Properties of a GetQuotaAdjusterSettingsRequest. */ + interface IGetQuotaAdjusterSettingsRequest { + + /** GetQuotaAdjusterSettingsRequest name */ + name?: (string|null); + } + + /** Represents a GetQuotaAdjusterSettingsRequest. */ + class GetQuotaAdjusterSettingsRequest implements IGetQuotaAdjusterSettingsRequest { + + /** + * Constructs a new GetQuotaAdjusterSettingsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest); + + /** GetQuotaAdjusterSettingsRequest name. */ + public name: string; + + /** + * Creates a new GetQuotaAdjusterSettingsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetQuotaAdjusterSettingsRequest instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest): google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest; + + /** + * Encodes the specified GetQuotaAdjusterSettingsRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest.verify|verify} messages. + * @param message GetQuotaAdjusterSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetQuotaAdjusterSettingsRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest.verify|verify} messages. + * @param message GetQuotaAdjusterSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetQuotaAdjusterSettingsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetQuotaAdjusterSettingsRequest + * @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.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest; + + /** + * Decodes a GetQuotaAdjusterSettingsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetQuotaAdjusterSettingsRequest + * @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.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest; + + /** + * Verifies a GetQuotaAdjusterSettingsRequest 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 GetQuotaAdjusterSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetQuotaAdjusterSettingsRequest + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest; + + /** + * Creates a plain object from a GetQuotaAdjusterSettingsRequest message. Also converts values to other types if specified. + * @param message GetQuotaAdjusterSettingsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetQuotaAdjusterSettingsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetQuotaAdjusterSettingsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateQuotaAdjusterSettingsRequest. */ + interface IUpdateQuotaAdjusterSettingsRequest { + + /** UpdateQuotaAdjusterSettingsRequest quotaAdjusterSettings */ + quotaAdjusterSettings?: (google.api.cloudquotas.v1beta.IQuotaAdjusterSettings|null); + + /** UpdateQuotaAdjusterSettingsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateQuotaAdjusterSettingsRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents an UpdateQuotaAdjusterSettingsRequest. */ + class UpdateQuotaAdjusterSettingsRequest implements IUpdateQuotaAdjusterSettingsRequest { + + /** + * Constructs a new UpdateQuotaAdjusterSettingsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest); + + /** UpdateQuotaAdjusterSettingsRequest quotaAdjusterSettings. */ + public quotaAdjusterSettings?: (google.api.cloudquotas.v1beta.IQuotaAdjusterSettings|null); + + /** UpdateQuotaAdjusterSettingsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateQuotaAdjusterSettingsRequest validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new UpdateQuotaAdjusterSettingsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateQuotaAdjusterSettingsRequest instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest): google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest; + + /** + * Encodes the specified UpdateQuotaAdjusterSettingsRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest.verify|verify} messages. + * @param message UpdateQuotaAdjusterSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateQuotaAdjusterSettingsRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest.verify|verify} messages. + * @param message UpdateQuotaAdjusterSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateQuotaAdjusterSettingsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateQuotaAdjusterSettingsRequest + * @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.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest; + + /** + * Decodes an UpdateQuotaAdjusterSettingsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateQuotaAdjusterSettingsRequest + * @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.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest; + + /** + * Verifies an UpdateQuotaAdjusterSettingsRequest 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 UpdateQuotaAdjusterSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateQuotaAdjusterSettingsRequest + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest; + + /** + * Creates a plain object from an UpdateQuotaAdjusterSettingsRequest message. Also converts values to other types if specified. + * @param message UpdateQuotaAdjusterSettingsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateQuotaAdjusterSettingsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateQuotaAdjusterSettingsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QuotaAdjusterSettings. */ + interface IQuotaAdjusterSettings { + + /** QuotaAdjusterSettings name */ + name?: (string|null); + + /** QuotaAdjusterSettings enablement */ + enablement?: (google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement|keyof typeof google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement|null); + + /** QuotaAdjusterSettings updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** QuotaAdjusterSettings etag */ + etag?: (string|null); + } + + /** Represents a QuotaAdjusterSettings. */ + class QuotaAdjusterSettings implements IQuotaAdjusterSettings { + + /** + * Constructs a new QuotaAdjusterSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.cloudquotas.v1beta.IQuotaAdjusterSettings); + + /** QuotaAdjusterSettings name. */ + public name: string; + + /** QuotaAdjusterSettings enablement. */ + public enablement: (google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement|keyof typeof google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement); + + /** QuotaAdjusterSettings updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** QuotaAdjusterSettings etag. */ + public etag: string; + + /** + * Creates a new QuotaAdjusterSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns QuotaAdjusterSettings instance + */ + public static create(properties?: google.api.cloudquotas.v1beta.IQuotaAdjusterSettings): google.api.cloudquotas.v1beta.QuotaAdjusterSettings; + + /** + * Encodes the specified QuotaAdjusterSettings message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaAdjusterSettings.verify|verify} messages. + * @param message QuotaAdjusterSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuotaAdjusterSettings message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaAdjusterSettings.verify|verify} messages. + * @param message QuotaAdjusterSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuotaAdjusterSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuotaAdjusterSettings + * @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.cloudquotas.v1beta.QuotaAdjusterSettings; + + /** + * Decodes a QuotaAdjusterSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuotaAdjusterSettings + * @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.cloudquotas.v1beta.QuotaAdjusterSettings; + + /** + * Verifies a QuotaAdjusterSettings 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 QuotaAdjusterSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuotaAdjusterSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.cloudquotas.v1beta.QuotaAdjusterSettings; + + /** + * Creates a plain object from a QuotaAdjusterSettings message. Also converts values to other types if specified. + * @param message QuotaAdjusterSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.cloudquotas.v1beta.QuotaAdjusterSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuotaAdjusterSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QuotaAdjusterSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace QuotaAdjusterSettings { + + /** Enablement enum. */ + enum Enablement { + ENABLEMENT_UNSPECIFIED = 0, + ENABLED = 2, + DISABLED = 3 + } + } + } } /** Properties of a Http. */ diff --git a/packages/google-api-cloudquotas/protos/protos.js b/packages/google-api-cloudquotas/protos/protos.js index 4b487659b8b..51c39dbc26d 100644 --- a/packages/google-api-cloudquotas/protos/protos.js +++ b/packages/google-api-cloudquotas/protos/protos.js @@ -5064,6 +5064,5895 @@ return v1; })(); + cloudquotas.v1beta = (function() { + + /** + * Namespace v1beta. + * @memberof google.api.cloudquotas + * @namespace + */ + var v1beta = {}; + + v1beta.CloudQuotas = (function() { + + /** + * Constructs a new CloudQuotas service. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a CloudQuotas + * @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 CloudQuotas(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CloudQuotas.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CloudQuotas; + + /** + * Creates new CloudQuotas service using the specified rpc implementation. + * @function create + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @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 {CloudQuotas} RPC service. Useful where requests and/or responses are streamed. + */ + CloudQuotas.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|listQuotaInfos}. + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @typedef ListQuotaInfosCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.cloudquotas.v1beta.ListQuotaInfosResponse} [response] ListQuotaInfosResponse + */ + + /** + * Calls ListQuotaInfos. + * @function listQuotaInfos + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosRequest} request ListQuotaInfosRequest message or plain object + * @param {google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaInfosCallback} callback Node-style callback called with the error, if any, and ListQuotaInfosResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudQuotas.prototype.listQuotaInfos = function listQuotaInfos(request, callback) { + return this.rpcCall(listQuotaInfos, $root.google.api.cloudquotas.v1beta.ListQuotaInfosRequest, $root.google.api.cloudquotas.v1beta.ListQuotaInfosResponse, request, callback); + }, "name", { value: "ListQuotaInfos" }); + + /** + * Calls ListQuotaInfos. + * @function listQuotaInfos + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosRequest} request ListQuotaInfosRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|getQuotaInfo}. + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @typedef GetQuotaInfoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.cloudquotas.v1beta.QuotaInfo} [response] QuotaInfo + */ + + /** + * Calls GetQuotaInfo. + * @function getQuotaInfo + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IGetQuotaInfoRequest} request GetQuotaInfoRequest message or plain object + * @param {google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaInfoCallback} callback Node-style callback called with the error, if any, and QuotaInfo + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudQuotas.prototype.getQuotaInfo = function getQuotaInfo(request, callback) { + return this.rpcCall(getQuotaInfo, $root.google.api.cloudquotas.v1beta.GetQuotaInfoRequest, $root.google.api.cloudquotas.v1beta.QuotaInfo, request, callback); + }, "name", { value: "GetQuotaInfo" }); + + /** + * Calls GetQuotaInfo. + * @function getQuotaInfo + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IGetQuotaInfoRequest} request GetQuotaInfoRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|listQuotaPreferences}. + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @typedef ListQuotaPreferencesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse} [response] ListQuotaPreferencesResponse + */ + + /** + * Calls ListQuotaPreferences. + * @function listQuotaPreferences + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest} request ListQuotaPreferencesRequest message or plain object + * @param {google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaPreferencesCallback} callback Node-style callback called with the error, if any, and ListQuotaPreferencesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudQuotas.prototype.listQuotaPreferences = function listQuotaPreferences(request, callback) { + return this.rpcCall(listQuotaPreferences, $root.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest, $root.google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse, request, callback); + }, "name", { value: "ListQuotaPreferences" }); + + /** + * Calls ListQuotaPreferences. + * @function listQuotaPreferences + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest} request ListQuotaPreferencesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|getQuotaPreference}. + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @typedef GetQuotaPreferenceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.cloudquotas.v1beta.QuotaPreference} [response] QuotaPreference + */ + + /** + * Calls GetQuotaPreference. + * @function getQuotaPreference + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest} request GetQuotaPreferenceRequest message or plain object + * @param {google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaPreferenceCallback} callback Node-style callback called with the error, if any, and QuotaPreference + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudQuotas.prototype.getQuotaPreference = function getQuotaPreference(request, callback) { + return this.rpcCall(getQuotaPreference, $root.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest, $root.google.api.cloudquotas.v1beta.QuotaPreference, request, callback); + }, "name", { value: "GetQuotaPreference" }); + + /** + * Calls GetQuotaPreference. + * @function getQuotaPreference + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest} request GetQuotaPreferenceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|createQuotaPreference}. + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @typedef CreateQuotaPreferenceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.cloudquotas.v1beta.QuotaPreference} [response] QuotaPreference + */ + + /** + * Calls CreateQuotaPreference. + * @function createQuotaPreference + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest} request CreateQuotaPreferenceRequest message or plain object + * @param {google.api.cloudquotas.v1beta.CloudQuotas.CreateQuotaPreferenceCallback} callback Node-style callback called with the error, if any, and QuotaPreference + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudQuotas.prototype.createQuotaPreference = function createQuotaPreference(request, callback) { + return this.rpcCall(createQuotaPreference, $root.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest, $root.google.api.cloudquotas.v1beta.QuotaPreference, request, callback); + }, "name", { value: "CreateQuotaPreference" }); + + /** + * Calls CreateQuotaPreference. + * @function createQuotaPreference + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest} request CreateQuotaPreferenceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.CloudQuotas|updateQuotaPreference}. + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @typedef UpdateQuotaPreferenceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.cloudquotas.v1beta.QuotaPreference} [response] QuotaPreference + */ + + /** + * Calls UpdateQuotaPreference. + * @function updateQuotaPreference + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest} request UpdateQuotaPreferenceRequest message or plain object + * @param {google.api.cloudquotas.v1beta.CloudQuotas.UpdateQuotaPreferenceCallback} callback Node-style callback called with the error, if any, and QuotaPreference + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudQuotas.prototype.updateQuotaPreference = function updateQuotaPreference(request, callback) { + return this.rpcCall(updateQuotaPreference, $root.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest, $root.google.api.cloudquotas.v1beta.QuotaPreference, request, callback); + }, "name", { value: "UpdateQuotaPreference" }); + + /** + * Calls UpdateQuotaPreference. + * @function updateQuotaPreference + * @memberof google.api.cloudquotas.v1beta.CloudQuotas + * @instance + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest} request UpdateQuotaPreferenceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CloudQuotas; + })(); + + v1beta.ListQuotaInfosRequest = (function() { + + /** + * Properties of a ListQuotaInfosRequest. + * @memberof google.api.cloudquotas.v1beta + * @interface IListQuotaInfosRequest + * @property {string|null} [parent] ListQuotaInfosRequest parent + * @property {number|null} [pageSize] ListQuotaInfosRequest pageSize + * @property {string|null} [pageToken] ListQuotaInfosRequest pageToken + */ + + /** + * Constructs a new ListQuotaInfosRequest. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a ListQuotaInfosRequest. + * @implements IListQuotaInfosRequest + * @constructor + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosRequest=} [properties] Properties to set + */ + function ListQuotaInfosRequest(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]]; + } + + /** + * ListQuotaInfosRequest parent. + * @member {string} parent + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @instance + */ + ListQuotaInfosRequest.prototype.parent = ""; + + /** + * ListQuotaInfosRequest pageSize. + * @member {number} pageSize + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @instance + */ + ListQuotaInfosRequest.prototype.pageSize = 0; + + /** + * ListQuotaInfosRequest pageToken. + * @member {string} pageToken + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @instance + */ + ListQuotaInfosRequest.prototype.pageToken = ""; + + /** + * Creates a new ListQuotaInfosRequest instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosRequest=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.ListQuotaInfosRequest} ListQuotaInfosRequest instance + */ + ListQuotaInfosRequest.create = function create(properties) { + return new ListQuotaInfosRequest(properties); + }; + + /** + * Encodes the specified ListQuotaInfosRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaInfosRequest.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosRequest} message ListQuotaInfosRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQuotaInfosRequest.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); + return writer; + }; + + /** + * Encodes the specified ListQuotaInfosRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaInfosRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosRequest} message ListQuotaInfosRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQuotaInfosRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListQuotaInfosRequest message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.ListQuotaInfosRequest} ListQuotaInfosRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQuotaInfosRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.ListQuotaInfosRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListQuotaInfosRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.ListQuotaInfosRequest} ListQuotaInfosRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQuotaInfosRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListQuotaInfosRequest message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListQuotaInfosRequest.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"; + return null; + }; + + /** + * Creates a ListQuotaInfosRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.ListQuotaInfosRequest} ListQuotaInfosRequest + */ + ListQuotaInfosRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.ListQuotaInfosRequest) + return object; + var message = new $root.google.api.cloudquotas.v1beta.ListQuotaInfosRequest(); + 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); + return message; + }; + + /** + * Creates a plain object from a ListQuotaInfosRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {google.api.cloudquotas.v1beta.ListQuotaInfosRequest} message ListQuotaInfosRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListQuotaInfosRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + 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; + return object; + }; + + /** + * Converts this ListQuotaInfosRequest to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @instance + * @returns {Object.} JSON object + */ + ListQuotaInfosRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListQuotaInfosRequest + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListQuotaInfosRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.ListQuotaInfosRequest"; + }; + + return ListQuotaInfosRequest; + })(); + + v1beta.ListQuotaInfosResponse = (function() { + + /** + * Properties of a ListQuotaInfosResponse. + * @memberof google.api.cloudquotas.v1beta + * @interface IListQuotaInfosResponse + * @property {Array.|null} [quotaInfos] ListQuotaInfosResponse quotaInfos + * @property {string|null} [nextPageToken] ListQuotaInfosResponse nextPageToken + */ + + /** + * Constructs a new ListQuotaInfosResponse. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a ListQuotaInfosResponse. + * @implements IListQuotaInfosResponse + * @constructor + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosResponse=} [properties] Properties to set + */ + function ListQuotaInfosResponse(properties) { + this.quotaInfos = []; + 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]]; + } + + /** + * ListQuotaInfosResponse quotaInfos. + * @member {Array.} quotaInfos + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @instance + */ + ListQuotaInfosResponse.prototype.quotaInfos = $util.emptyArray; + + /** + * ListQuotaInfosResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @instance + */ + ListQuotaInfosResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListQuotaInfosResponse instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosResponse=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.ListQuotaInfosResponse} ListQuotaInfosResponse instance + */ + ListQuotaInfosResponse.create = function create(properties) { + return new ListQuotaInfosResponse(properties); + }; + + /** + * Encodes the specified ListQuotaInfosResponse message. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaInfosResponse.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosResponse} message ListQuotaInfosResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQuotaInfosResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.quotaInfos != null && message.quotaInfos.length) + for (var i = 0; i < message.quotaInfos.length; ++i) + $root.google.api.cloudquotas.v1beta.QuotaInfo.encode(message.quotaInfos[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); + return writer; + }; + + /** + * Encodes the specified ListQuotaInfosResponse message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaInfosResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaInfosResponse} message ListQuotaInfosResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQuotaInfosResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListQuotaInfosResponse message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.ListQuotaInfosResponse} ListQuotaInfosResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQuotaInfosResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.ListQuotaInfosResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.quotaInfos && message.quotaInfos.length)) + message.quotaInfos = []; + message.quotaInfos.push($root.google.api.cloudquotas.v1beta.QuotaInfo.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListQuotaInfosResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.ListQuotaInfosResponse} ListQuotaInfosResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQuotaInfosResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListQuotaInfosResponse message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListQuotaInfosResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.quotaInfos != null && message.hasOwnProperty("quotaInfos")) { + if (!Array.isArray(message.quotaInfos)) + return "quotaInfos: array expected"; + for (var i = 0; i < message.quotaInfos.length; ++i) { + var error = $root.google.api.cloudquotas.v1beta.QuotaInfo.verify(message.quotaInfos[i]); + if (error) + return "quotaInfos." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListQuotaInfosResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.ListQuotaInfosResponse} ListQuotaInfosResponse + */ + ListQuotaInfosResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.ListQuotaInfosResponse) + return object; + var message = new $root.google.api.cloudquotas.v1beta.ListQuotaInfosResponse(); + if (object.quotaInfos) { + if (!Array.isArray(object.quotaInfos)) + throw TypeError(".google.api.cloudquotas.v1beta.ListQuotaInfosResponse.quotaInfos: array expected"); + message.quotaInfos = []; + for (var i = 0; i < object.quotaInfos.length; ++i) { + if (typeof object.quotaInfos[i] !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.ListQuotaInfosResponse.quotaInfos: object expected"); + message.quotaInfos[i] = $root.google.api.cloudquotas.v1beta.QuotaInfo.fromObject(object.quotaInfos[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListQuotaInfosResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {google.api.cloudquotas.v1beta.ListQuotaInfosResponse} message ListQuotaInfosResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListQuotaInfosResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.quotaInfos = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.quotaInfos && message.quotaInfos.length) { + object.quotaInfos = []; + for (var j = 0; j < message.quotaInfos.length; ++j) + object.quotaInfos[j] = $root.google.api.cloudquotas.v1beta.QuotaInfo.toObject(message.quotaInfos[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListQuotaInfosResponse to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @instance + * @returns {Object.} JSON object + */ + ListQuotaInfosResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListQuotaInfosResponse + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.ListQuotaInfosResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListQuotaInfosResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.ListQuotaInfosResponse"; + }; + + return ListQuotaInfosResponse; + })(); + + v1beta.GetQuotaInfoRequest = (function() { + + /** + * Properties of a GetQuotaInfoRequest. + * @memberof google.api.cloudquotas.v1beta + * @interface IGetQuotaInfoRequest + * @property {string|null} [name] GetQuotaInfoRequest name + */ + + /** + * Constructs a new GetQuotaInfoRequest. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a GetQuotaInfoRequest. + * @implements IGetQuotaInfoRequest + * @constructor + * @param {google.api.cloudquotas.v1beta.IGetQuotaInfoRequest=} [properties] Properties to set + */ + function GetQuotaInfoRequest(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]]; + } + + /** + * GetQuotaInfoRequest name. + * @member {string} name + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @instance + */ + GetQuotaInfoRequest.prototype.name = ""; + + /** + * Creates a new GetQuotaInfoRequest instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaInfoRequest=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.GetQuotaInfoRequest} GetQuotaInfoRequest instance + */ + GetQuotaInfoRequest.create = function create(properties) { + return new GetQuotaInfoRequest(properties); + }; + + /** + * Encodes the specified GetQuotaInfoRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaInfoRequest.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaInfoRequest} message GetQuotaInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetQuotaInfoRequest.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 GetQuotaInfoRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaInfoRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaInfoRequest} message GetQuotaInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetQuotaInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetQuotaInfoRequest message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.GetQuotaInfoRequest} GetQuotaInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetQuotaInfoRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.GetQuotaInfoRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetQuotaInfoRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.GetQuotaInfoRequest} GetQuotaInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetQuotaInfoRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetQuotaInfoRequest message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetQuotaInfoRequest.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 GetQuotaInfoRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.GetQuotaInfoRequest} GetQuotaInfoRequest + */ + GetQuotaInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.GetQuotaInfoRequest) + return object; + var message = new $root.google.api.cloudquotas.v1beta.GetQuotaInfoRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetQuotaInfoRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {google.api.cloudquotas.v1beta.GetQuotaInfoRequest} message GetQuotaInfoRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetQuotaInfoRequest.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 GetQuotaInfoRequest to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @instance + * @returns {Object.} JSON object + */ + GetQuotaInfoRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetQuotaInfoRequest + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.GetQuotaInfoRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetQuotaInfoRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.GetQuotaInfoRequest"; + }; + + return GetQuotaInfoRequest; + })(); + + v1beta.ListQuotaPreferencesRequest = (function() { + + /** + * Properties of a ListQuotaPreferencesRequest. + * @memberof google.api.cloudquotas.v1beta + * @interface IListQuotaPreferencesRequest + * @property {string|null} [parent] ListQuotaPreferencesRequest parent + * @property {number|null} [pageSize] ListQuotaPreferencesRequest pageSize + * @property {string|null} [pageToken] ListQuotaPreferencesRequest pageToken + * @property {string|null} [filter] ListQuotaPreferencesRequest filter + * @property {string|null} [orderBy] ListQuotaPreferencesRequest orderBy + */ + + /** + * Constructs a new ListQuotaPreferencesRequest. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a ListQuotaPreferencesRequest. + * @implements IListQuotaPreferencesRequest + * @constructor + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest=} [properties] Properties to set + */ + function ListQuotaPreferencesRequest(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]]; + } + + /** + * ListQuotaPreferencesRequest parent. + * @member {string} parent + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @instance + */ + ListQuotaPreferencesRequest.prototype.parent = ""; + + /** + * ListQuotaPreferencesRequest pageSize. + * @member {number} pageSize + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @instance + */ + ListQuotaPreferencesRequest.prototype.pageSize = 0; + + /** + * ListQuotaPreferencesRequest pageToken. + * @member {string} pageToken + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @instance + */ + ListQuotaPreferencesRequest.prototype.pageToken = ""; + + /** + * ListQuotaPreferencesRequest filter. + * @member {string} filter + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @instance + */ + ListQuotaPreferencesRequest.prototype.filter = ""; + + /** + * ListQuotaPreferencesRequest orderBy. + * @member {string} orderBy + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @instance + */ + ListQuotaPreferencesRequest.prototype.orderBy = ""; + + /** + * Creates a new ListQuotaPreferencesRequest instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest} ListQuotaPreferencesRequest instance + */ + ListQuotaPreferencesRequest.create = function create(properties) { + return new ListQuotaPreferencesRequest(properties); + }; + + /** + * Encodes the specified ListQuotaPreferencesRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest} message ListQuotaPreferencesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQuotaPreferencesRequest.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 ListQuotaPreferencesRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest} message ListQuotaPreferencesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQuotaPreferencesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListQuotaPreferencesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest} ListQuotaPreferencesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQuotaPreferencesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListQuotaPreferencesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest} ListQuotaPreferencesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQuotaPreferencesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListQuotaPreferencesRequest message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListQuotaPreferencesRequest.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 ListQuotaPreferencesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest} ListQuotaPreferencesRequest + */ + ListQuotaPreferencesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest) + return object; + var message = new $root.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest(); + 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 ListQuotaPreferencesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest} message ListQuotaPreferencesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListQuotaPreferencesRequest.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 ListQuotaPreferencesRequest to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @instance + * @returns {Object.} JSON object + */ + ListQuotaPreferencesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListQuotaPreferencesRequest + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListQuotaPreferencesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest"; + }; + + return ListQuotaPreferencesRequest; + })(); + + v1beta.ListQuotaPreferencesResponse = (function() { + + /** + * Properties of a ListQuotaPreferencesResponse. + * @memberof google.api.cloudquotas.v1beta + * @interface IListQuotaPreferencesResponse + * @property {Array.|null} [quotaPreferences] ListQuotaPreferencesResponse quotaPreferences + * @property {string|null} [nextPageToken] ListQuotaPreferencesResponse nextPageToken + * @property {Array.|null} [unreachable] ListQuotaPreferencesResponse unreachable + */ + + /** + * Constructs a new ListQuotaPreferencesResponse. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a ListQuotaPreferencesResponse. + * @implements IListQuotaPreferencesResponse + * @constructor + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse=} [properties] Properties to set + */ + function ListQuotaPreferencesResponse(properties) { + this.quotaPreferences = []; + 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]]; + } + + /** + * ListQuotaPreferencesResponse quotaPreferences. + * @member {Array.} quotaPreferences + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @instance + */ + ListQuotaPreferencesResponse.prototype.quotaPreferences = $util.emptyArray; + + /** + * ListQuotaPreferencesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @instance + */ + ListQuotaPreferencesResponse.prototype.nextPageToken = ""; + + /** + * ListQuotaPreferencesResponse unreachable. + * @member {Array.} unreachable + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @instance + */ + ListQuotaPreferencesResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListQuotaPreferencesResponse instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse} ListQuotaPreferencesResponse instance + */ + ListQuotaPreferencesResponse.create = function create(properties) { + return new ListQuotaPreferencesResponse(properties); + }; + + /** + * Encodes the specified ListQuotaPreferencesResponse message. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse} message ListQuotaPreferencesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQuotaPreferencesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.quotaPreferences != null && message.quotaPreferences.length) + for (var i = 0; i < message.quotaPreferences.length; ++i) + $root.google.api.cloudquotas.v1beta.QuotaPreference.encode(message.quotaPreferences[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 ListQuotaPreferencesResponse message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse} message ListQuotaPreferencesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListQuotaPreferencesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListQuotaPreferencesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse} ListQuotaPreferencesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQuotaPreferencesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.quotaPreferences && message.quotaPreferences.length)) + message.quotaPreferences = []; + message.quotaPreferences.push($root.google.api.cloudquotas.v1beta.QuotaPreference.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 ListQuotaPreferencesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse} ListQuotaPreferencesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListQuotaPreferencesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListQuotaPreferencesResponse message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListQuotaPreferencesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.quotaPreferences != null && message.hasOwnProperty("quotaPreferences")) { + if (!Array.isArray(message.quotaPreferences)) + return "quotaPreferences: array expected"; + for (var i = 0; i < message.quotaPreferences.length; ++i) { + var error = $root.google.api.cloudquotas.v1beta.QuotaPreference.verify(message.quotaPreferences[i]); + if (error) + return "quotaPreferences." + 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 ListQuotaPreferencesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse} ListQuotaPreferencesResponse + */ + ListQuotaPreferencesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse) + return object; + var message = new $root.google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse(); + if (object.quotaPreferences) { + if (!Array.isArray(object.quotaPreferences)) + throw TypeError(".google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse.quotaPreferences: array expected"); + message.quotaPreferences = []; + for (var i = 0; i < object.quotaPreferences.length; ++i) { + if (typeof object.quotaPreferences[i] !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse.quotaPreferences: object expected"); + message.quotaPreferences[i] = $root.google.api.cloudquotas.v1beta.QuotaPreference.fromObject(object.quotaPreferences[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse.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 ListQuotaPreferencesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse} message ListQuotaPreferencesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListQuotaPreferencesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.quotaPreferences = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.quotaPreferences && message.quotaPreferences.length) { + object.quotaPreferences = []; + for (var j = 0; j < message.quotaPreferences.length; ++j) + object.quotaPreferences[j] = $root.google.api.cloudquotas.v1beta.QuotaPreference.toObject(message.quotaPreferences[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 ListQuotaPreferencesResponse to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @instance + * @returns {Object.} JSON object + */ + ListQuotaPreferencesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListQuotaPreferencesResponse + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListQuotaPreferencesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.ListQuotaPreferencesResponse"; + }; + + return ListQuotaPreferencesResponse; + })(); + + v1beta.GetQuotaPreferenceRequest = (function() { + + /** + * Properties of a GetQuotaPreferenceRequest. + * @memberof google.api.cloudquotas.v1beta + * @interface IGetQuotaPreferenceRequest + * @property {string|null} [name] GetQuotaPreferenceRequest name + */ + + /** + * Constructs a new GetQuotaPreferenceRequest. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a GetQuotaPreferenceRequest. + * @implements IGetQuotaPreferenceRequest + * @constructor + * @param {google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest=} [properties] Properties to set + */ + function GetQuotaPreferenceRequest(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]]; + } + + /** + * GetQuotaPreferenceRequest name. + * @member {string} name + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @instance + */ + GetQuotaPreferenceRequest.prototype.name = ""; + + /** + * Creates a new GetQuotaPreferenceRequest instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest} GetQuotaPreferenceRequest instance + */ + GetQuotaPreferenceRequest.create = function create(properties) { + return new GetQuotaPreferenceRequest(properties); + }; + + /** + * Encodes the specified GetQuotaPreferenceRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest} message GetQuotaPreferenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetQuotaPreferenceRequest.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 GetQuotaPreferenceRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest} message GetQuotaPreferenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetQuotaPreferenceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetQuotaPreferenceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest} GetQuotaPreferenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetQuotaPreferenceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetQuotaPreferenceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest} GetQuotaPreferenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetQuotaPreferenceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetQuotaPreferenceRequest message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetQuotaPreferenceRequest.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 GetQuotaPreferenceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest} GetQuotaPreferenceRequest + */ + GetQuotaPreferenceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest) + return object; + var message = new $root.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetQuotaPreferenceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest} message GetQuotaPreferenceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetQuotaPreferenceRequest.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 GetQuotaPreferenceRequest to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @instance + * @returns {Object.} JSON object + */ + GetQuotaPreferenceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetQuotaPreferenceRequest + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetQuotaPreferenceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest"; + }; + + return GetQuotaPreferenceRequest; + })(); + + v1beta.CreateQuotaPreferenceRequest = (function() { + + /** + * Properties of a CreateQuotaPreferenceRequest. + * @memberof google.api.cloudquotas.v1beta + * @interface ICreateQuotaPreferenceRequest + * @property {string|null} [parent] CreateQuotaPreferenceRequest parent + * @property {string|null} [quotaPreferenceId] CreateQuotaPreferenceRequest quotaPreferenceId + * @property {google.api.cloudquotas.v1beta.IQuotaPreference|null} [quotaPreference] CreateQuotaPreferenceRequest quotaPreference + * @property {Array.|null} [ignoreSafetyChecks] CreateQuotaPreferenceRequest ignoreSafetyChecks + */ + + /** + * Constructs a new CreateQuotaPreferenceRequest. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a CreateQuotaPreferenceRequest. + * @implements ICreateQuotaPreferenceRequest + * @constructor + * @param {google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest=} [properties] Properties to set + */ + function CreateQuotaPreferenceRequest(properties) { + this.ignoreSafetyChecks = []; + 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]]; + } + + /** + * CreateQuotaPreferenceRequest parent. + * @member {string} parent + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @instance + */ + CreateQuotaPreferenceRequest.prototype.parent = ""; + + /** + * CreateQuotaPreferenceRequest quotaPreferenceId. + * @member {string} quotaPreferenceId + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @instance + */ + CreateQuotaPreferenceRequest.prototype.quotaPreferenceId = ""; + + /** + * CreateQuotaPreferenceRequest quotaPreference. + * @member {google.api.cloudquotas.v1beta.IQuotaPreference|null|undefined} quotaPreference + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @instance + */ + CreateQuotaPreferenceRequest.prototype.quotaPreference = null; + + /** + * CreateQuotaPreferenceRequest ignoreSafetyChecks. + * @member {Array.} ignoreSafetyChecks + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @instance + */ + CreateQuotaPreferenceRequest.prototype.ignoreSafetyChecks = $util.emptyArray; + + /** + * Creates a new CreateQuotaPreferenceRequest instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest} CreateQuotaPreferenceRequest instance + */ + CreateQuotaPreferenceRequest.create = function create(properties) { + return new CreateQuotaPreferenceRequest(properties); + }; + + /** + * Encodes the specified CreateQuotaPreferenceRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest} message CreateQuotaPreferenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateQuotaPreferenceRequest.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.quotaPreferenceId != null && Object.hasOwnProperty.call(message, "quotaPreferenceId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.quotaPreferenceId); + if (message.quotaPreference != null && Object.hasOwnProperty.call(message, "quotaPreference")) + $root.google.api.cloudquotas.v1beta.QuotaPreference.encode(message.quotaPreference, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.ignoreSafetyChecks != null && message.ignoreSafetyChecks.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.ignoreSafetyChecks.length; ++i) + writer.int32(message.ignoreSafetyChecks[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CreateQuotaPreferenceRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest} message CreateQuotaPreferenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateQuotaPreferenceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateQuotaPreferenceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest} CreateQuotaPreferenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateQuotaPreferenceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.quotaPreferenceId = reader.string(); + break; + } + case 3: { + message.quotaPreference = $root.google.api.cloudquotas.v1beta.QuotaPreference.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.ignoreSafetyChecks && message.ignoreSafetyChecks.length)) + message.ignoreSafetyChecks = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ignoreSafetyChecks.push(reader.int32()); + } else + message.ignoreSafetyChecks.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateQuotaPreferenceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest} CreateQuotaPreferenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateQuotaPreferenceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateQuotaPreferenceRequest message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateQuotaPreferenceRequest.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.quotaPreferenceId != null && message.hasOwnProperty("quotaPreferenceId")) + if (!$util.isString(message.quotaPreferenceId)) + return "quotaPreferenceId: string expected"; + if (message.quotaPreference != null && message.hasOwnProperty("quotaPreference")) { + var error = $root.google.api.cloudquotas.v1beta.QuotaPreference.verify(message.quotaPreference); + if (error) + return "quotaPreference." + error; + } + if (message.ignoreSafetyChecks != null && message.hasOwnProperty("ignoreSafetyChecks")) { + if (!Array.isArray(message.ignoreSafetyChecks)) + return "ignoreSafetyChecks: array expected"; + for (var i = 0; i < message.ignoreSafetyChecks.length; ++i) + switch (message.ignoreSafetyChecks[i]) { + default: + return "ignoreSafetyChecks: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a CreateQuotaPreferenceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest} CreateQuotaPreferenceRequest + */ + CreateQuotaPreferenceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest) + return object; + var message = new $root.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.quotaPreferenceId != null) + message.quotaPreferenceId = String(object.quotaPreferenceId); + if (object.quotaPreference != null) { + if (typeof object.quotaPreference !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest.quotaPreference: object expected"); + message.quotaPreference = $root.google.api.cloudquotas.v1beta.QuotaPreference.fromObject(object.quotaPreference); + } + if (object.ignoreSafetyChecks) { + if (!Array.isArray(object.ignoreSafetyChecks)) + throw TypeError(".google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest.ignoreSafetyChecks: array expected"); + message.ignoreSafetyChecks = []; + for (var i = 0; i < object.ignoreSafetyChecks.length; ++i) + switch (object.ignoreSafetyChecks[i]) { + default: + if (typeof object.ignoreSafetyChecks[i] === "number") { + message.ignoreSafetyChecks[i] = object.ignoreSafetyChecks[i]; + break; + } + case "QUOTA_SAFETY_CHECK_UNSPECIFIED": + case 0: + message.ignoreSafetyChecks[i] = 0; + break; + case "QUOTA_DECREASE_BELOW_USAGE": + case 1: + message.ignoreSafetyChecks[i] = 1; + break; + case "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH": + case 2: + message.ignoreSafetyChecks[i] = 2; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a CreateQuotaPreferenceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest} message CreateQuotaPreferenceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateQuotaPreferenceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ignoreSafetyChecks = []; + if (options.defaults) { + object.parent = ""; + object.quotaPreferenceId = ""; + object.quotaPreference = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.quotaPreferenceId != null && message.hasOwnProperty("quotaPreferenceId")) + object.quotaPreferenceId = message.quotaPreferenceId; + if (message.quotaPreference != null && message.hasOwnProperty("quotaPreference")) + object.quotaPreference = $root.google.api.cloudquotas.v1beta.QuotaPreference.toObject(message.quotaPreference, options); + if (message.ignoreSafetyChecks && message.ignoreSafetyChecks.length) { + object.ignoreSafetyChecks = []; + for (var j = 0; j < message.ignoreSafetyChecks.length; ++j) + object.ignoreSafetyChecks[j] = options.enums === String ? $root.google.api.cloudquotas.v1beta.QuotaSafetyCheck[message.ignoreSafetyChecks[j]] === undefined ? message.ignoreSafetyChecks[j] : $root.google.api.cloudquotas.v1beta.QuotaSafetyCheck[message.ignoreSafetyChecks[j]] : message.ignoreSafetyChecks[j]; + } + return object; + }; + + /** + * Converts this CreateQuotaPreferenceRequest to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @instance + * @returns {Object.} JSON object + */ + CreateQuotaPreferenceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateQuotaPreferenceRequest + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateQuotaPreferenceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest"; + }; + + return CreateQuotaPreferenceRequest; + })(); + + v1beta.UpdateQuotaPreferenceRequest = (function() { + + /** + * Properties of an UpdateQuotaPreferenceRequest. + * @memberof google.api.cloudquotas.v1beta + * @interface IUpdateQuotaPreferenceRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateQuotaPreferenceRequest updateMask + * @property {google.api.cloudquotas.v1beta.IQuotaPreference|null} [quotaPreference] UpdateQuotaPreferenceRequest quotaPreference + * @property {boolean|null} [allowMissing] UpdateQuotaPreferenceRequest allowMissing + * @property {boolean|null} [validateOnly] UpdateQuotaPreferenceRequest validateOnly + * @property {Array.|null} [ignoreSafetyChecks] UpdateQuotaPreferenceRequest ignoreSafetyChecks + */ + + /** + * Constructs a new UpdateQuotaPreferenceRequest. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents an UpdateQuotaPreferenceRequest. + * @implements IUpdateQuotaPreferenceRequest + * @constructor + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest=} [properties] Properties to set + */ + function UpdateQuotaPreferenceRequest(properties) { + this.ignoreSafetyChecks = []; + 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]]; + } + + /** + * UpdateQuotaPreferenceRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @instance + */ + UpdateQuotaPreferenceRequest.prototype.updateMask = null; + + /** + * UpdateQuotaPreferenceRequest quotaPreference. + * @member {google.api.cloudquotas.v1beta.IQuotaPreference|null|undefined} quotaPreference + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @instance + */ + UpdateQuotaPreferenceRequest.prototype.quotaPreference = null; + + /** + * UpdateQuotaPreferenceRequest allowMissing. + * @member {boolean} allowMissing + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @instance + */ + UpdateQuotaPreferenceRequest.prototype.allowMissing = false; + + /** + * UpdateQuotaPreferenceRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @instance + */ + UpdateQuotaPreferenceRequest.prototype.validateOnly = false; + + /** + * UpdateQuotaPreferenceRequest ignoreSafetyChecks. + * @member {Array.} ignoreSafetyChecks + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @instance + */ + UpdateQuotaPreferenceRequest.prototype.ignoreSafetyChecks = $util.emptyArray; + + /** + * Creates a new UpdateQuotaPreferenceRequest instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest} UpdateQuotaPreferenceRequest instance + */ + UpdateQuotaPreferenceRequest.create = function create(properties) { + return new UpdateQuotaPreferenceRequest(properties); + }; + + /** + * Encodes the specified UpdateQuotaPreferenceRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest} message UpdateQuotaPreferenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateQuotaPreferenceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.quotaPreference != null && Object.hasOwnProperty.call(message, "quotaPreference")) + $root.google.api.cloudquotas.v1beta.QuotaPreference.encode(message.quotaPreference, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allowMissing != null && Object.hasOwnProperty.call(message, "allowMissing")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowMissing); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.validateOnly); + if (message.ignoreSafetyChecks != null && message.ignoreSafetyChecks.length) { + writer.uint32(/* id 5, wireType 2 =*/42).fork(); + for (var i = 0; i < message.ignoreSafetyChecks.length; ++i) + writer.int32(message.ignoreSafetyChecks[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified UpdateQuotaPreferenceRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest} message UpdateQuotaPreferenceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateQuotaPreferenceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateQuotaPreferenceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest} UpdateQuotaPreferenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateQuotaPreferenceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 2: { + message.quotaPreference = $root.google.api.cloudquotas.v1beta.QuotaPreference.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowMissing = reader.bool(); + break; + } + case 4: { + message.validateOnly = reader.bool(); + break; + } + case 5: { + if (!(message.ignoreSafetyChecks && message.ignoreSafetyChecks.length)) + message.ignoreSafetyChecks = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.ignoreSafetyChecks.push(reader.int32()); + } else + message.ignoreSafetyChecks.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateQuotaPreferenceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest} UpdateQuotaPreferenceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateQuotaPreferenceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateQuotaPreferenceRequest message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateQuotaPreferenceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.quotaPreference != null && message.hasOwnProperty("quotaPreference")) { + var error = $root.google.api.cloudquotas.v1beta.QuotaPreference.verify(message.quotaPreference); + if (error) + return "quotaPreference." + error; + } + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + if (typeof message.allowMissing !== "boolean") + return "allowMissing: boolean expected"; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + if (message.ignoreSafetyChecks != null && message.hasOwnProperty("ignoreSafetyChecks")) { + if (!Array.isArray(message.ignoreSafetyChecks)) + return "ignoreSafetyChecks: array expected"; + for (var i = 0; i < message.ignoreSafetyChecks.length; ++i) + switch (message.ignoreSafetyChecks[i]) { + default: + return "ignoreSafetyChecks: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates an UpdateQuotaPreferenceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest} UpdateQuotaPreferenceRequest + */ + UpdateQuotaPreferenceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest) + return object; + var message = new $root.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.quotaPreference != null) { + if (typeof object.quotaPreference !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest.quotaPreference: object expected"); + message.quotaPreference = $root.google.api.cloudquotas.v1beta.QuotaPreference.fromObject(object.quotaPreference); + } + if (object.allowMissing != null) + message.allowMissing = Boolean(object.allowMissing); + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + if (object.ignoreSafetyChecks) { + if (!Array.isArray(object.ignoreSafetyChecks)) + throw TypeError(".google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest.ignoreSafetyChecks: array expected"); + message.ignoreSafetyChecks = []; + for (var i = 0; i < object.ignoreSafetyChecks.length; ++i) + switch (object.ignoreSafetyChecks[i]) { + default: + if (typeof object.ignoreSafetyChecks[i] === "number") { + message.ignoreSafetyChecks[i] = object.ignoreSafetyChecks[i]; + break; + } + case "QUOTA_SAFETY_CHECK_UNSPECIFIED": + case 0: + message.ignoreSafetyChecks[i] = 0; + break; + case "QUOTA_DECREASE_BELOW_USAGE": + case 1: + message.ignoreSafetyChecks[i] = 1; + break; + case "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH": + case 2: + message.ignoreSafetyChecks[i] = 2; + break; + } + } + return message; + }; + + /** + * Creates a plain object from an UpdateQuotaPreferenceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest} message UpdateQuotaPreferenceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateQuotaPreferenceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ignoreSafetyChecks = []; + if (options.defaults) { + object.updateMask = null; + object.quotaPreference = null; + object.allowMissing = false; + object.validateOnly = false; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.quotaPreference != null && message.hasOwnProperty("quotaPreference")) + object.quotaPreference = $root.google.api.cloudquotas.v1beta.QuotaPreference.toObject(message.quotaPreference, options); + if (message.allowMissing != null && message.hasOwnProperty("allowMissing")) + object.allowMissing = message.allowMissing; + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + if (message.ignoreSafetyChecks && message.ignoreSafetyChecks.length) { + object.ignoreSafetyChecks = []; + for (var j = 0; j < message.ignoreSafetyChecks.length; ++j) + object.ignoreSafetyChecks[j] = options.enums === String ? $root.google.api.cloudquotas.v1beta.QuotaSafetyCheck[message.ignoreSafetyChecks[j]] === undefined ? message.ignoreSafetyChecks[j] : $root.google.api.cloudquotas.v1beta.QuotaSafetyCheck[message.ignoreSafetyChecks[j]] : message.ignoreSafetyChecks[j]; + } + return object; + }; + + /** + * Converts this UpdateQuotaPreferenceRequest to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateQuotaPreferenceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateQuotaPreferenceRequest + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateQuotaPreferenceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest"; + }; + + return UpdateQuotaPreferenceRequest; + })(); + + /** + * QuotaSafetyCheck enum. + * @name google.api.cloudquotas.v1beta.QuotaSafetyCheck + * @enum {number} + * @property {number} QUOTA_SAFETY_CHECK_UNSPECIFIED=0 QUOTA_SAFETY_CHECK_UNSPECIFIED value + * @property {number} QUOTA_DECREASE_BELOW_USAGE=1 QUOTA_DECREASE_BELOW_USAGE value + * @property {number} QUOTA_DECREASE_PERCENTAGE_TOO_HIGH=2 QUOTA_DECREASE_PERCENTAGE_TOO_HIGH value + */ + v1beta.QuotaSafetyCheck = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "QUOTA_SAFETY_CHECK_UNSPECIFIED"] = 0; + values[valuesById[1] = "QUOTA_DECREASE_BELOW_USAGE"] = 1; + values[valuesById[2] = "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH"] = 2; + return values; + })(); + + v1beta.QuotaInfo = (function() { + + /** + * Properties of a QuotaInfo. + * @memberof google.api.cloudquotas.v1beta + * @interface IQuotaInfo + * @property {string|null} [name] QuotaInfo name + * @property {string|null} [quotaId] QuotaInfo quotaId + * @property {string|null} [metric] QuotaInfo metric + * @property {string|null} [service] QuotaInfo service + * @property {boolean|null} [isPrecise] QuotaInfo isPrecise + * @property {string|null} [refreshInterval] QuotaInfo refreshInterval + * @property {google.api.cloudquotas.v1beta.QuotaInfo.ContainerType|null} [containerType] QuotaInfo containerType + * @property {Array.|null} [dimensions] QuotaInfo dimensions + * @property {string|null} [metricDisplayName] QuotaInfo metricDisplayName + * @property {string|null} [quotaDisplayName] QuotaInfo quotaDisplayName + * @property {string|null} [metricUnit] QuotaInfo metricUnit + * @property {google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility|null} [quotaIncreaseEligibility] QuotaInfo quotaIncreaseEligibility + * @property {boolean|null} [isFixed] QuotaInfo isFixed + * @property {Array.|null} [dimensionsInfos] QuotaInfo dimensionsInfos + * @property {boolean|null} [isConcurrent] QuotaInfo isConcurrent + * @property {string|null} [serviceRequestQuotaUri] QuotaInfo serviceRequestQuotaUri + */ + + /** + * Constructs a new QuotaInfo. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a QuotaInfo. + * @implements IQuotaInfo + * @constructor + * @param {google.api.cloudquotas.v1beta.IQuotaInfo=} [properties] Properties to set + */ + function QuotaInfo(properties) { + this.dimensions = []; + this.dimensionsInfos = []; + 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]]; + } + + /** + * QuotaInfo name. + * @member {string} name + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.name = ""; + + /** + * QuotaInfo quotaId. + * @member {string} quotaId + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.quotaId = ""; + + /** + * QuotaInfo metric. + * @member {string} metric + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.metric = ""; + + /** + * QuotaInfo service. + * @member {string} service + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.service = ""; + + /** + * QuotaInfo isPrecise. + * @member {boolean} isPrecise + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.isPrecise = false; + + /** + * QuotaInfo refreshInterval. + * @member {string} refreshInterval + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.refreshInterval = ""; + + /** + * QuotaInfo containerType. + * @member {google.api.cloudquotas.v1beta.QuotaInfo.ContainerType} containerType + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.containerType = 0; + + /** + * QuotaInfo dimensions. + * @member {Array.} dimensions + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.dimensions = $util.emptyArray; + + /** + * QuotaInfo metricDisplayName. + * @member {string} metricDisplayName + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.metricDisplayName = ""; + + /** + * QuotaInfo quotaDisplayName. + * @member {string} quotaDisplayName + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.quotaDisplayName = ""; + + /** + * QuotaInfo metricUnit. + * @member {string} metricUnit + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.metricUnit = ""; + + /** + * QuotaInfo quotaIncreaseEligibility. + * @member {google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility|null|undefined} quotaIncreaseEligibility + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.quotaIncreaseEligibility = null; + + /** + * QuotaInfo isFixed. + * @member {boolean} isFixed + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.isFixed = false; + + /** + * QuotaInfo dimensionsInfos. + * @member {Array.} dimensionsInfos + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.dimensionsInfos = $util.emptyArray; + + /** + * QuotaInfo isConcurrent. + * @member {boolean} isConcurrent + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.isConcurrent = false; + + /** + * QuotaInfo serviceRequestQuotaUri. + * @member {string} serviceRequestQuotaUri + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + */ + QuotaInfo.prototype.serviceRequestQuotaUri = ""; + + /** + * Creates a new QuotaInfo instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaInfo=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.QuotaInfo} QuotaInfo instance + */ + QuotaInfo.create = function create(properties) { + return new QuotaInfo(properties); + }; + + /** + * Encodes the specified QuotaInfo message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaInfo.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaInfo} message QuotaInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaInfo.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.quotaId != null && Object.hasOwnProperty.call(message, "quotaId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.quotaId); + if (message.metric != null && Object.hasOwnProperty.call(message, "metric")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.metric); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.service); + if (message.isPrecise != null && Object.hasOwnProperty.call(message, "isPrecise")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.isPrecise); + if (message.refreshInterval != null && Object.hasOwnProperty.call(message, "refreshInterval")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.refreshInterval); + if (message.containerType != null && Object.hasOwnProperty.call(message, "containerType")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.containerType); + if (message.dimensions != null && message.dimensions.length) + for (var i = 0; i < message.dimensions.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.dimensions[i]); + if (message.metricDisplayName != null && Object.hasOwnProperty.call(message, "metricDisplayName")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.metricDisplayName); + if (message.quotaDisplayName != null && Object.hasOwnProperty.call(message, "quotaDisplayName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.quotaDisplayName); + if (message.metricUnit != null && Object.hasOwnProperty.call(message, "metricUnit")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.metricUnit); + if (message.quotaIncreaseEligibility != null && Object.hasOwnProperty.call(message, "quotaIncreaseEligibility")) + $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.encode(message.quotaIncreaseEligibility, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.isFixed != null && Object.hasOwnProperty.call(message, "isFixed")) + writer.uint32(/* id 13, wireType 0 =*/104).bool(message.isFixed); + if (message.dimensionsInfos != null && message.dimensionsInfos.length) + for (var i = 0; i < message.dimensionsInfos.length; ++i) + $root.google.api.cloudquotas.v1beta.DimensionsInfo.encode(message.dimensionsInfos[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.isConcurrent != null && Object.hasOwnProperty.call(message, "isConcurrent")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.isConcurrent); + if (message.serviceRequestQuotaUri != null && Object.hasOwnProperty.call(message, "serviceRequestQuotaUri")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.serviceRequestQuotaUri); + return writer; + }; + + /** + * Encodes the specified QuotaInfo message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaInfo} message QuotaInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuotaInfo message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.QuotaInfo} QuotaInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.QuotaInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.quotaId = reader.string(); + break; + } + case 3: { + message.metric = reader.string(); + break; + } + case 4: { + message.service = reader.string(); + break; + } + case 5: { + message.isPrecise = reader.bool(); + break; + } + case 6: { + message.refreshInterval = reader.string(); + break; + } + case 7: { + message.containerType = reader.int32(); + break; + } + case 8: { + if (!(message.dimensions && message.dimensions.length)) + message.dimensions = []; + message.dimensions.push(reader.string()); + break; + } + case 9: { + message.metricDisplayName = reader.string(); + break; + } + case 10: { + message.quotaDisplayName = reader.string(); + break; + } + case 11: { + message.metricUnit = reader.string(); + break; + } + case 12: { + message.quotaIncreaseEligibility = $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.decode(reader, reader.uint32()); + break; + } + case 13: { + message.isFixed = reader.bool(); + break; + } + case 14: { + if (!(message.dimensionsInfos && message.dimensionsInfos.length)) + message.dimensionsInfos = []; + message.dimensionsInfos.push($root.google.api.cloudquotas.v1beta.DimensionsInfo.decode(reader, reader.uint32())); + break; + } + case 15: { + message.isConcurrent = reader.bool(); + break; + } + case 17: { + message.serviceRequestQuotaUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuotaInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.QuotaInfo} QuotaInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuotaInfo message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuotaInfo.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.quotaId != null && message.hasOwnProperty("quotaId")) + if (!$util.isString(message.quotaId)) + return "quotaId: string expected"; + if (message.metric != null && message.hasOwnProperty("metric")) + if (!$util.isString(message.metric)) + return "metric: string expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.isPrecise != null && message.hasOwnProperty("isPrecise")) + if (typeof message.isPrecise !== "boolean") + return "isPrecise: boolean expected"; + if (message.refreshInterval != null && message.hasOwnProperty("refreshInterval")) + if (!$util.isString(message.refreshInterval)) + return "refreshInterval: string expected"; + if (message.containerType != null && message.hasOwnProperty("containerType")) + switch (message.containerType) { + default: + return "containerType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.dimensions != null && message.hasOwnProperty("dimensions")) { + if (!Array.isArray(message.dimensions)) + return "dimensions: array expected"; + for (var i = 0; i < message.dimensions.length; ++i) + if (!$util.isString(message.dimensions[i])) + return "dimensions: string[] expected"; + } + if (message.metricDisplayName != null && message.hasOwnProperty("metricDisplayName")) + if (!$util.isString(message.metricDisplayName)) + return "metricDisplayName: string expected"; + if (message.quotaDisplayName != null && message.hasOwnProperty("quotaDisplayName")) + if (!$util.isString(message.quotaDisplayName)) + return "quotaDisplayName: string expected"; + if (message.metricUnit != null && message.hasOwnProperty("metricUnit")) + if (!$util.isString(message.metricUnit)) + return "metricUnit: string expected"; + if (message.quotaIncreaseEligibility != null && message.hasOwnProperty("quotaIncreaseEligibility")) { + var error = $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.verify(message.quotaIncreaseEligibility); + if (error) + return "quotaIncreaseEligibility." + error; + } + if (message.isFixed != null && message.hasOwnProperty("isFixed")) + if (typeof message.isFixed !== "boolean") + return "isFixed: boolean expected"; + if (message.dimensionsInfos != null && message.hasOwnProperty("dimensionsInfos")) { + if (!Array.isArray(message.dimensionsInfos)) + return "dimensionsInfos: array expected"; + for (var i = 0; i < message.dimensionsInfos.length; ++i) { + var error = $root.google.api.cloudquotas.v1beta.DimensionsInfo.verify(message.dimensionsInfos[i]); + if (error) + return "dimensionsInfos." + error; + } + } + if (message.isConcurrent != null && message.hasOwnProperty("isConcurrent")) + if (typeof message.isConcurrent !== "boolean") + return "isConcurrent: boolean expected"; + if (message.serviceRequestQuotaUri != null && message.hasOwnProperty("serviceRequestQuotaUri")) + if (!$util.isString(message.serviceRequestQuotaUri)) + return "serviceRequestQuotaUri: string expected"; + return null; + }; + + /** + * Creates a QuotaInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.QuotaInfo} QuotaInfo + */ + QuotaInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.QuotaInfo) + return object; + var message = new $root.google.api.cloudquotas.v1beta.QuotaInfo(); + if (object.name != null) + message.name = String(object.name); + if (object.quotaId != null) + message.quotaId = String(object.quotaId); + if (object.metric != null) + message.metric = String(object.metric); + if (object.service != null) + message.service = String(object.service); + if (object.isPrecise != null) + message.isPrecise = Boolean(object.isPrecise); + if (object.refreshInterval != null) + message.refreshInterval = String(object.refreshInterval); + switch (object.containerType) { + default: + if (typeof object.containerType === "number") { + message.containerType = object.containerType; + break; + } + break; + case "CONTAINER_TYPE_UNSPECIFIED": + case 0: + message.containerType = 0; + break; + case "PROJECT": + case 1: + message.containerType = 1; + break; + case "FOLDER": + case 2: + message.containerType = 2; + break; + case "ORGANIZATION": + case 3: + message.containerType = 3; + break; + } + if (object.dimensions) { + if (!Array.isArray(object.dimensions)) + throw TypeError(".google.api.cloudquotas.v1beta.QuotaInfo.dimensions: array expected"); + message.dimensions = []; + for (var i = 0; i < object.dimensions.length; ++i) + message.dimensions[i] = String(object.dimensions[i]); + } + if (object.metricDisplayName != null) + message.metricDisplayName = String(object.metricDisplayName); + if (object.quotaDisplayName != null) + message.quotaDisplayName = String(object.quotaDisplayName); + if (object.metricUnit != null) + message.metricUnit = String(object.metricUnit); + if (object.quotaIncreaseEligibility != null) { + if (typeof object.quotaIncreaseEligibility !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaInfo.quotaIncreaseEligibility: object expected"); + message.quotaIncreaseEligibility = $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.fromObject(object.quotaIncreaseEligibility); + } + if (object.isFixed != null) + message.isFixed = Boolean(object.isFixed); + if (object.dimensionsInfos) { + if (!Array.isArray(object.dimensionsInfos)) + throw TypeError(".google.api.cloudquotas.v1beta.QuotaInfo.dimensionsInfos: array expected"); + message.dimensionsInfos = []; + for (var i = 0; i < object.dimensionsInfos.length; ++i) { + if (typeof object.dimensionsInfos[i] !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaInfo.dimensionsInfos: object expected"); + message.dimensionsInfos[i] = $root.google.api.cloudquotas.v1beta.DimensionsInfo.fromObject(object.dimensionsInfos[i]); + } + } + if (object.isConcurrent != null) + message.isConcurrent = Boolean(object.isConcurrent); + if (object.serviceRequestQuotaUri != null) + message.serviceRequestQuotaUri = String(object.serviceRequestQuotaUri); + return message; + }; + + /** + * Creates a plain object from a QuotaInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {google.api.cloudquotas.v1beta.QuotaInfo} message QuotaInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuotaInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dimensions = []; + object.dimensionsInfos = []; + } + if (options.defaults) { + object.name = ""; + object.quotaId = ""; + object.metric = ""; + object.service = ""; + object.isPrecise = false; + object.refreshInterval = ""; + object.containerType = options.enums === String ? "CONTAINER_TYPE_UNSPECIFIED" : 0; + object.metricDisplayName = ""; + object.quotaDisplayName = ""; + object.metricUnit = ""; + object.quotaIncreaseEligibility = null; + object.isFixed = false; + object.isConcurrent = false; + object.serviceRequestQuotaUri = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.quotaId != null && message.hasOwnProperty("quotaId")) + object.quotaId = message.quotaId; + if (message.metric != null && message.hasOwnProperty("metric")) + object.metric = message.metric; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.isPrecise != null && message.hasOwnProperty("isPrecise")) + object.isPrecise = message.isPrecise; + if (message.refreshInterval != null && message.hasOwnProperty("refreshInterval")) + object.refreshInterval = message.refreshInterval; + if (message.containerType != null && message.hasOwnProperty("containerType")) + object.containerType = options.enums === String ? $root.google.api.cloudquotas.v1beta.QuotaInfo.ContainerType[message.containerType] === undefined ? message.containerType : $root.google.api.cloudquotas.v1beta.QuotaInfo.ContainerType[message.containerType] : message.containerType; + if (message.dimensions && message.dimensions.length) { + object.dimensions = []; + for (var j = 0; j < message.dimensions.length; ++j) + object.dimensions[j] = message.dimensions[j]; + } + if (message.metricDisplayName != null && message.hasOwnProperty("metricDisplayName")) + object.metricDisplayName = message.metricDisplayName; + if (message.quotaDisplayName != null && message.hasOwnProperty("quotaDisplayName")) + object.quotaDisplayName = message.quotaDisplayName; + if (message.metricUnit != null && message.hasOwnProperty("metricUnit")) + object.metricUnit = message.metricUnit; + if (message.quotaIncreaseEligibility != null && message.hasOwnProperty("quotaIncreaseEligibility")) + object.quotaIncreaseEligibility = $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.toObject(message.quotaIncreaseEligibility, options); + if (message.isFixed != null && message.hasOwnProperty("isFixed")) + object.isFixed = message.isFixed; + if (message.dimensionsInfos && message.dimensionsInfos.length) { + object.dimensionsInfos = []; + for (var j = 0; j < message.dimensionsInfos.length; ++j) + object.dimensionsInfos[j] = $root.google.api.cloudquotas.v1beta.DimensionsInfo.toObject(message.dimensionsInfos[j], options); + } + if (message.isConcurrent != null && message.hasOwnProperty("isConcurrent")) + object.isConcurrent = message.isConcurrent; + if (message.serviceRequestQuotaUri != null && message.hasOwnProperty("serviceRequestQuotaUri")) + object.serviceRequestQuotaUri = message.serviceRequestQuotaUri; + return object; + }; + + /** + * Converts this QuotaInfo to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @instance + * @returns {Object.} JSON object + */ + QuotaInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QuotaInfo + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.QuotaInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QuotaInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.QuotaInfo"; + }; + + /** + * ContainerType enum. + * @name google.api.cloudquotas.v1beta.QuotaInfo.ContainerType + * @enum {number} + * @property {number} CONTAINER_TYPE_UNSPECIFIED=0 CONTAINER_TYPE_UNSPECIFIED value + * @property {number} PROJECT=1 PROJECT value + * @property {number} FOLDER=2 FOLDER value + * @property {number} ORGANIZATION=3 ORGANIZATION value + */ + QuotaInfo.ContainerType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONTAINER_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PROJECT"] = 1; + values[valuesById[2] = "FOLDER"] = 2; + values[valuesById[3] = "ORGANIZATION"] = 3; + return values; + })(); + + return QuotaInfo; + })(); + + v1beta.QuotaIncreaseEligibility = (function() { + + /** + * Properties of a QuotaIncreaseEligibility. + * @memberof google.api.cloudquotas.v1beta + * @interface IQuotaIncreaseEligibility + * @property {boolean|null} [isEligible] QuotaIncreaseEligibility isEligible + * @property {google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason|null} [ineligibilityReason] QuotaIncreaseEligibility ineligibilityReason + */ + + /** + * Constructs a new QuotaIncreaseEligibility. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a QuotaIncreaseEligibility. + * @implements IQuotaIncreaseEligibility + * @constructor + * @param {google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility=} [properties] Properties to set + */ + function QuotaIncreaseEligibility(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]]; + } + + /** + * QuotaIncreaseEligibility isEligible. + * @member {boolean} isEligible + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @instance + */ + QuotaIncreaseEligibility.prototype.isEligible = false; + + /** + * QuotaIncreaseEligibility ineligibilityReason. + * @member {google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason} ineligibilityReason + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @instance + */ + QuotaIncreaseEligibility.prototype.ineligibilityReason = 0; + + /** + * Creates a new QuotaIncreaseEligibility instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.QuotaIncreaseEligibility} QuotaIncreaseEligibility instance + */ + QuotaIncreaseEligibility.create = function create(properties) { + return new QuotaIncreaseEligibility(properties); + }; + + /** + * Encodes the specified QuotaIncreaseEligibility message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility} message QuotaIncreaseEligibility message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaIncreaseEligibility.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.isEligible != null && Object.hasOwnProperty.call(message, "isEligible")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.isEligible); + if (message.ineligibilityReason != null && Object.hasOwnProperty.call(message, "ineligibilityReason")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ineligibilityReason); + return writer; + }; + + /** + * Encodes the specified QuotaIncreaseEligibility message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaIncreaseEligibility} message QuotaIncreaseEligibility message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaIncreaseEligibility.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuotaIncreaseEligibility message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.QuotaIncreaseEligibility} QuotaIncreaseEligibility + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaIncreaseEligibility.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.isEligible = reader.bool(); + break; + } + case 2: { + message.ineligibilityReason = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuotaIncreaseEligibility message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.QuotaIncreaseEligibility} QuotaIncreaseEligibility + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaIncreaseEligibility.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuotaIncreaseEligibility message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuotaIncreaseEligibility.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.isEligible != null && message.hasOwnProperty("isEligible")) + if (typeof message.isEligible !== "boolean") + return "isEligible: boolean expected"; + if (message.ineligibilityReason != null && message.hasOwnProperty("ineligibilityReason")) + switch (message.ineligibilityReason) { + default: + return "ineligibilityReason: enum value expected"; + case 0: + case 1: + case 3: + case 4: + case 2: + break; + } + return null; + }; + + /** + * Creates a QuotaIncreaseEligibility message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.QuotaIncreaseEligibility} QuotaIncreaseEligibility + */ + QuotaIncreaseEligibility.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility) + return object; + var message = new $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility(); + if (object.isEligible != null) + message.isEligible = Boolean(object.isEligible); + switch (object.ineligibilityReason) { + default: + if (typeof object.ineligibilityReason === "number") { + message.ineligibilityReason = object.ineligibilityReason; + break; + } + break; + case "INELIGIBILITY_REASON_UNSPECIFIED": + case 0: + message.ineligibilityReason = 0; + break; + case "NO_VALID_BILLING_ACCOUNT": + case 1: + message.ineligibilityReason = 1; + break; + case "NOT_SUPPORTED": + case 3: + message.ineligibilityReason = 3; + break; + case "NOT_ENOUGH_USAGE_HISTORY": + case 4: + message.ineligibilityReason = 4; + break; + case "OTHER": + case 2: + message.ineligibilityReason = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a QuotaIncreaseEligibility message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {google.api.cloudquotas.v1beta.QuotaIncreaseEligibility} message QuotaIncreaseEligibility + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuotaIncreaseEligibility.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.isEligible = false; + object.ineligibilityReason = options.enums === String ? "INELIGIBILITY_REASON_UNSPECIFIED" : 0; + } + if (message.isEligible != null && message.hasOwnProperty("isEligible")) + object.isEligible = message.isEligible; + if (message.ineligibilityReason != null && message.hasOwnProperty("ineligibilityReason")) + object.ineligibilityReason = options.enums === String ? $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason[message.ineligibilityReason] === undefined ? message.ineligibilityReason : $root.google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason[message.ineligibilityReason] : message.ineligibilityReason; + return object; + }; + + /** + * Converts this QuotaIncreaseEligibility to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @instance + * @returns {Object.} JSON object + */ + QuotaIncreaseEligibility.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QuotaIncreaseEligibility + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.QuotaIncreaseEligibility + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QuotaIncreaseEligibility.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.QuotaIncreaseEligibility"; + }; + + /** + * IneligibilityReason enum. + * @name google.api.cloudquotas.v1beta.QuotaIncreaseEligibility.IneligibilityReason + * @enum {number} + * @property {number} INELIGIBILITY_REASON_UNSPECIFIED=0 INELIGIBILITY_REASON_UNSPECIFIED value + * @property {number} NO_VALID_BILLING_ACCOUNT=1 NO_VALID_BILLING_ACCOUNT value + * @property {number} NOT_SUPPORTED=3 NOT_SUPPORTED value + * @property {number} NOT_ENOUGH_USAGE_HISTORY=4 NOT_ENOUGH_USAGE_HISTORY value + * @property {number} OTHER=2 OTHER value + */ + QuotaIncreaseEligibility.IneligibilityReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INELIGIBILITY_REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "NO_VALID_BILLING_ACCOUNT"] = 1; + values[valuesById[3] = "NOT_SUPPORTED"] = 3; + values[valuesById[4] = "NOT_ENOUGH_USAGE_HISTORY"] = 4; + values[valuesById[2] = "OTHER"] = 2; + return values; + })(); + + return QuotaIncreaseEligibility; + })(); + + v1beta.QuotaPreference = (function() { + + /** + * Properties of a QuotaPreference. + * @memberof google.api.cloudquotas.v1beta + * @interface IQuotaPreference + * @property {string|null} [name] QuotaPreference name + * @property {Object.|null} [dimensions] QuotaPreference dimensions + * @property {google.api.cloudquotas.v1beta.IQuotaConfig|null} [quotaConfig] QuotaPreference quotaConfig + * @property {string|null} [etag] QuotaPreference etag + * @property {google.protobuf.ITimestamp|null} [createTime] QuotaPreference createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] QuotaPreference updateTime + * @property {string|null} [service] QuotaPreference service + * @property {string|null} [quotaId] QuotaPreference quotaId + * @property {boolean|null} [reconciling] QuotaPreference reconciling + * @property {string|null} [justification] QuotaPreference justification + * @property {string|null} [contactEmail] QuotaPreference contactEmail + */ + + /** + * Constructs a new QuotaPreference. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a QuotaPreference. + * @implements IQuotaPreference + * @constructor + * @param {google.api.cloudquotas.v1beta.IQuotaPreference=} [properties] Properties to set + */ + function QuotaPreference(properties) { + this.dimensions = {}; + 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]]; + } + + /** + * QuotaPreference name. + * @member {string} name + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.name = ""; + + /** + * QuotaPreference dimensions. + * @member {Object.} dimensions + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.dimensions = $util.emptyObject; + + /** + * QuotaPreference quotaConfig. + * @member {google.api.cloudquotas.v1beta.IQuotaConfig|null|undefined} quotaConfig + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.quotaConfig = null; + + /** + * QuotaPreference etag. + * @member {string} etag + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.etag = ""; + + /** + * QuotaPreference createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.createTime = null; + + /** + * QuotaPreference updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.updateTime = null; + + /** + * QuotaPreference service. + * @member {string} service + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.service = ""; + + /** + * QuotaPreference quotaId. + * @member {string} quotaId + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.quotaId = ""; + + /** + * QuotaPreference reconciling. + * @member {boolean} reconciling + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.reconciling = false; + + /** + * QuotaPreference justification. + * @member {string} justification + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.justification = ""; + + /** + * QuotaPreference contactEmail. + * @member {string} contactEmail + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + */ + QuotaPreference.prototype.contactEmail = ""; + + /** + * Creates a new QuotaPreference instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaPreference=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.QuotaPreference} QuotaPreference instance + */ + QuotaPreference.create = function create(properties) { + return new QuotaPreference(properties); + }; + + /** + * Encodes the specified QuotaPreference message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaPreference.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaPreference} message QuotaPreference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaPreference.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.dimensions != null && Object.hasOwnProperty.call(message, "dimensions")) + for (var keys = Object.keys(message.dimensions), 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.dimensions[keys[i]]).ldelim(); + if (message.quotaConfig != null && Object.hasOwnProperty.call(message, "quotaConfig")) + $root.google.api.cloudquotas.v1beta.QuotaConfig.encode(message.quotaConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.etag); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.service); + if (message.quotaId != null && Object.hasOwnProperty.call(message, "quotaId")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.quotaId); + if (message.reconciling != null && Object.hasOwnProperty.call(message, "reconciling")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.reconciling); + if (message.justification != null && Object.hasOwnProperty.call(message, "justification")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.justification); + if (message.contactEmail != null && Object.hasOwnProperty.call(message, "contactEmail")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.contactEmail); + return writer; + }; + + /** + * Encodes the specified QuotaPreference message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaPreference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaPreference} message QuotaPreference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaPreference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuotaPreference message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.QuotaPreference} QuotaPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaPreference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.QuotaPreference(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (message.dimensions === $util.emptyObject) + message.dimensions = {}; + 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.dimensions[key] = value; + break; + } + case 3: { + message.quotaConfig = $root.google.api.cloudquotas.v1beta.QuotaConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.etag = reader.string(); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.service = reader.string(); + break; + } + case 8: { + message.quotaId = reader.string(); + break; + } + case 10: { + message.reconciling = reader.bool(); + break; + } + case 11: { + message.justification = reader.string(); + break; + } + case 12: { + message.contactEmail = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuotaPreference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.QuotaPreference} QuotaPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaPreference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuotaPreference message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuotaPreference.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.dimensions != null && message.hasOwnProperty("dimensions")) { + if (!$util.isObject(message.dimensions)) + return "dimensions: object expected"; + var key = Object.keys(message.dimensions); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.dimensions[key[i]])) + return "dimensions: string{k:string} expected"; + } + if (message.quotaConfig != null && message.hasOwnProperty("quotaConfig")) { + var error = $root.google.api.cloudquotas.v1beta.QuotaConfig.verify(message.quotaConfig); + if (error) + return "quotaConfig." + error; + } + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: 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.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.quotaId != null && message.hasOwnProperty("quotaId")) + if (!$util.isString(message.quotaId)) + return "quotaId: string expected"; + if (message.reconciling != null && message.hasOwnProperty("reconciling")) + if (typeof message.reconciling !== "boolean") + return "reconciling: boolean expected"; + if (message.justification != null && message.hasOwnProperty("justification")) + if (!$util.isString(message.justification)) + return "justification: string expected"; + if (message.contactEmail != null && message.hasOwnProperty("contactEmail")) + if (!$util.isString(message.contactEmail)) + return "contactEmail: string expected"; + return null; + }; + + /** + * Creates a QuotaPreference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.QuotaPreference} QuotaPreference + */ + QuotaPreference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.QuotaPreference) + return object; + var message = new $root.google.api.cloudquotas.v1beta.QuotaPreference(); + if (object.name != null) + message.name = String(object.name); + if (object.dimensions) { + if (typeof object.dimensions !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaPreference.dimensions: object expected"); + message.dimensions = {}; + for (var keys = Object.keys(object.dimensions), i = 0; i < keys.length; ++i) + message.dimensions[keys[i]] = String(object.dimensions[keys[i]]); + } + if (object.quotaConfig != null) { + if (typeof object.quotaConfig !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaPreference.quotaConfig: object expected"); + message.quotaConfig = $root.google.api.cloudquotas.v1beta.QuotaConfig.fromObject(object.quotaConfig); + } + if (object.etag != null) + message.etag = String(object.etag); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaPreference.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaPreference.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.service != null) + message.service = String(object.service); + if (object.quotaId != null) + message.quotaId = String(object.quotaId); + if (object.reconciling != null) + message.reconciling = Boolean(object.reconciling); + if (object.justification != null) + message.justification = String(object.justification); + if (object.contactEmail != null) + message.contactEmail = String(object.contactEmail); + return message; + }; + + /** + * Creates a plain object from a QuotaPreference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {google.api.cloudquotas.v1beta.QuotaPreference} message QuotaPreference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuotaPreference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.dimensions = {}; + if (options.defaults) { + object.name = ""; + object.quotaConfig = null; + object.etag = ""; + object.createTime = null; + object.updateTime = null; + object.service = ""; + object.quotaId = ""; + object.reconciling = false; + object.justification = ""; + object.contactEmail = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + var keys2; + if (message.dimensions && (keys2 = Object.keys(message.dimensions)).length) { + object.dimensions = {}; + for (var j = 0; j < keys2.length; ++j) + object.dimensions[keys2[j]] = message.dimensions[keys2[j]]; + } + if (message.quotaConfig != null && message.hasOwnProperty("quotaConfig")) + object.quotaConfig = $root.google.api.cloudquotas.v1beta.QuotaConfig.toObject(message.quotaConfig, options); + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + 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); + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.quotaId != null && message.hasOwnProperty("quotaId")) + object.quotaId = message.quotaId; + if (message.reconciling != null && message.hasOwnProperty("reconciling")) + object.reconciling = message.reconciling; + if (message.justification != null && message.hasOwnProperty("justification")) + object.justification = message.justification; + if (message.contactEmail != null && message.hasOwnProperty("contactEmail")) + object.contactEmail = message.contactEmail; + return object; + }; + + /** + * Converts this QuotaPreference to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @instance + * @returns {Object.} JSON object + */ + QuotaPreference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QuotaPreference + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.QuotaPreference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QuotaPreference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.QuotaPreference"; + }; + + return QuotaPreference; + })(); + + v1beta.QuotaConfig = (function() { + + /** + * Properties of a QuotaConfig. + * @memberof google.api.cloudquotas.v1beta + * @interface IQuotaConfig + * @property {number|Long|null} [preferredValue] QuotaConfig preferredValue + * @property {string|null} [stateDetail] QuotaConfig stateDetail + * @property {google.protobuf.IInt64Value|null} [grantedValue] QuotaConfig grantedValue + * @property {string|null} [traceId] QuotaConfig traceId + * @property {Object.|null} [annotations] QuotaConfig annotations + * @property {google.api.cloudquotas.v1beta.QuotaConfig.Origin|null} [requestOrigin] QuotaConfig requestOrigin + */ + + /** + * Constructs a new QuotaConfig. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a QuotaConfig. + * @implements IQuotaConfig + * @constructor + * @param {google.api.cloudquotas.v1beta.IQuotaConfig=} [properties] Properties to set + */ + function QuotaConfig(properties) { + this.annotations = {}; + 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]]; + } + + /** + * QuotaConfig preferredValue. + * @member {number|Long} preferredValue + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @instance + */ + QuotaConfig.prototype.preferredValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * QuotaConfig stateDetail. + * @member {string} stateDetail + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @instance + */ + QuotaConfig.prototype.stateDetail = ""; + + /** + * QuotaConfig grantedValue. + * @member {google.protobuf.IInt64Value|null|undefined} grantedValue + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @instance + */ + QuotaConfig.prototype.grantedValue = null; + + /** + * QuotaConfig traceId. + * @member {string} traceId + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @instance + */ + QuotaConfig.prototype.traceId = ""; + + /** + * QuotaConfig annotations. + * @member {Object.} annotations + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @instance + */ + QuotaConfig.prototype.annotations = $util.emptyObject; + + /** + * QuotaConfig requestOrigin. + * @member {google.api.cloudquotas.v1beta.QuotaConfig.Origin} requestOrigin + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @instance + */ + QuotaConfig.prototype.requestOrigin = 0; + + /** + * Creates a new QuotaConfig instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaConfig=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.QuotaConfig} QuotaConfig instance + */ + QuotaConfig.create = function create(properties) { + return new QuotaConfig(properties); + }; + + /** + * Encodes the specified QuotaConfig message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaConfig.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaConfig} message QuotaConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.preferredValue != null && Object.hasOwnProperty.call(message, "preferredValue")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.preferredValue); + if (message.stateDetail != null && Object.hasOwnProperty.call(message, "stateDetail")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateDetail); + if (message.grantedValue != null && Object.hasOwnProperty.call(message, "grantedValue")) + $root.google.protobuf.Int64Value.encode(message.grantedValue, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.traceId != null && Object.hasOwnProperty.call(message, "traceId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.traceId); + if (message.annotations != null && Object.hasOwnProperty.call(message, "annotations")) + for (var keys = Object.keys(message.annotations), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.annotations[keys[i]]).ldelim(); + if (message.requestOrigin != null && Object.hasOwnProperty.call(message, "requestOrigin")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.requestOrigin); + return writer; + }; + + /** + * Encodes the specified QuotaConfig message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaConfig} message QuotaConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuotaConfig message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.QuotaConfig} QuotaConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.QuotaConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.preferredValue = reader.int64(); + break; + } + case 2: { + message.stateDetail = reader.string(); + break; + } + case 3: { + message.grantedValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 4: { + message.traceId = reader.string(); + break; + } + case 5: { + if (message.annotations === $util.emptyObject) + message.annotations = {}; + 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.annotations[key] = value; + break; + } + case 6: { + message.requestOrigin = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuotaConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.QuotaConfig} QuotaConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuotaConfig message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuotaConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.preferredValue != null && message.hasOwnProperty("preferredValue")) + if (!$util.isInteger(message.preferredValue) && !(message.preferredValue && $util.isInteger(message.preferredValue.low) && $util.isInteger(message.preferredValue.high))) + return "preferredValue: integer|Long expected"; + if (message.stateDetail != null && message.hasOwnProperty("stateDetail")) + if (!$util.isString(message.stateDetail)) + return "stateDetail: string expected"; + if (message.grantedValue != null && message.hasOwnProperty("grantedValue")) { + var error = $root.google.protobuf.Int64Value.verify(message.grantedValue); + if (error) + return "grantedValue." + error; + } + if (message.traceId != null && message.hasOwnProperty("traceId")) + if (!$util.isString(message.traceId)) + return "traceId: string expected"; + if (message.annotations != null && message.hasOwnProperty("annotations")) { + if (!$util.isObject(message.annotations)) + return "annotations: object expected"; + var key = Object.keys(message.annotations); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.annotations[key[i]])) + return "annotations: string{k:string} expected"; + } + if (message.requestOrigin != null && message.hasOwnProperty("requestOrigin")) + switch (message.requestOrigin) { + default: + return "requestOrigin: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a QuotaConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.QuotaConfig} QuotaConfig + */ + QuotaConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.QuotaConfig) + return object; + var message = new $root.google.api.cloudquotas.v1beta.QuotaConfig(); + if (object.preferredValue != null) + if ($util.Long) + (message.preferredValue = $util.Long.fromValue(object.preferredValue)).unsigned = false; + else if (typeof object.preferredValue === "string") + message.preferredValue = parseInt(object.preferredValue, 10); + else if (typeof object.preferredValue === "number") + message.preferredValue = object.preferredValue; + else if (typeof object.preferredValue === "object") + message.preferredValue = new $util.LongBits(object.preferredValue.low >>> 0, object.preferredValue.high >>> 0).toNumber(); + if (object.stateDetail != null) + message.stateDetail = String(object.stateDetail); + if (object.grantedValue != null) { + if (typeof object.grantedValue !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaConfig.grantedValue: object expected"); + message.grantedValue = $root.google.protobuf.Int64Value.fromObject(object.grantedValue); + } + if (object.traceId != null) + message.traceId = String(object.traceId); + if (object.annotations) { + if (typeof object.annotations !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaConfig.annotations: object expected"); + message.annotations = {}; + for (var keys = Object.keys(object.annotations), i = 0; i < keys.length; ++i) + message.annotations[keys[i]] = String(object.annotations[keys[i]]); + } + switch (object.requestOrigin) { + default: + if (typeof object.requestOrigin === "number") { + message.requestOrigin = object.requestOrigin; + break; + } + break; + case "ORIGIN_UNSPECIFIED": + case 0: + message.requestOrigin = 0; + break; + case "CLOUD_CONSOLE": + case 1: + message.requestOrigin = 1; + break; + case "AUTO_ADJUSTER": + case 2: + message.requestOrigin = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a QuotaConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {google.api.cloudquotas.v1beta.QuotaConfig} message QuotaConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuotaConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.annotations = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.preferredValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.preferredValue = options.longs === String ? "0" : 0; + object.stateDetail = ""; + object.grantedValue = null; + object.traceId = ""; + object.requestOrigin = options.enums === String ? "ORIGIN_UNSPECIFIED" : 0; + } + if (message.preferredValue != null && message.hasOwnProperty("preferredValue")) + if (typeof message.preferredValue === "number") + object.preferredValue = options.longs === String ? String(message.preferredValue) : message.preferredValue; + else + object.preferredValue = options.longs === String ? $util.Long.prototype.toString.call(message.preferredValue) : options.longs === Number ? new $util.LongBits(message.preferredValue.low >>> 0, message.preferredValue.high >>> 0).toNumber() : message.preferredValue; + if (message.stateDetail != null && message.hasOwnProperty("stateDetail")) + object.stateDetail = message.stateDetail; + if (message.grantedValue != null && message.hasOwnProperty("grantedValue")) + object.grantedValue = $root.google.protobuf.Int64Value.toObject(message.grantedValue, options); + if (message.traceId != null && message.hasOwnProperty("traceId")) + object.traceId = message.traceId; + var keys2; + if (message.annotations && (keys2 = Object.keys(message.annotations)).length) { + object.annotations = {}; + for (var j = 0; j < keys2.length; ++j) + object.annotations[keys2[j]] = message.annotations[keys2[j]]; + } + if (message.requestOrigin != null && message.hasOwnProperty("requestOrigin")) + object.requestOrigin = options.enums === String ? $root.google.api.cloudquotas.v1beta.QuotaConfig.Origin[message.requestOrigin] === undefined ? message.requestOrigin : $root.google.api.cloudquotas.v1beta.QuotaConfig.Origin[message.requestOrigin] : message.requestOrigin; + return object; + }; + + /** + * Converts this QuotaConfig to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @instance + * @returns {Object.} JSON object + */ + QuotaConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QuotaConfig + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.QuotaConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QuotaConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.QuotaConfig"; + }; + + /** + * Origin enum. + * @name google.api.cloudquotas.v1beta.QuotaConfig.Origin + * @enum {number} + * @property {number} ORIGIN_UNSPECIFIED=0 ORIGIN_UNSPECIFIED value + * @property {number} CLOUD_CONSOLE=1 CLOUD_CONSOLE value + * @property {number} AUTO_ADJUSTER=2 AUTO_ADJUSTER value + */ + QuotaConfig.Origin = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ORIGIN_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD_CONSOLE"] = 1; + values[valuesById[2] = "AUTO_ADJUSTER"] = 2; + return values; + })(); + + return QuotaConfig; + })(); + + v1beta.DimensionsInfo = (function() { + + /** + * Properties of a DimensionsInfo. + * @memberof google.api.cloudquotas.v1beta + * @interface IDimensionsInfo + * @property {Object.|null} [dimensions] DimensionsInfo dimensions + * @property {google.api.cloudquotas.v1beta.IQuotaDetails|null} [details] DimensionsInfo details + * @property {Array.|null} [applicableLocations] DimensionsInfo applicableLocations + */ + + /** + * Constructs a new DimensionsInfo. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a DimensionsInfo. + * @implements IDimensionsInfo + * @constructor + * @param {google.api.cloudquotas.v1beta.IDimensionsInfo=} [properties] Properties to set + */ + function DimensionsInfo(properties) { + this.dimensions = {}; + this.applicableLocations = []; + 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]]; + } + + /** + * DimensionsInfo dimensions. + * @member {Object.} dimensions + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @instance + */ + DimensionsInfo.prototype.dimensions = $util.emptyObject; + + /** + * DimensionsInfo details. + * @member {google.api.cloudquotas.v1beta.IQuotaDetails|null|undefined} details + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @instance + */ + DimensionsInfo.prototype.details = null; + + /** + * DimensionsInfo applicableLocations. + * @member {Array.} applicableLocations + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @instance + */ + DimensionsInfo.prototype.applicableLocations = $util.emptyArray; + + /** + * Creates a new DimensionsInfo instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {google.api.cloudquotas.v1beta.IDimensionsInfo=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.DimensionsInfo} DimensionsInfo instance + */ + DimensionsInfo.create = function create(properties) { + return new DimensionsInfo(properties); + }; + + /** + * Encodes the specified DimensionsInfo message. Does not implicitly {@link google.api.cloudquotas.v1beta.DimensionsInfo.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {google.api.cloudquotas.v1beta.IDimensionsInfo} message DimensionsInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DimensionsInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dimensions != null && Object.hasOwnProperty.call(message, "dimensions")) + for (var keys = Object.keys(message.dimensions), i = 0; i < keys.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.dimensions[keys[i]]).ldelim(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + $root.google.api.cloudquotas.v1beta.QuotaDetails.encode(message.details, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.applicableLocations != null && message.applicableLocations.length) + for (var i = 0; i < message.applicableLocations.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.applicableLocations[i]); + return writer; + }; + + /** + * Encodes the specified DimensionsInfo message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.DimensionsInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {google.api.cloudquotas.v1beta.IDimensionsInfo} message DimensionsInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DimensionsInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DimensionsInfo message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.DimensionsInfo} DimensionsInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DimensionsInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.DimensionsInfo(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (message.dimensions === $util.emptyObject) + message.dimensions = {}; + 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.dimensions[key] = value; + break; + } + case 2: { + message.details = $root.google.api.cloudquotas.v1beta.QuotaDetails.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.applicableLocations && message.applicableLocations.length)) + message.applicableLocations = []; + message.applicableLocations.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DimensionsInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.DimensionsInfo} DimensionsInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DimensionsInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DimensionsInfo message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DimensionsInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dimensions != null && message.hasOwnProperty("dimensions")) { + if (!$util.isObject(message.dimensions)) + return "dimensions: object expected"; + var key = Object.keys(message.dimensions); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.dimensions[key[i]])) + return "dimensions: string{k:string} expected"; + } + if (message.details != null && message.hasOwnProperty("details")) { + var error = $root.google.api.cloudquotas.v1beta.QuotaDetails.verify(message.details); + if (error) + return "details." + error; + } + if (message.applicableLocations != null && message.hasOwnProperty("applicableLocations")) { + if (!Array.isArray(message.applicableLocations)) + return "applicableLocations: array expected"; + for (var i = 0; i < message.applicableLocations.length; ++i) + if (!$util.isString(message.applicableLocations[i])) + return "applicableLocations: string[] expected"; + } + return null; + }; + + /** + * Creates a DimensionsInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.DimensionsInfo} DimensionsInfo + */ + DimensionsInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.DimensionsInfo) + return object; + var message = new $root.google.api.cloudquotas.v1beta.DimensionsInfo(); + if (object.dimensions) { + if (typeof object.dimensions !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.DimensionsInfo.dimensions: object expected"); + message.dimensions = {}; + for (var keys = Object.keys(object.dimensions), i = 0; i < keys.length; ++i) + message.dimensions[keys[i]] = String(object.dimensions[keys[i]]); + } + if (object.details != null) { + if (typeof object.details !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.DimensionsInfo.details: object expected"); + message.details = $root.google.api.cloudquotas.v1beta.QuotaDetails.fromObject(object.details); + } + if (object.applicableLocations) { + if (!Array.isArray(object.applicableLocations)) + throw TypeError(".google.api.cloudquotas.v1beta.DimensionsInfo.applicableLocations: array expected"); + message.applicableLocations = []; + for (var i = 0; i < object.applicableLocations.length; ++i) + message.applicableLocations[i] = String(object.applicableLocations[i]); + } + return message; + }; + + /** + * Creates a plain object from a DimensionsInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {google.api.cloudquotas.v1beta.DimensionsInfo} message DimensionsInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DimensionsInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.applicableLocations = []; + if (options.objects || options.defaults) + object.dimensions = {}; + if (options.defaults) + object.details = null; + var keys2; + if (message.dimensions && (keys2 = Object.keys(message.dimensions)).length) { + object.dimensions = {}; + for (var j = 0; j < keys2.length; ++j) + object.dimensions[keys2[j]] = message.dimensions[keys2[j]]; + } + if (message.details != null && message.hasOwnProperty("details")) + object.details = $root.google.api.cloudquotas.v1beta.QuotaDetails.toObject(message.details, options); + if (message.applicableLocations && message.applicableLocations.length) { + object.applicableLocations = []; + for (var j = 0; j < message.applicableLocations.length; ++j) + object.applicableLocations[j] = message.applicableLocations[j]; + } + return object; + }; + + /** + * Converts this DimensionsInfo to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @instance + * @returns {Object.} JSON object + */ + DimensionsInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DimensionsInfo + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.DimensionsInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DimensionsInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.DimensionsInfo"; + }; + + return DimensionsInfo; + })(); + + v1beta.QuotaDetails = (function() { + + /** + * Properties of a QuotaDetails. + * @memberof google.api.cloudquotas.v1beta + * @interface IQuotaDetails + * @property {number|Long|null} [value] QuotaDetails value + * @property {google.api.cloudquotas.v1beta.IRolloutInfo|null} [rolloutInfo] QuotaDetails rolloutInfo + */ + + /** + * Constructs a new QuotaDetails. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a QuotaDetails. + * @implements IQuotaDetails + * @constructor + * @param {google.api.cloudquotas.v1beta.IQuotaDetails=} [properties] Properties to set + */ + function QuotaDetails(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]]; + } + + /** + * QuotaDetails value. + * @member {number|Long} value + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @instance + */ + QuotaDetails.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * QuotaDetails rolloutInfo. + * @member {google.api.cloudquotas.v1beta.IRolloutInfo|null|undefined} rolloutInfo + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @instance + */ + QuotaDetails.prototype.rolloutInfo = null; + + /** + * Creates a new QuotaDetails instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaDetails=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.QuotaDetails} QuotaDetails instance + */ + QuotaDetails.create = function create(properties) { + return new QuotaDetails(properties); + }; + + /** + * Encodes the specified QuotaDetails message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaDetails.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaDetails} message QuotaDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaDetails.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); + if (message.rolloutInfo != null && Object.hasOwnProperty.call(message, "rolloutInfo")) + $root.google.api.cloudquotas.v1beta.RolloutInfo.encode(message.rolloutInfo, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QuotaDetails message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaDetails.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaDetails} message QuotaDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaDetails.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuotaDetails message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.QuotaDetails} QuotaDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaDetails.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.QuotaDetails(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.int64(); + break; + } + case 3: { + message.rolloutInfo = $root.google.api.cloudquotas.v1beta.RolloutInfo.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuotaDetails message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.QuotaDetails} QuotaDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaDetails.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuotaDetails message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuotaDetails.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + if (message.rolloutInfo != null && message.hasOwnProperty("rolloutInfo")) { + var error = $root.google.api.cloudquotas.v1beta.RolloutInfo.verify(message.rolloutInfo); + if (error) + return "rolloutInfo." + error; + } + return null; + }; + + /** + * Creates a QuotaDetails message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.QuotaDetails} QuotaDetails + */ + QuotaDetails.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.QuotaDetails) + return object; + var message = new $root.google.api.cloudquotas.v1beta.QuotaDetails(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = false; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); + if (object.rolloutInfo != null) { + if (typeof object.rolloutInfo !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaDetails.rolloutInfo: object expected"); + message.rolloutInfo = $root.google.api.cloudquotas.v1beta.RolloutInfo.fromObject(object.rolloutInfo); + } + return message; + }; + + /** + * Creates a plain object from a QuotaDetails message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {google.api.cloudquotas.v1beta.QuotaDetails} message QuotaDetails + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuotaDetails.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + object.rolloutInfo = null; + } + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; + if (message.rolloutInfo != null && message.hasOwnProperty("rolloutInfo")) + object.rolloutInfo = $root.google.api.cloudquotas.v1beta.RolloutInfo.toObject(message.rolloutInfo, options); + return object; + }; + + /** + * Converts this QuotaDetails to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @instance + * @returns {Object.} JSON object + */ + QuotaDetails.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QuotaDetails + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.QuotaDetails + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QuotaDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.QuotaDetails"; + }; + + return QuotaDetails; + })(); + + v1beta.RolloutInfo = (function() { + + /** + * Properties of a RolloutInfo. + * @memberof google.api.cloudquotas.v1beta + * @interface IRolloutInfo + * @property {boolean|null} [ongoingRollout] RolloutInfo ongoingRollout + */ + + /** + * Constructs a new RolloutInfo. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a RolloutInfo. + * @implements IRolloutInfo + * @constructor + * @param {google.api.cloudquotas.v1beta.IRolloutInfo=} [properties] Properties to set + */ + function RolloutInfo(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]]; + } + + /** + * RolloutInfo ongoingRollout. + * @member {boolean} ongoingRollout + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @instance + */ + RolloutInfo.prototype.ongoingRollout = false; + + /** + * Creates a new RolloutInfo instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {google.api.cloudquotas.v1beta.IRolloutInfo=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.RolloutInfo} RolloutInfo instance + */ + RolloutInfo.create = function create(properties) { + return new RolloutInfo(properties); + }; + + /** + * Encodes the specified RolloutInfo message. Does not implicitly {@link google.api.cloudquotas.v1beta.RolloutInfo.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {google.api.cloudquotas.v1beta.IRolloutInfo} message RolloutInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RolloutInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ongoingRollout != null && Object.hasOwnProperty.call(message, "ongoingRollout")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.ongoingRollout); + return writer; + }; + + /** + * Encodes the specified RolloutInfo message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.RolloutInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {google.api.cloudquotas.v1beta.IRolloutInfo} message RolloutInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RolloutInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RolloutInfo message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.RolloutInfo} RolloutInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RolloutInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.RolloutInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.ongoingRollout = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RolloutInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.RolloutInfo} RolloutInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RolloutInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RolloutInfo message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RolloutInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ongoingRollout != null && message.hasOwnProperty("ongoingRollout")) + if (typeof message.ongoingRollout !== "boolean") + return "ongoingRollout: boolean expected"; + return null; + }; + + /** + * Creates a RolloutInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.RolloutInfo} RolloutInfo + */ + RolloutInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.RolloutInfo) + return object; + var message = new $root.google.api.cloudquotas.v1beta.RolloutInfo(); + if (object.ongoingRollout != null) + message.ongoingRollout = Boolean(object.ongoingRollout); + return message; + }; + + /** + * Creates a plain object from a RolloutInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {google.api.cloudquotas.v1beta.RolloutInfo} message RolloutInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RolloutInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.ongoingRollout = false; + if (message.ongoingRollout != null && message.hasOwnProperty("ongoingRollout")) + object.ongoingRollout = message.ongoingRollout; + return object; + }; + + /** + * Converts this RolloutInfo to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @instance + * @returns {Object.} JSON object + */ + RolloutInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RolloutInfo + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.RolloutInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RolloutInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.RolloutInfo"; + }; + + return RolloutInfo; + })(); + + v1beta.QuotaAdjusterSettingsManager = (function() { + + /** + * Constructs a new QuotaAdjusterSettingsManager service. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a QuotaAdjusterSettingsManager + * @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 QuotaAdjusterSettingsManager(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (QuotaAdjusterSettingsManager.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = QuotaAdjusterSettingsManager; + + /** + * Creates new QuotaAdjusterSettingsManager service using the specified rpc implementation. + * @function create + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager + * @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 {QuotaAdjusterSettingsManager} RPC service. Useful where requests and/or responses are streamed. + */ + QuotaAdjusterSettingsManager.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager|updateQuotaAdjusterSettings}. + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager + * @typedef UpdateQuotaAdjusterSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.cloudquotas.v1beta.QuotaAdjusterSettings} [response] QuotaAdjusterSettings + */ + + /** + * Calls UpdateQuotaAdjusterSettings. + * @function updateQuotaAdjusterSettings + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager + * @instance + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest} request UpdateQuotaAdjusterSettingsRequest message or plain object + * @param {google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.UpdateQuotaAdjusterSettingsCallback} callback Node-style callback called with the error, if any, and QuotaAdjusterSettings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(QuotaAdjusterSettingsManager.prototype.updateQuotaAdjusterSettings = function updateQuotaAdjusterSettings(request, callback) { + return this.rpcCall(updateQuotaAdjusterSettings, $root.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest, $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings, request, callback); + }, "name", { value: "UpdateQuotaAdjusterSettings" }); + + /** + * Calls UpdateQuotaAdjusterSettings. + * @function updateQuotaAdjusterSettings + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager + * @instance + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest} request UpdateQuotaAdjusterSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager|getQuotaAdjusterSettings}. + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager + * @typedef GetQuotaAdjusterSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.cloudquotas.v1beta.QuotaAdjusterSettings} [response] QuotaAdjusterSettings + */ + + /** + * Calls GetQuotaAdjusterSettings. + * @function getQuotaAdjusterSettings + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager + * @instance + * @param {google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest} request GetQuotaAdjusterSettingsRequest message or plain object + * @param {google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.GetQuotaAdjusterSettingsCallback} callback Node-style callback called with the error, if any, and QuotaAdjusterSettings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(QuotaAdjusterSettingsManager.prototype.getQuotaAdjusterSettings = function getQuotaAdjusterSettings(request, callback) { + return this.rpcCall(getQuotaAdjusterSettings, $root.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest, $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings, request, callback); + }, "name", { value: "GetQuotaAdjusterSettings" }); + + /** + * Calls GetQuotaAdjusterSettings. + * @function getQuotaAdjusterSettings + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager + * @instance + * @param {google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest} request GetQuotaAdjusterSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return QuotaAdjusterSettingsManager; + })(); + + v1beta.GetQuotaAdjusterSettingsRequest = (function() { + + /** + * Properties of a GetQuotaAdjusterSettingsRequest. + * @memberof google.api.cloudquotas.v1beta + * @interface IGetQuotaAdjusterSettingsRequest + * @property {string|null} [name] GetQuotaAdjusterSettingsRequest name + */ + + /** + * Constructs a new GetQuotaAdjusterSettingsRequest. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a GetQuotaAdjusterSettingsRequest. + * @implements IGetQuotaAdjusterSettingsRequest + * @constructor + * @param {google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest=} [properties] Properties to set + */ + function GetQuotaAdjusterSettingsRequest(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]]; + } + + /** + * GetQuotaAdjusterSettingsRequest name. + * @member {string} name + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @instance + */ + GetQuotaAdjusterSettingsRequest.prototype.name = ""; + + /** + * Creates a new GetQuotaAdjusterSettingsRequest instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest} GetQuotaAdjusterSettingsRequest instance + */ + GetQuotaAdjusterSettingsRequest.create = function create(properties) { + return new GetQuotaAdjusterSettingsRequest(properties); + }; + + /** + * Encodes the specified GetQuotaAdjusterSettingsRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest} message GetQuotaAdjusterSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetQuotaAdjusterSettingsRequest.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 GetQuotaAdjusterSettingsRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest} message GetQuotaAdjusterSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetQuotaAdjusterSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetQuotaAdjusterSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest} GetQuotaAdjusterSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetQuotaAdjusterSettingsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetQuotaAdjusterSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest} GetQuotaAdjusterSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetQuotaAdjusterSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetQuotaAdjusterSettingsRequest message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetQuotaAdjusterSettingsRequest.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 GetQuotaAdjusterSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest} GetQuotaAdjusterSettingsRequest + */ + GetQuotaAdjusterSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest) + return object; + var message = new $root.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetQuotaAdjusterSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest} message GetQuotaAdjusterSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetQuotaAdjusterSettingsRequest.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 GetQuotaAdjusterSettingsRequest to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + GetQuotaAdjusterSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetQuotaAdjusterSettingsRequest + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetQuotaAdjusterSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest"; + }; + + return GetQuotaAdjusterSettingsRequest; + })(); + + v1beta.UpdateQuotaAdjusterSettingsRequest = (function() { + + /** + * Properties of an UpdateQuotaAdjusterSettingsRequest. + * @memberof google.api.cloudquotas.v1beta + * @interface IUpdateQuotaAdjusterSettingsRequest + * @property {google.api.cloudquotas.v1beta.IQuotaAdjusterSettings|null} [quotaAdjusterSettings] UpdateQuotaAdjusterSettingsRequest quotaAdjusterSettings + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateQuotaAdjusterSettingsRequest updateMask + * @property {boolean|null} [validateOnly] UpdateQuotaAdjusterSettingsRequest validateOnly + */ + + /** + * Constructs a new UpdateQuotaAdjusterSettingsRequest. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents an UpdateQuotaAdjusterSettingsRequest. + * @implements IUpdateQuotaAdjusterSettingsRequest + * @constructor + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest=} [properties] Properties to set + */ + function UpdateQuotaAdjusterSettingsRequest(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]]; + } + + /** + * UpdateQuotaAdjusterSettingsRequest quotaAdjusterSettings. + * @member {google.api.cloudquotas.v1beta.IQuotaAdjusterSettings|null|undefined} quotaAdjusterSettings + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @instance + */ + UpdateQuotaAdjusterSettingsRequest.prototype.quotaAdjusterSettings = null; + + /** + * UpdateQuotaAdjusterSettingsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @instance + */ + UpdateQuotaAdjusterSettingsRequest.prototype.updateMask = null; + + /** + * UpdateQuotaAdjusterSettingsRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @instance + */ + UpdateQuotaAdjusterSettingsRequest.prototype.validateOnly = false; + + /** + * Creates a new UpdateQuotaAdjusterSettingsRequest instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest} UpdateQuotaAdjusterSettingsRequest instance + */ + UpdateQuotaAdjusterSettingsRequest.create = function create(properties) { + return new UpdateQuotaAdjusterSettingsRequest(properties); + }; + + /** + * Encodes the specified UpdateQuotaAdjusterSettingsRequest message. Does not implicitly {@link google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest} message UpdateQuotaAdjusterSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateQuotaAdjusterSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.quotaAdjusterSettings != null && Object.hasOwnProperty.call(message, "quotaAdjusterSettings")) + $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings.encode(message.quotaAdjusterSettings, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified UpdateQuotaAdjusterSettingsRequest message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest} message UpdateQuotaAdjusterSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateQuotaAdjusterSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateQuotaAdjusterSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest} UpdateQuotaAdjusterSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateQuotaAdjusterSettingsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.quotaAdjusterSettings = $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.validateOnly = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateQuotaAdjusterSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest} UpdateQuotaAdjusterSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateQuotaAdjusterSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateQuotaAdjusterSettingsRequest message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateQuotaAdjusterSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.quotaAdjusterSettings != null && message.hasOwnProperty("quotaAdjusterSettings")) { + var error = $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings.verify(message.quotaAdjusterSettings); + if (error) + return "quotaAdjusterSettings." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates an UpdateQuotaAdjusterSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest} UpdateQuotaAdjusterSettingsRequest + */ + UpdateQuotaAdjusterSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest) + return object; + var message = new $root.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest(); + if (object.quotaAdjusterSettings != null) { + if (typeof object.quotaAdjusterSettings !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest.quotaAdjusterSettings: object expected"); + message.quotaAdjusterSettings = $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings.fromObject(object.quotaAdjusterSettings); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from an UpdateQuotaAdjusterSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest} message UpdateQuotaAdjusterSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateQuotaAdjusterSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.quotaAdjusterSettings = null; + object.updateMask = null; + object.validateOnly = false; + } + if (message.quotaAdjusterSettings != null && message.hasOwnProperty("quotaAdjusterSettings")) + object.quotaAdjusterSettings = $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings.toObject(message.quotaAdjusterSettings, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this UpdateQuotaAdjusterSettingsRequest to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateQuotaAdjusterSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateQuotaAdjusterSettingsRequest + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateQuotaAdjusterSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest"; + }; + + return UpdateQuotaAdjusterSettingsRequest; + })(); + + v1beta.QuotaAdjusterSettings = (function() { + + /** + * Properties of a QuotaAdjusterSettings. + * @memberof google.api.cloudquotas.v1beta + * @interface IQuotaAdjusterSettings + * @property {string|null} [name] QuotaAdjusterSettings name + * @property {google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement|null} [enablement] QuotaAdjusterSettings enablement + * @property {google.protobuf.ITimestamp|null} [updateTime] QuotaAdjusterSettings updateTime + * @property {string|null} [etag] QuotaAdjusterSettings etag + */ + + /** + * Constructs a new QuotaAdjusterSettings. + * @memberof google.api.cloudquotas.v1beta + * @classdesc Represents a QuotaAdjusterSettings. + * @implements IQuotaAdjusterSettings + * @constructor + * @param {google.api.cloudquotas.v1beta.IQuotaAdjusterSettings=} [properties] Properties to set + */ + function QuotaAdjusterSettings(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]]; + } + + /** + * QuotaAdjusterSettings name. + * @member {string} name + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @instance + */ + QuotaAdjusterSettings.prototype.name = ""; + + /** + * QuotaAdjusterSettings enablement. + * @member {google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement} enablement + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @instance + */ + QuotaAdjusterSettings.prototype.enablement = 0; + + /** + * QuotaAdjusterSettings updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @instance + */ + QuotaAdjusterSettings.prototype.updateTime = null; + + /** + * QuotaAdjusterSettings etag. + * @member {string} etag + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @instance + */ + QuotaAdjusterSettings.prototype.etag = ""; + + /** + * Creates a new QuotaAdjusterSettings instance using the specified properties. + * @function create + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaAdjusterSettings=} [properties] Properties to set + * @returns {google.api.cloudquotas.v1beta.QuotaAdjusterSettings} QuotaAdjusterSettings instance + */ + QuotaAdjusterSettings.create = function create(properties) { + return new QuotaAdjusterSettings(properties); + }; + + /** + * Encodes the specified QuotaAdjusterSettings message. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaAdjusterSettings.verify|verify} messages. + * @function encode + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaAdjusterSettings} message QuotaAdjusterSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaAdjusterSettings.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.enablement != null && Object.hasOwnProperty.call(message, "enablement")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.enablement); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.etag); + return writer; + }; + + /** + * Encodes the specified QuotaAdjusterSettings message, length delimited. Does not implicitly {@link google.api.cloudquotas.v1beta.QuotaAdjusterSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {google.api.cloudquotas.v1beta.IQuotaAdjusterSettings} message QuotaAdjusterSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuotaAdjusterSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuotaAdjusterSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.cloudquotas.v1beta.QuotaAdjusterSettings} QuotaAdjusterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaAdjusterSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.enablement = reader.int32(); + break; + } + case 5: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.etag = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuotaAdjusterSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.cloudquotas.v1beta.QuotaAdjusterSettings} QuotaAdjusterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuotaAdjusterSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuotaAdjusterSettings message. + * @function verify + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuotaAdjusterSettings.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.enablement != null && message.hasOwnProperty("enablement")) + switch (message.enablement) { + default: + return "enablement: enum value expected"; + case 0: + case 2: + case 3: + break; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + return null; + }; + + /** + * Creates a QuotaAdjusterSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.cloudquotas.v1beta.QuotaAdjusterSettings} QuotaAdjusterSettings + */ + QuotaAdjusterSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings) + return object; + var message = new $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings(); + if (object.name != null) + message.name = String(object.name); + switch (object.enablement) { + default: + if (typeof object.enablement === "number") { + message.enablement = object.enablement; + break; + } + break; + case "ENABLEMENT_UNSPECIFIED": + case 0: + message.enablement = 0; + break; + case "ENABLED": + case 2: + message.enablement = 2; + break; + case "DISABLED": + case 3: + message.enablement = 3; + break; + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.api.cloudquotas.v1beta.QuotaAdjusterSettings.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.etag != null) + message.etag = String(object.etag); + return message; + }; + + /** + * Creates a plain object from a QuotaAdjusterSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {google.api.cloudquotas.v1beta.QuotaAdjusterSettings} message QuotaAdjusterSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuotaAdjusterSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.enablement = options.enums === String ? "ENABLEMENT_UNSPECIFIED" : 0; + object.updateTime = null; + object.etag = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.enablement != null && message.hasOwnProperty("enablement")) + object.enablement = options.enums === String ? $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement[message.enablement] === undefined ? message.enablement : $root.google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement[message.enablement] : message.enablement; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + return object; + }; + + /** + * Converts this QuotaAdjusterSettings to JSON. + * @function toJSON + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @instance + * @returns {Object.} JSON object + */ + QuotaAdjusterSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QuotaAdjusterSettings + * @function getTypeUrl + * @memberof google.api.cloudquotas.v1beta.QuotaAdjusterSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QuotaAdjusterSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.cloudquotas.v1beta.QuotaAdjusterSettings"; + }; + + /** + * Enablement enum. + * @name google.api.cloudquotas.v1beta.QuotaAdjusterSettings.Enablement + * @enum {number} + * @property {number} ENABLEMENT_UNSPECIFIED=0 ENABLEMENT_UNSPECIFIED value + * @property {number} ENABLED=2 ENABLED value + * @property {number} DISABLED=3 DISABLED value + */ + QuotaAdjusterSettings.Enablement = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENABLEMENT_UNSPECIFIED"] = 0; + values[valuesById[2] = "ENABLED"] = 2; + values[valuesById[3] = "DISABLED"] = 3; + return values; + })(); + + return QuotaAdjusterSettings; + })(); + + return v1beta; + })(); + return cloudquotas; })(); diff --git a/packages/google-api-cloudquotas/protos/protos.json b/packages/google-api-cloudquotas/protos/protos.json index d4bc52ee077..fd74225901e 100644 --- a/packages/google-api-cloudquotas/protos/protos.json +++ b/packages/google-api-cloudquotas/protos/protos.json @@ -691,6 +691,812 @@ } } } + }, + "v1beta": { + "options": { + "csharp_namespace": "Google.Cloud.CloudQuotas.V1Beta", + "go_package": "cloud.google.com/go/cloudquotas/apiv1beta/cloudquotaspb;cloudquotaspb", + "java_multiple_files": true, + "java_outer_classname": "QuotaAdjusterSettingsProto", + "java_package": "com.google.api.cloudquotas.v1beta", + "php_namespace": "Google\\Cloud\\CloudQuotas\\V1beta", + "ruby_package": "Google::Cloud::CloudQuotas::V1beta", + "(google.api.resource_definition).type": "cloudquotas.googleapis.com/Location", + "(google.api.resource_definition).pattern": "organizations/{organization}/locations/{location}" + }, + "nested": { + "CloudQuotas": { + "options": { + "(google.api.default_host)": "cloudquotas.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListQuotaInfos": { + "requestType": "ListQuotaInfosRequest", + "responseType": "ListQuotaInfosResponse", + "options": { + "(google.api.http).get": "/v1beta/{parent=projects/*/locations/*/services/*}/quotaInfos", + "(google.api.http).additional_bindings.get": "/v1beta/{parent=folders/*/locations/*/services/*}/quotaInfos", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta/{parent=projects/*/locations/*/services/*}/quotaInfos", + "additional_bindings": [ + { + "get": "/v1beta/{parent=organizations/*/locations/*/services/*}/quotaInfos" + }, + { + "get": "/v1beta/{parent=folders/*/locations/*/services/*}/quotaInfos" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetQuotaInfo": { + "requestType": "GetQuotaInfoRequest", + "responseType": "QuotaInfo", + "options": { + "(google.api.http).get": "/v1beta/{name=projects/*/locations/*/services/*/quotaInfos/*}", + "(google.api.http).additional_bindings.get": "/v1beta/{name=folders/*/locations/*/services/*/quotaInfos/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta/{name=projects/*/locations/*/services/*/quotaInfos/*}", + "additional_bindings": [ + { + "get": "/v1beta/{name=organizations/*/locations/*/services/*/quotaInfos/*}" + }, + { + "get": "/v1beta/{name=folders/*/locations/*/services/*/quotaInfos/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListQuotaPreferences": { + "requestType": "ListQuotaPreferencesRequest", + "responseType": "ListQuotaPreferencesResponse", + "options": { + "(google.api.http).get": "/v1beta/{parent=projects/*/locations/*}/quotaPreferences", + "(google.api.http).additional_bindings.get": "/v1beta/{parent=organizations/*/locations/*}/quotaPreferences", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta/{parent=projects/*/locations/*}/quotaPreferences", + "additional_bindings": [ + { + "get": "/v1beta/{parent=folders/*/locations/*}/quotaPreferences" + }, + { + "get": "/v1beta/{parent=organizations/*/locations/*}/quotaPreferences" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetQuotaPreference": { + "requestType": "GetQuotaPreferenceRequest", + "responseType": "QuotaPreference", + "options": { + "(google.api.http).get": "/v1beta/{name=projects/*/locations/*/quotaPreferences/*}", + "(google.api.http).additional_bindings.get": "/v1beta/{name=folders/*/locations/*/quotaPreferences/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta/{name=projects/*/locations/*/quotaPreferences/*}", + "additional_bindings": [ + { + "get": "/v1beta/{name=organizations/*/locations/*/quotaPreferences/*}" + }, + { + "get": "/v1beta/{name=folders/*/locations/*/quotaPreferences/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateQuotaPreference": { + "requestType": "CreateQuotaPreferenceRequest", + "responseType": "QuotaPreference", + "options": { + "(google.api.http).post": "/v1beta/{parent=projects/*/locations/*}/quotaPreferences", + "(google.api.http).body": "quota_preference", + "(google.api.http).additional_bindings.post": "/v1beta/{parent=organizations/*/locations/*}/quotaPreferences", + "(google.api.http).additional_bindings.body": "quota_preference", + "(google.api.method_signature)": "parent,quota_preference" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta/{parent=projects/*/locations/*}/quotaPreferences", + "body": "quota_preference", + "additional_bindings": [ + { + "post": "/v1beta/{parent=folders/*/locations/*}/quotaPreferences", + "body": "quota_preference" + }, + { + "post": "/v1beta/{parent=organizations/*/locations/*}/quotaPreferences", + "body": "quota_preference" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,quota_preference,quota_preference_id" + }, + { + "(google.api.method_signature)": "parent,quota_preference" + } + ] + }, + "UpdateQuotaPreference": { + "requestType": "UpdateQuotaPreferenceRequest", + "responseType": "QuotaPreference", + "options": { + "(google.api.http).patch": "/v1beta/{quota_preference.name=projects/*/locations/*/quotaPreferences/*}", + "(google.api.http).body": "quota_preference", + "(google.api.http).additional_bindings.patch": "/v1beta/{quota_preference.name=organizations/*/locations/*/quotaPreferences/*}", + "(google.api.http).additional_bindings.body": "quota_preference", + "(google.api.method_signature)": "quota_preference,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1beta/{quota_preference.name=projects/*/locations/*/quotaPreferences/*}", + "body": "quota_preference", + "additional_bindings": [ + { + "patch": "/v1beta/{quota_preference.name=folders/*/locations/*/quotaPreferences/*}", + "body": "quota_preference" + }, + { + "patch": "/v1beta/{quota_preference.name=organizations/*/locations/*/quotaPreferences/*}", + "body": "quota_preference" + } + ] + } + }, + { + "(google.api.method_signature)": "quota_preference,update_mask" + } + ] + } + } + }, + "ListQuotaInfosRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudquotas.googleapis.com/QuotaInfo" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListQuotaInfosResponse": { + "fields": { + "quotaInfos": { + "rule": "repeated", + "type": "QuotaInfo", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetQuotaInfoRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudquotas.googleapis.com/QuotaInfo" + } + } + } + }, + "ListQuotaPreferencesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudquotas.googleapis.com/QuotaPreference" + } + }, + "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" + } + } + } + }, + "ListQuotaPreferencesResponse": { + "fields": { + "quotaPreferences": { + "rule": "repeated", + "type": "QuotaPreference", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetQuotaPreferenceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudquotas.googleapis.com/QuotaPreference" + } + } + } + }, + "CreateQuotaPreferenceRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudquotas.googleapis.com/QuotaPreference" + } + }, + "quotaPreferenceId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "quotaPreference": { + "type": "QuotaPreference", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "ignoreSafetyChecks": { + "rule": "repeated", + "type": "QuotaSafetyCheck", + "id": 4 + } + } + }, + "UpdateQuotaPreferenceRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "quotaPreference": { + "type": "QuotaPreference", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "allowMissing": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "validateOnly": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "ignoreSafetyChecks": { + "rule": "repeated", + "type": "QuotaSafetyCheck", + "id": 5 + } + } + }, + "QuotaSafetyCheck": { + "values": { + "QUOTA_SAFETY_CHECK_UNSPECIFIED": 0, + "QUOTA_DECREASE_BELOW_USAGE": 1, + "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH": 2 + } + }, + "QuotaInfo": { + "options": { + "(google.api.resource).type": "cloudquotas.googleapis.com/QuotaInfo", + "(google.api.resource).pattern": "organizations/{organization}/locations/{location}/services/{service}/quotaInfos/{quota_info}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "quotaId": { + "type": "string", + "id": 2 + }, + "metric": { + "type": "string", + "id": 3 + }, + "service": { + "type": "string", + "id": 4 + }, + "isPrecise": { + "type": "bool", + "id": 5 + }, + "refreshInterval": { + "type": "string", + "id": 6 + }, + "containerType": { + "type": "ContainerType", + "id": 7 + }, + "dimensions": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "metricDisplayName": { + "type": "string", + "id": 9 + }, + "quotaDisplayName": { + "type": "string", + "id": 10 + }, + "metricUnit": { + "type": "string", + "id": 11 + }, + "quotaIncreaseEligibility": { + "type": "QuotaIncreaseEligibility", + "id": 12 + }, + "isFixed": { + "type": "bool", + "id": 13 + }, + "dimensionsInfos": { + "rule": "repeated", + "type": "DimensionsInfo", + "id": 14 + }, + "isConcurrent": { + "type": "bool", + "id": 15 + }, + "serviceRequestQuotaUri": { + "type": "string", + "id": 17 + } + }, + "nested": { + "ContainerType": { + "values": { + "CONTAINER_TYPE_UNSPECIFIED": 0, + "PROJECT": 1, + "FOLDER": 2, + "ORGANIZATION": 3 + } + } + } + }, + "QuotaIncreaseEligibility": { + "fields": { + "isEligible": { + "type": "bool", + "id": 1 + }, + "ineligibilityReason": { + "type": "IneligibilityReason", + "id": 2 + } + }, + "nested": { + "IneligibilityReason": { + "values": { + "INELIGIBILITY_REASON_UNSPECIFIED": 0, + "NO_VALID_BILLING_ACCOUNT": 1, + "NOT_SUPPORTED": 3, + "NOT_ENOUGH_USAGE_HISTORY": 4, + "OTHER": 2 + } + } + } + }, + "QuotaPreference": { + "options": { + "(google.api.resource).type": "cloudquotas.googleapis.com/QuotaPreference", + "(google.api.resource).pattern": "organizations/{organization}/locations/{location}/quotaPreferences/{quota_preference}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "dimensions": { + "keyType": "string", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "quotaConfig": { + "type": "QuotaConfig", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "etag": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "service": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "quotaId": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "reconciling": { + "type": "bool", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "justification": { + "type": "string", + "id": 11 + }, + "contactEmail": { + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } + } + } + }, + "QuotaConfig": { + "fields": { + "preferredValue": { + "type": "int64", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "stateDetail": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "grantedValue": { + "type": "google.protobuf.Int64Value", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "traceId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "annotations": { + "keyType": "string", + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "requestOrigin": { + "type": "Origin", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Origin": { + "values": { + "ORIGIN_UNSPECIFIED": 0, + "CLOUD_CONSOLE": 1, + "AUTO_ADJUSTER": 2 + } + } + } + }, + "DimensionsInfo": { + "fields": { + "dimensions": { + "keyType": "string", + "type": "string", + "id": 1 + }, + "details": { + "type": "QuotaDetails", + "id": 2 + }, + "applicableLocations": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "QuotaDetails": { + "fields": { + "value": { + "type": "int64", + "id": 1 + }, + "rolloutInfo": { + "type": "RolloutInfo", + "id": 3 + } + } + }, + "RolloutInfo": { + "fields": { + "ongoingRollout": { + "type": "bool", + "id": 1 + } + } + }, + "QuotaAdjusterSettingsManager": { + "options": { + "(google.api.default_host)": "cloudquotas.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "UpdateQuotaAdjusterSettings": { + "requestType": "UpdateQuotaAdjusterSettingsRequest", + "responseType": "QuotaAdjusterSettings", + "options": { + "(google.api.http).patch": "/v1beta/{quota_adjuster_settings.name=projects/*/locations/*/quotaAdjusterSettings}", + "(google.api.http).body": "quota_adjuster_settings", + "(google.api.method_signature)": "quota_adjuster_settings,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1beta/{quota_adjuster_settings.name=projects/*/locations/*/quotaAdjusterSettings}", + "body": "quota_adjuster_settings" + } + }, + { + "(google.api.method_signature)": "quota_adjuster_settings,update_mask" + } + ] + }, + "GetQuotaAdjusterSettings": { + "requestType": "GetQuotaAdjusterSettingsRequest", + "responseType": "QuotaAdjusterSettings", + "options": { + "(google.api.http).get": "/v1beta/{name=projects/*/locations/*/quotaAdjusterSettings}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta/{name=projects/*/locations/*/quotaAdjusterSettings}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "GetQuotaAdjusterSettingsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudquotas.googleapis.com/QuotaAdjusterSettings" + } + } + } + }, + "UpdateQuotaAdjusterSettingsRequest": { + "fields": { + "quotaAdjusterSettings": { + "type": "QuotaAdjusterSettings", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "validateOnly": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "QuotaAdjusterSettings": { + "options": { + "(google.api.resource).type": "cloudquotas.googleapis.com/QuotaAdjusterSettings", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/quotaAdjusterSettings", + "(google.api.resource).plural": "quotaAdjusterSettings", + "(google.api.resource).singular": "quotaAdjusterSettings", + "(google.api.resource).style": "DECLARATIVE_FRIENDLY" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "enablement": { + "type": "Enablement", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "etag": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Enablement": { + "values": { + "ENABLEMENT_UNSPECIFIED": 0, + "ENABLED": 2, + "DISABLED": 3 + } + } + } + } + } } } }, diff --git a/packages/google-api-cloudquotas/samples/README.md b/packages/google-api-cloudquotas/samples/README.md index a53352ecfda..8f2ada30c9f 100644 --- a/packages/google-api-cloudquotas/samples/README.md +++ b/packages/google-api-cloudquotas/samples/README.md @@ -18,6 +18,14 @@ * [Cloud_quotas.list_quota_infos](#cloud_quotas.list_quota_infos) * [Cloud_quotas.list_quota_preferences](#cloud_quotas.list_quota_preferences) * [Cloud_quotas.update_quota_preference](#cloud_quotas.update_quota_preference) + * [Cloud_quotas.create_quota_preference](#cloud_quotas.create_quota_preference) + * [Cloud_quotas.get_quota_info](#cloud_quotas.get_quota_info) + * [Cloud_quotas.get_quota_preference](#cloud_quotas.get_quota_preference) + * [Cloud_quotas.list_quota_infos](#cloud_quotas.list_quota_infos) + * [Cloud_quotas.list_quota_preferences](#cloud_quotas.list_quota_preferences) + * [Cloud_quotas.update_quota_preference](#cloud_quotas.update_quota_preference) + * [Quota_adjuster_settings_manager.get_quota_adjuster_settings](#quota_adjuster_settings_manager.get_quota_adjuster_settings) + * [Quota_adjuster_settings_manager.update_quota_adjuster_settings](#quota_adjuster_settings_manager.update_quota_adjuster_settings) * [Quickstart](#quickstart) ## Before you begin @@ -137,6 +145,142 @@ __Usage:__ +### Cloud_quotas.create_quota_preference + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.create_quota_preference.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.create_quota_preference.js,samples/README.md) + +__Usage:__ + + +`node packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.create_quota_preference.js` + + +----- + + + + +### Cloud_quotas.get_quota_info + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_info.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_info.js,samples/README.md) + +__Usage:__ + + +`node packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_info.js` + + +----- + + + + +### Cloud_quotas.get_quota_preference + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_preference.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_preference.js,samples/README.md) + +__Usage:__ + + +`node packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_preference.js` + + +----- + + + + +### Cloud_quotas.list_quota_infos + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_infos.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_infos.js,samples/README.md) + +__Usage:__ + + +`node packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_infos.js` + + +----- + + + + +### Cloud_quotas.list_quota_preferences + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_preferences.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_preferences.js,samples/README.md) + +__Usage:__ + + +`node packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_preferences.js` + + +----- + + + + +### Cloud_quotas.update_quota_preference + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.update_quota_preference.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.update_quota_preference.js,samples/README.md) + +__Usage:__ + + +`node packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.update_quota_preference.js` + + +----- + + + + +### Quota_adjuster_settings_manager.get_quota_adjuster_settings + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js,samples/README.md) + +__Usage:__ + + +`node packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js` + + +----- + + + + +### Quota_adjuster_settings_manager.update_quota_adjuster_settings + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js,samples/README.md) + +__Usage:__ + + +`node packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js` + + +----- + + + + ### Quickstart View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-api-cloudquotas/samples/quickstart.js). diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.create_quota_preference.js b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.create_quota_preference.js new file mode 100644 index 00000000000..a934acf0cb5 --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.create_quota_preference.js @@ -0,0 +1,77 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, quotaPreference) { + // [START cloudquotas_v1beta_generated_CloudQuotas_CreateQuotaPreference_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. + * Example: + * `projects/123/locations/global` + */ + // const parent = 'abc123' + /** + * Optional. Id of the requesting object, must be unique under its parent. + * If client does not set this field, the service will generate one. + */ + // const quotaPreferenceId = 'abc123' + /** + * Required. The resource being created + */ + // const quotaPreference = {} + /** + * The list of quota safety checks to be ignored. + */ + // const ignoreSafetyChecks = [1,2,3,4] + + // Imports the Cloudquotas library + const {CloudQuotasClient} = require('@google-cloud/cloudquotas').v1beta; + + // Instantiates a client + const cloudquotasClient = new CloudQuotasClient(); + + async function callCreateQuotaPreference() { + // Construct request + const request = { + parent, + quotaPreference, + }; + + // Run request + const response = await cloudquotasClient.createQuotaPreference(request); + console.log(response); + } + + callCreateQuotaPreference(); + // [END cloudquotas_v1beta_generated_CloudQuotas_CreateQuotaPreference_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_info.js b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_info.js new file mode 100644 index 00000000000..61b814b99e8 --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_info.js @@ -0,0 +1,63 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudquotas_v1beta_generated_CloudQuotas_GetQuotaInfo_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 resource name of the quota info. + * An example name: + * `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion` + */ + // const name = 'abc123' + + // Imports the Cloudquotas library + const {CloudQuotasClient} = require('@google-cloud/cloudquotas').v1beta; + + // Instantiates a client + const cloudquotasClient = new CloudQuotasClient(); + + async function callGetQuotaInfo() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudquotasClient.getQuotaInfo(request); + console.log(response); + } + + callGetQuotaInfo(); + // [END cloudquotas_v1beta_generated_CloudQuotas_GetQuotaInfo_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_preference.js b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_preference.js new file mode 100644 index 00000000000..dd7c743b353 --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.get_quota_preference.js @@ -0,0 +1,63 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudquotas_v1beta_generated_CloudQuotas_GetQuotaPreference_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 + * Example name: + * `projects/123/locations/global/quota_preferences/my-config-for-us-east1` + */ + // const name = 'abc123' + + // Imports the Cloudquotas library + const {CloudQuotasClient} = require('@google-cloud/cloudquotas').v1beta; + + // Instantiates a client + const cloudquotasClient = new CloudQuotasClient(); + + async function callGetQuotaPreference() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudquotasClient.getQuotaPreference(request); + console.log(response); + } + + callGetQuotaPreference(); + // [END cloudquotas_v1beta_generated_CloudQuotas_GetQuotaPreference_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_infos.js b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_infos.js new file mode 100644 index 00000000000..62dd9e452a5 --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_infos.js @@ -0,0 +1,78 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudquotas_v1beta_generated_CloudQuotas_ListQuotaInfos_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 of QuotaInfo resources. + * Listing across different resource containers (such as 'projects/-') is not + * allowed. + * Example names: + * `projects/123/locations/global/services/compute.googleapis.com` + * `folders/234/locations/global/services/compute.googleapis.com` + * `organizations/345/locations/global/services/compute.googleapis.com` + */ + // 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' + + // Imports the Cloudquotas library + const {CloudQuotasClient} = require('@google-cloud/cloudquotas').v1beta; + + // Instantiates a client + const cloudquotasClient = new CloudQuotasClient(); + + async function callListQuotaInfos() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = cloudquotasClient.listQuotaInfosAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListQuotaInfos(); + // [END cloudquotas_v1beta_generated_CloudQuotas_ListQuotaInfos_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_preferences.js b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_preferences.js new file mode 100644 index 00000000000..2d9c2bd5e34 --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.list_quota_preferences.js @@ -0,0 +1,95 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudquotas_v1beta_generated_CloudQuotas_ListQuotaPreferences_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 of QuotaPreference resources. + * Listing across different resource containers (such as 'projects/-') is not + * allowed. + * When the value starts with 'folders' or 'organizations', it lists the + * QuotaPreferences for org quotas in the container. It does not list the + * QuotaPreferences in the descendant projects of the container. + * Example parents: + * `projects/123/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. Filter result QuotaPreferences by their state, type, + * create/update time range. + * Example filters: + * `reconciling=true AND request_type=CLOUD_CONSOLE`, + * `reconciling=true OR creation_time>2022-12-03T10:30:00` + */ + // const filter = 'abc123' + /** + * Optional. How to order of the results. By default, the results are ordered + * by create time. + * Example orders: + * `quota_id`, + * `service, create_time` + */ + // const orderBy = 'abc123' + + // Imports the Cloudquotas library + const {CloudQuotasClient} = require('@google-cloud/cloudquotas').v1beta; + + // Instantiates a client + const cloudquotasClient = new CloudQuotasClient(); + + async function callListQuotaPreferences() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = cloudquotasClient.listQuotaPreferencesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListQuotaPreferences(); + // [END cloudquotas_v1beta_generated_CloudQuotas_ListQuotaPreferences_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.update_quota_preference.js b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.update_quota_preference.js new file mode 100644 index 00000000000..0c77dccf7cc --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/cloud_quotas.update_quota_preference.js @@ -0,0 +1,84 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(quotaPreference) { + // [START cloudquotas_v1beta_generated_CloudQuotas_UpdateQuotaPreference_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. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * QuotaPreference 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 quotaPreference = {} + /** + * Optional. If set to true, and the quota preference is not found, a new one + * will be created. In this situation, `update_mask` is ignored. + */ + // const allowMissing = true + /** + * Optional. If set to true, validate the request, but do not actually update. + * Note that a request being valid does not mean that the request is + * guaranteed to be fulfilled. + */ + // const validateOnly = true + /** + * The list of quota safety checks to be ignored. + */ + // const ignoreSafetyChecks = [1,2,3,4] + + // Imports the Cloudquotas library + const {CloudQuotasClient} = require('@google-cloud/cloudquotas').v1beta; + + // Instantiates a client + const cloudquotasClient = new CloudQuotasClient(); + + async function callUpdateQuotaPreference() { + // Construct request + const request = { + quotaPreference, + }; + + // Run request + const response = await cloudquotasClient.updateQuotaPreference(request); + console.log(response); + } + + callUpdateQuotaPreference(); + // [END cloudquotas_v1beta_generated_CloudQuotas_UpdateQuotaPreference_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js b/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js new file mode 100644 index 00000000000..4e95a4ea891 --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js @@ -0,0 +1,62 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_GetQuotaAdjusterSettings_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 config. Required to be “settings”, as only a single + * setting per container will be supported initially. + */ + // const name = 'abc123' + + // Imports the Cloudquotas library + const {QuotaAdjusterSettingsManagerClient} = require('@google-cloud/cloudquotas').v1beta; + + // Instantiates a client + const cloudquotasClient = new QuotaAdjusterSettingsManagerClient(); + + async function callGetQuotaAdjusterSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await cloudquotasClient.getQuotaAdjusterSettings(request); + console.log(response); + } + + callGetQuotaAdjusterSettings(); + // [END cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_GetQuotaAdjusterSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js b/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js new file mode 100644 index 00000000000..6ee206987b7 --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js @@ -0,0 +1,71 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(quotaAdjusterSettings) { + // [START cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_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 QuotaAdjusterSettings to update. + */ + // const quotaAdjusterSettings = {} + /** + * Optional. The list of fields to update. + */ + // const updateMask = {} + /** + * Optional. If set to true, validate the request, but do not actually update. + * Note that a request being valid does not mean that the request is + * guaranteed to be fulfilled. + */ + // const validateOnly = true + + // Imports the Cloudquotas library + const {QuotaAdjusterSettingsManagerClient} = require('@google-cloud/cloudquotas').v1beta; + + // Instantiates a client + const cloudquotasClient = new QuotaAdjusterSettingsManagerClient(); + + async function callUpdateQuotaAdjusterSettings() { + // Construct request + const request = { + quotaAdjusterSettings, + }; + + // Run request + const response = await cloudquotasClient.updateQuotaAdjusterSettings(request); + console.log(response); + } + + callUpdateQuotaAdjusterSettings(); + // [END cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-api-cloudquotas/samples/generated/v1beta/snippet_metadata_google.api.cloudquotas.v1beta.json b/packages/google-api-cloudquotas/samples/generated/v1beta/snippet_metadata_google.api.cloudquotas.v1beta.json new file mode 100644 index 00000000000..332dd393d36 --- /dev/null +++ b/packages/google-api-cloudquotas/samples/generated/v1beta/snippet_metadata_google.api.cloudquotas.v1beta.json @@ -0,0 +1,395 @@ +{ + "clientLibrary": { + "name": "nodejs-cloudquotas", + "version": "0.5.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.api.cloudquotas.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudquotas_v1beta_generated_CloudQuotas_ListQuotaInfos_async", + "title": "CloudQuotas listQuotaInfos Sample", + "origin": "API_DEFINITION", + "description": " Lists QuotaInfos of all quotas for a given project, folder or organization.", + "canonical": true, + "file": "cloud_quotas.list_quota_infos.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListQuotaInfos", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaInfos", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.cloudquotas.v1beta.ListQuotaInfosResponse", + "client": { + "shortName": "CloudQuotasClient", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotasClient" + }, + "method": { + "shortName": "ListQuotaInfos", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaInfos", + "service": { + "shortName": "CloudQuotas", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + } + }, + { + "regionTag": "cloudquotas_v1beta_generated_CloudQuotas_GetQuotaInfo_async", + "title": "CloudQuotas getQuotaInfo Sample", + "origin": "API_DEFINITION", + "description": " Retrieve the QuotaInfo of a quota for a project, folder or organization.", + "canonical": true, + "file": "cloud_quotas.get_quota_info.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetQuotaInfo", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaInfo", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.cloudquotas.v1beta.QuotaInfo", + "client": { + "shortName": "CloudQuotasClient", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotasClient" + }, + "method": { + "shortName": "GetQuotaInfo", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaInfo", + "service": { + "shortName": "CloudQuotas", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + } + }, + { + "regionTag": "cloudquotas_v1beta_generated_CloudQuotas_ListQuotaPreferences_async", + "title": "CloudQuotas listQuotaPreferences Sample", + "origin": "API_DEFINITION", + "description": " Lists QuotaPreferences in a given project, folder or organization.", + "canonical": true, + "file": "cloud_quotas.list_quota_preferences.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListQuotaPreferences", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaPreferences", + "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.api.cloudquotas.v1beta.ListQuotaPreferencesResponse", + "client": { + "shortName": "CloudQuotasClient", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotasClient" + }, + "method": { + "shortName": "ListQuotaPreferences", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.ListQuotaPreferences", + "service": { + "shortName": "CloudQuotas", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + } + }, + { + "regionTag": "cloudquotas_v1beta_generated_CloudQuotas_GetQuotaPreference_async", + "title": "CloudQuotas getQuotaPreference Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single QuotaPreference.", + "canonical": true, + "file": "cloud_quotas.get_quota_preference.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetQuotaPreference", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaPreference", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.cloudquotas.v1beta.QuotaPreference", + "client": { + "shortName": "CloudQuotasClient", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotasClient" + }, + "method": { + "shortName": "GetQuotaPreference", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.GetQuotaPreference", + "service": { + "shortName": "CloudQuotas", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + } + }, + { + "regionTag": "cloudquotas_v1beta_generated_CloudQuotas_CreateQuotaPreference_async", + "title": "CloudQuotas createQuotaPreference Sample", + "origin": "API_DEFINITION", + "description": " Creates a new QuotaPreference that declares the desired value for a quota.", + "canonical": true, + "file": "cloud_quotas.create_quota_preference.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateQuotaPreference", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.CreateQuotaPreference", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "quota_preference_id", + "type": "TYPE_STRING" + }, + { + "name": "quota_preference", + "type": ".google.api.cloudquotas.v1beta.QuotaPreference" + }, + { + "name": "ignore_safety_checks", + "type": "TYPE_ENUM[]" + } + ], + "resultType": ".google.api.cloudquotas.v1beta.QuotaPreference", + "client": { + "shortName": "CloudQuotasClient", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotasClient" + }, + "method": { + "shortName": "CreateQuotaPreference", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.CreateQuotaPreference", + "service": { + "shortName": "CloudQuotas", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + } + }, + { + "regionTag": "cloudquotas_v1beta_generated_CloudQuotas_UpdateQuotaPreference_async", + "title": "CloudQuotas updateQuotaPreference Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single QuotaPreference. It can updates the config in any states, not just the ones pending approval.", + "canonical": true, + "file": "cloud_quotas.update_quota_preference.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateQuotaPreference", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.UpdateQuotaPreference", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "quota_preference", + "type": ".google.api.cloudquotas.v1beta.QuotaPreference" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "ignore_safety_checks", + "type": "TYPE_ENUM[]" + } + ], + "resultType": ".google.api.cloudquotas.v1beta.QuotaPreference", + "client": { + "shortName": "CloudQuotasClient", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotasClient" + }, + "method": { + "shortName": "UpdateQuotaPreference", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas.UpdateQuotaPreference", + "service": { + "shortName": "CloudQuotas", + "fullName": "google.api.cloudquotas.v1beta.CloudQuotas" + } + } + } + }, + { + "regionTag": "cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_async", + "title": "CloudQuotas updateQuotaAdjusterSettings Sample", + "origin": "API_DEFINITION", + "description": " RPC Method for updating QuotaAdjusterSettings based on the request", + "canonical": true, + "file": "quota_adjuster_settings_manager.update_quota_adjuster_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateQuotaAdjusterSettings", + "fullName": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.UpdateQuotaAdjusterSettings", + "async": true, + "parameters": [ + { + "name": "quota_adjuster_settings", + "type": ".google.api.cloudquotas.v1beta.QuotaAdjusterSettings" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.api.cloudquotas.v1beta.QuotaAdjusterSettings", + "client": { + "shortName": "QuotaAdjusterSettingsManagerClient", + "fullName": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManagerClient" + }, + "method": { + "shortName": "UpdateQuotaAdjusterSettings", + "fullName": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.UpdateQuotaAdjusterSettings", + "service": { + "shortName": "QuotaAdjusterSettingsManager", + "fullName": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager" + } + } + } + }, + { + "regionTag": "cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_GetQuotaAdjusterSettings_async", + "title": "CloudQuotas getQuotaAdjusterSettings Sample", + "origin": "API_DEFINITION", + "description": " RPC Method for getting QuotaAdjusterSettings based on the request", + "canonical": true, + "file": "quota_adjuster_settings_manager.get_quota_adjuster_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetQuotaAdjusterSettings", + "fullName": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.GetQuotaAdjusterSettings", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.api.cloudquotas.v1beta.QuotaAdjusterSettings", + "client": { + "shortName": "QuotaAdjusterSettingsManagerClient", + "fullName": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManagerClient" + }, + "method": { + "shortName": "GetQuotaAdjusterSettings", + "fullName": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager.GetQuotaAdjusterSettings", + "service": { + "shortName": "QuotaAdjusterSettingsManager", + "fullName": "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-api-cloudquotas/src/index.ts b/packages/google-api-cloudquotas/src/index.ts index 52073448354..bd69ae6b654 100644 --- a/packages/google-api-cloudquotas/src/index.ts +++ b/packages/google-api-cloudquotas/src/index.ts @@ -17,11 +17,12 @@ // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; +import * as v1beta from './v1beta'; const CloudQuotasClient = v1.CloudQuotasClient; type CloudQuotasClient = v1.CloudQuotasClient; -export {v1, CloudQuotasClient}; -export default {v1, CloudQuotasClient}; +export {v1, v1beta, CloudQuotasClient}; +export default {v1, v1beta, CloudQuotasClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_client.ts b/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_client.ts new file mode 100644 index 00000000000..c8a5cb64dda --- /dev/null +++ b/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_client.ts @@ -0,0 +1,1950 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); + +/** + * Client JSON configuration object, loaded from + * `src/v1beta/cloud_quotas_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_quotas_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Cloud Quotas API is an infrastructure service for Google Cloud that lets + * service consumers list and manage their resource usage limits. + * + * - List/Get the metadata and current status of the quotas for a service. + * - Create/Update quota preferencess that declare the preferred quota values. + * - Check the status of a quota preference request. + * - List/Get pending and historical quota preference. + * @class + * @memberof v1beta + */ +export class CloudQuotasClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + cloudQuotasStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudQuotasClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CloudQuotasClient({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 CloudQuotasClient; + 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 = 'cloudquotas.' + 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; + } + + // 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 = { + folderLocationQuotaPreferencePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/quotaPreferences/{quota_preference}' + ), + folderLocationServiceQuotaInfoPathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/services/{service}/quotaInfos/{quota_info}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + organizationLocationQuotaPreferencePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/quotaPreferences/{quota_preference}' + ), + organizationLocationServiceQuotaInfoPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/services/{service}/quotaInfos/{quota_info}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationQuotaPreferencePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/quotaPreferences/{quota_preference}' + ), + projectLocationServicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}' + ), + projectLocationServiceQuotaInfoPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/quotaInfos/{quota_info}' + ), + quotaAdjusterSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/quotaAdjusterSettings' + ), + }; + + // 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 = { + listQuotaInfos: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'quotaInfos' + ), + listQuotaPreferences: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'quotaPreferences' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.api.cloudquotas.v1beta.CloudQuotas', + 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.cloudQuotasStub) { + return this.cloudQuotasStub; + } + + // Put together the "service stub" for + // google.api.cloudquotas.v1beta.CloudQuotas. + this.cloudQuotasStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.api.cloudquotas.v1beta.CloudQuotas' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.api.cloudquotas.v1beta.CloudQuotas, + 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 cloudQuotasStubMethods = [ + 'listQuotaInfos', + 'getQuotaInfo', + 'listQuotaPreferences', + 'getQuotaPreference', + 'createQuotaPreference', + 'updateQuotaPreference', + ]; + for (const methodName of cloudQuotasStubMethods) { + const callPromise = this.cloudQuotasStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudQuotasStub; + } + + /** + * 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 'cloudquotas.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 'cloudquotas.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 -- + // ------------------- + /** + * Retrieve the QuotaInfo of a quota for a project, folder or organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the quota info. + * + * An example name: + * `projects/123/locations/global/services/compute.googleapis.com/quotaInfos/CpusPerProjectPerRegion` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.api.cloudquotas.v1beta.QuotaInfo|QuotaInfo}. + * 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/v1beta/cloud_quotas.get_quota_info.js + * region_tag:cloudquotas_v1beta_generated_CloudQuotas_GetQuotaInfo_async + */ + getQuotaInfo( + request?: protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaInfo, + protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest | undefined, + {} | undefined, + ] + >; + getQuotaInfo( + request: protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest, + options: CallOptions, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaInfo, + | protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getQuotaInfo( + request: protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaInfo, + | protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getQuotaInfo( + request?: protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.cloudquotas.v1beta.IQuotaInfo, + | protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaInfo, + | protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaInfo, + protos.google.api.cloudquotas.v1beta.IGetQuotaInfoRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getQuotaInfo(request, options, callback); + } + /** + * Gets details of a single QuotaPreference. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * + * Example name: + * `projects/123/locations/global/quota_preferences/my-config-for-us-east1` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.api.cloudquotas.v1beta.QuotaPreference|QuotaPreference}. + * 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/v1beta/cloud_quotas.get_quota_preference.js + * region_tag:cloudquotas_v1beta_generated_CloudQuotas_GetQuotaPreference_async + */ + getQuotaPreference( + request?: protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + ( + | protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest + | undefined + ), + {} | undefined, + ] + >; + getQuotaPreference( + request: protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest, + options: CallOptions, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getQuotaPreference( + request: protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getQuotaPreference( + request?: protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + ( + | protos.google.api.cloudquotas.v1beta.IGetQuotaPreferenceRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getQuotaPreference(request, options, callback); + } + /** + * Creates a new QuotaPreference that declares the desired value for a quota. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * + * Example: + * `projects/123/locations/global` + * @param {string} [request.quotaPreferenceId] + * Optional. Id of the requesting object, must be unique under its parent. + * If client does not set this field, the service will generate one. + * @param {google.api.cloudquotas.v1beta.QuotaPreference} request.quotaPreference + * Required. The resource being created + * @param {number[]} request.ignoreSafetyChecks + * The list of quota safety checks to be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.api.cloudquotas.v1beta.QuotaPreference|QuotaPreference}. + * 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/v1beta/cloud_quotas.create_quota_preference.js + * region_tag:cloudquotas_v1beta_generated_CloudQuotas_CreateQuotaPreference_async + */ + createQuotaPreference( + request?: protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + ( + | protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest + | undefined + ), + {} | undefined, + ] + >; + createQuotaPreference( + request: protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest, + options: CallOptions, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createQuotaPreference( + request: protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createQuotaPreference( + request?: protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + ( + | protos.google.api.cloudquotas.v1beta.ICreateQuotaPreferenceRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createQuotaPreference(request, options, callback); + } + /** + * Updates the parameters of a single QuotaPreference. It can updates the + * config in any states, not just the ones pending approval. + * + * @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 + * QuotaPreference 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.api.cloudquotas.v1beta.QuotaPreference} request.quotaPreference + * Required. The resource being updated + * @param {boolean} [request.allowMissing] + * Optional. If set to true, and the quota preference is not found, a new one + * will be created. In this situation, `update_mask` is ignored. + * @param {boolean} [request.validateOnly] + * Optional. If set to true, validate the request, but do not actually update. + * Note that a request being valid does not mean that the request is + * guaranteed to be fulfilled. + * @param {number[]} request.ignoreSafetyChecks + * The list of quota safety checks to be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.api.cloudquotas.v1beta.QuotaPreference|QuotaPreference}. + * 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/v1beta/cloud_quotas.update_quota_preference.js + * region_tag:cloudquotas_v1beta_generated_CloudQuotas_UpdateQuotaPreference_async + */ + updateQuotaPreference( + request?: protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + ( + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest + | undefined + ), + {} | undefined, + ] + >; + updateQuotaPreference( + request: protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest, + options: CallOptions, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateQuotaPreference( + request: protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateQuotaPreference( + request?: protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaPreference, + ( + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaPreferenceRequest + | 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({ + 'quota_preference.name': request.quotaPreference!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateQuotaPreference(request, options, callback); + } + + /** + * Lists QuotaInfos of all quotas for a given project, folder or organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value of QuotaInfo resources. + * Listing across different resource containers (such as 'projects/-') is not + * allowed. + * + * Example names: + * `projects/123/locations/global/services/compute.googleapis.com` + * `folders/234/locations/global/services/compute.googleapis.com` + * `organizations/345/locations/global/services/compute.googleapis.com` + * @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 {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.api.cloudquotas.v1beta.QuotaInfo|QuotaInfo}. + * 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 `listQuotaInfosAsync()` + * 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. + */ + listQuotaInfos( + request?: protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaInfo[], + protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest | null, + protos.google.api.cloudquotas.v1beta.IListQuotaInfosResponse, + ] + >; + listQuotaInfos( + request: protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + | protos.google.api.cloudquotas.v1beta.IListQuotaInfosResponse + | null + | undefined, + protos.google.api.cloudquotas.v1beta.IQuotaInfo + > + ): void; + listQuotaInfos( + request: protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + callback: PaginationCallback< + protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + | protos.google.api.cloudquotas.v1beta.IListQuotaInfosResponse + | null + | undefined, + protos.google.api.cloudquotas.v1beta.IQuotaInfo + > + ): void; + listQuotaInfos( + request?: protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + | protos.google.api.cloudquotas.v1beta.IListQuotaInfosResponse + | null + | undefined, + protos.google.api.cloudquotas.v1beta.IQuotaInfo + >, + callback?: PaginationCallback< + protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + | protos.google.api.cloudquotas.v1beta.IListQuotaInfosResponse + | null + | undefined, + protos.google.api.cloudquotas.v1beta.IQuotaInfo + > + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaInfo[], + protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest | null, + protos.google.api.cloudquotas.v1beta.IListQuotaInfosResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listQuotaInfos(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value of QuotaInfo resources. + * Listing across different resource containers (such as 'projects/-') is not + * allowed. + * + * Example names: + * `projects/123/locations/global/services/compute.googleapis.com` + * `folders/234/locations/global/services/compute.googleapis.com` + * `organizations/345/locations/global/services/compute.googleapis.com` + * @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 {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.api.cloudquotas.v1beta.QuotaInfo|QuotaInfo} 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 `listQuotaInfosAsync()` + * 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. + */ + listQuotaInfosStream( + request?: protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + 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['listQuotaInfos']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listQuotaInfos.createStream( + this.innerApiCalls.listQuotaInfos as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listQuotaInfos`, 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 of QuotaInfo resources. + * Listing across different resource containers (such as 'projects/-') is not + * allowed. + * + * Example names: + * `projects/123/locations/global/services/compute.googleapis.com` + * `folders/234/locations/global/services/compute.googleapis.com` + * `organizations/345/locations/global/services/compute.googleapis.com` + * @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 {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.api.cloudquotas.v1beta.QuotaInfo|QuotaInfo}. 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/v1beta/cloud_quotas.list_quota_infos.js + * region_tag:cloudquotas_v1beta_generated_CloudQuotas_ListQuotaInfos_async + */ + listQuotaInfosAsync( + request?: protos.google.api.cloudquotas.v1beta.IListQuotaInfosRequest, + 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['listQuotaInfos']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listQuotaInfos.asyncIterate( + this.innerApiCalls['listQuotaInfos'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists QuotaPreferences in a given project, folder or organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value of QuotaPreference resources. + * Listing across different resource containers (such as 'projects/-') is not + * allowed. + * + * When the value starts with 'folders' or 'organizations', it lists the + * QuotaPreferences for org quotas in the container. It does not list the + * QuotaPreferences in the descendant projects of the container. + * + * Example parents: + * `projects/123/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. Filter result QuotaPreferences by their state, type, + * create/update time range. + * + * Example filters: + * `reconciling=true AND request_type=CLOUD_CONSOLE`, + * `reconciling=true OR creation_time>2022-12-03T10:30:00` + * @param {string} [request.orderBy] + * Optional. How to order of the results. By default, the results are ordered + * by create time. + * + * Example orders: + * `quota_id`, + * `service, create_time` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.api.cloudquotas.v1beta.QuotaPreference|QuotaPreference}. + * 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 `listQuotaPreferencesAsync()` + * 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. + */ + listQuotaPreferences( + request?: protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaPreference[], + protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest | null, + protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse, + ] + >; + listQuotaPreferences( + request: protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + | protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse + | null + | undefined, + protos.google.api.cloudquotas.v1beta.IQuotaPreference + > + ): void; + listQuotaPreferences( + request: protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + callback: PaginationCallback< + protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + | protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse + | null + | undefined, + protos.google.api.cloudquotas.v1beta.IQuotaPreference + > + ): void; + listQuotaPreferences( + request?: protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + | protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse + | null + | undefined, + protos.google.api.cloudquotas.v1beta.IQuotaPreference + >, + callback?: PaginationCallback< + protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + | protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse + | null + | undefined, + protos.google.api.cloudquotas.v1beta.IQuotaPreference + > + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaPreference[], + protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest | null, + protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listQuotaPreferences(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value of QuotaPreference resources. + * Listing across different resource containers (such as 'projects/-') is not + * allowed. + * + * When the value starts with 'folders' or 'organizations', it lists the + * QuotaPreferences for org quotas in the container. It does not list the + * QuotaPreferences in the descendant projects of the container. + * + * Example parents: + * `projects/123/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. Filter result QuotaPreferences by their state, type, + * create/update time range. + * + * Example filters: + * `reconciling=true AND request_type=CLOUD_CONSOLE`, + * `reconciling=true OR creation_time>2022-12-03T10:30:00` + * @param {string} [request.orderBy] + * Optional. How to order of the results. By default, the results are ordered + * by create time. + * + * Example orders: + * `quota_id`, + * `service, create_time` + * @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.api.cloudquotas.v1beta.QuotaPreference|QuotaPreference} 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 `listQuotaPreferencesAsync()` + * 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. + */ + listQuotaPreferencesStream( + request?: protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + 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['listQuotaPreferences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listQuotaPreferences.createStream( + this.innerApiCalls.listQuotaPreferences as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listQuotaPreferences`, 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 of QuotaPreference resources. + * Listing across different resource containers (such as 'projects/-') is not + * allowed. + * + * When the value starts with 'folders' or 'organizations', it lists the + * QuotaPreferences for org quotas in the container. It does not list the + * QuotaPreferences in the descendant projects of the container. + * + * Example parents: + * `projects/123/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. Filter result QuotaPreferences by their state, type, + * create/update time range. + * + * Example filters: + * `reconciling=true AND request_type=CLOUD_CONSOLE`, + * `reconciling=true OR creation_time>2022-12-03T10:30:00` + * @param {string} [request.orderBy] + * Optional. How to order of the results. By default, the results are ordered + * by create time. + * + * Example orders: + * `quota_id`, + * `service, create_time` + * @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.api.cloudquotas.v1beta.QuotaPreference|QuotaPreference}. 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/v1beta/cloud_quotas.list_quota_preferences.js + * region_tag:cloudquotas_v1beta_generated_CloudQuotas_ListQuotaPreferences_async + */ + listQuotaPreferencesAsync( + request?: protos.google.api.cloudquotas.v1beta.IListQuotaPreferencesRequest, + 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['listQuotaPreferences']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listQuotaPreferences.asyncIterate( + this.innerApiCalls['listQuotaPreferences'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderLocationQuotaPreference resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} quota_preference + * @returns {string} Resource name string. + */ + folderLocationQuotaPreferencePath( + folder: string, + location: string, + quotaPreference: string + ) { + return this.pathTemplates.folderLocationQuotaPreferencePathTemplate.render({ + folder: folder, + location: location, + quota_preference: quotaPreference, + }); + } + + /** + * Parse the folder from FolderLocationQuotaPreference resource. + * + * @param {string} folderLocationQuotaPreferenceName + * A fully-qualified path representing folder_location_quota_preference resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationQuotaPreferenceName( + folderLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.folderLocationQuotaPreferencePathTemplate.match( + folderLocationQuotaPreferenceName + ).folder; + } + + /** + * Parse the location from FolderLocationQuotaPreference resource. + * + * @param {string} folderLocationQuotaPreferenceName + * A fully-qualified path representing folder_location_quota_preference resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationQuotaPreferenceName( + folderLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.folderLocationQuotaPreferencePathTemplate.match( + folderLocationQuotaPreferenceName + ).location; + } + + /** + * Parse the quota_preference from FolderLocationQuotaPreference resource. + * + * @param {string} folderLocationQuotaPreferenceName + * A fully-qualified path representing folder_location_quota_preference resource. + * @returns {string} A string representing the quota_preference. + */ + matchQuotaPreferenceFromFolderLocationQuotaPreferenceName( + folderLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.folderLocationQuotaPreferencePathTemplate.match( + folderLocationQuotaPreferenceName + ).quota_preference; + } + + /** + * Return a fully-qualified folderLocationServiceQuotaInfo resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} service + * @param {string} quota_info + * @returns {string} Resource name string. + */ + folderLocationServiceQuotaInfoPath( + folder: string, + location: string, + service: string, + quotaInfo: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.render( + { + folder: folder, + location: location, + service: service, + quota_info: quotaInfo, + } + ); + } + + /** + * Parse the folder from FolderLocationServiceQuotaInfo resource. + * + * @param {string} folderLocationServiceQuotaInfoName + * A fully-qualified path representing folder_location_service_quota_info resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationServiceQuotaInfoName( + folderLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match( + folderLocationServiceQuotaInfoName + ).folder; + } + + /** + * Parse the location from FolderLocationServiceQuotaInfo resource. + * + * @param {string} folderLocationServiceQuotaInfoName + * A fully-qualified path representing folder_location_service_quota_info resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationServiceQuotaInfoName( + folderLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match( + folderLocationServiceQuotaInfoName + ).location; + } + + /** + * Parse the service from FolderLocationServiceQuotaInfo resource. + * + * @param {string} folderLocationServiceQuotaInfoName + * A fully-qualified path representing folder_location_service_quota_info resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderLocationServiceQuotaInfoName( + folderLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match( + folderLocationServiceQuotaInfoName + ).service; + } + + /** + * Parse the quota_info from FolderLocationServiceQuotaInfo resource. + * + * @param {string} folderLocationServiceQuotaInfoName + * A fully-qualified path representing folder_location_service_quota_info resource. + * @returns {string} A string representing the quota_info. + */ + matchQuotaInfoFromFolderLocationServiceQuotaInfoName( + folderLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match( + folderLocationServiceQuotaInfoName + ).quota_info; + } + + /** + * 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 organizationLocationQuotaPreference resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} quota_preference + * @returns {string} Resource name string. + */ + organizationLocationQuotaPreferencePath( + organization: string, + location: string, + quotaPreference: string + ) { + return this.pathTemplates.organizationLocationQuotaPreferencePathTemplate.render( + { + organization: organization, + location: location, + quota_preference: quotaPreference, + } + ); + } + + /** + * Parse the organization from OrganizationLocationQuotaPreference resource. + * + * @param {string} organizationLocationQuotaPreferenceName + * A fully-qualified path representing organization_location_quota_preference resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationQuotaPreferenceName( + organizationLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.organizationLocationQuotaPreferencePathTemplate.match( + organizationLocationQuotaPreferenceName + ).organization; + } + + /** + * Parse the location from OrganizationLocationQuotaPreference resource. + * + * @param {string} organizationLocationQuotaPreferenceName + * A fully-qualified path representing organization_location_quota_preference resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationQuotaPreferenceName( + organizationLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.organizationLocationQuotaPreferencePathTemplate.match( + organizationLocationQuotaPreferenceName + ).location; + } + + /** + * Parse the quota_preference from OrganizationLocationQuotaPreference resource. + * + * @param {string} organizationLocationQuotaPreferenceName + * A fully-qualified path representing organization_location_quota_preference resource. + * @returns {string} A string representing the quota_preference. + */ + matchQuotaPreferenceFromOrganizationLocationQuotaPreferenceName( + organizationLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.organizationLocationQuotaPreferencePathTemplate.match( + organizationLocationQuotaPreferenceName + ).quota_preference; + } + + /** + * Return a fully-qualified organizationLocationServiceQuotaInfo resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} service + * @param {string} quota_info + * @returns {string} Resource name string. + */ + organizationLocationServiceQuotaInfoPath( + organization: string, + location: string, + service: string, + quotaInfo: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.render( + { + organization: organization, + location: location, + service: service, + quota_info: quotaInfo, + } + ); + } + + /** + * Parse the organization from OrganizationLocationServiceQuotaInfo resource. + * + * @param {string} organizationLocationServiceQuotaInfoName + * A fully-qualified path representing organization_location_service_quota_info resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationServiceQuotaInfoName( + organizationLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match( + organizationLocationServiceQuotaInfoName + ).organization; + } + + /** + * Parse the location from OrganizationLocationServiceQuotaInfo resource. + * + * @param {string} organizationLocationServiceQuotaInfoName + * A fully-qualified path representing organization_location_service_quota_info resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationServiceQuotaInfoName( + organizationLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match( + organizationLocationServiceQuotaInfoName + ).location; + } + + /** + * Parse the service from OrganizationLocationServiceQuotaInfo resource. + * + * @param {string} organizationLocationServiceQuotaInfoName + * A fully-qualified path representing organization_location_service_quota_info resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationLocationServiceQuotaInfoName( + organizationLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match( + organizationLocationServiceQuotaInfoName + ).service; + } + + /** + * Parse the quota_info from OrganizationLocationServiceQuotaInfo resource. + * + * @param {string} organizationLocationServiceQuotaInfoName + * A fully-qualified path representing organization_location_service_quota_info resource. + * @returns {string} A string representing the quota_info. + */ + matchQuotaInfoFromOrganizationLocationServiceQuotaInfoName( + organizationLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match( + organizationLocationServiceQuotaInfoName + ).quota_info; + } + + /** + * 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 projectLocationQuotaPreference resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} quota_preference + * @returns {string} Resource name string. + */ + projectLocationQuotaPreferencePath( + project: string, + location: string, + quotaPreference: string + ) { + return this.pathTemplates.projectLocationQuotaPreferencePathTemplate.render( + { + project: project, + location: location, + quota_preference: quotaPreference, + } + ); + } + + /** + * Parse the project from ProjectLocationQuotaPreference resource. + * + * @param {string} projectLocationQuotaPreferenceName + * A fully-qualified path representing project_location_quota_preference resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationQuotaPreferenceName( + projectLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.projectLocationQuotaPreferencePathTemplate.match( + projectLocationQuotaPreferenceName + ).project; + } + + /** + * Parse the location from ProjectLocationQuotaPreference resource. + * + * @param {string} projectLocationQuotaPreferenceName + * A fully-qualified path representing project_location_quota_preference resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationQuotaPreferenceName( + projectLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.projectLocationQuotaPreferencePathTemplate.match( + projectLocationQuotaPreferenceName + ).location; + } + + /** + * Parse the quota_preference from ProjectLocationQuotaPreference resource. + * + * @param {string} projectLocationQuotaPreferenceName + * A fully-qualified path representing project_location_quota_preference resource. + * @returns {string} A string representing the quota_preference. + */ + matchQuotaPreferenceFromProjectLocationQuotaPreferenceName( + projectLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.projectLocationQuotaPreferencePathTemplate.match( + projectLocationQuotaPreferenceName + ).quota_preference; + } + + /** + * Return a fully-qualified projectLocationService resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @returns {string} Resource name string. + */ + projectLocationServicePath( + project: string, + location: string, + service: string + ) { + return this.pathTemplates.projectLocationServicePathTemplate.render({ + project: project, + location: location, + service: service, + }); + } + + /** + * Parse the project from ProjectLocationService resource. + * + * @param {string} projectLocationServiceName + * A fully-qualified path representing project_location_service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationServiceName( + projectLocationServiceName: string + ) { + return this.pathTemplates.projectLocationServicePathTemplate.match( + projectLocationServiceName + ).project; + } + + /** + * Parse the location from ProjectLocationService resource. + * + * @param {string} projectLocationServiceName + * A fully-qualified path representing project_location_service resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationServiceName( + projectLocationServiceName: string + ) { + return this.pathTemplates.projectLocationServicePathTemplate.match( + projectLocationServiceName + ).location; + } + + /** + * Parse the service from ProjectLocationService resource. + * + * @param {string} projectLocationServiceName + * A fully-qualified path representing project_location_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectLocationServiceName( + projectLocationServiceName: string + ) { + return this.pathTemplates.projectLocationServicePathTemplate.match( + projectLocationServiceName + ).service; + } + + /** + * Return a fully-qualified projectLocationServiceQuotaInfo resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} quota_info + * @returns {string} Resource name string. + */ + projectLocationServiceQuotaInfoPath( + project: string, + location: string, + service: string, + quotaInfo: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.render( + { + project: project, + location: location, + service: service, + quota_info: quotaInfo, + } + ); + } + + /** + * Parse the project from ProjectLocationServiceQuotaInfo resource. + * + * @param {string} projectLocationServiceQuotaInfoName + * A fully-qualified path representing project_location_service_quota_info resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationServiceQuotaInfoName( + projectLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match( + projectLocationServiceQuotaInfoName + ).project; + } + + /** + * Parse the location from ProjectLocationServiceQuotaInfo resource. + * + * @param {string} projectLocationServiceQuotaInfoName + * A fully-qualified path representing project_location_service_quota_info resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationServiceQuotaInfoName( + projectLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match( + projectLocationServiceQuotaInfoName + ).location; + } + + /** + * Parse the service from ProjectLocationServiceQuotaInfo resource. + * + * @param {string} projectLocationServiceQuotaInfoName + * A fully-qualified path representing project_location_service_quota_info resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectLocationServiceQuotaInfoName( + projectLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match( + projectLocationServiceQuotaInfoName + ).service; + } + + /** + * Parse the quota_info from ProjectLocationServiceQuotaInfo resource. + * + * @param {string} projectLocationServiceQuotaInfoName + * A fully-qualified path representing project_location_service_quota_info resource. + * @returns {string} A string representing the quota_info. + */ + matchQuotaInfoFromProjectLocationServiceQuotaInfoName( + projectLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match( + projectLocationServiceQuotaInfoName + ).quota_info; + } + + /** + * Return a fully-qualified quotaAdjusterSettings resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + quotaAdjusterSettingsPath(project: string, location: string) { + return this.pathTemplates.quotaAdjusterSettingsPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from QuotaAdjusterSettings resource. + * + * @param {string} quotaAdjusterSettingsName + * A fully-qualified path representing QuotaAdjusterSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromQuotaAdjusterSettingsName(quotaAdjusterSettingsName: string) { + return this.pathTemplates.quotaAdjusterSettingsPathTemplate.match( + quotaAdjusterSettingsName + ).project; + } + + /** + * Parse the location from QuotaAdjusterSettings resource. + * + * @param {string} quotaAdjusterSettingsName + * A fully-qualified path representing QuotaAdjusterSettings resource. + * @returns {string} A string representing the location. + */ + matchLocationFromQuotaAdjusterSettingsName( + quotaAdjusterSettingsName: string + ) { + return this.pathTemplates.quotaAdjusterSettingsPathTemplate.match( + quotaAdjusterSettingsName + ).location; + } + + /** + * 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.cloudQuotasStub && !this._terminated) { + return this.cloudQuotasStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_client_config.json b/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_client_config.json new file mode 100644 index 00000000000..1640d4f9e8b --- /dev/null +++ b/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_client_config.json @@ -0,0 +1,68 @@ +{ + "interfaces": { + "google.api.cloudquotas.v1beta.CloudQuotas": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListQuotaInfos": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetQuotaInfo": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListQuotaPreferences": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetQuotaPreference": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateQuotaPreference": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateQuotaPreference": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_proto_list.json b/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_proto_list.json new file mode 100644 index 00000000000..4e9ed56c3da --- /dev/null +++ b/packages/google-api-cloudquotas/src/v1beta/cloud_quotas_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/api/cloudquotas/v1beta/cloudquotas.proto", + "../../protos/google/api/cloudquotas/v1beta/quota_adjuster_settings.proto", + "../../protos/google/api/cloudquotas/v1beta/resources.proto" +] diff --git a/packages/google-api-cloudquotas/src/v1beta/gapic_metadata.json b/packages/google-api-cloudquotas/src/v1beta/gapic_metadata.json new file mode 100644 index 00000000000..ae97b3769a9 --- /dev/null +++ b/packages/google-api-cloudquotas/src/v1beta/gapic_metadata.json @@ -0,0 +1,125 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.api.cloudquotas.v1beta", + "libraryPackage": "@google-cloud/cloudquotas", + "services": { + "CloudQuotas": { + "clients": { + "grpc": { + "libraryClient": "CloudQuotasClient", + "rpcs": { + "GetQuotaInfo": { + "methods": [ + "getQuotaInfo" + ] + }, + "GetQuotaPreference": { + "methods": [ + "getQuotaPreference" + ] + }, + "CreateQuotaPreference": { + "methods": [ + "createQuotaPreference" + ] + }, + "UpdateQuotaPreference": { + "methods": [ + "updateQuotaPreference" + ] + }, + "ListQuotaInfos": { + "methods": [ + "listQuotaInfos", + "listQuotaInfosStream", + "listQuotaInfosAsync" + ] + }, + "ListQuotaPreferences": { + "methods": [ + "listQuotaPreferences", + "listQuotaPreferencesStream", + "listQuotaPreferencesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudQuotasClient", + "rpcs": { + "GetQuotaInfo": { + "methods": [ + "getQuotaInfo" + ] + }, + "GetQuotaPreference": { + "methods": [ + "getQuotaPreference" + ] + }, + "CreateQuotaPreference": { + "methods": [ + "createQuotaPreference" + ] + }, + "UpdateQuotaPreference": { + "methods": [ + "updateQuotaPreference" + ] + }, + "ListQuotaInfos": { + "methods": [ + "listQuotaInfos", + "listQuotaInfosStream", + "listQuotaInfosAsync" + ] + }, + "ListQuotaPreferences": { + "methods": [ + "listQuotaPreferences", + "listQuotaPreferencesStream", + "listQuotaPreferencesAsync" + ] + } + } + } + } + }, + "QuotaAdjusterSettingsManager": { + "clients": { + "grpc": { + "libraryClient": "QuotaAdjusterSettingsManagerClient", + "rpcs": { + "UpdateQuotaAdjusterSettings": { + "methods": [ + "updateQuotaAdjusterSettings" + ] + }, + "GetQuotaAdjusterSettings": { + "methods": [ + "getQuotaAdjusterSettings" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "QuotaAdjusterSettingsManagerClient", + "rpcs": { + "UpdateQuotaAdjusterSettings": { + "methods": [ + "updateQuotaAdjusterSettings" + ] + }, + "GetQuotaAdjusterSettings": { + "methods": [ + "getQuotaAdjusterSettings" + ] + } + } + } + } + } + } +} diff --git a/packages/google-api-cloudquotas/src/v1beta/index.ts b/packages/google-api-cloudquotas/src/v1beta/index.ts new file mode 100644 index 00000000000..4db1adfca69 --- /dev/null +++ b/packages/google-api-cloudquotas/src/v1beta/index.ts @@ -0,0 +1,20 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CloudQuotasClient} from './cloud_quotas_client'; +export {QuotaAdjusterSettingsManagerClient} from './quota_adjuster_settings_manager_client'; diff --git a/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_client.ts b/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_client.ts new file mode 100644 index 00000000000..719e70e5042 --- /dev/null +++ b/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_client.ts @@ -0,0 +1,1126 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); + +/** + * Client JSON configuration object, loaded from + * `src/v1beta/quota_adjuster_settings_manager_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './quota_adjuster_settings_manager_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Quotas Adjuster Settings API is an infrastructure service for Google + * Cloud that lets service consumers view and update their quota adjuster + * settings. + * + * - Update quota adjuster settings. + * - Get the name of the configurations. + * @class + * @memberof v1beta + */ +export class QuotaAdjusterSettingsManagerClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + quotaAdjusterSettingsManagerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of QuotaAdjusterSettingsManagerClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new QuotaAdjusterSettingsManagerClient({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 QuotaAdjusterSettingsManagerClient; + 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 = 'cloudquotas.' + 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; + } + + // 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 = { + folderLocationQuotaPreferencePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/quotaPreferences/{quota_preference}' + ), + folderLocationServiceQuotaInfoPathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/locations/{location}/services/{service}/quotaInfos/{quota_info}' + ), + organizationLocationQuotaPreferencePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/quotaPreferences/{quota_preference}' + ), + organizationLocationServiceQuotaInfoPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/locations/{location}/services/{service}/quotaInfos/{quota_info}' + ), + projectLocationQuotaPreferencePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/quotaPreferences/{quota_preference}' + ), + projectLocationServiceQuotaInfoPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/services/{service}/quotaInfos/{quota_info}' + ), + quotaAdjusterSettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/quotaAdjusterSettings' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager', + 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.quotaAdjusterSettingsManagerStub) { + return this.quotaAdjusterSettingsManagerStub; + } + + // Put together the "service stub" for + // google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager. + this.quotaAdjusterSettingsManagerStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.api.cloudquotas.v1beta + .QuotaAdjusterSettingsManager, + 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 quotaAdjusterSettingsManagerStubMethods = [ + 'updateQuotaAdjusterSettings', + 'getQuotaAdjusterSettings', + ]; + for (const methodName of quotaAdjusterSettingsManagerStubMethods) { + const callPromise = this.quotaAdjusterSettingsManagerStub.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 = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.quotaAdjusterSettingsManagerStub; + } + + /** + * 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 'cloudquotas.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 'cloudquotas.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 -- + // ------------------- + /** + * RPC Method for updating QuotaAdjusterSettings based on the request + * + * @param {Object} request + * The request object that will be sent. + * @param {google.api.cloudquotas.v1beta.QuotaAdjusterSettings} request.quotaAdjusterSettings + * Required. The QuotaAdjusterSettings to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. + * @param {boolean} [request.validateOnly] + * Optional. If set to true, validate the request, but do not actually update. + * Note that a request being valid does not mean that the request is + * guaranteed to be fulfilled. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.api.cloudquotas.v1beta.QuotaAdjusterSettings|QuotaAdjusterSettings}. + * 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/v1beta/quota_adjuster_settings_manager.update_quota_adjuster_settings.js + * region_tag:cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_UpdateQuotaAdjusterSettings_async + */ + updateQuotaAdjusterSettings( + request?: protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + ( + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest + | undefined + ), + {} | undefined, + ] + >; + updateQuotaAdjusterSettings( + request: protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateQuotaAdjusterSettings( + request: protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateQuotaAdjusterSettings( + request?: protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + ( + | protos.google.api.cloudquotas.v1beta.IUpdateQuotaAdjusterSettingsRequest + | 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({ + 'quota_adjuster_settings.name': + request.quotaAdjusterSettings!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateQuotaAdjusterSettings( + request, + options, + callback + ); + } + /** + * RPC Method for getting QuotaAdjusterSettings based on the request + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the config. Required to be “settings”, as only a single + * setting per container will be supported initially. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.api.cloudquotas.v1beta.QuotaAdjusterSettings|QuotaAdjusterSettings}. + * 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/v1beta/quota_adjuster_settings_manager.get_quota_adjuster_settings.js + * region_tag:cloudquotas_v1beta_generated_QuotaAdjusterSettingsManager_GetQuotaAdjusterSettings_async + */ + getQuotaAdjusterSettings( + request?: protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + ( + | protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest + | undefined + ), + {} | undefined, + ] + >; + getQuotaAdjusterSettings( + request: protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + | protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getQuotaAdjusterSettings( + request: protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest, + callback: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + | protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getQuotaAdjusterSettings( + request?: protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + | protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + | protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings, + ( + | protos.google.api.cloudquotas.v1beta.IGetQuotaAdjusterSettingsRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getQuotaAdjusterSettings( + request, + options, + callback + ); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderLocationQuotaPreference resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} quota_preference + * @returns {string} Resource name string. + */ + folderLocationQuotaPreferencePath( + folder: string, + location: string, + quotaPreference: string + ) { + return this.pathTemplates.folderLocationQuotaPreferencePathTemplate.render({ + folder: folder, + location: location, + quota_preference: quotaPreference, + }); + } + + /** + * Parse the folder from FolderLocationQuotaPreference resource. + * + * @param {string} folderLocationQuotaPreferenceName + * A fully-qualified path representing folder_location_quota_preference resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationQuotaPreferenceName( + folderLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.folderLocationQuotaPreferencePathTemplate.match( + folderLocationQuotaPreferenceName + ).folder; + } + + /** + * Parse the location from FolderLocationQuotaPreference resource. + * + * @param {string} folderLocationQuotaPreferenceName + * A fully-qualified path representing folder_location_quota_preference resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationQuotaPreferenceName( + folderLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.folderLocationQuotaPreferencePathTemplate.match( + folderLocationQuotaPreferenceName + ).location; + } + + /** + * Parse the quota_preference from FolderLocationQuotaPreference resource. + * + * @param {string} folderLocationQuotaPreferenceName + * A fully-qualified path representing folder_location_quota_preference resource. + * @returns {string} A string representing the quota_preference. + */ + matchQuotaPreferenceFromFolderLocationQuotaPreferenceName( + folderLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.folderLocationQuotaPreferencePathTemplate.match( + folderLocationQuotaPreferenceName + ).quota_preference; + } + + /** + * Return a fully-qualified folderLocationServiceQuotaInfo resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} service + * @param {string} quota_info + * @returns {string} Resource name string. + */ + folderLocationServiceQuotaInfoPath( + folder: string, + location: string, + service: string, + quotaInfo: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.render( + { + folder: folder, + location: location, + service: service, + quota_info: quotaInfo, + } + ); + } + + /** + * Parse the folder from FolderLocationServiceQuotaInfo resource. + * + * @param {string} folderLocationServiceQuotaInfoName + * A fully-qualified path representing folder_location_service_quota_info resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationServiceQuotaInfoName( + folderLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match( + folderLocationServiceQuotaInfoName + ).folder; + } + + /** + * Parse the location from FolderLocationServiceQuotaInfo resource. + * + * @param {string} folderLocationServiceQuotaInfoName + * A fully-qualified path representing folder_location_service_quota_info resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationServiceQuotaInfoName( + folderLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match( + folderLocationServiceQuotaInfoName + ).location; + } + + /** + * Parse the service from FolderLocationServiceQuotaInfo resource. + * + * @param {string} folderLocationServiceQuotaInfoName + * A fully-qualified path representing folder_location_service_quota_info resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderLocationServiceQuotaInfoName( + folderLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match( + folderLocationServiceQuotaInfoName + ).service; + } + + /** + * Parse the quota_info from FolderLocationServiceQuotaInfo resource. + * + * @param {string} folderLocationServiceQuotaInfoName + * A fully-qualified path representing folder_location_service_quota_info resource. + * @returns {string} A string representing the quota_info. + */ + matchQuotaInfoFromFolderLocationServiceQuotaInfoName( + folderLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match( + folderLocationServiceQuotaInfoName + ).quota_info; + } + + /** + * Return a fully-qualified organizationLocationQuotaPreference resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} quota_preference + * @returns {string} Resource name string. + */ + organizationLocationQuotaPreferencePath( + organization: string, + location: string, + quotaPreference: string + ) { + return this.pathTemplates.organizationLocationQuotaPreferencePathTemplate.render( + { + organization: organization, + location: location, + quota_preference: quotaPreference, + } + ); + } + + /** + * Parse the organization from OrganizationLocationQuotaPreference resource. + * + * @param {string} organizationLocationQuotaPreferenceName + * A fully-qualified path representing organization_location_quota_preference resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationQuotaPreferenceName( + organizationLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.organizationLocationQuotaPreferencePathTemplate.match( + organizationLocationQuotaPreferenceName + ).organization; + } + + /** + * Parse the location from OrganizationLocationQuotaPreference resource. + * + * @param {string} organizationLocationQuotaPreferenceName + * A fully-qualified path representing organization_location_quota_preference resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationQuotaPreferenceName( + organizationLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.organizationLocationQuotaPreferencePathTemplate.match( + organizationLocationQuotaPreferenceName + ).location; + } + + /** + * Parse the quota_preference from OrganizationLocationQuotaPreference resource. + * + * @param {string} organizationLocationQuotaPreferenceName + * A fully-qualified path representing organization_location_quota_preference resource. + * @returns {string} A string representing the quota_preference. + */ + matchQuotaPreferenceFromOrganizationLocationQuotaPreferenceName( + organizationLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.organizationLocationQuotaPreferencePathTemplate.match( + organizationLocationQuotaPreferenceName + ).quota_preference; + } + + /** + * Return a fully-qualified organizationLocationServiceQuotaInfo resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} service + * @param {string} quota_info + * @returns {string} Resource name string. + */ + organizationLocationServiceQuotaInfoPath( + organization: string, + location: string, + service: string, + quotaInfo: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.render( + { + organization: organization, + location: location, + service: service, + quota_info: quotaInfo, + } + ); + } + + /** + * Parse the organization from OrganizationLocationServiceQuotaInfo resource. + * + * @param {string} organizationLocationServiceQuotaInfoName + * A fully-qualified path representing organization_location_service_quota_info resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationServiceQuotaInfoName( + organizationLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match( + organizationLocationServiceQuotaInfoName + ).organization; + } + + /** + * Parse the location from OrganizationLocationServiceQuotaInfo resource. + * + * @param {string} organizationLocationServiceQuotaInfoName + * A fully-qualified path representing organization_location_service_quota_info resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationServiceQuotaInfoName( + organizationLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match( + organizationLocationServiceQuotaInfoName + ).location; + } + + /** + * Parse the service from OrganizationLocationServiceQuotaInfo resource. + * + * @param {string} organizationLocationServiceQuotaInfoName + * A fully-qualified path representing organization_location_service_quota_info resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationLocationServiceQuotaInfoName( + organizationLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match( + organizationLocationServiceQuotaInfoName + ).service; + } + + /** + * Parse the quota_info from OrganizationLocationServiceQuotaInfo resource. + * + * @param {string} organizationLocationServiceQuotaInfoName + * A fully-qualified path representing organization_location_service_quota_info resource. + * @returns {string} A string representing the quota_info. + */ + matchQuotaInfoFromOrganizationLocationServiceQuotaInfoName( + organizationLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match( + organizationLocationServiceQuotaInfoName + ).quota_info; + } + + /** + * Return a fully-qualified projectLocationQuotaPreference resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} quota_preference + * @returns {string} Resource name string. + */ + projectLocationQuotaPreferencePath( + project: string, + location: string, + quotaPreference: string + ) { + return this.pathTemplates.projectLocationQuotaPreferencePathTemplate.render( + { + project: project, + location: location, + quota_preference: quotaPreference, + } + ); + } + + /** + * Parse the project from ProjectLocationQuotaPreference resource. + * + * @param {string} projectLocationQuotaPreferenceName + * A fully-qualified path representing project_location_quota_preference resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationQuotaPreferenceName( + projectLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.projectLocationQuotaPreferencePathTemplate.match( + projectLocationQuotaPreferenceName + ).project; + } + + /** + * Parse the location from ProjectLocationQuotaPreference resource. + * + * @param {string} projectLocationQuotaPreferenceName + * A fully-qualified path representing project_location_quota_preference resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationQuotaPreferenceName( + projectLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.projectLocationQuotaPreferencePathTemplate.match( + projectLocationQuotaPreferenceName + ).location; + } + + /** + * Parse the quota_preference from ProjectLocationQuotaPreference resource. + * + * @param {string} projectLocationQuotaPreferenceName + * A fully-qualified path representing project_location_quota_preference resource. + * @returns {string} A string representing the quota_preference. + */ + matchQuotaPreferenceFromProjectLocationQuotaPreferenceName( + projectLocationQuotaPreferenceName: string + ) { + return this.pathTemplates.projectLocationQuotaPreferencePathTemplate.match( + projectLocationQuotaPreferenceName + ).quota_preference; + } + + /** + * Return a fully-qualified projectLocationServiceQuotaInfo resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} service + * @param {string} quota_info + * @returns {string} Resource name string. + */ + projectLocationServiceQuotaInfoPath( + project: string, + location: string, + service: string, + quotaInfo: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.render( + { + project: project, + location: location, + service: service, + quota_info: quotaInfo, + } + ); + } + + /** + * Parse the project from ProjectLocationServiceQuotaInfo resource. + * + * @param {string} projectLocationServiceQuotaInfoName + * A fully-qualified path representing project_location_service_quota_info resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationServiceQuotaInfoName( + projectLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match( + projectLocationServiceQuotaInfoName + ).project; + } + + /** + * Parse the location from ProjectLocationServiceQuotaInfo resource. + * + * @param {string} projectLocationServiceQuotaInfoName + * A fully-qualified path representing project_location_service_quota_info resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationServiceQuotaInfoName( + projectLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match( + projectLocationServiceQuotaInfoName + ).location; + } + + /** + * Parse the service from ProjectLocationServiceQuotaInfo resource. + * + * @param {string} projectLocationServiceQuotaInfoName + * A fully-qualified path representing project_location_service_quota_info resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectLocationServiceQuotaInfoName( + projectLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match( + projectLocationServiceQuotaInfoName + ).service; + } + + /** + * Parse the quota_info from ProjectLocationServiceQuotaInfo resource. + * + * @param {string} projectLocationServiceQuotaInfoName + * A fully-qualified path representing project_location_service_quota_info resource. + * @returns {string} A string representing the quota_info. + */ + matchQuotaInfoFromProjectLocationServiceQuotaInfoName( + projectLocationServiceQuotaInfoName: string + ) { + return this.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match( + projectLocationServiceQuotaInfoName + ).quota_info; + } + + /** + * Return a fully-qualified quotaAdjusterSettings resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + quotaAdjusterSettingsPath(project: string, location: string) { + return this.pathTemplates.quotaAdjusterSettingsPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from QuotaAdjusterSettings resource. + * + * @param {string} quotaAdjusterSettingsName + * A fully-qualified path representing QuotaAdjusterSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromQuotaAdjusterSettingsName(quotaAdjusterSettingsName: string) { + return this.pathTemplates.quotaAdjusterSettingsPathTemplate.match( + quotaAdjusterSettingsName + ).project; + } + + /** + * Parse the location from QuotaAdjusterSettings resource. + * + * @param {string} quotaAdjusterSettingsName + * A fully-qualified path representing QuotaAdjusterSettings resource. + * @returns {string} A string representing the location. + */ + matchLocationFromQuotaAdjusterSettingsName( + quotaAdjusterSettingsName: string + ) { + return this.pathTemplates.quotaAdjusterSettingsPathTemplate.match( + quotaAdjusterSettingsName + ).location; + } + + /** + * 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.quotaAdjusterSettingsManagerStub && !this._terminated) { + return this.quotaAdjusterSettingsManagerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_client_config.json b/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_client_config.json new file mode 100644 index 00000000000..d5af40dd6e1 --- /dev/null +++ b/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_client_config.json @@ -0,0 +1,48 @@ +{ + "interfaces": { + "google.api.cloudquotas.v1beta.QuotaAdjusterSettingsManager": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "UpdateQuotaAdjusterSettings": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetQuotaAdjusterSettings": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_proto_list.json b/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_proto_list.json new file mode 100644 index 00000000000..4e9ed56c3da --- /dev/null +++ b/packages/google-api-cloudquotas/src/v1beta/quota_adjuster_settings_manager_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/api/cloudquotas/v1beta/cloudquotas.proto", + "../../protos/google/api/cloudquotas/v1beta/quota_adjuster_settings.proto", + "../../protos/google/api/cloudquotas/v1beta/resources.proto" +] diff --git a/packages/google-api-cloudquotas/test/gapic_cloud_quotas_v1beta.ts b/packages/google-api-cloudquotas/test/gapic_cloud_quotas_v1beta.ts new file mode 100644 index 00000000000..6912de5b437 --- /dev/null +++ b/packages/google-api-cloudquotas/test/gapic_cloud_quotas_v1beta.ts @@ -0,0 +1,2269 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as cloudquotasModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} 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 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('v1beta.CloudQuotasClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'cloudquotas.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient(); + 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 = + cloudquotasModule.v1beta.CloudQuotasClient.servicePath; + assert.strictEqual(servicePath, 'cloudquotas.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + cloudquotasModule.v1beta.CloudQuotasClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'cloudquotas.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudquotas.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudquotas.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 cloudquotasModule.v1beta.CloudQuotasClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudquotas.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 cloudquotasModule.v1beta.CloudQuotasClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudquotas.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 cloudquotasModule.v1beta.CloudQuotasClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = cloudquotasModule.v1beta.CloudQuotasClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudQuotasStub, undefined); + await client.initialize(); + assert(client.cloudQuotasStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudQuotasStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudQuotasStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + 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 cloudquotasModule.v1beta.CloudQuotasClient({ + 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('getQuotaInfo', () => { + it('invokes getQuotaInfo without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaInfoRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ); + client.innerApiCalls.getQuotaInfo = stubSimpleCall(expectedResponse); + const [response] = await client.getQuotaInfo(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getQuotaInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaInfo without error using callback', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaInfoRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ); + client.innerApiCalls.getQuotaInfo = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getQuotaInfo( + request, + ( + err?: Error | null, + result?: protos.google.api.cloudquotas.v1beta.IQuotaInfo | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getQuotaInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaInfo with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaInfoRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getQuotaInfo = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getQuotaInfo(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getQuotaInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaInfo with closed client', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaInfoRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getQuotaInfo(request), expectedError); + }); + }); + + describe('getQuotaPreference', () => { + it('invokes getQuotaPreference without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ); + client.innerApiCalls.getQuotaPreference = + stubSimpleCall(expectedResponse); + const [response] = await client.getQuotaPreference(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaPreference without error using callback', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ); + client.innerApiCalls.getQuotaPreference = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getQuotaPreference( + request, + ( + err?: Error | null, + result?: protos.google.api.cloudquotas.v1beta.IQuotaPreference | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaPreference with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getQuotaPreference = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getQuotaPreference(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaPreference with closed client', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaPreferenceRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getQuotaPreference(request), expectedError); + }); + }); + + describe('createQuotaPreference', () => { + it('invokes createQuotaPreference without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ); + client.innerApiCalls.createQuotaPreference = + stubSimpleCall(expectedResponse); + const [response] = await client.createQuotaPreference(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createQuotaPreference without error using callback', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ); + client.innerApiCalls.createQuotaPreference = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createQuotaPreference( + request, + ( + err?: Error | null, + result?: protos.google.api.cloudquotas.v1beta.IQuotaPreference | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createQuotaPreference with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createQuotaPreference = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createQuotaPreference(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createQuotaPreference with closed client', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.CreateQuotaPreferenceRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.createQuotaPreference(request), + expectedError + ); + }); + }); + + describe('updateQuotaPreference', () => { + it('invokes updateQuotaPreference without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest() + ); + request.quotaPreference ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest', + ['quotaPreference', 'name'] + ); + request.quotaPreference.name = defaultValue1; + const expectedHeaderRequestParams = `quota_preference.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ); + client.innerApiCalls.updateQuotaPreference = + stubSimpleCall(expectedResponse); + const [response] = await client.updateQuotaPreference(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateQuotaPreference without error using callback', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest() + ); + request.quotaPreference ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest', + ['quotaPreference', 'name'] + ); + request.quotaPreference.name = defaultValue1; + const expectedHeaderRequestParams = `quota_preference.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ); + client.innerApiCalls.updateQuotaPreference = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateQuotaPreference( + request, + ( + err?: Error | null, + result?: protos.google.api.cloudquotas.v1beta.IQuotaPreference | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateQuotaPreference with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest() + ); + request.quotaPreference ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest', + ['quotaPreference', 'name'] + ); + request.quotaPreference.name = defaultValue1; + const expectedHeaderRequestParams = `quota_preference.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateQuotaPreference = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateQuotaPreference(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateQuotaPreference as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateQuotaPreference as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateQuotaPreference with closed client', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest() + ); + request.quotaPreference ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.UpdateQuotaPreferenceRequest', + ['quotaPreference', 'name'] + ); + request.quotaPreference.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateQuotaPreference(request), + expectedError + ); + }); + }); + + describe('listQuotaInfos', () => { + it('invokes listQuotaInfos without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaInfosRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaInfosRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + ]; + client.innerApiCalls.listQuotaInfos = stubSimpleCall(expectedResponse); + const [response] = await client.listQuotaInfos(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listQuotaInfos as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQuotaInfos as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQuotaInfos without error using callback', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaInfosRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaInfosRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + ]; + client.innerApiCalls.listQuotaInfos = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listQuotaInfos( + request, + ( + err?: Error | null, + result?: protos.google.api.cloudquotas.v1beta.IQuotaInfo[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listQuotaInfos as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQuotaInfos as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQuotaInfos with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaInfosRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaInfosRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listQuotaInfos = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listQuotaInfos(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listQuotaInfos as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQuotaInfos as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQuotaInfosStream without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaInfosRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaInfosRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + ]; + client.descriptors.page.listQuotaInfos.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listQuotaInfosStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.cloudquotas.v1beta.QuotaInfo[] = []; + stream.on( + 'data', + (response: protos.google.api.cloudquotas.v1beta.QuotaInfo) => { + 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.listQuotaInfos.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listQuotaInfos, request) + ); + assert( + (client.descriptors.page.listQuotaInfos.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('invokes listQuotaInfosStream with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaInfosRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaInfosRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listQuotaInfos.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listQuotaInfosStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.cloudquotas.v1beta.QuotaInfo[] = []; + stream.on( + 'data', + (response: protos.google.api.cloudquotas.v1beta.QuotaInfo) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listQuotaInfos.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listQuotaInfos, request) + ); + assert( + (client.descriptors.page.listQuotaInfos.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('uses async iteration with listQuotaInfos without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaInfosRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaInfosRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaInfo() + ), + ]; + client.descriptors.page.listQuotaInfos.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.cloudquotas.v1beta.IQuotaInfo[] = []; + const iterable = client.listQuotaInfosAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listQuotaInfos.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listQuotaInfos.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('uses async iteration with listQuotaInfos with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaInfosRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaInfosRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listQuotaInfos.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listQuotaInfosAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.cloudquotas.v1beta.IQuotaInfo[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listQuotaInfos.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listQuotaInfos.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + }); + + describe('listQuotaPreferences', () => { + it('invokes listQuotaPreferences without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + ]; + client.innerApiCalls.listQuotaPreferences = + stubSimpleCall(expectedResponse); + const [response] = await client.listQuotaPreferences(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listQuotaPreferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQuotaPreferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQuotaPreferences without error using callback', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + ]; + client.innerApiCalls.listQuotaPreferences = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listQuotaPreferences( + request, + ( + err?: Error | null, + result?: + | protos.google.api.cloudquotas.v1beta.IQuotaPreference[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listQuotaPreferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQuotaPreferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQuotaPreferences with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listQuotaPreferences = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listQuotaPreferences(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listQuotaPreferences as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listQuotaPreferences as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listQuotaPreferencesStream without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + ]; + client.descriptors.page.listQuotaPreferences.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listQuotaPreferencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.cloudquotas.v1beta.QuotaPreference[] = + []; + stream.on( + 'data', + (response: protos.google.api.cloudquotas.v1beta.QuotaPreference) => { + 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.listQuotaPreferences.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listQuotaPreferences, request) + ); + assert( + (client.descriptors.page.listQuotaPreferences.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('invokes listQuotaPreferencesStream with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listQuotaPreferences.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listQuotaPreferencesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.cloudquotas.v1beta.QuotaPreference[] = + []; + stream.on( + 'data', + (response: protos.google.api.cloudquotas.v1beta.QuotaPreference) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listQuotaPreferences.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listQuotaPreferences, request) + ); + assert( + (client.descriptors.page.listQuotaPreferences.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('uses async iteration with listQuotaPreferences without error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaPreference() + ), + ]; + client.descriptors.page.listQuotaPreferences.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.cloudquotas.v1beta.IQuotaPreference[] = + []; + const iterable = client.listQuotaPreferencesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listQuotaPreferences.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listQuotaPreferences.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + + it('uses async iteration with listQuotaPreferences with error', async () => { + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.ListQuotaPreferencesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listQuotaPreferences.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listQuotaPreferencesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.cloudquotas.v1beta.IQuotaPreference[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listQuotaPreferences.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listQuotaPreferences.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams) + ); + }); + }); + + describe('Path templates', () => { + describe('folderLocationQuotaPreference', () => { + const fakePath = '/rendered/path/folderLocationQuotaPreference'; + const expectedParameters = { + folder: 'folderValue', + location: 'locationValue', + quota_preference: 'quotaPreferenceValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationQuotaPreferencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationQuotaPreferencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationQuotaPreferencePath', () => { + const result = client.folderLocationQuotaPreferencePath( + 'folderValue', + 'locationValue', + 'quotaPreferenceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderLocationQuotaPreferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderLocationQuotaPreferenceName', () => { + const result = + client.matchFolderFromFolderLocationQuotaPreferenceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFolderLocationQuotaPreferenceName', () => { + const result = + client.matchLocationFromFolderLocationQuotaPreferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.folderLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaPreferenceFromFolderLocationQuotaPreferenceName', () => { + const result = + client.matchQuotaPreferenceFromFolderLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'quotaPreferenceValue'); + assert( + ( + client.pathTemplates.folderLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderLocationServiceQuotaInfo', () => { + const fakePath = '/rendered/path/folderLocationServiceQuotaInfo'; + const expectedParameters = { + folder: 'folderValue', + location: 'locationValue', + service: 'serviceValue', + quota_info: 'quotaInfoValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationServiceQuotaInfoPath', () => { + const result = client.folderLocationServiceQuotaInfoPath( + 'folderValue', + 'locationValue', + 'serviceValue', + 'quotaInfoValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderLocationServiceQuotaInfoName', () => { + const result = + client.matchFolderFromFolderLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFolderLocationServiceQuotaInfoName', () => { + const result = + client.matchLocationFromFolderLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderLocationServiceQuotaInfoName', () => { + const result = + client.matchServiceFromFolderLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaInfoFromFolderLocationServiceQuotaInfoName', () => { + const result = + client.matchQuotaInfoFromFolderLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'quotaInfoValue'); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationLocationQuotaPreference', () => { + const fakePath = '/rendered/path/organizationLocationQuotaPreference'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + quota_preference: 'quotaPreferenceValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationQuotaPreferencePath', () => { + const result = client.organizationLocationQuotaPreferencePath( + 'organizationValue', + 'locationValue', + 'quotaPreferenceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationLocationQuotaPreferenceName', () => { + const result = + client.matchOrganizationFromOrganizationLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromOrganizationLocationQuotaPreferenceName', () => { + const result = + client.matchLocationFromOrganizationLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaPreferenceFromOrganizationLocationQuotaPreferenceName', () => { + const result = + client.matchQuotaPreferenceFromOrganizationLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'quotaPreferenceValue'); + assert( + ( + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationLocationServiceQuotaInfo', () => { + const fakePath = '/rendered/path/organizationLocationServiceQuotaInfo'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + service: 'serviceValue', + quota_info: 'quotaInfoValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationServiceQuotaInfoPath', () => { + const result = client.organizationLocationServiceQuotaInfoPath( + 'organizationValue', + 'locationValue', + 'serviceValue', + 'quotaInfoValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationLocationServiceQuotaInfoName', () => { + const result = + client.matchOrganizationFromOrganizationLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromOrganizationLocationServiceQuotaInfoName', () => { + const result = + client.matchLocationFromOrganizationLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationLocationServiceQuotaInfoName', () => { + const result = + client.matchServiceFromOrganizationLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaInfoFromOrganizationLocationServiceQuotaInfoName', () => { + const result = + client.matchQuotaInfoFromOrganizationLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'quotaInfoValue'); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationQuotaPreference', () => { + const fakePath = '/rendered/path/projectLocationQuotaPreference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + quota_preference: 'quotaPreferenceValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationQuotaPreferencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationQuotaPreferencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationQuotaPreferencePath', () => { + const result = client.projectLocationQuotaPreferencePath( + 'projectValue', + 'locationValue', + 'quotaPreferenceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationQuotaPreferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationQuotaPreferenceName', () => { + const result = + client.matchProjectFromProjectLocationQuotaPreferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationQuotaPreferenceName', () => { + const result = + client.matchLocationFromProjectLocationQuotaPreferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaPreferenceFromProjectLocationQuotaPreferenceName', () => { + const result = + client.matchQuotaPreferenceFromProjectLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'quotaPreferenceValue'); + assert( + ( + client.pathTemplates.projectLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationService', () => { + const fakePath = '/rendered/path/projectLocationService'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + service: 'serviceValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationServicePath', () => { + const result = client.projectLocationServicePath( + 'projectValue', + 'locationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationServiceName', () => { + const result = + client.matchProjectFromProjectLocationServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationServiceName', () => { + const result = + client.matchLocationFromProjectLocationServiceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectLocationServiceName', () => { + const result = + client.matchServiceFromProjectLocationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectLocationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationServiceQuotaInfo', () => { + const fakePath = '/rendered/path/projectLocationServiceQuotaInfo'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + service: 'serviceValue', + quota_info: 'quotaInfoValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationServiceQuotaInfoPath', () => { + const result = client.projectLocationServiceQuotaInfoPath( + 'projectValue', + 'locationValue', + 'serviceValue', + 'quotaInfoValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationServiceQuotaInfoName', () => { + const result = + client.matchProjectFromProjectLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationServiceQuotaInfoName', () => { + const result = + client.matchLocationFromProjectLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectLocationServiceQuotaInfoName', () => { + const result = + client.matchServiceFromProjectLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaInfoFromProjectLocationServiceQuotaInfoName', () => { + const result = + client.matchQuotaInfoFromProjectLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'quotaInfoValue'); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('quotaAdjusterSettings', () => { + const fakePath = '/rendered/path/quotaAdjusterSettings'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new cloudquotasModule.v1beta.CloudQuotasClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.quotaAdjusterSettingsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.quotaAdjusterSettingsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('quotaAdjusterSettingsPath', () => { + const result = client.quotaAdjusterSettingsPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.quotaAdjusterSettingsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromQuotaAdjusterSettingsName', () => { + const result = + client.matchProjectFromQuotaAdjusterSettingsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.quotaAdjusterSettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromQuotaAdjusterSettingsName', () => { + const result = + client.matchLocationFromQuotaAdjusterSettingsName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.quotaAdjusterSettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-api-cloudquotas/test/gapic_quota_adjuster_settings_manager_v1beta.ts b/packages/google-api-cloudquotas/test/gapic_quota_adjuster_settings_manager_v1beta.ts new file mode 100644 index 00000000000..e5400fd8974 --- /dev/null +++ b/packages/google-api-cloudquotas/test/gapic_quota_adjuster_settings_manager_v1beta.ts @@ -0,0 +1,1195 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as quotaadjustersettingsmanagerModule from '../src'; + +import {protobuf} 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); +} + +describe('v1beta.QuotaAdjusterSettingsManagerClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'cloudquotas.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient(); + 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 = + quotaadjustersettingsmanagerModule.v1beta + .QuotaAdjusterSettingsManagerClient.servicePath; + assert.strictEqual(servicePath, 'cloudquotas.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + quotaadjustersettingsmanagerModule.v1beta + .QuotaAdjusterSettingsManagerClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'cloudquotas.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudquotas.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudquotas.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 quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudquotas.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 quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + {universeDomain: 'configured.example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudquotas.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 quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); + }); + + it('has port', () => { + const port = + quotaadjustersettingsmanagerModule.v1beta + .QuotaAdjusterSettingsManagerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + fallback: true, + } + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.quotaAdjusterSettingsManagerStub, undefined); + await client.initialize(); + assert(client.quotaAdjusterSettingsManagerStub); + }); + + it('has close method for the initialized client', done => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + assert(client.quotaAdjusterSettingsManagerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.quotaAdjusterSettingsManagerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + 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 quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + 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('updateQuotaAdjusterSettings', () => { + it('invokes updateQuotaAdjusterSettings without error', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest() + ); + request.quotaAdjusterSettings ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest', + ['quotaAdjusterSettings', 'name'] + ); + request.quotaAdjusterSettings.name = defaultValue1; + const expectedHeaderRequestParams = `quota_adjuster_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaAdjusterSettings() + ); + client.innerApiCalls.updateQuotaAdjusterSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.updateQuotaAdjusterSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateQuotaAdjusterSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateQuotaAdjusterSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateQuotaAdjusterSettings without error using callback', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest() + ); + request.quotaAdjusterSettings ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest', + ['quotaAdjusterSettings', 'name'] + ); + request.quotaAdjusterSettings.name = defaultValue1; + const expectedHeaderRequestParams = `quota_adjuster_settings.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaAdjusterSettings() + ); + client.innerApiCalls.updateQuotaAdjusterSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateQuotaAdjusterSettings( + request, + ( + err?: Error | null, + result?: protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateQuotaAdjusterSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateQuotaAdjusterSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateQuotaAdjusterSettings with error', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest() + ); + request.quotaAdjusterSettings ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest', + ['quotaAdjusterSettings', 'name'] + ); + request.quotaAdjusterSettings.name = defaultValue1; + const expectedHeaderRequestParams = `quota_adjuster_settings.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateQuotaAdjusterSettings = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateQuotaAdjusterSettings(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateQuotaAdjusterSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateQuotaAdjusterSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateQuotaAdjusterSettings with closed client', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest() + ); + request.quotaAdjusterSettings ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.UpdateQuotaAdjusterSettingsRequest', + ['quotaAdjusterSettings', 'name'] + ); + request.quotaAdjusterSettings.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateQuotaAdjusterSettings(request), + expectedError + ); + }); + }); + + describe('getQuotaAdjusterSettings', () => { + it('invokes getQuotaAdjusterSettings without error', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaAdjusterSettings() + ); + client.innerApiCalls.getQuotaAdjusterSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.getQuotaAdjusterSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getQuotaAdjusterSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaAdjusterSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaAdjusterSettings without error using callback', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.QuotaAdjusterSettings() + ); + client.innerApiCalls.getQuotaAdjusterSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getQuotaAdjusterSettings( + request, + ( + err?: Error | null, + result?: protos.google.api.cloudquotas.v1beta.IQuotaAdjusterSettings | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getQuotaAdjusterSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaAdjusterSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaAdjusterSettings with error', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getQuotaAdjusterSettings = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getQuotaAdjusterSettings(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getQuotaAdjusterSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getQuotaAdjusterSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getQuotaAdjusterSettings with closed client', async () => { + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.api.cloudquotas.v1beta.GetQuotaAdjusterSettingsRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getQuotaAdjusterSettings(request), + expectedError + ); + }); + }); + + describe('Path templates', () => { + describe('folderLocationQuotaPreference', () => { + const fakePath = '/rendered/path/folderLocationQuotaPreference'; + const expectedParameters = { + folder: 'folderValue', + location: 'locationValue', + quota_preference: 'quotaPreferenceValue', + }; + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderLocationQuotaPreferencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationQuotaPreferencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationQuotaPreferencePath', () => { + const result = client.folderLocationQuotaPreferencePath( + 'folderValue', + 'locationValue', + 'quotaPreferenceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderLocationQuotaPreferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderLocationQuotaPreferenceName', () => { + const result = + client.matchFolderFromFolderLocationQuotaPreferenceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFolderLocationQuotaPreferenceName', () => { + const result = + client.matchLocationFromFolderLocationQuotaPreferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.folderLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaPreferenceFromFolderLocationQuotaPreferenceName', () => { + const result = + client.matchQuotaPreferenceFromFolderLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'quotaPreferenceValue'); + assert( + ( + client.pathTemplates.folderLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderLocationServiceQuotaInfo', () => { + const fakePath = '/rendered/path/folderLocationServiceQuotaInfo'; + const expectedParameters = { + folder: 'folderValue', + location: 'locationValue', + service: 'serviceValue', + quota_info: 'quotaInfoValue', + }; + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderLocationServiceQuotaInfoPath', () => { + const result = client.folderLocationServiceQuotaInfoPath( + 'folderValue', + 'locationValue', + 'serviceValue', + 'quotaInfoValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderLocationServiceQuotaInfoName', () => { + const result = + client.matchFolderFromFolderLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromFolderLocationServiceQuotaInfoName', () => { + const result = + client.matchLocationFromFolderLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderLocationServiceQuotaInfoName', () => { + const result = + client.matchServiceFromFolderLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaInfoFromFolderLocationServiceQuotaInfoName', () => { + const result = + client.matchQuotaInfoFromFolderLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'quotaInfoValue'); + assert( + ( + client.pathTemplates.folderLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationLocationQuotaPreference', () => { + const fakePath = '/rendered/path/organizationLocationQuotaPreference'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + quota_preference: 'quotaPreferenceValue', + }; + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationQuotaPreferencePath', () => { + const result = client.organizationLocationQuotaPreferencePath( + 'organizationValue', + 'locationValue', + 'quotaPreferenceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationLocationQuotaPreferenceName', () => { + const result = + client.matchOrganizationFromOrganizationLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromOrganizationLocationQuotaPreferenceName', () => { + const result = + client.matchLocationFromOrganizationLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaPreferenceFromOrganizationLocationQuotaPreferenceName', () => { + const result = + client.matchQuotaPreferenceFromOrganizationLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'quotaPreferenceValue'); + assert( + ( + client.pathTemplates.organizationLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationLocationServiceQuotaInfo', () => { + const fakePath = '/rendered/path/organizationLocationServiceQuotaInfo'; + const expectedParameters = { + organization: 'organizationValue', + location: 'locationValue', + service: 'serviceValue', + quota_info: 'quotaInfoValue', + }; + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationLocationServiceQuotaInfoPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationLocationServiceQuotaInfoPath', () => { + const result = client.organizationLocationServiceQuotaInfoPath( + 'organizationValue', + 'locationValue', + 'serviceValue', + 'quotaInfoValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationLocationServiceQuotaInfoName', () => { + const result = + client.matchOrganizationFromOrganizationLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromOrganizationLocationServiceQuotaInfoName', () => { + const result = + client.matchLocationFromOrganizationLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationLocationServiceQuotaInfoName', () => { + const result = + client.matchServiceFromOrganizationLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaInfoFromOrganizationLocationServiceQuotaInfoName', () => { + const result = + client.matchQuotaInfoFromOrganizationLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'quotaInfoValue'); + assert( + ( + client.pathTemplates + .organizationLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationQuotaPreference', () => { + const fakePath = '/rendered/path/projectLocationQuotaPreference'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + quota_preference: 'quotaPreferenceValue', + }; + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationQuotaPreferencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationQuotaPreferencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationQuotaPreferencePath', () => { + const result = client.projectLocationQuotaPreferencePath( + 'projectValue', + 'locationValue', + 'quotaPreferenceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationQuotaPreferencePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationQuotaPreferenceName', () => { + const result = + client.matchProjectFromProjectLocationQuotaPreferenceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationQuotaPreferenceName', () => { + const result = + client.matchLocationFromProjectLocationQuotaPreferenceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaPreferenceFromProjectLocationQuotaPreferenceName', () => { + const result = + client.matchQuotaPreferenceFromProjectLocationQuotaPreferenceName( + fakePath + ); + assert.strictEqual(result, 'quotaPreferenceValue'); + assert( + ( + client.pathTemplates.projectLocationQuotaPreferencePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationServiceQuotaInfo', () => { + const fakePath = '/rendered/path/projectLocationServiceQuotaInfo'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + service: 'serviceValue', + quota_info: 'quotaInfoValue', + }; + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationServiceQuotaInfoPath', () => { + const result = client.projectLocationServiceQuotaInfoPath( + 'projectValue', + 'locationValue', + 'serviceValue', + 'quotaInfoValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationServiceQuotaInfoName', () => { + const result = + client.matchProjectFromProjectLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationServiceQuotaInfoName', () => { + const result = + client.matchLocationFromProjectLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectLocationServiceQuotaInfoName', () => { + const result = + client.matchServiceFromProjectLocationServiceQuotaInfoName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchQuotaInfoFromProjectLocationServiceQuotaInfoName', () => { + const result = + client.matchQuotaInfoFromProjectLocationServiceQuotaInfoName( + fakePath + ); + assert.strictEqual(result, 'quotaInfoValue'); + assert( + ( + client.pathTemplates.projectLocationServiceQuotaInfoPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('quotaAdjusterSettings', () => { + const fakePath = '/rendered/path/quotaAdjusterSettings'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new quotaadjustersettingsmanagerModule.v1beta.QuotaAdjusterSettingsManagerClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.quotaAdjusterSettingsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.quotaAdjusterSettingsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('quotaAdjusterSettingsPath', () => { + const result = client.quotaAdjusterSettingsPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.quotaAdjusterSettingsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromQuotaAdjusterSettingsName', () => { + const result = + client.matchProjectFromQuotaAdjusterSettingsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.quotaAdjusterSettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromQuotaAdjusterSettingsName', () => { + const result = + client.matchLocationFromQuotaAdjusterSettingsName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.quotaAdjusterSettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +});