diff --git a/packages/google-cloud-backupdr/.jsdoc.js b/packages/google-cloud-backupdr/.jsdoc.js index f6b96e7b70a..c694adb20c8 100644 --- a/packages/google-cloud-backupdr/.jsdoc.js +++ b/packages/google-cloud-backupdr/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2025 Google LLC', + copyright: 'Copyright 2026 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/backupdr', diff --git a/packages/google-cloud-backupdr/.mocharc.js b/packages/google-cloud-backupdr/.mocharc.js index 24e9d15257f..5eb34e86c87 100644 --- a/packages/google-cloud-backupdr/.mocharc.js +++ b/packages/google-cloud-backupdr/.mocharc.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/.prettierrc.js b/packages/google-cloud-backupdr/.prettierrc.js index d89a632f90b..7649ee3c254 100644 --- a/packages/google-cloud-backupdr/.prettierrc.js +++ b/packages/google-cloud-backupdr/.prettierrc.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/README.md b/packages/google-cloud-backupdr/README.md index 6284940c753..e6ee413b3b5 100644 --- a/packages/google-cloud-backupdr/README.md +++ b/packages/google-cloud-backupdr/README.md @@ -95,6 +95,7 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ | update backup plan association | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan_association.js) | | update backup vault | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_vault.js) | | update data source | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_data_source.js) | +| list resource backup configs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-backupdr/samples/generated/v1/backup_dr_protection_summary.list_resource_backup_configs.js) | | cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-backupdr/samples/generated/v1/snippet_metadata_google.cloud.backupdr.v1.json) | diff --git a/packages/google-cloud-backupdr/protos/google/cloud/backupdr/v1/protection_summary.proto b/packages/google-cloud-backupdr/protos/google/cloud/backupdr/v1/protection_summary.proto new file mode 100644 index 00000000000..7bf36153f34 --- /dev/null +++ b/packages/google-cloud-backupdr/protos/google/cloud/backupdr/v1/protection_summary.proto @@ -0,0 +1,322 @@ +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.backupdr.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/field_info.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.BackupDR.V1"; +option go_package = "cloud.google.com/go/backupdr/apiv1/backupdrpb;backupdrpb"; +option java_multiple_files = true; +option java_outer_classname = "ProtectionSummaryProto"; +option java_package = "com.google.cloud.backupdr.v1"; +option php_namespace = "Google\\Cloud\\BackupDR\\V1"; +option ruby_package = "Google::Cloud::BackupDR::V1"; + +// The Protection Summary service. +service BackupDrProtectionSummary { + option (google.api.default_host) = "backupdr.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists ResourceBackupConfigs. + rpc ListResourceBackupConfigs(ListResourceBackupConfigsRequest) + returns (ListResourceBackupConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/resourceBackupConfigs" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for ListResourceBackupConfigs. +message ListResourceBackupConfigsRequest { + // Required. The project and location for which to retrieve resource backup + // configs. Format: 'projects/{project_id}/locations/{location}'. In Google + // Cloud Backup and DR, locations map to Google Cloud regions, for example + // **us-central1**. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Requested page size. Server may return fewer items than + // requested. If unspecified, server will use 100 as default. Maximum value is + // 500 and values above 500 will be coerced to 500. + 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. Filtering results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Hint for how to order the results. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListResourceBackupConfigs. +message ListResourceBackupConfigsResponse { + // The list of ResourceBackupConfigs for the specified scope. + repeated ResourceBackupConfig resource_backup_configs = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; +} + +// ResourceBackupConfig represents a resource along with its backup +// configurations. +message ResourceBackupConfig { + option (google.api.resource) = { + type: "backupdr.googleapis.com/ResourceBackupConfig" + pattern: "projects/{project}/locations/{location}/resourceBackupConfigs/{resource_backup_config}" + plural: "resourceBackupConfigs" + singular: "resourceBackupConfig" + }; + + // The type of the cloud resource. + enum ResourceType { + // Resource type not set. + RESOURCE_TYPE_UNSPECIFIED = 0; + + // Cloud SQL instance. + CLOUD_SQL_INSTANCE = 1; + + // Compute Engine VM. + COMPUTE_ENGINE_VM = 2; + + // Compute Engine Disk. + COMPUTE_ENGINE_DISK = 3; + + // Compute Engine Regional Disk. + COMPUTE_ENGINE_REGIONAL_DISK = 4; + } + + // Identifier. The resource name of the ResourceBackupConfig. + // Format: + // projects/{project}/locations/{location}/resourceBackupConfigs/{uid} + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. The unique identifier of the resource backup config. + string uid = 2 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. The [full resource + // name](https://cloud.google.com/asset-inventory/docs/resource-name-format) + // of the cloud resource that this configuration applies to. Supported + // resource types are + // [ResourceBackupConfig.ResourceType][google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType]. + string target_resource = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The human friendly name of the target resource. + string target_resource_display_name = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the target resource. + ResourceType target_resource_type = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels associated with the target resource. + map target_resource_labels = 6; + + // Backup configurations applying to the target resource, including those + // targeting its related/child resources. For example, backup configuration + // applicable to Compute Engine disks will be populated in this field for a + // Compute Engine VM which has the disk associated. + repeated BackupConfigDetails backup_configs_details = 7; + + // Output only. Whether the target resource is configured for backup. This is + // true if the backup_configs_details is not empty. + bool backup_configured = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the target resource is protected by a backup vault. + // This is true if the backup_configs_details is not empty and any of the + // [ResourceBackupConfig.backup_configs_details][google.cloud.backupdr.v1.ResourceBackupConfig.backup_configs_details] + // has a backup configuration with + // [BackupConfigDetails.backup_vault][google.cloud.backupdr.v1.BackupConfigDetails.backup_vault] + // set. set. + bool vaulted = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// BackupConfigDetails has information about how the resource is configured +// for backups and about the most recent backup taken for this configuration. +message BackupConfigDetails { + // Type of the backup configuration. + // This enum may receive new values in the future. + enum Type { + // Backup config type is unspecified. + TYPE_UNSPECIFIED = 0; + + // Backup config is Cloud SQL instance's automated backup config. + CLOUD_SQL_INSTANCE_BACKUP_CONFIG = 1; + + // Backup config is Compute Engine Resource Policy. + COMPUTE_ENGINE_RESOURCE_POLICY = 2; + + // Backup config is Google Cloud Backup and DR's Backup Plan. + BACKUPDR_BACKUP_PLAN = 3; + + // Backup config is Google Cloud Backup and DR's Template. + BACKUPDR_TEMPLATE = 4; + } + + // The state tells whether the backup config is active or not. + enum State { + // Backup config state not set. + STATE_UNSPECIFIED = 0; + + // The config is in an active state protecting the resource + ACTIVE = 1; + + // The config is currently not protecting the resource. Either because it is + // disabled or the owning project has been deleted without cleanup of the + // actual resource. + INACTIVE = 2; + + // The config still exists but because of some error state it is not + // protecting the resource. Like the source project is deleted. For eg. + // PlanAssociation, BackupPlan is deleted. + ERROR = 3; + } + + // Output only. The full resource name of the backup config source resource. + // For example, + // "//backupdr.googleapis.com/v1/projects/{project}/locations/{region}/backupPlans/{backupplanId}" + // or + // "//compute.googleapis.com/projects/{project}/locations/{region}/resourcePolicies/{resourcePolicyId}". + string backup_config_source = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The display name of the backup config source resource. + string backup_config_source_display_name = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of the backup config resource. + Type type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of the backup config resource. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Point in time recovery settings of the backup configuration + // resource. + PitrSettings pitr_settings = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp of the latest successful backup created via this + // backup configuration. + google.protobuf.Timestamp latest_successful_backup_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The [full resource + // name](https://cloud.google.com/asset-inventory/docs/resource-name-format) + // of the resource that is applicable for the backup configuration. Example: + // "//compute.googleapis.com/projects/{project}/zones/{zone}/instances/{instance}" + string applicable_resource = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The [full resource + // name](https://cloud.google.com/asset-inventory/docs/resource-name-format) + // of the backup vault that will store the backups generated through this + // backup configuration. Example: + // "//backupdr.googleapis.com/v1/projects/{project}/locations/{region}/backupVaults/{backupvaultId}" + string backup_vault = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The locations where the backups are to be stored. + repeated BackupLocation backup_locations = 12; + + // The plan specific config. This depends on the value of + // [BackupConfigDetails.type][google.cloud.backupdr.v1.BackupConfigDetails.type]. + // For type=BACKUPDR_BACKUP_PLAN, backup_dr_plan_config would be populated to + // capture information related to Google Cloud Backup and DR's Backup Plans. + // For type=BACKUPDR_TEMPLATE, backup_dr_template_config would be populated to + // capture information related to Google Cloud Backup and DR's Template + // details. + oneof plan_specific_config { + // Google Cloud Backup and DR's Backup Plan specific data. + BackupDrPlanConfig backup_dr_plan_config = 10; + + // Google Cloud Backup and DR's Template specific data. + BackupDrTemplateConfig backup_dr_template_config = 11; + } +} + +// Point in time recovery settings of the backup configuration resource. +message PitrSettings { + // Output only. Number of days to retain the backup. + int32 retention_days = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Provides additional information about Google Cloud Backup +// and DR's Template backup configuration. +message BackupDrTemplateConfig { + // Output only. The URI of the BackupDr template resource for the first party + // identity users. + string first_party_management_uri = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The URI of the BackupDr template resource for the third party + // identity users. + string third_party_management_uri = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// BackupDrPlanConfig has additional information about Google Cloud Backup and +// DR's Plan backup configuration. +message BackupDrPlanConfig { + // Backup rules of the backup plan resource. + repeated BackupDrPlanRule backup_dr_plan_rules = 1; +} + +// BackupDrPlanRule has rule specific information of the backup plan resource. +message BackupDrPlanRule { + // Output only. Unique Id of the backup rule. + string rule_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Timestamp of the latest successful backup created via this + // backup rule. + google.protobuf.Timestamp last_successful_backup_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// BackupLocation represents a cloud location where a backup can be stored. +message BackupLocation { + // The type of the location. + enum Type { + // Location type is unspecified. + TYPE_UNSPECIFIED = 0; + + // Location type is zonal. + ZONAL = 1; + + // Location type is regional. + REGIONAL = 2; + + // Location type is multi regional. + MULTI_REGIONAL = 3; + } + + // Output only. The type of the location. + Type type = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The id of the cloud location. Example: "us-central1" + string location_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/packages/google-cloud-backupdr/protos/protos.d.ts b/packages/google-cloud-backupdr/protos/protos.d.ts index 1795a47a51d..30f0900de60 100644 --- a/packages/google-cloud-backupdr/protos/protos.d.ts +++ b/packages/google-cloud-backupdr/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15573,6 +15573,1126 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Represents a BackupDrProtectionSummary */ + class BackupDrProtectionSummary extends $protobuf.rpc.Service { + + /** + * Constructs a new BackupDrProtectionSummary 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 BackupDrProtectionSummary 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): BackupDrProtectionSummary; + + /** + * Calls ListResourceBackupConfigs. + * @param request ListResourceBackupConfigsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListResourceBackupConfigsResponse + */ + public listResourceBackupConfigs(request: google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, callback: google.cloud.backupdr.v1.BackupDrProtectionSummary.ListResourceBackupConfigsCallback): void; + + /** + * Calls ListResourceBackupConfigs. + * @param request ListResourceBackupConfigsRequest message or plain object + * @returns Promise + */ + public listResourceBackupConfigs(request: google.cloud.backupdr.v1.IListResourceBackupConfigsRequest): Promise; + } + + namespace BackupDrProtectionSummary { + + /** + * Callback as used by {@link google.cloud.backupdr.v1.BackupDrProtectionSummary|listResourceBackupConfigs}. + * @param error Error, if any + * @param [response] ListResourceBackupConfigsResponse + */ + type ListResourceBackupConfigsCallback = (error: (Error|null), response?: google.cloud.backupdr.v1.ListResourceBackupConfigsResponse) => void; + } + + /** Properties of a ListResourceBackupConfigsRequest. */ + interface IListResourceBackupConfigsRequest { + + /** ListResourceBackupConfigsRequest parent */ + parent?: (string|null); + + /** ListResourceBackupConfigsRequest pageSize */ + pageSize?: (number|null); + + /** ListResourceBackupConfigsRequest pageToken */ + pageToken?: (string|null); + + /** ListResourceBackupConfigsRequest filter */ + filter?: (string|null); + + /** ListResourceBackupConfigsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListResourceBackupConfigsRequest. */ + class ListResourceBackupConfigsRequest implements IListResourceBackupConfigsRequest { + + /** + * Constructs a new ListResourceBackupConfigsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IListResourceBackupConfigsRequest); + + /** ListResourceBackupConfigsRequest parent. */ + public parent: string; + + /** ListResourceBackupConfigsRequest pageSize. */ + public pageSize: number; + + /** ListResourceBackupConfigsRequest pageToken. */ + public pageToken: string; + + /** ListResourceBackupConfigsRequest filter. */ + public filter: string; + + /** ListResourceBackupConfigsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListResourceBackupConfigsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListResourceBackupConfigsRequest instance + */ + public static create(properties?: google.cloud.backupdr.v1.IListResourceBackupConfigsRequest): google.cloud.backupdr.v1.ListResourceBackupConfigsRequest; + + /** + * Encodes the specified ListResourceBackupConfigsRequest message. Does not implicitly {@link google.cloud.backupdr.v1.ListResourceBackupConfigsRequest.verify|verify} messages. + * @param message ListResourceBackupConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListResourceBackupConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.ListResourceBackupConfigsRequest.verify|verify} messages. + * @param message ListResourceBackupConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListResourceBackupConfigsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListResourceBackupConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.ListResourceBackupConfigsRequest; + + /** + * Decodes a ListResourceBackupConfigsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListResourceBackupConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.ListResourceBackupConfigsRequest; + + /** + * Verifies a ListResourceBackupConfigsRequest 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 ListResourceBackupConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListResourceBackupConfigsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.ListResourceBackupConfigsRequest; + + /** + * Creates a plain object from a ListResourceBackupConfigsRequest message. Also converts values to other types if specified. + * @param message ListResourceBackupConfigsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.ListResourceBackupConfigsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListResourceBackupConfigsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListResourceBackupConfigsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListResourceBackupConfigsResponse. */ + interface IListResourceBackupConfigsResponse { + + /** ListResourceBackupConfigsResponse resourceBackupConfigs */ + resourceBackupConfigs?: (google.cloud.backupdr.v1.IResourceBackupConfig[]|null); + + /** ListResourceBackupConfigsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListResourceBackupConfigsResponse. */ + class ListResourceBackupConfigsResponse implements IListResourceBackupConfigsResponse { + + /** + * Constructs a new ListResourceBackupConfigsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IListResourceBackupConfigsResponse); + + /** ListResourceBackupConfigsResponse resourceBackupConfigs. */ + public resourceBackupConfigs: google.cloud.backupdr.v1.IResourceBackupConfig[]; + + /** ListResourceBackupConfigsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListResourceBackupConfigsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListResourceBackupConfigsResponse instance + */ + public static create(properties?: google.cloud.backupdr.v1.IListResourceBackupConfigsResponse): google.cloud.backupdr.v1.ListResourceBackupConfigsResponse; + + /** + * Encodes the specified ListResourceBackupConfigsResponse message. Does not implicitly {@link google.cloud.backupdr.v1.ListResourceBackupConfigsResponse.verify|verify} messages. + * @param message ListResourceBackupConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IListResourceBackupConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListResourceBackupConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.ListResourceBackupConfigsResponse.verify|verify} messages. + * @param message ListResourceBackupConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IListResourceBackupConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListResourceBackupConfigsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListResourceBackupConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.ListResourceBackupConfigsResponse; + + /** + * Decodes a ListResourceBackupConfigsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListResourceBackupConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.ListResourceBackupConfigsResponse; + + /** + * Verifies a ListResourceBackupConfigsResponse 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 ListResourceBackupConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListResourceBackupConfigsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.ListResourceBackupConfigsResponse; + + /** + * Creates a plain object from a ListResourceBackupConfigsResponse message. Also converts values to other types if specified. + * @param message ListResourceBackupConfigsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.ListResourceBackupConfigsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListResourceBackupConfigsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListResourceBackupConfigsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ResourceBackupConfig. */ + interface IResourceBackupConfig { + + /** ResourceBackupConfig name */ + name?: (string|null); + + /** ResourceBackupConfig uid */ + uid?: (string|null); + + /** ResourceBackupConfig targetResource */ + targetResource?: (string|null); + + /** ResourceBackupConfig targetResourceDisplayName */ + targetResourceDisplayName?: (string|null); + + /** ResourceBackupConfig targetResourceType */ + targetResourceType?: (google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType|keyof typeof google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType|null); + + /** ResourceBackupConfig targetResourceLabels */ + targetResourceLabels?: ({ [k: string]: string }|null); + + /** ResourceBackupConfig backupConfigsDetails */ + backupConfigsDetails?: (google.cloud.backupdr.v1.IBackupConfigDetails[]|null); + + /** ResourceBackupConfig backupConfigured */ + backupConfigured?: (boolean|null); + + /** ResourceBackupConfig vaulted */ + vaulted?: (boolean|null); + } + + /** Represents a ResourceBackupConfig. */ + class ResourceBackupConfig implements IResourceBackupConfig { + + /** + * Constructs a new ResourceBackupConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IResourceBackupConfig); + + /** ResourceBackupConfig name. */ + public name: string; + + /** ResourceBackupConfig uid. */ + public uid: string; + + /** ResourceBackupConfig targetResource. */ + public targetResource: string; + + /** ResourceBackupConfig targetResourceDisplayName. */ + public targetResourceDisplayName: string; + + /** ResourceBackupConfig targetResourceType. */ + public targetResourceType: (google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType|keyof typeof google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType); + + /** ResourceBackupConfig targetResourceLabels. */ + public targetResourceLabels: { [k: string]: string }; + + /** ResourceBackupConfig backupConfigsDetails. */ + public backupConfigsDetails: google.cloud.backupdr.v1.IBackupConfigDetails[]; + + /** ResourceBackupConfig backupConfigured. */ + public backupConfigured: boolean; + + /** ResourceBackupConfig vaulted. */ + public vaulted: boolean; + + /** + * Creates a new ResourceBackupConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceBackupConfig instance + */ + public static create(properties?: google.cloud.backupdr.v1.IResourceBackupConfig): google.cloud.backupdr.v1.ResourceBackupConfig; + + /** + * Encodes the specified ResourceBackupConfig message. Does not implicitly {@link google.cloud.backupdr.v1.ResourceBackupConfig.verify|verify} messages. + * @param message ResourceBackupConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IResourceBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceBackupConfig message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.ResourceBackupConfig.verify|verify} messages. + * @param message ResourceBackupConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IResourceBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceBackupConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.ResourceBackupConfig; + + /** + * Decodes a ResourceBackupConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.ResourceBackupConfig; + + /** + * Verifies a ResourceBackupConfig 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 ResourceBackupConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceBackupConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.ResourceBackupConfig; + + /** + * Creates a plain object from a ResourceBackupConfig message. Also converts values to other types if specified. + * @param message ResourceBackupConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.ResourceBackupConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceBackupConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceBackupConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ResourceBackupConfig { + + /** ResourceType enum. */ + enum ResourceType { + RESOURCE_TYPE_UNSPECIFIED = 0, + CLOUD_SQL_INSTANCE = 1, + COMPUTE_ENGINE_VM = 2, + COMPUTE_ENGINE_DISK = 3, + COMPUTE_ENGINE_REGIONAL_DISK = 4 + } + } + + /** Properties of a BackupConfigDetails. */ + interface IBackupConfigDetails { + + /** BackupConfigDetails backupConfigSource */ + backupConfigSource?: (string|null); + + /** BackupConfigDetails backupConfigSourceDisplayName */ + backupConfigSourceDisplayName?: (string|null); + + /** BackupConfigDetails type */ + type?: (google.cloud.backupdr.v1.BackupConfigDetails.Type|keyof typeof google.cloud.backupdr.v1.BackupConfigDetails.Type|null); + + /** BackupConfigDetails state */ + state?: (google.cloud.backupdr.v1.BackupConfigDetails.State|keyof typeof google.cloud.backupdr.v1.BackupConfigDetails.State|null); + + /** BackupConfigDetails pitrSettings */ + pitrSettings?: (google.cloud.backupdr.v1.IPitrSettings|null); + + /** BackupConfigDetails latestSuccessfulBackupTime */ + latestSuccessfulBackupTime?: (google.protobuf.ITimestamp|null); + + /** BackupConfigDetails applicableResource */ + applicableResource?: (string|null); + + /** BackupConfigDetails backupVault */ + backupVault?: (string|null); + + /** BackupConfigDetails backupLocations */ + backupLocations?: (google.cloud.backupdr.v1.IBackupLocation[]|null); + + /** BackupConfigDetails backupDrPlanConfig */ + backupDrPlanConfig?: (google.cloud.backupdr.v1.IBackupDrPlanConfig|null); + + /** BackupConfigDetails backupDrTemplateConfig */ + backupDrTemplateConfig?: (google.cloud.backupdr.v1.IBackupDrTemplateConfig|null); + } + + /** Represents a BackupConfigDetails. */ + class BackupConfigDetails implements IBackupConfigDetails { + + /** + * Constructs a new BackupConfigDetails. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IBackupConfigDetails); + + /** BackupConfigDetails backupConfigSource. */ + public backupConfigSource: string; + + /** BackupConfigDetails backupConfigSourceDisplayName. */ + public backupConfigSourceDisplayName: string; + + /** BackupConfigDetails type. */ + public type: (google.cloud.backupdr.v1.BackupConfigDetails.Type|keyof typeof google.cloud.backupdr.v1.BackupConfigDetails.Type); + + /** BackupConfigDetails state. */ + public state: (google.cloud.backupdr.v1.BackupConfigDetails.State|keyof typeof google.cloud.backupdr.v1.BackupConfigDetails.State); + + /** BackupConfigDetails pitrSettings. */ + public pitrSettings?: (google.cloud.backupdr.v1.IPitrSettings|null); + + /** BackupConfigDetails latestSuccessfulBackupTime. */ + public latestSuccessfulBackupTime?: (google.protobuf.ITimestamp|null); + + /** BackupConfigDetails applicableResource. */ + public applicableResource: string; + + /** BackupConfigDetails backupVault. */ + public backupVault: string; + + /** BackupConfigDetails backupLocations. */ + public backupLocations: google.cloud.backupdr.v1.IBackupLocation[]; + + /** BackupConfigDetails backupDrPlanConfig. */ + public backupDrPlanConfig?: (google.cloud.backupdr.v1.IBackupDrPlanConfig|null); + + /** BackupConfigDetails backupDrTemplateConfig. */ + public backupDrTemplateConfig?: (google.cloud.backupdr.v1.IBackupDrTemplateConfig|null); + + /** BackupConfigDetails planSpecificConfig. */ + public planSpecificConfig?: ("backupDrPlanConfig"|"backupDrTemplateConfig"); + + /** + * Creates a new BackupConfigDetails instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupConfigDetails instance + */ + public static create(properties?: google.cloud.backupdr.v1.IBackupConfigDetails): google.cloud.backupdr.v1.BackupConfigDetails; + + /** + * Encodes the specified BackupConfigDetails message. Does not implicitly {@link google.cloud.backupdr.v1.BackupConfigDetails.verify|verify} messages. + * @param message BackupConfigDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IBackupConfigDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupConfigDetails message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupConfigDetails.verify|verify} messages. + * @param message BackupConfigDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IBackupConfigDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupConfigDetails message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupConfigDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.BackupConfigDetails; + + /** + * Decodes a BackupConfigDetails message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupConfigDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.BackupConfigDetails; + + /** + * Verifies a BackupConfigDetails 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 BackupConfigDetails message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupConfigDetails + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.BackupConfigDetails; + + /** + * Creates a plain object from a BackupConfigDetails message. Also converts values to other types if specified. + * @param message BackupConfigDetails + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.BackupConfigDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupConfigDetails to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupConfigDetails + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BackupConfigDetails { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + CLOUD_SQL_INSTANCE_BACKUP_CONFIG = 1, + COMPUTE_ENGINE_RESOURCE_POLICY = 2, + BACKUPDR_BACKUP_PLAN = 3, + BACKUPDR_TEMPLATE = 4 + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACTIVE = 1, + INACTIVE = 2, + ERROR = 3 + } + } + + /** Properties of a PitrSettings. */ + interface IPitrSettings { + + /** PitrSettings retentionDays */ + retentionDays?: (number|null); + } + + /** Represents a PitrSettings. */ + class PitrSettings implements IPitrSettings { + + /** + * Constructs a new PitrSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IPitrSettings); + + /** PitrSettings retentionDays. */ + public retentionDays: number; + + /** + * Creates a new PitrSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns PitrSettings instance + */ + public static create(properties?: google.cloud.backupdr.v1.IPitrSettings): google.cloud.backupdr.v1.PitrSettings; + + /** + * Encodes the specified PitrSettings message. Does not implicitly {@link google.cloud.backupdr.v1.PitrSettings.verify|verify} messages. + * @param message PitrSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IPitrSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PitrSettings message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.PitrSettings.verify|verify} messages. + * @param message PitrSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IPitrSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PitrSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PitrSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.PitrSettings; + + /** + * Decodes a PitrSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PitrSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.PitrSettings; + + /** + * Verifies a PitrSettings 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 PitrSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PitrSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.PitrSettings; + + /** + * Creates a plain object from a PitrSettings message. Also converts values to other types if specified. + * @param message PitrSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.PitrSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PitrSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PitrSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupDrTemplateConfig. */ + interface IBackupDrTemplateConfig { + + /** BackupDrTemplateConfig firstPartyManagementUri */ + firstPartyManagementUri?: (string|null); + + /** BackupDrTemplateConfig thirdPartyManagementUri */ + thirdPartyManagementUri?: (string|null); + } + + /** Represents a BackupDrTemplateConfig. */ + class BackupDrTemplateConfig implements IBackupDrTemplateConfig { + + /** + * Constructs a new BackupDrTemplateConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IBackupDrTemplateConfig); + + /** BackupDrTemplateConfig firstPartyManagementUri. */ + public firstPartyManagementUri: string; + + /** BackupDrTemplateConfig thirdPartyManagementUri. */ + public thirdPartyManagementUri: string; + + /** + * Creates a new BackupDrTemplateConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupDrTemplateConfig instance + */ + public static create(properties?: google.cloud.backupdr.v1.IBackupDrTemplateConfig): google.cloud.backupdr.v1.BackupDrTemplateConfig; + + /** + * Encodes the specified BackupDrTemplateConfig message. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrTemplateConfig.verify|verify} messages. + * @param message BackupDrTemplateConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IBackupDrTemplateConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupDrTemplateConfig message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrTemplateConfig.verify|verify} messages. + * @param message BackupDrTemplateConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IBackupDrTemplateConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupDrTemplateConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupDrTemplateConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.BackupDrTemplateConfig; + + /** + * Decodes a BackupDrTemplateConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupDrTemplateConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.BackupDrTemplateConfig; + + /** + * Verifies a BackupDrTemplateConfig 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 BackupDrTemplateConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupDrTemplateConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.BackupDrTemplateConfig; + + /** + * Creates a plain object from a BackupDrTemplateConfig message. Also converts values to other types if specified. + * @param message BackupDrTemplateConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.BackupDrTemplateConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupDrTemplateConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupDrTemplateConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupDrPlanConfig. */ + interface IBackupDrPlanConfig { + + /** BackupDrPlanConfig backupDrPlanRules */ + backupDrPlanRules?: (google.cloud.backupdr.v1.IBackupDrPlanRule[]|null); + } + + /** Represents a BackupDrPlanConfig. */ + class BackupDrPlanConfig implements IBackupDrPlanConfig { + + /** + * Constructs a new BackupDrPlanConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IBackupDrPlanConfig); + + /** BackupDrPlanConfig backupDrPlanRules. */ + public backupDrPlanRules: google.cloud.backupdr.v1.IBackupDrPlanRule[]; + + /** + * Creates a new BackupDrPlanConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupDrPlanConfig instance + */ + public static create(properties?: google.cloud.backupdr.v1.IBackupDrPlanConfig): google.cloud.backupdr.v1.BackupDrPlanConfig; + + /** + * Encodes the specified BackupDrPlanConfig message. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrPlanConfig.verify|verify} messages. + * @param message BackupDrPlanConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IBackupDrPlanConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupDrPlanConfig message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrPlanConfig.verify|verify} messages. + * @param message BackupDrPlanConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IBackupDrPlanConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupDrPlanConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupDrPlanConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.BackupDrPlanConfig; + + /** + * Decodes a BackupDrPlanConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupDrPlanConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.BackupDrPlanConfig; + + /** + * Verifies a BackupDrPlanConfig 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 BackupDrPlanConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupDrPlanConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.BackupDrPlanConfig; + + /** + * Creates a plain object from a BackupDrPlanConfig message. Also converts values to other types if specified. + * @param message BackupDrPlanConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.BackupDrPlanConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupDrPlanConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupDrPlanConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupDrPlanRule. */ + interface IBackupDrPlanRule { + + /** BackupDrPlanRule ruleId */ + ruleId?: (string|null); + + /** BackupDrPlanRule lastSuccessfulBackupTime */ + lastSuccessfulBackupTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a BackupDrPlanRule. */ + class BackupDrPlanRule implements IBackupDrPlanRule { + + /** + * Constructs a new BackupDrPlanRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IBackupDrPlanRule); + + /** BackupDrPlanRule ruleId. */ + public ruleId: string; + + /** BackupDrPlanRule lastSuccessfulBackupTime. */ + public lastSuccessfulBackupTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new BackupDrPlanRule instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupDrPlanRule instance + */ + public static create(properties?: google.cloud.backupdr.v1.IBackupDrPlanRule): google.cloud.backupdr.v1.BackupDrPlanRule; + + /** + * Encodes the specified BackupDrPlanRule message. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrPlanRule.verify|verify} messages. + * @param message BackupDrPlanRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IBackupDrPlanRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupDrPlanRule message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrPlanRule.verify|verify} messages. + * @param message BackupDrPlanRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IBackupDrPlanRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupDrPlanRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupDrPlanRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.BackupDrPlanRule; + + /** + * Decodes a BackupDrPlanRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupDrPlanRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.BackupDrPlanRule; + + /** + * Verifies a BackupDrPlanRule 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 BackupDrPlanRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupDrPlanRule + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.BackupDrPlanRule; + + /** + * Creates a plain object from a BackupDrPlanRule message. Also converts values to other types if specified. + * @param message BackupDrPlanRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.BackupDrPlanRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupDrPlanRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupDrPlanRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupLocation. */ + interface IBackupLocation { + + /** BackupLocation type */ + type?: (google.cloud.backupdr.v1.BackupLocation.Type|keyof typeof google.cloud.backupdr.v1.BackupLocation.Type|null); + + /** BackupLocation locationId */ + locationId?: (string|null); + } + + /** Represents a BackupLocation. */ + class BackupLocation implements IBackupLocation { + + /** + * Constructs a new BackupLocation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.backupdr.v1.IBackupLocation); + + /** BackupLocation type. */ + public type: (google.cloud.backupdr.v1.BackupLocation.Type|keyof typeof google.cloud.backupdr.v1.BackupLocation.Type); + + /** BackupLocation locationId. */ + public locationId: string; + + /** + * Creates a new BackupLocation instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupLocation instance + */ + public static create(properties?: google.cloud.backupdr.v1.IBackupLocation): google.cloud.backupdr.v1.BackupLocation; + + /** + * Encodes the specified BackupLocation message. Does not implicitly {@link google.cloud.backupdr.v1.BackupLocation.verify|verify} messages. + * @param message BackupLocation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.backupdr.v1.IBackupLocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupLocation message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupLocation.verify|verify} messages. + * @param message BackupLocation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.backupdr.v1.IBackupLocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupLocation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.backupdr.v1.BackupLocation; + + /** + * Decodes a BackupLocation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.backupdr.v1.BackupLocation; + + /** + * Verifies a BackupLocation 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 BackupLocation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupLocation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.backupdr.v1.BackupLocation; + + /** + * Creates a plain object from a BackupLocation message. Also converts values to other types if specified. + * @param message BackupLocation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.backupdr.v1.BackupLocation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupLocation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupLocation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BackupLocation { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + ZONAL = 1, + REGIONAL = 2, + MULTI_REGIONAL = 3 + } + } } } } diff --git a/packages/google-cloud-backupdr/protos/protos.js b/packages/google-cloud-backupdr/protos/protos.js index 41d226cbad6..2eab54d52dd 100644 --- a/packages/google-cloud-backupdr/protos/protos.js +++ b/packages/google-cloud-backupdr/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -42945,6 +42945,2900 @@ return FetchDataSourceReferencesForResourceTypeResponse; })(); + v1.BackupDrProtectionSummary = (function() { + + /** + * Constructs a new BackupDrProtectionSummary service. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a BackupDrProtectionSummary + * @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 BackupDrProtectionSummary(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (BackupDrProtectionSummary.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = BackupDrProtectionSummary; + + /** + * Creates new BackupDrProtectionSummary service using the specified rpc implementation. + * @function create + * @memberof google.cloud.backupdr.v1.BackupDrProtectionSummary + * @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 {BackupDrProtectionSummary} RPC service. Useful where requests and/or responses are streamed. + */ + BackupDrProtectionSummary.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.backupdr.v1.BackupDrProtectionSummary|listResourceBackupConfigs}. + * @memberof google.cloud.backupdr.v1.BackupDrProtectionSummary + * @typedef ListResourceBackupConfigsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.backupdr.v1.ListResourceBackupConfigsResponse} [response] ListResourceBackupConfigsResponse + */ + + /** + * Calls ListResourceBackupConfigs. + * @function listResourceBackupConfigs + * @memberof google.cloud.backupdr.v1.BackupDrProtectionSummary + * @instance + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsRequest} request ListResourceBackupConfigsRequest message or plain object + * @param {google.cloud.backupdr.v1.BackupDrProtectionSummary.ListResourceBackupConfigsCallback} callback Node-style callback called with the error, if any, and ListResourceBackupConfigsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(BackupDrProtectionSummary.prototype.listResourceBackupConfigs = function listResourceBackupConfigs(request, callback) { + return this.rpcCall(listResourceBackupConfigs, $root.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest, $root.google.cloud.backupdr.v1.ListResourceBackupConfigsResponse, request, callback); + }, "name", { value: "ListResourceBackupConfigs" }); + + /** + * Calls ListResourceBackupConfigs. + * @function listResourceBackupConfigs + * @memberof google.cloud.backupdr.v1.BackupDrProtectionSummary + * @instance + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsRequest} request ListResourceBackupConfigsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return BackupDrProtectionSummary; + })(); + + v1.ListResourceBackupConfigsRequest = (function() { + + /** + * Properties of a ListResourceBackupConfigsRequest. + * @memberof google.cloud.backupdr.v1 + * @interface IListResourceBackupConfigsRequest + * @property {string|null} [parent] ListResourceBackupConfigsRequest parent + * @property {number|null} [pageSize] ListResourceBackupConfigsRequest pageSize + * @property {string|null} [pageToken] ListResourceBackupConfigsRequest pageToken + * @property {string|null} [filter] ListResourceBackupConfigsRequest filter + * @property {string|null} [orderBy] ListResourceBackupConfigsRequest orderBy + */ + + /** + * Constructs a new ListResourceBackupConfigsRequest. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a ListResourceBackupConfigsRequest. + * @implements IListResourceBackupConfigsRequest + * @constructor + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsRequest=} [properties] Properties to set + */ + function ListResourceBackupConfigsRequest(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]]; + } + + /** + * ListResourceBackupConfigsRequest parent. + * @member {string} parent + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @instance + */ + ListResourceBackupConfigsRequest.prototype.parent = ""; + + /** + * ListResourceBackupConfigsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @instance + */ + ListResourceBackupConfigsRequest.prototype.pageSize = 0; + + /** + * ListResourceBackupConfigsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @instance + */ + ListResourceBackupConfigsRequest.prototype.pageToken = ""; + + /** + * ListResourceBackupConfigsRequest filter. + * @member {string} filter + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @instance + */ + ListResourceBackupConfigsRequest.prototype.filter = ""; + + /** + * ListResourceBackupConfigsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @instance + */ + ListResourceBackupConfigsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListResourceBackupConfigsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsRequest=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.ListResourceBackupConfigsRequest} ListResourceBackupConfigsRequest instance + */ + ListResourceBackupConfigsRequest.create = function create(properties) { + return new ListResourceBackupConfigsRequest(properties); + }; + + /** + * Encodes the specified ListResourceBackupConfigsRequest message. Does not implicitly {@link google.cloud.backupdr.v1.ListResourceBackupConfigsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsRequest} message ListResourceBackupConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListResourceBackupConfigsRequest.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 ListResourceBackupConfigsRequest message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.ListResourceBackupConfigsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsRequest} message ListResourceBackupConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListResourceBackupConfigsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListResourceBackupConfigsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.ListResourceBackupConfigsRequest} ListResourceBackupConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListResourceBackupConfigsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListResourceBackupConfigsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.ListResourceBackupConfigsRequest} ListResourceBackupConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListResourceBackupConfigsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListResourceBackupConfigsRequest message. + * @function verify + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListResourceBackupConfigsRequest.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 ListResourceBackupConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.ListResourceBackupConfigsRequest} ListResourceBackupConfigsRequest + */ + ListResourceBackupConfigsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest) + return object; + var message = new $root.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest(); + 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 ListResourceBackupConfigsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {google.cloud.backupdr.v1.ListResourceBackupConfigsRequest} message ListResourceBackupConfigsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListResourceBackupConfigsRequest.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 ListResourceBackupConfigsRequest to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @instance + * @returns {Object.} JSON object + */ + ListResourceBackupConfigsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListResourceBackupConfigsRequest + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListResourceBackupConfigsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.ListResourceBackupConfigsRequest"; + }; + + return ListResourceBackupConfigsRequest; + })(); + + v1.ListResourceBackupConfigsResponse = (function() { + + /** + * Properties of a ListResourceBackupConfigsResponse. + * @memberof google.cloud.backupdr.v1 + * @interface IListResourceBackupConfigsResponse + * @property {Array.|null} [resourceBackupConfigs] ListResourceBackupConfigsResponse resourceBackupConfigs + * @property {string|null} [nextPageToken] ListResourceBackupConfigsResponse nextPageToken + */ + + /** + * Constructs a new ListResourceBackupConfigsResponse. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a ListResourceBackupConfigsResponse. + * @implements IListResourceBackupConfigsResponse + * @constructor + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsResponse=} [properties] Properties to set + */ + function ListResourceBackupConfigsResponse(properties) { + this.resourceBackupConfigs = []; + 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]]; + } + + /** + * ListResourceBackupConfigsResponse resourceBackupConfigs. + * @member {Array.} resourceBackupConfigs + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @instance + */ + ListResourceBackupConfigsResponse.prototype.resourceBackupConfigs = $util.emptyArray; + + /** + * ListResourceBackupConfigsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @instance + */ + ListResourceBackupConfigsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListResourceBackupConfigsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsResponse=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.ListResourceBackupConfigsResponse} ListResourceBackupConfigsResponse instance + */ + ListResourceBackupConfigsResponse.create = function create(properties) { + return new ListResourceBackupConfigsResponse(properties); + }; + + /** + * Encodes the specified ListResourceBackupConfigsResponse message. Does not implicitly {@link google.cloud.backupdr.v1.ListResourceBackupConfigsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsResponse} message ListResourceBackupConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListResourceBackupConfigsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resourceBackupConfigs != null && message.resourceBackupConfigs.length) + for (var i = 0; i < message.resourceBackupConfigs.length; ++i) + $root.google.cloud.backupdr.v1.ResourceBackupConfig.encode(message.resourceBackupConfigs[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 ListResourceBackupConfigsResponse message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.ListResourceBackupConfigsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {google.cloud.backupdr.v1.IListResourceBackupConfigsResponse} message ListResourceBackupConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListResourceBackupConfigsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListResourceBackupConfigsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.ListResourceBackupConfigsResponse} ListResourceBackupConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListResourceBackupConfigsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.ListResourceBackupConfigsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.resourceBackupConfigs && message.resourceBackupConfigs.length)) + message.resourceBackupConfigs = []; + message.resourceBackupConfigs.push($root.google.cloud.backupdr.v1.ResourceBackupConfig.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListResourceBackupConfigsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.ListResourceBackupConfigsResponse} ListResourceBackupConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListResourceBackupConfigsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListResourceBackupConfigsResponse message. + * @function verify + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListResourceBackupConfigsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resourceBackupConfigs != null && message.hasOwnProperty("resourceBackupConfigs")) { + if (!Array.isArray(message.resourceBackupConfigs)) + return "resourceBackupConfigs: array expected"; + for (var i = 0; i < message.resourceBackupConfigs.length; ++i) { + var error = $root.google.cloud.backupdr.v1.ResourceBackupConfig.verify(message.resourceBackupConfigs[i]); + if (error) + return "resourceBackupConfigs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListResourceBackupConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.ListResourceBackupConfigsResponse} ListResourceBackupConfigsResponse + */ + ListResourceBackupConfigsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.ListResourceBackupConfigsResponse) + return object; + var message = new $root.google.cloud.backupdr.v1.ListResourceBackupConfigsResponse(); + if (object.resourceBackupConfigs) { + if (!Array.isArray(object.resourceBackupConfigs)) + throw TypeError(".google.cloud.backupdr.v1.ListResourceBackupConfigsResponse.resourceBackupConfigs: array expected"); + message.resourceBackupConfigs = []; + for (var i = 0; i < object.resourceBackupConfigs.length; ++i) { + if (typeof object.resourceBackupConfigs[i] !== "object") + throw TypeError(".google.cloud.backupdr.v1.ListResourceBackupConfigsResponse.resourceBackupConfigs: object expected"); + message.resourceBackupConfigs[i] = $root.google.cloud.backupdr.v1.ResourceBackupConfig.fromObject(object.resourceBackupConfigs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListResourceBackupConfigsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {google.cloud.backupdr.v1.ListResourceBackupConfigsResponse} message ListResourceBackupConfigsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListResourceBackupConfigsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.resourceBackupConfigs = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.resourceBackupConfigs && message.resourceBackupConfigs.length) { + object.resourceBackupConfigs = []; + for (var j = 0; j < message.resourceBackupConfigs.length; ++j) + object.resourceBackupConfigs[j] = $root.google.cloud.backupdr.v1.ResourceBackupConfig.toObject(message.resourceBackupConfigs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListResourceBackupConfigsResponse to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @instance + * @returns {Object.} JSON object + */ + ListResourceBackupConfigsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListResourceBackupConfigsResponse + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.ListResourceBackupConfigsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListResourceBackupConfigsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.ListResourceBackupConfigsResponse"; + }; + + return ListResourceBackupConfigsResponse; + })(); + + v1.ResourceBackupConfig = (function() { + + /** + * Properties of a ResourceBackupConfig. + * @memberof google.cloud.backupdr.v1 + * @interface IResourceBackupConfig + * @property {string|null} [name] ResourceBackupConfig name + * @property {string|null} [uid] ResourceBackupConfig uid + * @property {string|null} [targetResource] ResourceBackupConfig targetResource + * @property {string|null} [targetResourceDisplayName] ResourceBackupConfig targetResourceDisplayName + * @property {google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType|null} [targetResourceType] ResourceBackupConfig targetResourceType + * @property {Object.|null} [targetResourceLabels] ResourceBackupConfig targetResourceLabels + * @property {Array.|null} [backupConfigsDetails] ResourceBackupConfig backupConfigsDetails + * @property {boolean|null} [backupConfigured] ResourceBackupConfig backupConfigured + * @property {boolean|null} [vaulted] ResourceBackupConfig vaulted + */ + + /** + * Constructs a new ResourceBackupConfig. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a ResourceBackupConfig. + * @implements IResourceBackupConfig + * @constructor + * @param {google.cloud.backupdr.v1.IResourceBackupConfig=} [properties] Properties to set + */ + function ResourceBackupConfig(properties) { + this.targetResourceLabels = {}; + this.backupConfigsDetails = []; + 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]]; + } + + /** + * ResourceBackupConfig name. + * @member {string} name + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.name = ""; + + /** + * ResourceBackupConfig uid. + * @member {string} uid + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.uid = ""; + + /** + * ResourceBackupConfig targetResource. + * @member {string} targetResource + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.targetResource = ""; + + /** + * ResourceBackupConfig targetResourceDisplayName. + * @member {string} targetResourceDisplayName + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.targetResourceDisplayName = ""; + + /** + * ResourceBackupConfig targetResourceType. + * @member {google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType} targetResourceType + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.targetResourceType = 0; + + /** + * ResourceBackupConfig targetResourceLabels. + * @member {Object.} targetResourceLabels + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.targetResourceLabels = $util.emptyObject; + + /** + * ResourceBackupConfig backupConfigsDetails. + * @member {Array.} backupConfigsDetails + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.backupConfigsDetails = $util.emptyArray; + + /** + * ResourceBackupConfig backupConfigured. + * @member {boolean} backupConfigured + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.backupConfigured = false; + + /** + * ResourceBackupConfig vaulted. + * @member {boolean} vaulted + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + */ + ResourceBackupConfig.prototype.vaulted = false; + + /** + * Creates a new ResourceBackupConfig instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {google.cloud.backupdr.v1.IResourceBackupConfig=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.ResourceBackupConfig} ResourceBackupConfig instance + */ + ResourceBackupConfig.create = function create(properties) { + return new ResourceBackupConfig(properties); + }; + + /** + * Encodes the specified ResourceBackupConfig message. Does not implicitly {@link google.cloud.backupdr.v1.ResourceBackupConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {google.cloud.backupdr.v1.IResourceBackupConfig} message ResourceBackupConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceBackupConfig.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.uid != null && Object.hasOwnProperty.call(message, "uid")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uid); + if (message.targetResource != null && Object.hasOwnProperty.call(message, "targetResource")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetResource); + if (message.targetResourceDisplayName != null && Object.hasOwnProperty.call(message, "targetResourceDisplayName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.targetResourceDisplayName); + if (message.targetResourceType != null && Object.hasOwnProperty.call(message, "targetResourceType")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.targetResourceType); + if (message.targetResourceLabels != null && Object.hasOwnProperty.call(message, "targetResourceLabels")) + for (var keys = Object.keys(message.targetResourceLabels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.targetResourceLabels[keys[i]]).ldelim(); + if (message.backupConfigsDetails != null && message.backupConfigsDetails.length) + for (var i = 0; i < message.backupConfigsDetails.length; ++i) + $root.google.cloud.backupdr.v1.BackupConfigDetails.encode(message.backupConfigsDetails[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.backupConfigured != null && Object.hasOwnProperty.call(message, "backupConfigured")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.backupConfigured); + if (message.vaulted != null && Object.hasOwnProperty.call(message, "vaulted")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.vaulted); + return writer; + }; + + /** + * Encodes the specified ResourceBackupConfig message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.ResourceBackupConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {google.cloud.backupdr.v1.IResourceBackupConfig} message ResourceBackupConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceBackupConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceBackupConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.ResourceBackupConfig} ResourceBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceBackupConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.ResourceBackupConfig(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.uid = reader.string(); + break; + } + case 3: { + message.targetResource = reader.string(); + break; + } + case 4: { + message.targetResourceDisplayName = reader.string(); + break; + } + case 5: { + message.targetResourceType = reader.int32(); + break; + } + case 6: { + if (message.targetResourceLabels === $util.emptyObject) + message.targetResourceLabels = {}; + 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.targetResourceLabels[key] = value; + break; + } + case 7: { + if (!(message.backupConfigsDetails && message.backupConfigsDetails.length)) + message.backupConfigsDetails = []; + message.backupConfigsDetails.push($root.google.cloud.backupdr.v1.BackupConfigDetails.decode(reader, reader.uint32())); + break; + } + case 8: { + message.backupConfigured = reader.bool(); + break; + } + case 9: { + message.vaulted = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceBackupConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.ResourceBackupConfig} ResourceBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceBackupConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceBackupConfig message. + * @function verify + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceBackupConfig.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.uid != null && message.hasOwnProperty("uid")) + if (!$util.isString(message.uid)) + return "uid: string expected"; + if (message.targetResource != null && message.hasOwnProperty("targetResource")) + if (!$util.isString(message.targetResource)) + return "targetResource: string expected"; + if (message.targetResourceDisplayName != null && message.hasOwnProperty("targetResourceDisplayName")) + if (!$util.isString(message.targetResourceDisplayName)) + return "targetResourceDisplayName: string expected"; + if (message.targetResourceType != null && message.hasOwnProperty("targetResourceType")) + switch (message.targetResourceType) { + default: + return "targetResourceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.targetResourceLabels != null && message.hasOwnProperty("targetResourceLabels")) { + if (!$util.isObject(message.targetResourceLabels)) + return "targetResourceLabels: object expected"; + var key = Object.keys(message.targetResourceLabels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.targetResourceLabels[key[i]])) + return "targetResourceLabels: string{k:string} expected"; + } + if (message.backupConfigsDetails != null && message.hasOwnProperty("backupConfigsDetails")) { + if (!Array.isArray(message.backupConfigsDetails)) + return "backupConfigsDetails: array expected"; + for (var i = 0; i < message.backupConfigsDetails.length; ++i) { + var error = $root.google.cloud.backupdr.v1.BackupConfigDetails.verify(message.backupConfigsDetails[i]); + if (error) + return "backupConfigsDetails." + error; + } + } + if (message.backupConfigured != null && message.hasOwnProperty("backupConfigured")) + if (typeof message.backupConfigured !== "boolean") + return "backupConfigured: boolean expected"; + if (message.vaulted != null && message.hasOwnProperty("vaulted")) + if (typeof message.vaulted !== "boolean") + return "vaulted: boolean expected"; + return null; + }; + + /** + * Creates a ResourceBackupConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.ResourceBackupConfig} ResourceBackupConfig + */ + ResourceBackupConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.ResourceBackupConfig) + return object; + var message = new $root.google.cloud.backupdr.v1.ResourceBackupConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.uid != null) + message.uid = String(object.uid); + if (object.targetResource != null) + message.targetResource = String(object.targetResource); + if (object.targetResourceDisplayName != null) + message.targetResourceDisplayName = String(object.targetResourceDisplayName); + switch (object.targetResourceType) { + default: + if (typeof object.targetResourceType === "number") { + message.targetResourceType = object.targetResourceType; + break; + } + break; + case "RESOURCE_TYPE_UNSPECIFIED": + case 0: + message.targetResourceType = 0; + break; + case "CLOUD_SQL_INSTANCE": + case 1: + message.targetResourceType = 1; + break; + case "COMPUTE_ENGINE_VM": + case 2: + message.targetResourceType = 2; + break; + case "COMPUTE_ENGINE_DISK": + case 3: + message.targetResourceType = 3; + break; + case "COMPUTE_ENGINE_REGIONAL_DISK": + case 4: + message.targetResourceType = 4; + break; + } + if (object.targetResourceLabels) { + if (typeof object.targetResourceLabels !== "object") + throw TypeError(".google.cloud.backupdr.v1.ResourceBackupConfig.targetResourceLabels: object expected"); + message.targetResourceLabels = {}; + for (var keys = Object.keys(object.targetResourceLabels), i = 0; i < keys.length; ++i) + message.targetResourceLabels[keys[i]] = String(object.targetResourceLabels[keys[i]]); + } + if (object.backupConfigsDetails) { + if (!Array.isArray(object.backupConfigsDetails)) + throw TypeError(".google.cloud.backupdr.v1.ResourceBackupConfig.backupConfigsDetails: array expected"); + message.backupConfigsDetails = []; + for (var i = 0; i < object.backupConfigsDetails.length; ++i) { + if (typeof object.backupConfigsDetails[i] !== "object") + throw TypeError(".google.cloud.backupdr.v1.ResourceBackupConfig.backupConfigsDetails: object expected"); + message.backupConfigsDetails[i] = $root.google.cloud.backupdr.v1.BackupConfigDetails.fromObject(object.backupConfigsDetails[i]); + } + } + if (object.backupConfigured != null) + message.backupConfigured = Boolean(object.backupConfigured); + if (object.vaulted != null) + message.vaulted = Boolean(object.vaulted); + return message; + }; + + /** + * Creates a plain object from a ResourceBackupConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {google.cloud.backupdr.v1.ResourceBackupConfig} message ResourceBackupConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceBackupConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.backupConfigsDetails = []; + if (options.objects || options.defaults) + object.targetResourceLabels = {}; + if (options.defaults) { + object.name = ""; + object.uid = ""; + object.targetResource = ""; + object.targetResourceDisplayName = ""; + object.targetResourceType = options.enums === String ? "RESOURCE_TYPE_UNSPECIFIED" : 0; + object.backupConfigured = false; + object.vaulted = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.uid != null && message.hasOwnProperty("uid")) + object.uid = message.uid; + if (message.targetResource != null && message.hasOwnProperty("targetResource")) + object.targetResource = message.targetResource; + if (message.targetResourceDisplayName != null && message.hasOwnProperty("targetResourceDisplayName")) + object.targetResourceDisplayName = message.targetResourceDisplayName; + if (message.targetResourceType != null && message.hasOwnProperty("targetResourceType")) + object.targetResourceType = options.enums === String ? $root.google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType[message.targetResourceType] === undefined ? message.targetResourceType : $root.google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType[message.targetResourceType] : message.targetResourceType; + var keys2; + if (message.targetResourceLabels && (keys2 = Object.keys(message.targetResourceLabels)).length) { + object.targetResourceLabels = {}; + for (var j = 0; j < keys2.length; ++j) + object.targetResourceLabels[keys2[j]] = message.targetResourceLabels[keys2[j]]; + } + if (message.backupConfigsDetails && message.backupConfigsDetails.length) { + object.backupConfigsDetails = []; + for (var j = 0; j < message.backupConfigsDetails.length; ++j) + object.backupConfigsDetails[j] = $root.google.cloud.backupdr.v1.BackupConfigDetails.toObject(message.backupConfigsDetails[j], options); + } + if (message.backupConfigured != null && message.hasOwnProperty("backupConfigured")) + object.backupConfigured = message.backupConfigured; + if (message.vaulted != null && message.hasOwnProperty("vaulted")) + object.vaulted = message.vaulted; + return object; + }; + + /** + * Converts this ResourceBackupConfig to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @instance + * @returns {Object.} JSON object + */ + ResourceBackupConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceBackupConfig + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.ResourceBackupConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceBackupConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.ResourceBackupConfig"; + }; + + /** + * ResourceType enum. + * @name google.cloud.backupdr.v1.ResourceBackupConfig.ResourceType + * @enum {number} + * @property {number} RESOURCE_TYPE_UNSPECIFIED=0 RESOURCE_TYPE_UNSPECIFIED value + * @property {number} CLOUD_SQL_INSTANCE=1 CLOUD_SQL_INSTANCE value + * @property {number} COMPUTE_ENGINE_VM=2 COMPUTE_ENGINE_VM value + * @property {number} COMPUTE_ENGINE_DISK=3 COMPUTE_ENGINE_DISK value + * @property {number} COMPUTE_ENGINE_REGIONAL_DISK=4 COMPUTE_ENGINE_REGIONAL_DISK value + */ + ResourceBackupConfig.ResourceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESOURCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD_SQL_INSTANCE"] = 1; + values[valuesById[2] = "COMPUTE_ENGINE_VM"] = 2; + values[valuesById[3] = "COMPUTE_ENGINE_DISK"] = 3; + values[valuesById[4] = "COMPUTE_ENGINE_REGIONAL_DISK"] = 4; + return values; + })(); + + return ResourceBackupConfig; + })(); + + v1.BackupConfigDetails = (function() { + + /** + * Properties of a BackupConfigDetails. + * @memberof google.cloud.backupdr.v1 + * @interface IBackupConfigDetails + * @property {string|null} [backupConfigSource] BackupConfigDetails backupConfigSource + * @property {string|null} [backupConfigSourceDisplayName] BackupConfigDetails backupConfigSourceDisplayName + * @property {google.cloud.backupdr.v1.BackupConfigDetails.Type|null} [type] BackupConfigDetails type + * @property {google.cloud.backupdr.v1.BackupConfigDetails.State|null} [state] BackupConfigDetails state + * @property {google.cloud.backupdr.v1.IPitrSettings|null} [pitrSettings] BackupConfigDetails pitrSettings + * @property {google.protobuf.ITimestamp|null} [latestSuccessfulBackupTime] BackupConfigDetails latestSuccessfulBackupTime + * @property {string|null} [applicableResource] BackupConfigDetails applicableResource + * @property {string|null} [backupVault] BackupConfigDetails backupVault + * @property {Array.|null} [backupLocations] BackupConfigDetails backupLocations + * @property {google.cloud.backupdr.v1.IBackupDrPlanConfig|null} [backupDrPlanConfig] BackupConfigDetails backupDrPlanConfig + * @property {google.cloud.backupdr.v1.IBackupDrTemplateConfig|null} [backupDrTemplateConfig] BackupConfigDetails backupDrTemplateConfig + */ + + /** + * Constructs a new BackupConfigDetails. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a BackupConfigDetails. + * @implements IBackupConfigDetails + * @constructor + * @param {google.cloud.backupdr.v1.IBackupConfigDetails=} [properties] Properties to set + */ + function BackupConfigDetails(properties) { + this.backupLocations = []; + 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]]; + } + + /** + * BackupConfigDetails backupConfigSource. + * @member {string} backupConfigSource + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.backupConfigSource = ""; + + /** + * BackupConfigDetails backupConfigSourceDisplayName. + * @member {string} backupConfigSourceDisplayName + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.backupConfigSourceDisplayName = ""; + + /** + * BackupConfigDetails type. + * @member {google.cloud.backupdr.v1.BackupConfigDetails.Type} type + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.type = 0; + + /** + * BackupConfigDetails state. + * @member {google.cloud.backupdr.v1.BackupConfigDetails.State} state + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.state = 0; + + /** + * BackupConfigDetails pitrSettings. + * @member {google.cloud.backupdr.v1.IPitrSettings|null|undefined} pitrSettings + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.pitrSettings = null; + + /** + * BackupConfigDetails latestSuccessfulBackupTime. + * @member {google.protobuf.ITimestamp|null|undefined} latestSuccessfulBackupTime + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.latestSuccessfulBackupTime = null; + + /** + * BackupConfigDetails applicableResource. + * @member {string} applicableResource + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.applicableResource = ""; + + /** + * BackupConfigDetails backupVault. + * @member {string} backupVault + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.backupVault = ""; + + /** + * BackupConfigDetails backupLocations. + * @member {Array.} backupLocations + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.backupLocations = $util.emptyArray; + + /** + * BackupConfigDetails backupDrPlanConfig. + * @member {google.cloud.backupdr.v1.IBackupDrPlanConfig|null|undefined} backupDrPlanConfig + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.backupDrPlanConfig = null; + + /** + * BackupConfigDetails backupDrTemplateConfig. + * @member {google.cloud.backupdr.v1.IBackupDrTemplateConfig|null|undefined} backupDrTemplateConfig + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + BackupConfigDetails.prototype.backupDrTemplateConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BackupConfigDetails planSpecificConfig. + * @member {"backupDrPlanConfig"|"backupDrTemplateConfig"|undefined} planSpecificConfig + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + */ + Object.defineProperty(BackupConfigDetails.prototype, "planSpecificConfig", { + get: $util.oneOfGetter($oneOfFields = ["backupDrPlanConfig", "backupDrTemplateConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupConfigDetails instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {google.cloud.backupdr.v1.IBackupConfigDetails=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.BackupConfigDetails} BackupConfigDetails instance + */ + BackupConfigDetails.create = function create(properties) { + return new BackupConfigDetails(properties); + }; + + /** + * Encodes the specified BackupConfigDetails message. Does not implicitly {@link google.cloud.backupdr.v1.BackupConfigDetails.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {google.cloud.backupdr.v1.IBackupConfigDetails} message BackupConfigDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupConfigDetails.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupConfigSource != null && Object.hasOwnProperty.call(message, "backupConfigSource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.backupConfigSource); + if (message.backupConfigSourceDisplayName != null && Object.hasOwnProperty.call(message, "backupConfigSourceDisplayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.backupConfigSourceDisplayName); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.pitrSettings != null && Object.hasOwnProperty.call(message, "pitrSettings")) + $root.google.cloud.backupdr.v1.PitrSettings.encode(message.pitrSettings, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.latestSuccessfulBackupTime != null && Object.hasOwnProperty.call(message, "latestSuccessfulBackupTime")) + $root.google.protobuf.Timestamp.encode(message.latestSuccessfulBackupTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.applicableResource != null && Object.hasOwnProperty.call(message, "applicableResource")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.applicableResource); + if (message.backupVault != null && Object.hasOwnProperty.call(message, "backupVault")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.backupVault); + if (message.backupDrPlanConfig != null && Object.hasOwnProperty.call(message, "backupDrPlanConfig")) + $root.google.cloud.backupdr.v1.BackupDrPlanConfig.encode(message.backupDrPlanConfig, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.backupDrTemplateConfig != null && Object.hasOwnProperty.call(message, "backupDrTemplateConfig")) + $root.google.cloud.backupdr.v1.BackupDrTemplateConfig.encode(message.backupDrTemplateConfig, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.backupLocations != null && message.backupLocations.length) + for (var i = 0; i < message.backupLocations.length; ++i) + $root.google.cloud.backupdr.v1.BackupLocation.encode(message.backupLocations[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BackupConfigDetails message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupConfigDetails.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {google.cloud.backupdr.v1.IBackupConfigDetails} message BackupConfigDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupConfigDetails.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupConfigDetails message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.BackupConfigDetails} BackupConfigDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupConfigDetails.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.BackupConfigDetails(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backupConfigSource = reader.string(); + break; + } + case 2: { + message.backupConfigSourceDisplayName = reader.string(); + break; + } + case 3: { + message.type = reader.int32(); + break; + } + case 4: { + message.state = reader.int32(); + break; + } + case 5: { + message.pitrSettings = $root.google.cloud.backupdr.v1.PitrSettings.decode(reader, reader.uint32()); + break; + } + case 6: { + message.latestSuccessfulBackupTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.applicableResource = reader.string(); + break; + } + case 8: { + message.backupVault = reader.string(); + break; + } + case 12: { + if (!(message.backupLocations && message.backupLocations.length)) + message.backupLocations = []; + message.backupLocations.push($root.google.cloud.backupdr.v1.BackupLocation.decode(reader, reader.uint32())); + break; + } + case 10: { + message.backupDrPlanConfig = $root.google.cloud.backupdr.v1.BackupDrPlanConfig.decode(reader, reader.uint32()); + break; + } + case 11: { + message.backupDrTemplateConfig = $root.google.cloud.backupdr.v1.BackupDrTemplateConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupConfigDetails message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.BackupConfigDetails} BackupConfigDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupConfigDetails.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupConfigDetails message. + * @function verify + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupConfigDetails.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.backupConfigSource != null && message.hasOwnProperty("backupConfigSource")) + if (!$util.isString(message.backupConfigSource)) + return "backupConfigSource: string expected"; + if (message.backupConfigSourceDisplayName != null && message.hasOwnProperty("backupConfigSourceDisplayName")) + if (!$util.isString(message.backupConfigSourceDisplayName)) + return "backupConfigSourceDisplayName: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.pitrSettings != null && message.hasOwnProperty("pitrSettings")) { + var error = $root.google.cloud.backupdr.v1.PitrSettings.verify(message.pitrSettings); + if (error) + return "pitrSettings." + error; + } + if (message.latestSuccessfulBackupTime != null && message.hasOwnProperty("latestSuccessfulBackupTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.latestSuccessfulBackupTime); + if (error) + return "latestSuccessfulBackupTime." + error; + } + if (message.applicableResource != null && message.hasOwnProperty("applicableResource")) + if (!$util.isString(message.applicableResource)) + return "applicableResource: string expected"; + if (message.backupVault != null && message.hasOwnProperty("backupVault")) + if (!$util.isString(message.backupVault)) + return "backupVault: string expected"; + if (message.backupLocations != null && message.hasOwnProperty("backupLocations")) { + if (!Array.isArray(message.backupLocations)) + return "backupLocations: array expected"; + for (var i = 0; i < message.backupLocations.length; ++i) { + var error = $root.google.cloud.backupdr.v1.BackupLocation.verify(message.backupLocations[i]); + if (error) + return "backupLocations." + error; + } + } + if (message.backupDrPlanConfig != null && message.hasOwnProperty("backupDrPlanConfig")) { + properties.planSpecificConfig = 1; + { + var error = $root.google.cloud.backupdr.v1.BackupDrPlanConfig.verify(message.backupDrPlanConfig); + if (error) + return "backupDrPlanConfig." + error; + } + } + if (message.backupDrTemplateConfig != null && message.hasOwnProperty("backupDrTemplateConfig")) { + if (properties.planSpecificConfig === 1) + return "planSpecificConfig: multiple values"; + properties.planSpecificConfig = 1; + { + var error = $root.google.cloud.backupdr.v1.BackupDrTemplateConfig.verify(message.backupDrTemplateConfig); + if (error) + return "backupDrTemplateConfig." + error; + } + } + return null; + }; + + /** + * Creates a BackupConfigDetails message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.BackupConfigDetails} BackupConfigDetails + */ + BackupConfigDetails.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.BackupConfigDetails) + return object; + var message = new $root.google.cloud.backupdr.v1.BackupConfigDetails(); + if (object.backupConfigSource != null) + message.backupConfigSource = String(object.backupConfigSource); + if (object.backupConfigSourceDisplayName != null) + message.backupConfigSourceDisplayName = String(object.backupConfigSourceDisplayName); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "CLOUD_SQL_INSTANCE_BACKUP_CONFIG": + case 1: + message.type = 1; + break; + case "COMPUTE_ENGINE_RESOURCE_POLICY": + case 2: + message.type = 2; + break; + case "BACKUPDR_BACKUP_PLAN": + case 3: + message.type = 3; + break; + case "BACKUPDR_TEMPLATE": + case 4: + message.type = 4; + break; + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACTIVE": + case 1: + message.state = 1; + break; + case "INACTIVE": + case 2: + message.state = 2; + break; + case "ERROR": + case 3: + message.state = 3; + break; + } + if (object.pitrSettings != null) { + if (typeof object.pitrSettings !== "object") + throw TypeError(".google.cloud.backupdr.v1.BackupConfigDetails.pitrSettings: object expected"); + message.pitrSettings = $root.google.cloud.backupdr.v1.PitrSettings.fromObject(object.pitrSettings); + } + if (object.latestSuccessfulBackupTime != null) { + if (typeof object.latestSuccessfulBackupTime !== "object") + throw TypeError(".google.cloud.backupdr.v1.BackupConfigDetails.latestSuccessfulBackupTime: object expected"); + message.latestSuccessfulBackupTime = $root.google.protobuf.Timestamp.fromObject(object.latestSuccessfulBackupTime); + } + if (object.applicableResource != null) + message.applicableResource = String(object.applicableResource); + if (object.backupVault != null) + message.backupVault = String(object.backupVault); + if (object.backupLocations) { + if (!Array.isArray(object.backupLocations)) + throw TypeError(".google.cloud.backupdr.v1.BackupConfigDetails.backupLocations: array expected"); + message.backupLocations = []; + for (var i = 0; i < object.backupLocations.length; ++i) { + if (typeof object.backupLocations[i] !== "object") + throw TypeError(".google.cloud.backupdr.v1.BackupConfigDetails.backupLocations: object expected"); + message.backupLocations[i] = $root.google.cloud.backupdr.v1.BackupLocation.fromObject(object.backupLocations[i]); + } + } + if (object.backupDrPlanConfig != null) { + if (typeof object.backupDrPlanConfig !== "object") + throw TypeError(".google.cloud.backupdr.v1.BackupConfigDetails.backupDrPlanConfig: object expected"); + message.backupDrPlanConfig = $root.google.cloud.backupdr.v1.BackupDrPlanConfig.fromObject(object.backupDrPlanConfig); + } + if (object.backupDrTemplateConfig != null) { + if (typeof object.backupDrTemplateConfig !== "object") + throw TypeError(".google.cloud.backupdr.v1.BackupConfigDetails.backupDrTemplateConfig: object expected"); + message.backupDrTemplateConfig = $root.google.cloud.backupdr.v1.BackupDrTemplateConfig.fromObject(object.backupDrTemplateConfig); + } + return message; + }; + + /** + * Creates a plain object from a BackupConfigDetails message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {google.cloud.backupdr.v1.BackupConfigDetails} message BackupConfigDetails + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupConfigDetails.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.backupLocations = []; + if (options.defaults) { + object.backupConfigSource = ""; + object.backupConfigSourceDisplayName = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.pitrSettings = null; + object.latestSuccessfulBackupTime = null; + object.applicableResource = ""; + object.backupVault = ""; + } + if (message.backupConfigSource != null && message.hasOwnProperty("backupConfigSource")) + object.backupConfigSource = message.backupConfigSource; + if (message.backupConfigSourceDisplayName != null && message.hasOwnProperty("backupConfigSourceDisplayName")) + object.backupConfigSourceDisplayName = message.backupConfigSourceDisplayName; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.backupdr.v1.BackupConfigDetails.Type[message.type] === undefined ? message.type : $root.google.cloud.backupdr.v1.BackupConfigDetails.Type[message.type] : message.type; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.backupdr.v1.BackupConfigDetails.State[message.state] === undefined ? message.state : $root.google.cloud.backupdr.v1.BackupConfigDetails.State[message.state] : message.state; + if (message.pitrSettings != null && message.hasOwnProperty("pitrSettings")) + object.pitrSettings = $root.google.cloud.backupdr.v1.PitrSettings.toObject(message.pitrSettings, options); + if (message.latestSuccessfulBackupTime != null && message.hasOwnProperty("latestSuccessfulBackupTime")) + object.latestSuccessfulBackupTime = $root.google.protobuf.Timestamp.toObject(message.latestSuccessfulBackupTime, options); + if (message.applicableResource != null && message.hasOwnProperty("applicableResource")) + object.applicableResource = message.applicableResource; + if (message.backupVault != null && message.hasOwnProperty("backupVault")) + object.backupVault = message.backupVault; + if (message.backupDrPlanConfig != null && message.hasOwnProperty("backupDrPlanConfig")) { + object.backupDrPlanConfig = $root.google.cloud.backupdr.v1.BackupDrPlanConfig.toObject(message.backupDrPlanConfig, options); + if (options.oneofs) + object.planSpecificConfig = "backupDrPlanConfig"; + } + if (message.backupDrTemplateConfig != null && message.hasOwnProperty("backupDrTemplateConfig")) { + object.backupDrTemplateConfig = $root.google.cloud.backupdr.v1.BackupDrTemplateConfig.toObject(message.backupDrTemplateConfig, options); + if (options.oneofs) + object.planSpecificConfig = "backupDrTemplateConfig"; + } + if (message.backupLocations && message.backupLocations.length) { + object.backupLocations = []; + for (var j = 0; j < message.backupLocations.length; ++j) + object.backupLocations[j] = $root.google.cloud.backupdr.v1.BackupLocation.toObject(message.backupLocations[j], options); + } + return object; + }; + + /** + * Converts this BackupConfigDetails to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @instance + * @returns {Object.} JSON object + */ + BackupConfigDetails.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupConfigDetails + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.BackupConfigDetails + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupConfigDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.BackupConfigDetails"; + }; + + /** + * Type enum. + * @name google.cloud.backupdr.v1.BackupConfigDetails.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} CLOUD_SQL_INSTANCE_BACKUP_CONFIG=1 CLOUD_SQL_INSTANCE_BACKUP_CONFIG value + * @property {number} COMPUTE_ENGINE_RESOURCE_POLICY=2 COMPUTE_ENGINE_RESOURCE_POLICY value + * @property {number} BACKUPDR_BACKUP_PLAN=3 BACKUPDR_BACKUP_PLAN value + * @property {number} BACKUPDR_TEMPLATE=4 BACKUPDR_TEMPLATE value + */ + BackupConfigDetails.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD_SQL_INSTANCE_BACKUP_CONFIG"] = 1; + values[valuesById[2] = "COMPUTE_ENGINE_RESOURCE_POLICY"] = 2; + values[valuesById[3] = "BACKUPDR_BACKUP_PLAN"] = 3; + values[valuesById[4] = "BACKUPDR_TEMPLATE"] = 4; + return values; + })(); + + /** + * State enum. + * @name google.cloud.backupdr.v1.BackupConfigDetails.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} INACTIVE=2 INACTIVE value + * @property {number} ERROR=3 ERROR value + */ + BackupConfigDetails.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "INACTIVE"] = 2; + values[valuesById[3] = "ERROR"] = 3; + return values; + })(); + + return BackupConfigDetails; + })(); + + v1.PitrSettings = (function() { + + /** + * Properties of a PitrSettings. + * @memberof google.cloud.backupdr.v1 + * @interface IPitrSettings + * @property {number|null} [retentionDays] PitrSettings retentionDays + */ + + /** + * Constructs a new PitrSettings. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a PitrSettings. + * @implements IPitrSettings + * @constructor + * @param {google.cloud.backupdr.v1.IPitrSettings=} [properties] Properties to set + */ + function PitrSettings(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]]; + } + + /** + * PitrSettings retentionDays. + * @member {number} retentionDays + * @memberof google.cloud.backupdr.v1.PitrSettings + * @instance + */ + PitrSettings.prototype.retentionDays = 0; + + /** + * Creates a new PitrSettings instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {google.cloud.backupdr.v1.IPitrSettings=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.PitrSettings} PitrSettings instance + */ + PitrSettings.create = function create(properties) { + return new PitrSettings(properties); + }; + + /** + * Encodes the specified PitrSettings message. Does not implicitly {@link google.cloud.backupdr.v1.PitrSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {google.cloud.backupdr.v1.IPitrSettings} message PitrSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PitrSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.retentionDays != null && Object.hasOwnProperty.call(message, "retentionDays")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.retentionDays); + return writer; + }; + + /** + * Encodes the specified PitrSettings message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.PitrSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {google.cloud.backupdr.v1.IPitrSettings} message PitrSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PitrSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PitrSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.PitrSettings} PitrSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PitrSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.PitrSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.retentionDays = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PitrSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.PitrSettings} PitrSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PitrSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PitrSettings message. + * @function verify + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PitrSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) + if (!$util.isInteger(message.retentionDays)) + return "retentionDays: integer expected"; + return null; + }; + + /** + * Creates a PitrSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.PitrSettings} PitrSettings + */ + PitrSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.PitrSettings) + return object; + var message = new $root.google.cloud.backupdr.v1.PitrSettings(); + if (object.retentionDays != null) + message.retentionDays = object.retentionDays | 0; + return message; + }; + + /** + * Creates a plain object from a PitrSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {google.cloud.backupdr.v1.PitrSettings} message PitrSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PitrSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.retentionDays = 0; + if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) + object.retentionDays = message.retentionDays; + return object; + }; + + /** + * Converts this PitrSettings to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.PitrSettings + * @instance + * @returns {Object.} JSON object + */ + PitrSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PitrSettings + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.PitrSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PitrSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.PitrSettings"; + }; + + return PitrSettings; + })(); + + v1.BackupDrTemplateConfig = (function() { + + /** + * Properties of a BackupDrTemplateConfig. + * @memberof google.cloud.backupdr.v1 + * @interface IBackupDrTemplateConfig + * @property {string|null} [firstPartyManagementUri] BackupDrTemplateConfig firstPartyManagementUri + * @property {string|null} [thirdPartyManagementUri] BackupDrTemplateConfig thirdPartyManagementUri + */ + + /** + * Constructs a new BackupDrTemplateConfig. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a BackupDrTemplateConfig. + * @implements IBackupDrTemplateConfig + * @constructor + * @param {google.cloud.backupdr.v1.IBackupDrTemplateConfig=} [properties] Properties to set + */ + function BackupDrTemplateConfig(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]]; + } + + /** + * BackupDrTemplateConfig firstPartyManagementUri. + * @member {string} firstPartyManagementUri + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @instance + */ + BackupDrTemplateConfig.prototype.firstPartyManagementUri = ""; + + /** + * BackupDrTemplateConfig thirdPartyManagementUri. + * @member {string} thirdPartyManagementUri + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @instance + */ + BackupDrTemplateConfig.prototype.thirdPartyManagementUri = ""; + + /** + * Creates a new BackupDrTemplateConfig instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {google.cloud.backupdr.v1.IBackupDrTemplateConfig=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.BackupDrTemplateConfig} BackupDrTemplateConfig instance + */ + BackupDrTemplateConfig.create = function create(properties) { + return new BackupDrTemplateConfig(properties); + }; + + /** + * Encodes the specified BackupDrTemplateConfig message. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrTemplateConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {google.cloud.backupdr.v1.IBackupDrTemplateConfig} message BackupDrTemplateConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupDrTemplateConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.firstPartyManagementUri != null && Object.hasOwnProperty.call(message, "firstPartyManagementUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.firstPartyManagementUri); + if (message.thirdPartyManagementUri != null && Object.hasOwnProperty.call(message, "thirdPartyManagementUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.thirdPartyManagementUri); + return writer; + }; + + /** + * Encodes the specified BackupDrTemplateConfig message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrTemplateConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {google.cloud.backupdr.v1.IBackupDrTemplateConfig} message BackupDrTemplateConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupDrTemplateConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupDrTemplateConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.BackupDrTemplateConfig} BackupDrTemplateConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupDrTemplateConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.BackupDrTemplateConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.firstPartyManagementUri = reader.string(); + break; + } + case 2: { + message.thirdPartyManagementUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupDrTemplateConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.BackupDrTemplateConfig} BackupDrTemplateConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupDrTemplateConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupDrTemplateConfig message. + * @function verify + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupDrTemplateConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.firstPartyManagementUri != null && message.hasOwnProperty("firstPartyManagementUri")) + if (!$util.isString(message.firstPartyManagementUri)) + return "firstPartyManagementUri: string expected"; + if (message.thirdPartyManagementUri != null && message.hasOwnProperty("thirdPartyManagementUri")) + if (!$util.isString(message.thirdPartyManagementUri)) + return "thirdPartyManagementUri: string expected"; + return null; + }; + + /** + * Creates a BackupDrTemplateConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.BackupDrTemplateConfig} BackupDrTemplateConfig + */ + BackupDrTemplateConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.BackupDrTemplateConfig) + return object; + var message = new $root.google.cloud.backupdr.v1.BackupDrTemplateConfig(); + if (object.firstPartyManagementUri != null) + message.firstPartyManagementUri = String(object.firstPartyManagementUri); + if (object.thirdPartyManagementUri != null) + message.thirdPartyManagementUri = String(object.thirdPartyManagementUri); + return message; + }; + + /** + * Creates a plain object from a BackupDrTemplateConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {google.cloud.backupdr.v1.BackupDrTemplateConfig} message BackupDrTemplateConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupDrTemplateConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.firstPartyManagementUri = ""; + object.thirdPartyManagementUri = ""; + } + if (message.firstPartyManagementUri != null && message.hasOwnProperty("firstPartyManagementUri")) + object.firstPartyManagementUri = message.firstPartyManagementUri; + if (message.thirdPartyManagementUri != null && message.hasOwnProperty("thirdPartyManagementUri")) + object.thirdPartyManagementUri = message.thirdPartyManagementUri; + return object; + }; + + /** + * Converts this BackupDrTemplateConfig to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @instance + * @returns {Object.} JSON object + */ + BackupDrTemplateConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupDrTemplateConfig + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.BackupDrTemplateConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupDrTemplateConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.BackupDrTemplateConfig"; + }; + + return BackupDrTemplateConfig; + })(); + + v1.BackupDrPlanConfig = (function() { + + /** + * Properties of a BackupDrPlanConfig. + * @memberof google.cloud.backupdr.v1 + * @interface IBackupDrPlanConfig + * @property {Array.|null} [backupDrPlanRules] BackupDrPlanConfig backupDrPlanRules + */ + + /** + * Constructs a new BackupDrPlanConfig. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a BackupDrPlanConfig. + * @implements IBackupDrPlanConfig + * @constructor + * @param {google.cloud.backupdr.v1.IBackupDrPlanConfig=} [properties] Properties to set + */ + function BackupDrPlanConfig(properties) { + this.backupDrPlanRules = []; + 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]]; + } + + /** + * BackupDrPlanConfig backupDrPlanRules. + * @member {Array.} backupDrPlanRules + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @instance + */ + BackupDrPlanConfig.prototype.backupDrPlanRules = $util.emptyArray; + + /** + * Creates a new BackupDrPlanConfig instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {google.cloud.backupdr.v1.IBackupDrPlanConfig=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.BackupDrPlanConfig} BackupDrPlanConfig instance + */ + BackupDrPlanConfig.create = function create(properties) { + return new BackupDrPlanConfig(properties); + }; + + /** + * Encodes the specified BackupDrPlanConfig message. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrPlanConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {google.cloud.backupdr.v1.IBackupDrPlanConfig} message BackupDrPlanConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupDrPlanConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupDrPlanRules != null && message.backupDrPlanRules.length) + for (var i = 0; i < message.backupDrPlanRules.length; ++i) + $root.google.cloud.backupdr.v1.BackupDrPlanRule.encode(message.backupDrPlanRules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BackupDrPlanConfig message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrPlanConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {google.cloud.backupdr.v1.IBackupDrPlanConfig} message BackupDrPlanConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupDrPlanConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupDrPlanConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.BackupDrPlanConfig} BackupDrPlanConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupDrPlanConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.BackupDrPlanConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.backupDrPlanRules && message.backupDrPlanRules.length)) + message.backupDrPlanRules = []; + message.backupDrPlanRules.push($root.google.cloud.backupdr.v1.BackupDrPlanRule.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupDrPlanConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.BackupDrPlanConfig} BackupDrPlanConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupDrPlanConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupDrPlanConfig message. + * @function verify + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupDrPlanConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backupDrPlanRules != null && message.hasOwnProperty("backupDrPlanRules")) { + if (!Array.isArray(message.backupDrPlanRules)) + return "backupDrPlanRules: array expected"; + for (var i = 0; i < message.backupDrPlanRules.length; ++i) { + var error = $root.google.cloud.backupdr.v1.BackupDrPlanRule.verify(message.backupDrPlanRules[i]); + if (error) + return "backupDrPlanRules." + error; + } + } + return null; + }; + + /** + * Creates a BackupDrPlanConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.BackupDrPlanConfig} BackupDrPlanConfig + */ + BackupDrPlanConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.BackupDrPlanConfig) + return object; + var message = new $root.google.cloud.backupdr.v1.BackupDrPlanConfig(); + if (object.backupDrPlanRules) { + if (!Array.isArray(object.backupDrPlanRules)) + throw TypeError(".google.cloud.backupdr.v1.BackupDrPlanConfig.backupDrPlanRules: array expected"); + message.backupDrPlanRules = []; + for (var i = 0; i < object.backupDrPlanRules.length; ++i) { + if (typeof object.backupDrPlanRules[i] !== "object") + throw TypeError(".google.cloud.backupdr.v1.BackupDrPlanConfig.backupDrPlanRules: object expected"); + message.backupDrPlanRules[i] = $root.google.cloud.backupdr.v1.BackupDrPlanRule.fromObject(object.backupDrPlanRules[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BackupDrPlanConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {google.cloud.backupdr.v1.BackupDrPlanConfig} message BackupDrPlanConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupDrPlanConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.backupDrPlanRules = []; + if (message.backupDrPlanRules && message.backupDrPlanRules.length) { + object.backupDrPlanRules = []; + for (var j = 0; j < message.backupDrPlanRules.length; ++j) + object.backupDrPlanRules[j] = $root.google.cloud.backupdr.v1.BackupDrPlanRule.toObject(message.backupDrPlanRules[j], options); + } + return object; + }; + + /** + * Converts this BackupDrPlanConfig to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @instance + * @returns {Object.} JSON object + */ + BackupDrPlanConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupDrPlanConfig + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.BackupDrPlanConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupDrPlanConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.BackupDrPlanConfig"; + }; + + return BackupDrPlanConfig; + })(); + + v1.BackupDrPlanRule = (function() { + + /** + * Properties of a BackupDrPlanRule. + * @memberof google.cloud.backupdr.v1 + * @interface IBackupDrPlanRule + * @property {string|null} [ruleId] BackupDrPlanRule ruleId + * @property {google.protobuf.ITimestamp|null} [lastSuccessfulBackupTime] BackupDrPlanRule lastSuccessfulBackupTime + */ + + /** + * Constructs a new BackupDrPlanRule. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a BackupDrPlanRule. + * @implements IBackupDrPlanRule + * @constructor + * @param {google.cloud.backupdr.v1.IBackupDrPlanRule=} [properties] Properties to set + */ + function BackupDrPlanRule(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]]; + } + + /** + * BackupDrPlanRule ruleId. + * @member {string} ruleId + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @instance + */ + BackupDrPlanRule.prototype.ruleId = ""; + + /** + * BackupDrPlanRule lastSuccessfulBackupTime. + * @member {google.protobuf.ITimestamp|null|undefined} lastSuccessfulBackupTime + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @instance + */ + BackupDrPlanRule.prototype.lastSuccessfulBackupTime = null; + + /** + * Creates a new BackupDrPlanRule instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {google.cloud.backupdr.v1.IBackupDrPlanRule=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.BackupDrPlanRule} BackupDrPlanRule instance + */ + BackupDrPlanRule.create = function create(properties) { + return new BackupDrPlanRule(properties); + }; + + /** + * Encodes the specified BackupDrPlanRule message. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrPlanRule.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {google.cloud.backupdr.v1.IBackupDrPlanRule} message BackupDrPlanRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupDrPlanRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ruleId != null && Object.hasOwnProperty.call(message, "ruleId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.ruleId); + if (message.lastSuccessfulBackupTime != null && Object.hasOwnProperty.call(message, "lastSuccessfulBackupTime")) + $root.google.protobuf.Timestamp.encode(message.lastSuccessfulBackupTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BackupDrPlanRule message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupDrPlanRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {google.cloud.backupdr.v1.IBackupDrPlanRule} message BackupDrPlanRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupDrPlanRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupDrPlanRule message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.BackupDrPlanRule} BackupDrPlanRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupDrPlanRule.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.BackupDrPlanRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ruleId = reader.string(); + break; + } + case 2: { + message.lastSuccessfulBackupTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupDrPlanRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.BackupDrPlanRule} BackupDrPlanRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupDrPlanRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupDrPlanRule message. + * @function verify + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupDrPlanRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ruleId != null && message.hasOwnProperty("ruleId")) + if (!$util.isString(message.ruleId)) + return "ruleId: string expected"; + if (message.lastSuccessfulBackupTime != null && message.hasOwnProperty("lastSuccessfulBackupTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.lastSuccessfulBackupTime); + if (error) + return "lastSuccessfulBackupTime." + error; + } + return null; + }; + + /** + * Creates a BackupDrPlanRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.BackupDrPlanRule} BackupDrPlanRule + */ + BackupDrPlanRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.BackupDrPlanRule) + return object; + var message = new $root.google.cloud.backupdr.v1.BackupDrPlanRule(); + if (object.ruleId != null) + message.ruleId = String(object.ruleId); + if (object.lastSuccessfulBackupTime != null) { + if (typeof object.lastSuccessfulBackupTime !== "object") + throw TypeError(".google.cloud.backupdr.v1.BackupDrPlanRule.lastSuccessfulBackupTime: object expected"); + message.lastSuccessfulBackupTime = $root.google.protobuf.Timestamp.fromObject(object.lastSuccessfulBackupTime); + } + return message; + }; + + /** + * Creates a plain object from a BackupDrPlanRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {google.cloud.backupdr.v1.BackupDrPlanRule} message BackupDrPlanRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupDrPlanRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ruleId = ""; + object.lastSuccessfulBackupTime = null; + } + if (message.ruleId != null && message.hasOwnProperty("ruleId")) + object.ruleId = message.ruleId; + if (message.lastSuccessfulBackupTime != null && message.hasOwnProperty("lastSuccessfulBackupTime")) + object.lastSuccessfulBackupTime = $root.google.protobuf.Timestamp.toObject(message.lastSuccessfulBackupTime, options); + return object; + }; + + /** + * Converts this BackupDrPlanRule to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @instance + * @returns {Object.} JSON object + */ + BackupDrPlanRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupDrPlanRule + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.BackupDrPlanRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupDrPlanRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.BackupDrPlanRule"; + }; + + return BackupDrPlanRule; + })(); + + v1.BackupLocation = (function() { + + /** + * Properties of a BackupLocation. + * @memberof google.cloud.backupdr.v1 + * @interface IBackupLocation + * @property {google.cloud.backupdr.v1.BackupLocation.Type|null} [type] BackupLocation type + * @property {string|null} [locationId] BackupLocation locationId + */ + + /** + * Constructs a new BackupLocation. + * @memberof google.cloud.backupdr.v1 + * @classdesc Represents a BackupLocation. + * @implements IBackupLocation + * @constructor + * @param {google.cloud.backupdr.v1.IBackupLocation=} [properties] Properties to set + */ + function BackupLocation(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]]; + } + + /** + * BackupLocation type. + * @member {google.cloud.backupdr.v1.BackupLocation.Type} type + * @memberof google.cloud.backupdr.v1.BackupLocation + * @instance + */ + BackupLocation.prototype.type = 0; + + /** + * BackupLocation locationId. + * @member {string} locationId + * @memberof google.cloud.backupdr.v1.BackupLocation + * @instance + */ + BackupLocation.prototype.locationId = ""; + + /** + * Creates a new BackupLocation instance using the specified properties. + * @function create + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {google.cloud.backupdr.v1.IBackupLocation=} [properties] Properties to set + * @returns {google.cloud.backupdr.v1.BackupLocation} BackupLocation instance + */ + BackupLocation.create = function create(properties) { + return new BackupLocation(properties); + }; + + /** + * Encodes the specified BackupLocation message. Does not implicitly {@link google.cloud.backupdr.v1.BackupLocation.verify|verify} messages. + * @function encode + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {google.cloud.backupdr.v1.IBackupLocation} message BackupLocation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupLocation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.locationId != null && Object.hasOwnProperty.call(message, "locationId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.locationId); + return writer; + }; + + /** + * Encodes the specified BackupLocation message, length delimited. Does not implicitly {@link google.cloud.backupdr.v1.BackupLocation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {google.cloud.backupdr.v1.IBackupLocation} message BackupLocation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupLocation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupLocation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.backupdr.v1.BackupLocation} BackupLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupLocation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.backupdr.v1.BackupLocation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.int32(); + break; + } + case 2: { + message.locationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupLocation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.backupdr.v1.BackupLocation} BackupLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupLocation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupLocation message. + * @function verify + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupLocation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.locationId != null && message.hasOwnProperty("locationId")) + if (!$util.isString(message.locationId)) + return "locationId: string expected"; + return null; + }; + + /** + * Creates a BackupLocation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.backupdr.v1.BackupLocation} BackupLocation + */ + BackupLocation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.backupdr.v1.BackupLocation) + return object; + var message = new $root.google.cloud.backupdr.v1.BackupLocation(); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "ZONAL": + case 1: + message.type = 1; + break; + case "REGIONAL": + case 2: + message.type = 2; + break; + case "MULTI_REGIONAL": + case 3: + message.type = 3; + break; + } + if (object.locationId != null) + message.locationId = String(object.locationId); + return message; + }; + + /** + * Creates a plain object from a BackupLocation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {google.cloud.backupdr.v1.BackupLocation} message BackupLocation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupLocation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.locationId = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.backupdr.v1.BackupLocation.Type[message.type] === undefined ? message.type : $root.google.cloud.backupdr.v1.BackupLocation.Type[message.type] : message.type; + if (message.locationId != null && message.hasOwnProperty("locationId")) + object.locationId = message.locationId; + return object; + }; + + /** + * Converts this BackupLocation to JSON. + * @function toJSON + * @memberof google.cloud.backupdr.v1.BackupLocation + * @instance + * @returns {Object.} JSON object + */ + BackupLocation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupLocation + * @function getTypeUrl + * @memberof google.cloud.backupdr.v1.BackupLocation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupLocation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.backupdr.v1.BackupLocation"; + }; + + /** + * Type enum. + * @name google.cloud.backupdr.v1.BackupLocation.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} ZONAL=1 ZONAL value + * @property {number} REGIONAL=2 REGIONAL value + * @property {number} MULTI_REGIONAL=3 MULTI_REGIONAL value + */ + BackupLocation.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ZONAL"] = 1; + values[valuesById[2] = "REGIONAL"] = 2; + values[valuesById[3] = "MULTI_REGIONAL"] = 3; + return values; + })(); + + return BackupLocation; + })(); + return v1; })(); diff --git a/packages/google-cloud-backupdr/protos/protos.json b/packages/google-cloud-backupdr/protos/protos.json index ad1b78a1c71..44ce9ef7529 100644 --- a/packages/google-cloud-backupdr/protos/protos.json +++ b/packages/google-cloud-backupdr/protos/protos.json @@ -11,7 +11,7 @@ "csharp_namespace": "Google.Cloud.BackupDR.V1", "go_package": "cloud.google.com/go/backupdr/apiv1/backupdrpb;backupdrpb", "java_multiple_files": true, - "java_outer_classname": "DataSourceReferenceProto", + "java_outer_classname": "ProtectionSummaryProto", "java_package": "com.google.cloud.backupdr.v1", "php_namespace": "Google\\Cloud\\BackupDR\\V1", "ruby_package": "Google::Cloud::BackupDR::V1", @@ -6550,6 +6550,350 @@ "id": 2 } } + }, + "BackupDrProtectionSummary": { + "options": { + "(google.api.default_host)": "backupdr.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListResourceBackupConfigs": { + "requestType": "ListResourceBackupConfigsRequest", + "responseType": "ListResourceBackupConfigsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/resourceBackupConfigs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/resourceBackupConfigs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "ListResourceBackupConfigsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "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" + } + } + } + }, + "ListResourceBackupConfigsResponse": { + "fields": { + "resourceBackupConfigs": { + "rule": "repeated", + "type": "ResourceBackupConfig", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ResourceBackupConfig": { + "options": { + "(google.api.resource).type": "backupdr.googleapis.com/ResourceBackupConfig", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/resourceBackupConfigs/{resource_backup_config}", + "(google.api.resource).plural": "resourceBackupConfigs", + "(google.api.resource).singular": "resourceBackupConfig" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "uid": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_info).format": "UUID4", + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "targetResource": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "targetResourceDisplayName": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "targetResourceType": { + "type": "ResourceType", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "targetResourceLabels": { + "keyType": "string", + "type": "string", + "id": 6 + }, + "backupConfigsDetails": { + "rule": "repeated", + "type": "BackupConfigDetails", + "id": 7 + }, + "backupConfigured": { + "type": "bool", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "vaulted": { + "type": "bool", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "ResourceType": { + "values": { + "RESOURCE_TYPE_UNSPECIFIED": 0, + "CLOUD_SQL_INSTANCE": 1, + "COMPUTE_ENGINE_VM": 2, + "COMPUTE_ENGINE_DISK": 3, + "COMPUTE_ENGINE_REGIONAL_DISK": 4 + } + } + } + }, + "BackupConfigDetails": { + "oneofs": { + "planSpecificConfig": { + "oneof": [ + "backupDrPlanConfig", + "backupDrTemplateConfig" + ] + } + }, + "fields": { + "backupConfigSource": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "backupConfigSourceDisplayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "type": { + "type": "Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "State", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "pitrSettings": { + "type": "PitrSettings", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "latestSuccessfulBackupTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "applicableResource": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "backupVault": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "backupLocations": { + "rule": "repeated", + "type": "BackupLocation", + "id": 12 + }, + "backupDrPlanConfig": { + "type": "BackupDrPlanConfig", + "id": 10 + }, + "backupDrTemplateConfig": { + "type": "BackupDrTemplateConfig", + "id": 11 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "CLOUD_SQL_INSTANCE_BACKUP_CONFIG": 1, + "COMPUTE_ENGINE_RESOURCE_POLICY": 2, + "BACKUPDR_BACKUP_PLAN": 3, + "BACKUPDR_TEMPLATE": 4 + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "INACTIVE": 2, + "ERROR": 3 + } + } + } + }, + "PitrSettings": { + "fields": { + "retentionDays": { + "type": "int32", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "BackupDrTemplateConfig": { + "fields": { + "firstPartyManagementUri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "thirdPartyManagementUri": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "BackupDrPlanConfig": { + "fields": { + "backupDrPlanRules": { + "rule": "repeated", + "type": "BackupDrPlanRule", + "id": 1 + } + } + }, + "BackupDrPlanRule": { + "fields": { + "ruleId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lastSuccessfulBackupTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "BackupLocation": { + "fields": { + "type": { + "type": "Type", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "locationId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "ZONAL": 1, + "REGIONAL": 2, + "MULTI_REGIONAL": 3 + } + } + } } } } diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_plan.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_plan.js index 34422f5ac48..744efb47244 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_plan.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_plan.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_plan_association.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_plan_association.js index a74b80de6f7..71be228e09e 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_plan_association.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_plan_association.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_vault.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_vault.js index 923ca067d04..aa8fe7e1485 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_vault.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_backup_vault.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_management_server.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_management_server.js index 23f73ab5e2f..19d882e52e5 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_management_server.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.create_management_server.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup.js index a480d8a31bd..dc9bee40a34 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_plan.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_plan.js index 7c23ff0b23a..70a490a5b4b 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_plan.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_plan.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_plan_association.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_plan_association.js index 14e7b0d4fa2..70e1ca0efc2 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_plan_association.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_plan_association.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_vault.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_vault.js index fdaace6b914..6a3e236ab2c 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_vault.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_backup_vault.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_management_server.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_management_server.js index ec29bc7662d..c7a17945e6b 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_management_server.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.delete_management_server.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_backup_plan_associations_for_resource_type.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_backup_plan_associations_for_resource_type.js index 49101edc88d..eb9ebd76fe4 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_backup_plan_associations_for_resource_type.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_backup_plan_associations_for_resource_type.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_backups_for_resource_type.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_backups_for_resource_type.js index 9306acf839c..83d92447b52 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_backups_for_resource_type.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_backups_for_resource_type.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_data_source_references_for_resource_type.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_data_source_references_for_resource_type.js index 1eed5c7fbb1..ba8227643a3 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_data_source_references_for_resource_type.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_data_source_references_for_resource_type.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_usable_backup_vaults.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_usable_backup_vaults.js index dd8f9c2dcc0..5bfda0bb76d 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_usable_backup_vaults.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.fetch_usable_backup_vaults.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup.js index 95703087caa..1db664e9c80 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan.js index e2e4a2bdb7c..cd367d4a1ce 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan_association.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan_association.js index 5eedcbc578a..d79ba972be0 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan_association.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan_association.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan_revision.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan_revision.js index 7385373d46c..7b00b5c17df 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan_revision.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_plan_revision.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_vault.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_vault.js index 2538adfbc95..14fdb5572ad 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_vault.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_backup_vault.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_data_source.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_data_source.js index 59d79e6723d..b6be2c0fe07 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_data_source.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_data_source.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_data_source_reference.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_data_source_reference.js index 7883c3b750c..8bcb3f16254 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_data_source_reference.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_data_source_reference.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_management_server.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_management_server.js index b562e39a2a3..03e80ac1640 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_management_server.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.get_management_server.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.initialize_service.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.initialize_service.js index 705e463ce3c..55c53e70194 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.initialize_service.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.initialize_service.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plan_associations.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plan_associations.js index 6fe29bc8480..3b8a476c2b0 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plan_associations.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plan_associations.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plan_revisions.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plan_revisions.js index d08353dd840..2fcc7d36b5b 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plan_revisions.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plan_revisions.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plans.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plans.js index 29b6515587c..3be463bf2e7 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plans.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_plans.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_vaults.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_vaults.js index dfcb8cd5288..e1bb4508c4e 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_vaults.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backup_vaults.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backups.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backups.js index 677db55a76f..b2736b060b3 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backups.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_backups.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_data_source_references.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_data_source_references.js index 94a13d6c9ad..c84c7594aa3 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_data_source_references.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_data_source_references.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_data_sources.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_data_sources.js index 7d90b0c58f8..e27878ed103 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_data_sources.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_data_sources.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_management_servers.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_management_servers.js index 1d98e7b7f88..90c999155be 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_management_servers.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.list_management_servers.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.restore_backup.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.restore_backup.js index 2ab1df9ec14..26250028fd3 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.restore_backup.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.restore_backup.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.trigger_backup.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.trigger_backup.js index 828beeb5072..b8c0ade8a11 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.trigger_backup.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.trigger_backup.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup.js index 1164041efa2..80cb7a400e7 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan.js index 3f34d5289ba..45ee6f6baae 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan_association.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan_association.js index f5fd25f1043..cb6d94b74b1 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan_association.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_plan_association.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_vault.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_vault.js index 6b4b90e509a..cf8aba9e2b3 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_vault.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_backup_vault.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_data_source.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_data_source.js index 609fcfa4098..23861e49849 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_data_source.js +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_d_r.update_data_source.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/samples/generated/v1/backup_dr_protection_summary.list_resource_backup_configs.js b/packages/google-cloud-backupdr/samples/generated/v1/backup_dr_protection_summary.list_resource_backup_configs.js new file mode 100644 index 00000000000..60a264503ce --- /dev/null +++ b/packages/google-cloud-backupdr/samples/generated/v1/backup_dr_protection_summary.list_resource_backup_configs.js @@ -0,0 +1,84 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START backupdr_v1_generated_BackupDrProtectionSummary_ListResourceBackupConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project and location for which to retrieve resource backup + * configs. Format: 'projects/{project_id}/locations/{location}'. In Google + * Cloud Backup and DR, locations map to Google Cloud regions, for example + * **us-central1**. + */ + // const parent = 'abc123' + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will use 100 as default. Maximum value is + * 500 and values above 500 will be coerced to 500. + */ + // const pageSize = 1234 + /** + * Optional. A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Optional. Filtering results. + */ + // const filter = 'abc123' + /** + * Optional. Hint for how to order the results. + */ + // const orderBy = 'abc123' + + // Imports the Backupdr library + const {BackupDrProtectionSummaryClient} = require('@google-cloud/backupdr').v1; + + // Instantiates a client + const backupdrClient = new BackupDrProtectionSummaryClient(); + + async function callListResourceBackupConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = backupdrClient.listResourceBackupConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListResourceBackupConfigs(); + // [END backupdr_v1_generated_BackupDrProtectionSummary_ListResourceBackupConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-backupdr/samples/generated/v1/snippet_metadata_google.cloud.backupdr.v1.json b/packages/google-cloud-backupdr/samples/generated/v1/snippet_metadata_google.cloud.backupdr.v1.json index 38a5feace79..e5916e1c98e 100644 --- a/packages/google-cloud-backupdr/samples/generated/v1/snippet_metadata_google.cloud.backupdr.v1.json +++ b/packages/google-cloud-backupdr/samples/generated/v1/snippet_metadata_google.cloud.backupdr.v1.json @@ -1898,6 +1898,62 @@ } } } + }, + { + "regionTag": "backupdr_v1_generated_BackupDrProtectionSummary_ListResourceBackupConfigs_async", + "title": "BackupDR listResourceBackupConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists ResourceBackupConfigs.", + "canonical": true, + "file": "backup_dr_protection_summary.list_resource_backup_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListResourceBackupConfigs", + "fullName": "google.cloud.backupdr.v1.BackupDrProtectionSummary.ListResourceBackupConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.backupdr.v1.ListResourceBackupConfigsResponse", + "client": { + "shortName": "BackupDrProtectionSummaryClient", + "fullName": "google.cloud.backupdr.v1.BackupDrProtectionSummaryClient" + }, + "method": { + "shortName": "ListResourceBackupConfigs", + "fullName": "google.cloud.backupdr.v1.BackupDrProtectionSummary.ListResourceBackupConfigs", + "service": { + "shortName": "BackupDrProtectionSummary", + "fullName": "google.cloud.backupdr.v1.BackupDrProtectionSummary" + } + } + } } ] } diff --git a/packages/google-cloud-backupdr/src/index.ts b/packages/google-cloud-backupdr/src/index.ts index 38633481fbb..5bc8aa0b7be 100644 --- a/packages/google-cloud-backupdr/src/index.ts +++ b/packages/google-cloud-backupdr/src/index.ts @@ -20,8 +20,10 @@ import * as v1 from './v1'; const BackupDRClient = v1.BackupDRClient; type BackupDRClient = v1.BackupDRClient; +const BackupDrProtectionSummaryClient = v1.BackupDrProtectionSummaryClient; +type BackupDrProtectionSummaryClient = v1.BackupDrProtectionSummaryClient; -export {v1, BackupDRClient}; -export default {v1, BackupDRClient}; +export {v1, BackupDRClient, BackupDrProtectionSummaryClient}; +export default {v1, BackupDRClient, BackupDrProtectionSummaryClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-backupdr/src/v1/backup_d_r_client.ts b/packages/google-cloud-backupdr/src/v1/backup_d_r_client.ts index 7f2b6f2e8a2..2dda6fe7907 100644 --- a/packages/google-cloud-backupdr/src/v1/backup_d_r_client.ts +++ b/packages/google-cloud-backupdr/src/v1/backup_d_r_client.ts @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -217,6 +217,9 @@ export class BackupDRClient { projectPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}' ), + resourceBackupConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/resourceBackupConfigs/{resource_backup_config}' + ), }; // Some of the methods on this service return "paged" results, @@ -7375,6 +7378,55 @@ export class BackupDRClient { return this.pathTemplates.projectPathTemplate.match(projectName).project; } + /** + * Return a fully-qualified resourceBackupConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} resource_backup_config + * @returns {string} Resource name string. + */ + resourceBackupConfigPath(project:string,location:string,resourceBackupConfig:string) { + return this.pathTemplates.resourceBackupConfigPathTemplate.render({ + project: project, + location: location, + resource_backup_config: resourceBackupConfig, + }); + } + + /** + * Parse the project from ResourceBackupConfig resource. + * + * @param {string} resourceBackupConfigName + * A fully-qualified path representing ResourceBackupConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromResourceBackupConfigName(resourceBackupConfigName: string) { + return this.pathTemplates.resourceBackupConfigPathTemplate.match(resourceBackupConfigName).project; + } + + /** + * Parse the location from ResourceBackupConfig resource. + * + * @param {string} resourceBackupConfigName + * A fully-qualified path representing ResourceBackupConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromResourceBackupConfigName(resourceBackupConfigName: string) { + return this.pathTemplates.resourceBackupConfigPathTemplate.match(resourceBackupConfigName).location; + } + + /** + * Parse the resource_backup_config from ResourceBackupConfig resource. + * + * @param {string} resourceBackupConfigName + * A fully-qualified path representing ResourceBackupConfig resource. + * @returns {string} A string representing the resource_backup_config. + */ + matchResourceBackupConfigFromResourceBackupConfigName(resourceBackupConfigName: string) { + return this.pathTemplates.resourceBackupConfigPathTemplate.match(resourceBackupConfigName).resource_backup_config; + } + /** * Terminate the gRPC channel and close the client. * diff --git a/packages/google-cloud-backupdr/src/v1/backup_d_r_proto_list.json b/packages/google-cloud-backupdr/src/v1/backup_d_r_proto_list.json index 5d07fdd2244..0a7f3ffd5b0 100644 --- a/packages/google-cloud-backupdr/src/v1/backup_d_r_proto_list.json +++ b/packages/google-cloud-backupdr/src/v1/backup_d_r_proto_list.json @@ -7,5 +7,6 @@ "../../protos/google/cloud/backupdr/v1/backupvault_cloudsql.proto", "../../protos/google/cloud/backupdr/v1/backupvault_disk.proto", "../../protos/google/cloud/backupdr/v1/backupvault_gce.proto", - "../../protos/google/cloud/backupdr/v1/datasourcereference.proto" + "../../protos/google/cloud/backupdr/v1/datasourcereference.proto", + "../../protos/google/cloud/backupdr/v1/protection_summary.proto" ] diff --git a/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_client.ts b/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_client.ts new file mode 100644 index 00000000000..cc83861c4c3 --- /dev/null +++ b/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_client.ts @@ -0,0 +1,1361 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/backup_dr_protection_summary_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './backup_dr_protection_summary_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Protection Summary service. + * @class + * @memberof v1 + */ +export class BackupDrProtectionSummaryClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('backupdr'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + backupDrProtectionSummaryStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of BackupDrProtectionSummaryClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new BackupDrProtectionSummaryClient({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 BackupDrProtectionSummaryClient; + 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 = 'backupdr.' + this._universeDomain; + const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}' + ), + backupPlanPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupPlans/{backup_plan}' + ), + backupPlanAssociationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupPlanAssociations/{backup_plan_association}' + ), + backupPlanRevisionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupPlans/{backup_plan}/revisions/{revision}' + ), + backupVaultPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupVaults/{backupvault}' + ), + dataSourcePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}' + ), + dataSourceReferencePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/dataSourceReferences/{data_source_reference}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + managementServerPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/managementServers/{managementserver}' + ), + resourceBackupConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/resourceBackupConfigs/{resource_backup_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listResourceBackupConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceBackupConfigs') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.backupdr.v1.BackupDrProtectionSummary', 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.backupDrProtectionSummaryStub) { + return this.backupDrProtectionSummaryStub; + } + + // Put together the "service stub" for + // google.cloud.backupdr.v1.BackupDrProtectionSummary. + this.backupDrProtectionSummaryStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.backupdr.v1.BackupDrProtectionSummary') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.backupdr.v1.BackupDrProtectionSummary, + 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 backupDrProtectionSummaryStubMethods = + ['listResourceBackupConfigs']; + for (const methodName of backupDrProtectionSummaryStubMethods) { + const callPromise = this.backupDrProtectionSummaryStub.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.backupDrProtectionSummaryStub; + } + + /** + * 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 'backupdr.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 'backupdr.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 -- + // ------------------- + + /** + * Lists ResourceBackupConfigs. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve resource backup + * configs. Format: 'projects/{project_id}/locations/{location}'. In Google + * Cloud Backup and DR, locations map to Google Cloud regions, for example + * **us-central1**. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will use 100 as default. Maximum value is + * 500 and values above 500 will be coerced to 500. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.backupdr.v1.ResourceBackupConfig|ResourceBackupConfig}. + * 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 `listResourceBackupConfigsAsync()` + * 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. + */ + listResourceBackupConfigs( + request?: protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.backupdr.v1.IResourceBackupConfig[], + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest|null, + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsResponse + ]>; + listResourceBackupConfigs( + request: protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsResponse|null|undefined, + protos.google.cloud.backupdr.v1.IResourceBackupConfig>): void; + listResourceBackupConfigs( + request: protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsResponse|null|undefined, + protos.google.cloud.backupdr.v1.IResourceBackupConfig>): void; + listResourceBackupConfigs( + request?: protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsResponse|null|undefined, + protos.google.cloud.backupdr.v1.IResourceBackupConfig>, + callback?: PaginationCallback< + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsResponse|null|undefined, + protos.google.cloud.backupdr.v1.IResourceBackupConfig>): + Promise<[ + protos.google.cloud.backupdr.v1.IResourceBackupConfig[], + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest|null, + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize().catch(err => {throw err}); + const wrappedCallback: PaginationCallback< + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsResponse|null|undefined, + protos.google.cloud.backupdr.v1.IResourceBackupConfig>|undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listResourceBackupConfigs values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listResourceBackupConfigs request %j', request); + return this.innerApiCalls + .listResourceBackupConfigs(request, options, wrappedCallback) + ?.then(([response, input, output]: [ + protos.google.cloud.backupdr.v1.IResourceBackupConfig[], + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest|null, + protos.google.cloud.backupdr.v1.IListResourceBackupConfigsResponse + ]) => { + this._log.info('listResourceBackupConfigs values %j', response); + return [response, input, output]; + }); + } + +/** + * Equivalent to `listResourceBackupConfigs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve resource backup + * configs. Format: 'projects/{project_id}/locations/{location}'. In Google + * Cloud Backup and DR, locations map to Google Cloud regions, for example + * **us-central1**. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will use 100 as default. Maximum value is + * 500 and values above 500 will be coerced to 500. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.backupdr.v1.ResourceBackupConfig|ResourceBackupConfig} 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 `listResourceBackupConfigsAsync()` + * 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. + */ + listResourceBackupConfigsStream( + request?: protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + 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['listResourceBackupConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listResourceBackupConfigs stream %j', request); + return this.descriptors.page.listResourceBackupConfigs.createStream( + this.innerApiCalls.listResourceBackupConfigs as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listResourceBackupConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location for which to retrieve resource backup + * configs. Format: 'projects/{project_id}/locations/{location}'. In Google + * Cloud Backup and DR, locations map to Google Cloud regions, for example + * **us-central1**. + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will use 100 as default. Maximum value is + * 500 and values above 500 will be coerced to 500. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. Filtering results. + * @param {string} [request.orderBy] + * Optional. Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.backupdr.v1.ResourceBackupConfig|ResourceBackupConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/backup_dr_protection_summary.list_resource_backup_configs.js + * region_tag:backupdr_v1_generated_BackupDrProtectionSummary_ListResourceBackupConfigs_async + */ + listResourceBackupConfigsAsync( + request?: protos.google.cloud.backupdr.v1.IListResourceBackupConfigsRequest, + 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['listResourceBackupConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listResourceBackupConfigs iterate %j', request); + return this.descriptors.page.listResourceBackupConfigs.asyncIterate( + this.innerApiCalls['listResourceBackupConfigs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.Policy]> { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backupvault + * @param {string} datasource + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project:string,location:string,backupvault:string,datasource:string,backup:string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + backupvault: backupvault, + datasource: datasource, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the backupvault from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backupvault. + */ + matchBackupvaultFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backupvault; + } + + /** + * Parse the datasource from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the datasource. + */ + matchDatasourceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).datasource; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified backupPlan resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup_plan + * @returns {string} Resource name string. + */ + backupPlanPath(project:string,location:string,backupPlan:string) { + return this.pathTemplates.backupPlanPathTemplate.render({ + project: project, + location: location, + backup_plan: backupPlan, + }); + } + + /** + * Parse the project from BackupPlan resource. + * + * @param {string} backupPlanName + * A fully-qualified path representing BackupPlan resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupPlanName(backupPlanName: string) { + return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).project; + } + + /** + * Parse the location from BackupPlan resource. + * + * @param {string} backupPlanName + * A fully-qualified path representing BackupPlan resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupPlanName(backupPlanName: string) { + return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).location; + } + + /** + * Parse the backup_plan from BackupPlan resource. + * + * @param {string} backupPlanName + * A fully-qualified path representing BackupPlan resource. + * @returns {string} A string representing the backup_plan. + */ + matchBackupPlanFromBackupPlanName(backupPlanName: string) { + return this.pathTemplates.backupPlanPathTemplate.match(backupPlanName).backup_plan; + } + + /** + * Return a fully-qualified backupPlanAssociation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup_plan_association + * @returns {string} Resource name string. + */ + backupPlanAssociationPath(project:string,location:string,backupPlanAssociation:string) { + return this.pathTemplates.backupPlanAssociationPathTemplate.render({ + project: project, + location: location, + backup_plan_association: backupPlanAssociation, + }); + } + + /** + * Parse the project from BackupPlanAssociation resource. + * + * @param {string} backupPlanAssociationName + * A fully-qualified path representing BackupPlanAssociation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupPlanAssociationName(backupPlanAssociationName: string) { + return this.pathTemplates.backupPlanAssociationPathTemplate.match(backupPlanAssociationName).project; + } + + /** + * Parse the location from BackupPlanAssociation resource. + * + * @param {string} backupPlanAssociationName + * A fully-qualified path representing BackupPlanAssociation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupPlanAssociationName(backupPlanAssociationName: string) { + return this.pathTemplates.backupPlanAssociationPathTemplate.match(backupPlanAssociationName).location; + } + + /** + * Parse the backup_plan_association from BackupPlanAssociation resource. + * + * @param {string} backupPlanAssociationName + * A fully-qualified path representing BackupPlanAssociation resource. + * @returns {string} A string representing the backup_plan_association. + */ + matchBackupPlanAssociationFromBackupPlanAssociationName(backupPlanAssociationName: string) { + return this.pathTemplates.backupPlanAssociationPathTemplate.match(backupPlanAssociationName).backup_plan_association; + } + + /** + * Return a fully-qualified backupPlanRevision resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backup_plan + * @param {string} revision + * @returns {string} Resource name string. + */ + backupPlanRevisionPath(project:string,location:string,backupPlan:string,revision:string) { + return this.pathTemplates.backupPlanRevisionPathTemplate.render({ + project: project, + location: location, + backup_plan: backupPlan, + revision: revision, + }); + } + + /** + * Parse the project from BackupPlanRevision resource. + * + * @param {string} backupPlanRevisionName + * A fully-qualified path representing BackupPlanRevision resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupPlanRevisionName(backupPlanRevisionName: string) { + return this.pathTemplates.backupPlanRevisionPathTemplate.match(backupPlanRevisionName).project; + } + + /** + * Parse the location from BackupPlanRevision resource. + * + * @param {string} backupPlanRevisionName + * A fully-qualified path representing BackupPlanRevision resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupPlanRevisionName(backupPlanRevisionName: string) { + return this.pathTemplates.backupPlanRevisionPathTemplate.match(backupPlanRevisionName).location; + } + + /** + * Parse the backup_plan from BackupPlanRevision resource. + * + * @param {string} backupPlanRevisionName + * A fully-qualified path representing BackupPlanRevision resource. + * @returns {string} A string representing the backup_plan. + */ + matchBackupPlanFromBackupPlanRevisionName(backupPlanRevisionName: string) { + return this.pathTemplates.backupPlanRevisionPathTemplate.match(backupPlanRevisionName).backup_plan; + } + + /** + * Parse the revision from BackupPlanRevision resource. + * + * @param {string} backupPlanRevisionName + * A fully-qualified path representing BackupPlanRevision resource. + * @returns {string} A string representing the revision. + */ + matchRevisionFromBackupPlanRevisionName(backupPlanRevisionName: string) { + return this.pathTemplates.backupPlanRevisionPathTemplate.match(backupPlanRevisionName).revision; + } + + /** + * Return a fully-qualified backupVault resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backupvault + * @returns {string} Resource name string. + */ + backupVaultPath(project:string,location:string,backupvault:string) { + return this.pathTemplates.backupVaultPathTemplate.render({ + project: project, + location: location, + backupvault: backupvault, + }); + } + + /** + * Parse the project from BackupVault resource. + * + * @param {string} backupVaultName + * A fully-qualified path representing BackupVault resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupVaultName(backupVaultName: string) { + return this.pathTemplates.backupVaultPathTemplate.match(backupVaultName).project; + } + + /** + * Parse the location from BackupVault resource. + * + * @param {string} backupVaultName + * A fully-qualified path representing BackupVault resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupVaultName(backupVaultName: string) { + return this.pathTemplates.backupVaultPathTemplate.match(backupVaultName).location; + } + + /** + * Parse the backupvault from BackupVault resource. + * + * @param {string} backupVaultName + * A fully-qualified path representing BackupVault resource. + * @returns {string} A string representing the backupvault. + */ + matchBackupvaultFromBackupVaultName(backupVaultName: string) { + return this.pathTemplates.backupVaultPathTemplate.match(backupVaultName).backupvault; + } + + /** + * Return a fully-qualified dataSource resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backupvault + * @param {string} datasource + * @returns {string} Resource name string. + */ + dataSourcePath(project:string,location:string,backupvault:string,datasource:string) { + return this.pathTemplates.dataSourcePathTemplate.render({ + project: project, + location: location, + backupvault: backupvault, + datasource: datasource, + }); + } + + /** + * Parse the project from DataSource resource. + * + * @param {string} dataSourceName + * A fully-qualified path representing DataSource resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDataSourceName(dataSourceName: string) { + return this.pathTemplates.dataSourcePathTemplate.match(dataSourceName).project; + } + + /** + * Parse the location from DataSource resource. + * + * @param {string} dataSourceName + * A fully-qualified path representing DataSource resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDataSourceName(dataSourceName: string) { + return this.pathTemplates.dataSourcePathTemplate.match(dataSourceName).location; + } + + /** + * Parse the backupvault from DataSource resource. + * + * @param {string} dataSourceName + * A fully-qualified path representing DataSource resource. + * @returns {string} A string representing the backupvault. + */ + matchBackupvaultFromDataSourceName(dataSourceName: string) { + return this.pathTemplates.dataSourcePathTemplate.match(dataSourceName).backupvault; + } + + /** + * Parse the datasource from DataSource resource. + * + * @param {string} dataSourceName + * A fully-qualified path representing DataSource resource. + * @returns {string} A string representing the datasource. + */ + matchDatasourceFromDataSourceName(dataSourceName: string) { + return this.pathTemplates.dataSourcePathTemplate.match(dataSourceName).datasource; + } + + /** + * Return a fully-qualified dataSourceReference resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} data_source_reference + * @returns {string} Resource name string. + */ + dataSourceReferencePath(project:string,location:string,dataSourceReference:string) { + return this.pathTemplates.dataSourceReferencePathTemplate.render({ + project: project, + location: location, + data_source_reference: dataSourceReference, + }); + } + + /** + * Parse the project from DataSourceReference resource. + * + * @param {string} dataSourceReferenceName + * A fully-qualified path representing DataSourceReference resource. + * @returns {string} A string representing the project. + */ + matchProjectFromDataSourceReferenceName(dataSourceReferenceName: string) { + return this.pathTemplates.dataSourceReferencePathTemplate.match(dataSourceReferenceName).project; + } + + /** + * Parse the location from DataSourceReference resource. + * + * @param {string} dataSourceReferenceName + * A fully-qualified path representing DataSourceReference resource. + * @returns {string} A string representing the location. + */ + matchLocationFromDataSourceReferenceName(dataSourceReferenceName: string) { + return this.pathTemplates.dataSourceReferencePathTemplate.match(dataSourceReferenceName).location; + } + + /** + * Parse the data_source_reference from DataSourceReference resource. + * + * @param {string} dataSourceReferenceName + * A fully-qualified path representing DataSourceReference resource. + * @returns {string} A string representing the data_source_reference. + */ + matchDataSourceReferenceFromDataSourceReferenceName(dataSourceReferenceName: string) { + return this.pathTemplates.dataSourceReferencePathTemplate.match(dataSourceReferenceName).data_source_reference; + } + + /** + * 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 managementServer resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} managementserver + * @returns {string} Resource name string. + */ + managementServerPath(project:string,location:string,managementserver:string) { + return this.pathTemplates.managementServerPathTemplate.render({ + project: project, + location: location, + managementserver: managementserver, + }); + } + + /** + * Parse the project from ManagementServer resource. + * + * @param {string} managementServerName + * A fully-qualified path representing ManagementServer resource. + * @returns {string} A string representing the project. + */ + matchProjectFromManagementServerName(managementServerName: string) { + return this.pathTemplates.managementServerPathTemplate.match(managementServerName).project; + } + + /** + * Parse the location from ManagementServer resource. + * + * @param {string} managementServerName + * A fully-qualified path representing ManagementServer resource. + * @returns {string} A string representing the location. + */ + matchLocationFromManagementServerName(managementServerName: string) { + return this.pathTemplates.managementServerPathTemplate.match(managementServerName).location; + } + + /** + * Parse the managementserver from ManagementServer resource. + * + * @param {string} managementServerName + * A fully-qualified path representing ManagementServer resource. + * @returns {string} A string representing the managementserver. + */ + matchManagementserverFromManagementServerName(managementServerName: string) { + return this.pathTemplates.managementServerPathTemplate.match(managementServerName).managementserver; + } + + /** + * Return a fully-qualified resourceBackupConfig resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} resource_backup_config + * @returns {string} Resource name string. + */ + resourceBackupConfigPath(project:string,location:string,resourceBackupConfig:string) { + return this.pathTemplates.resourceBackupConfigPathTemplate.render({ + project: project, + location: location, + resource_backup_config: resourceBackupConfig, + }); + } + + /** + * Parse the project from ResourceBackupConfig resource. + * + * @param {string} resourceBackupConfigName + * A fully-qualified path representing ResourceBackupConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromResourceBackupConfigName(resourceBackupConfigName: string) { + return this.pathTemplates.resourceBackupConfigPathTemplate.match(resourceBackupConfigName).project; + } + + /** + * Parse the location from ResourceBackupConfig resource. + * + * @param {string} resourceBackupConfigName + * A fully-qualified path representing ResourceBackupConfig resource. + * @returns {string} A string representing the location. + */ + matchLocationFromResourceBackupConfigName(resourceBackupConfigName: string) { + return this.pathTemplates.resourceBackupConfigPathTemplate.match(resourceBackupConfigName).location; + } + + /** + * Parse the resource_backup_config from ResourceBackupConfig resource. + * + * @param {string} resourceBackupConfigName + * A fully-qualified path representing ResourceBackupConfig resource. + * @returns {string} A string representing the resource_backup_config. + */ + matchResourceBackupConfigFromResourceBackupConfigName(resourceBackupConfigName: string) { + return this.pathTemplates.resourceBackupConfigPathTemplate.match(resourceBackupConfigName).resource_backup_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.backupDrProtectionSummaryStub && !this._terminated) { + return this.backupDrProtectionSummaryStub.then(stub => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.iamClient.close().catch(err => {throw err}); + this.locationsClient.close().catch(err => {throw err}); + }); + } + return Promise.resolve(); + } +} \ No newline at end of file diff --git a/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_client_config.json b/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_client_config.json new file mode 100644 index 00000000000..209bdd1a28f --- /dev/null +++ b/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_client_config.json @@ -0,0 +1,43 @@ +{ + "interfaces": { + "google.cloud.backupdr.v1.BackupDrProtectionSummary": { + "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": { + "ListResourceBackupConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_proto_list.json b/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_proto_list.json new file mode 100644 index 00000000000..0a7f3ffd5b0 --- /dev/null +++ b/packages/google-cloud-backupdr/src/v1/backup_dr_protection_summary_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/backupdr/v1/backupdr.proto", + "../../protos/google/cloud/backupdr/v1/backupplan.proto", + "../../protos/google/cloud/backupdr/v1/backupplanassociation.proto", + "../../protos/google/cloud/backupdr/v1/backupvault.proto", + "../../protos/google/cloud/backupdr/v1/backupvault_ba.proto", + "../../protos/google/cloud/backupdr/v1/backupvault_cloudsql.proto", + "../../protos/google/cloud/backupdr/v1/backupvault_disk.proto", + "../../protos/google/cloud/backupdr/v1/backupvault_gce.proto", + "../../protos/google/cloud/backupdr/v1/datasourcereference.proto", + "../../protos/google/cloud/backupdr/v1/protection_summary.proto" +] diff --git a/packages/google-cloud-backupdr/src/v1/gapic_metadata.json b/packages/google-cloud-backupdr/src/v1/gapic_metadata.json index 99e4f4b41c4..4d7fc4ea0bb 100644 --- a/packages/google-cloud-backupdr/src/v1/gapic_metadata.json +++ b/packages/google-cloud-backupdr/src/v1/gapic_metadata.json @@ -436,6 +436,34 @@ } } } + }, + "BackupDrProtectionSummary": { + "clients": { + "grpc": { + "libraryClient": "BackupDrProtectionSummaryClient", + "rpcs": { + "ListResourceBackupConfigs": { + "methods": [ + "listResourceBackupConfigs", + "listResourceBackupConfigsStream", + "listResourceBackupConfigsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "BackupDrProtectionSummaryClient", + "rpcs": { + "ListResourceBackupConfigs": { + "methods": [ + "listResourceBackupConfigs", + "listResourceBackupConfigsStream", + "listResourceBackupConfigsAsync" + ] + } + } + } + } } } } diff --git a/packages/google-cloud-backupdr/src/v1/index.ts b/packages/google-cloud-backupdr/src/v1/index.ts index 48638cc0789..576f9dae209 100644 --- a/packages/google-cloud-backupdr/src/v1/index.ts +++ b/packages/google-cloud-backupdr/src/v1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,3 +17,4 @@ // ** All changes to this file may be overwritten. ** export {BackupDRClient} from './backup_d_r_client'; +export {BackupDrProtectionSummaryClient} from './backup_dr_protection_summary_client'; diff --git a/packages/google-cloud-backupdr/system-test/fixtures/sample/src/index.js b/packages/google-cloud-backupdr/system-test/fixtures/sample/src/index.js index f26a63e5173..6557b418888 100644 --- a/packages/google-cloud-backupdr/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-backupdr/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ const backupdr = require('@google-cloud/backupdr'); function main() { const backupDRClient = new backupdr.BackupDRClient(); + const backupDrProtectionSummaryClient = new backupdr.BackupDrProtectionSummaryClient(); } main(); diff --git a/packages/google-cloud-backupdr/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-backupdr/system-test/fixtures/sample/src/index.ts index ebee08c8273..b0ba9f95bdf 100644 --- a/packages/google-cloud-backupdr/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-backupdr/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,17 +16,23 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {BackupDRClient} from '@google-cloud/backupdr'; +import {BackupDRClient, BackupDrProtectionSummaryClient} from '@google-cloud/backupdr'; // check that the client class type name can be used function doStuffWithBackupDRClient(client: BackupDRClient) { client.close(); } +function doStuffWithBackupDrProtectionSummaryClient(client: BackupDrProtectionSummaryClient) { + client.close(); +} function main() { // check that the client instance can be created const backupDRClient = new BackupDRClient(); doStuffWithBackupDRClient(backupDRClient); + // check that the client instance can be created + const backupDrProtectionSummaryClient = new BackupDrProtectionSummaryClient(); + doStuffWithBackupDrProtectionSummaryClient(backupDrProtectionSummaryClient); } main(); diff --git a/packages/google-cloud-backupdr/system-test/install.ts b/packages/google-cloud-backupdr/system-test/install.ts index 2a505d6df0c..394f3362d20 100644 --- a/packages/google-cloud-backupdr/system-test/install.ts +++ b/packages/google-cloud-backupdr/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-backupdr/test/gapic_backup_d_r_v1.ts b/packages/google-cloud-backupdr/test/gapic_backup_d_r_v1.ts index 985f77897d2..843d6ef43f6 100644 --- a/packages/google-cloud-backupdr/test/gapic_backup_d_r_v1.ts +++ b/packages/google-cloud-backupdr/test/gapic_backup_d_r_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -7883,5 +7883,51 @@ describe('v1.BackupDRClient', () => { .getCall(-1).calledWith(fakePath)); }); }); + + describe('resourceBackupConfig', async () => { + const fakePath = "/rendered/path/resourceBackupConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + resource_backup_config: "resourceBackupConfigValue", + }; + const client = new backupdrModule.v1.BackupDRClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.resourceBackupConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.resourceBackupConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('resourceBackupConfigPath', () => { + const result = client.resourceBackupConfigPath("projectValue", "locationValue", "resourceBackupConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.resourceBackupConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromResourceBackupConfigName', () => { + const result = client.matchProjectFromResourceBackupConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.resourceBackupConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromResourceBackupConfigName', () => { + const result = client.matchLocationFromResourceBackupConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.resourceBackupConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceBackupConfigFromResourceBackupConfigName', () => { + const result = client.matchResourceBackupConfigFromResourceBackupConfigName(fakePath); + assert.strictEqual(result, "resourceBackupConfigValue"); + assert((client.pathTemplates.resourceBackupConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); }); diff --git a/packages/google-cloud-backupdr/test/gapic_backup_dr_protection_summary_v1.ts b/packages/google-cloud-backupdr/test/gapic_backup_dr_protection_summary_v1.ts new file mode 100644 index 00000000000..503cbcd82b6 --- /dev/null +++ b/packages/google-cloud-backupdr/test/gapic_backup_dr_protection_summary_v1.ts @@ -0,0 +1,1435 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as backupdrprotectionsummaryModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// 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('v1.BackupDrProtectionSummaryClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'backupdr.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient(); + 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 = backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient.servicePath; + assert.strictEqual(servicePath, 'backupdr.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'backupdr.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({universeDomain: 'example.com'}); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'backupdr.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({universe_domain: 'example.com'}); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'backupdr.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 backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'backupdr.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 backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({universeDomain: 'configured.example.com'}); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'backupdr.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 backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + }); + + it('has port', () => { + const port = backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.backupDrProtectionSummaryStub, undefined); + await client.initialize(); + assert(client.backupDrProtectionSummaryStub); + }); + + it('has close method for the initialized client', done => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize().catch(err => {throw err}); + assert(client.backupDrProtectionSummaryStub); + client.close().then(() => { + done(); + }).catch(err => {throw err}); + }); + + it('has close method for the non-initialized client', done => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.backupDrProtectionSummaryStub, undefined); + client.close().then(() => { + done(); + }).catch(err => {throw err}); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + 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 backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + 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('listResourceBackupConfigs', () => { + it('invokes listResourceBackupConfigs without error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + ]; + client.innerApiCalls.listResourceBackupConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listResourceBackupConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listResourceBackupConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listResourceBackupConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listResourceBackupConfigs without error using callback', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + ]; + client.innerApiCalls.listResourceBackupConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listResourceBackupConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.backupdr.v1.IResourceBackupConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listResourceBackupConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listResourceBackupConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listResourceBackupConfigs with error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.listResourceBackupConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listResourceBackupConfigs(request), expectedError); + const actualRequest = (client.innerApiCalls.listResourceBackupConfigs as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listResourceBackupConfigs as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listResourceBackupConfigsStream without error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + ]; + client.descriptors.page.listResourceBackupConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listResourceBackupConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.backupdr.v1.ResourceBackupConfig[] = []; + stream.on('data', (response: protos.google.cloud.backupdr.v1.ResourceBackupConfig) => { + 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.listResourceBackupConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listResourceBackupConfigs, request)); + assert( + (client.descriptors.page.listResourceBackupConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listResourceBackupConfigsStream with error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listResourceBackupConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listResourceBackupConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.backupdr.v1.ResourceBackupConfig[] = []; + stream.on('data', (response: protos.google.cloud.backupdr.v1.ResourceBackupConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listResourceBackupConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listResourceBackupConfigs, request)); + assert( + (client.descriptors.page.listResourceBackupConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listResourceBackupConfigs without error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + generateSampleMessage(new protos.google.cloud.backupdr.v1.ResourceBackupConfig()), + ]; + client.descriptors.page.listResourceBackupConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.backupdr.v1.IResourceBackupConfig[] = []; + const iterable = client.listResourceBackupConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listResourceBackupConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listResourceBackupConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listResourceBackupConfigs with error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.backupdr.v1.ListResourceBackupConfigsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listResourceBackupConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listResourceBackupConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.backupdr.v1.IResourceBackupConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listResourceBackupConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listResourceBackupConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }).catch(err => {throw err}); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }).catch(err => {throw err}); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }).catch(err => {throw err}); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('backup', async () => { + const fakePath = "/rendered/path/backup"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backupvault: "backupvaultValue", + datasource: "datasourceValue", + backup: "backupValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath("projectValue", "locationValue", "backupvaultValue", "datasourceValue", "backupValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupvaultFromBackupName', () => { + const result = client.matchBackupvaultFromBackupName(fakePath); + assert.strictEqual(result, "backupvaultValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDatasourceFromBackupName', () => { + const result = client.matchDatasourceFromBackupName(fakePath); + assert.strictEqual(result, "datasourceValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, "backupValue"); + assert((client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('backupPlan', async () => { + const fakePath = "/rendered/path/backupPlan"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backup_plan: "backupPlanValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPlanPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPlanPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPlanPath', () => { + const result = client.backupPlanPath("projectValue", "locationValue", "backupPlanValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPlanPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupPlanName', () => { + const result = client.matchProjectFromBackupPlanName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupPlanName', () => { + const result = client.matchLocationFromBackupPlanName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupPlanFromBackupPlanName', () => { + const result = client.matchBackupPlanFromBackupPlanName(fakePath); + assert.strictEqual(result, "backupPlanValue"); + assert((client.pathTemplates.backupPlanPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('backupPlanAssociation', async () => { + const fakePath = "/rendered/path/backupPlanAssociation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backup_plan_association: "backupPlanAssociationValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPlanAssociationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPlanAssociationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPlanAssociationPath', () => { + const result = client.backupPlanAssociationPath("projectValue", "locationValue", "backupPlanAssociationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPlanAssociationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupPlanAssociationName', () => { + const result = client.matchProjectFromBackupPlanAssociationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPlanAssociationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupPlanAssociationName', () => { + const result = client.matchLocationFromBackupPlanAssociationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPlanAssociationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupPlanAssociationFromBackupPlanAssociationName', () => { + const result = client.matchBackupPlanAssociationFromBackupPlanAssociationName(fakePath); + assert.strictEqual(result, "backupPlanAssociationValue"); + assert((client.pathTemplates.backupPlanAssociationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('backupPlanRevision', async () => { + const fakePath = "/rendered/path/backupPlanRevision"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backup_plan: "backupPlanValue", + revision: "revisionValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPlanRevisionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupPlanRevisionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupPlanRevisionPath', () => { + const result = client.backupPlanRevisionPath("projectValue", "locationValue", "backupPlanValue", "revisionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupPlanRevisionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupPlanRevisionName', () => { + const result = client.matchProjectFromBackupPlanRevisionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupPlanRevisionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupPlanRevisionName', () => { + const result = client.matchLocationFromBackupPlanRevisionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupPlanRevisionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupPlanFromBackupPlanRevisionName', () => { + const result = client.matchBackupPlanFromBackupPlanRevisionName(fakePath); + assert.strictEqual(result, "backupPlanValue"); + assert((client.pathTemplates.backupPlanRevisionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRevisionFromBackupPlanRevisionName', () => { + const result = client.matchRevisionFromBackupPlanRevisionName(fakePath); + assert.strictEqual(result, "revisionValue"); + assert((client.pathTemplates.backupPlanRevisionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('backupVault', async () => { + const fakePath = "/rendered/path/backupVault"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backupvault: "backupvaultValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupVaultPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.backupVaultPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('backupVaultPath', () => { + const result = client.backupVaultPath("projectValue", "locationValue", "backupvaultValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.backupVaultPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromBackupVaultName', () => { + const result = client.matchProjectFromBackupVaultName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.backupVaultPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromBackupVaultName', () => { + const result = client.matchLocationFromBackupVaultName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.backupVaultPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupvaultFromBackupVaultName', () => { + const result = client.matchBackupvaultFromBackupVaultName(fakePath); + assert.strictEqual(result, "backupvaultValue"); + assert((client.pathTemplates.backupVaultPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('dataSource', async () => { + const fakePath = "/rendered/path/dataSource"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + backupvault: "backupvaultValue", + datasource: "datasourceValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataSourcePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.dataSourcePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('dataSourcePath', () => { + const result = client.dataSourcePath("projectValue", "locationValue", "backupvaultValue", "datasourceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.dataSourcePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDataSourceName', () => { + const result = client.matchProjectFromDataSourceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.dataSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromDataSourceName', () => { + const result = client.matchLocationFromDataSourceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.dataSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchBackupvaultFromDataSourceName', () => { + const result = client.matchBackupvaultFromDataSourceName(fakePath); + assert.strictEqual(result, "backupvaultValue"); + assert((client.pathTemplates.dataSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDatasourceFromDataSourceName', () => { + const result = client.matchDatasourceFromDataSourceName(fakePath); + assert.strictEqual(result, "datasourceValue"); + assert((client.pathTemplates.dataSourcePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('dataSourceReference', async () => { + const fakePath = "/rendered/path/dataSourceReference"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + data_source_reference: "dataSourceReferenceValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataSourceReferencePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.dataSourceReferencePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('dataSourceReferencePath', () => { + const result = client.dataSourceReferencePath("projectValue", "locationValue", "dataSourceReferenceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.dataSourceReferencePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromDataSourceReferenceName', () => { + const result = client.matchProjectFromDataSourceReferenceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.dataSourceReferencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromDataSourceReferenceName', () => { + const result = client.matchLocationFromDataSourceReferenceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.dataSourceReferencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchDataSourceReferenceFromDataSourceReferenceName', () => { + const result = client.matchDataSourceReferenceFromDataSourceReferenceName(fakePath); + assert.strictEqual(result, "dataSourceReferenceValue"); + assert((client.pathTemplates.dataSourceReferencePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', async () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('managementServer', async () => { + const fakePath = "/rendered/path/managementServer"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + managementserver: "managementserverValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.managementServerPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.managementServerPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('managementServerPath', () => { + const result = client.managementServerPath("projectValue", "locationValue", "managementserverValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.managementServerPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromManagementServerName', () => { + const result = client.matchProjectFromManagementServerName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.managementServerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromManagementServerName', () => { + const result = client.matchLocationFromManagementServerName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.managementServerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchManagementserverFromManagementServerName', () => { + const result = client.matchManagementserverFromManagementServerName(fakePath); + assert.strictEqual(result, "managementserverValue"); + assert((client.pathTemplates.managementServerPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('resourceBackupConfig', async () => { + const fakePath = "/rendered/path/resourceBackupConfig"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + resource_backup_config: "resourceBackupConfigValue", + }; + const client = new backupdrprotectionsummaryModule.v1.BackupDrProtectionSummaryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.resourceBackupConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.resourceBackupConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('resourceBackupConfigPath', () => { + const result = client.resourceBackupConfigPath("projectValue", "locationValue", "resourceBackupConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.resourceBackupConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromResourceBackupConfigName', () => { + const result = client.matchProjectFromResourceBackupConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.resourceBackupConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromResourceBackupConfigName', () => { + const result = client.matchLocationFromResourceBackupConfigName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.resourceBackupConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceBackupConfigFromResourceBackupConfigName', () => { + const result = client.matchResourceBackupConfigFromResourceBackupConfigName(fakePath); + assert.strictEqual(result, "resourceBackupConfigValue"); + assert((client.pathTemplates.resourceBackupConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +});