@google-cloud/storage-control
Version:
Cloud Storage API client for Node.js
970 lines • 127 kB
JavaScript
"use strict";
// 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 **
// ** All changes to this file may be overwritten. **
Object.defineProperty(exports, "__esModule", { value: true });
exports.StorageControlClient = void 0;
const storage_control_client_1 = require("./v2/storage_control_client");
const storage_client_1 = require("./v2/storage_client");
class StorageControlClient {
storageControlInternal;
storageClient;
auth;
descriptors = {
page: {},
stream: {},
longrunning: {},
batching: {},
};
warn;
innerApiCalls;
pathTemplates;
operationsClient;
storageControlStub;
/**
* @param {object} [StorageControlClientOptions] - Enables user to instantiate clients separately and use those as the subclients.
* To have sub-clients with different options, instantiate each client separately.
*/
constructor(options) {
options = options || {};
this.storageControlInternal =
options?.storageControlInternal ?? new storage_control_client_1.StorageControlClient(options);
// utilize whatever auth was created with the first client for the rest of the clients
// this will either be what the user passed into options.auth, or whatever was
// initialized by default in gax. We reuse this auth rather than instantiating a default ourselves
// so that we do not have to keep this code in sync with gax
options.auth = this.storageControlInternal.auth;
this.storageClient = options?.storageClient ?? new storage_client_1.StorageClient(options);
this.auth = this.storageControlInternal.auth;
this.descriptors = this.storageControlInternal.descriptors;
this.warn = this.storageControlInternal.warn;
this.innerApiCalls = this.storageControlInternal.innerApiCalls;
this.pathTemplates = this.storageControlInternal.pathTemplates;
this.operationsClient = this.storageControlInternal.operationsClient;
this.storageControlStub = this.storageControlInternal.storageControlStub;
}
/**
* 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() {
return this.storageControlInternal.initialize();
}
/**
* 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() {
return storage_control_client_1.StorageControlClient.servicePath;
}
/**
* 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() {
return storage_control_client_1.StorageControlClient.apiEndpoint;
}
/**
* 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.
*/
get apiEndpoint() {
return this.storageControlInternal.apiEndpoint;
}
get universeDomain() {
return this.storageControlInternal.universeDomain;
}
/**
* The port for this API service.
* @returns {number} The default port for this service.
*/
static get port() {
return storage_control_client_1.StorageControlClient.port;
}
/**
* The scopes needed to make gRPC calls for every method defined
* in this service.
* @returns {string[]} List of default scopes.
*/
static get scopes() {
return storage_control_client_1.StorageControlClient.scopes;
}
getProjectId(callback) {
if (callback) {
this.storageControlInternal.getProjectId(callback);
return;
}
return this.storageControlInternal.getProjectId();
}
// -------------------
// -- Service calls --
// -------------------
/**
* Creates a new folder. This operation is only applicable to a hierarchical
* namespace enabled bucket.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. Name of the bucket in which the folder will reside. The bucket
* must be a hierarchical namespace enabled bucket.
* @param {google.storage.control.v2.Folder} request.folder
* Required. Properties of the new folder being created.
* The bucket and name of the folder are specified in the parent and folder_id
* fields, respectively. Populating those fields in `folder` will result in an
* error.
* @param {string} request.folderId
* Required. The full name of a folder, including all its parent folders.
* Folders use single '/' characters as a delimiter.
* The folder_id must end with a slash.
* For example, the folder_id of "books/biographies/" would create a new
* "biographies/" folder under the "books/" folder.
* @param {boolean} [request.recursive]
* Optional. If true, parent folder doesn't have to be present and all missing
* ancestor folders will be created atomically.
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.Folder|Folder}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.create_folder.js</caption>
* region_tag:storage_v2_generated_StorageControl_CreateFolder_async
*/
createFolder(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.createFolder(request, options);
}
return this.storageControlInternal.createFolder(request, options, callback);
}
/**
* Permanently deletes an empty folder. This operation is only applicable to a
* hierarchical namespace enabled bucket.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. Name of the folder.
* Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
* @param {number} request.ifMetagenerationMatch
* Makes the operation only succeed conditional on whether the folder's
* current metageneration matches the given value.
* @param {number} request.ifMetagenerationNotMatch
* Makes the operation only succeed conditional on whether the folder's
* current metageneration does not match the given value.
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.delete_folder.js</caption>
* region_tag:storage_v2_generated_StorageControl_DeleteFolder_async
*/
deleteFolder(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.deleteFolder(request, options);
}
return this.storageControlInternal.deleteFolder(request, options, callback);
}
/**
* Returns metadata for the specified folder. This operation is only
* applicable to a hierarchical namespace enabled bucket.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. Name of the folder.
* Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
* @param {number} request.ifMetagenerationMatch
* Makes the operation only succeed conditional on whether the folder's
* current metageneration matches the given value.
* @param {number} request.ifMetagenerationNotMatch
* Makes the operation only succeed conditional on whether the folder's
* current metageneration does not match the given value.
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.Folder|Folder}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.get_folder.js</caption>
* region_tag:storage_v2_generated_StorageControl_GetFolder_async
*/
getFolder(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.getFolder(request, options);
}
return this.storageControlInternal.getFolder(request, options, callback);
}
/**
* Returns the storage layout configuration for a given bucket.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the StorageLayout resource.
* Format: `projects/{project}/buckets/{bucket}/storageLayout`
* @param {string} request.prefix
* An optional prefix used for permission check. It is useful when the caller
* only has limited permissions under a specific prefix.
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.StorageLayout|StorageLayout}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.get_storage_layout.js</caption>
* region_tag:storage_v2_generated_StorageControl_GetStorageLayout_async
*/
getStorageLayout(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.getStorageLayout(request, options);
}
return this.storageControlInternal.getStorageLayout(request, options, callback);
}
/**
* Creates a new managed folder.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. Name of the bucket this managed folder belongs to.
* @param {google.storage.control.v2.ManagedFolder} request.managedFolder
* Required. Properties of the managed folder being created.
* The bucket and managed folder names are specified in the `parent` and
* `managed_folder_id` fields. Populating these fields in `managed_folder`
* will result in an error.
* @param {string} request.managedFolderId
* Required. The name of the managed folder. It uses a single `/` as delimiter
* and leading and trailing `/` are allowed.
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.ManagedFolder|ManagedFolder}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.create_managed_folder.js</caption>
* region_tag:storage_v2_generated_StorageControl_CreateManagedFolder_async
*/
createManagedFolder(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.createManagedFolder(request, options);
}
return this.storageControlInternal.createManagedFolder(request, options, callback);
}
/**
* Permanently deletes an empty managed folder.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. Name of the managed folder.
* Format:
* `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
* @param {number} request.ifMetagenerationMatch
* The operation succeeds conditional on the managed folder's current
* metageneration matching the value here specified.
* @param {number} request.ifMetagenerationNotMatch
* The operation succeeds conditional on the managed folder's current
* metageneration NOT matching the value here specified.
* @param {boolean} request.allowNonEmpty
* Allows deletion of a managed folder even if it is not empty.
* A managed folder is empty if it manages no child managed folders or
* objects. Caller must have permission for
* storage.managedFolders.setIamPolicy.
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.delete_managed_folder.js</caption>
* region_tag:storage_v2_generated_StorageControl_DeleteManagedFolder_async
*/
deleteManagedFolder(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.deleteManagedFolder(request, options);
}
return this.storageControlInternal.deleteManagedFolder(request, options, callback);
}
/**
* Returns metadata for the specified managed folder.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. Name of the managed folder.
* Format:
* `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
* @param {number} request.ifMetagenerationMatch
* The operation succeeds conditional on the managed folder's current
* metageneration matching the value here specified.
* @param {number} request.ifMetagenerationNotMatch
* The operation succeeds conditional on the managed folder's current
* metageneration NOT matching the value here specified.
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.ManagedFolder|ManagedFolder}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.get_managed_folder.js</caption>
* region_tag:storage_v2_generated_StorageControl_GetManagedFolder_async
*/
getManagedFolder(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.getManagedFolder(request, options);
}
return this.storageControlInternal.getManagedFolder(request, options, callback);
}
/**
* Disables an Anywhere Cache instance. A disabled instance is read-only. The
* disablement could be revoked by calling ResumeAnywhereCache. The cache
* instance will be deleted automatically if it remains in the disabled state
* for at least one hour.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name field in the request should be:
* `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted. This request is only
* idempotent if a `request_id` is provided.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.AnywhereCache|AnywhereCache}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.disable_anywhere_cache.js</caption>
* region_tag:storage_v2_generated_StorageControl_DisableAnywhereCache_async
*/
disableAnywhereCache(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.disableAnywhereCache(request, options);
}
return this.storageControlInternal.disableAnywhereCache(request, options, callback);
}
/**
* Pauses an Anywhere Cache instance.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name field in the request should be:
* `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted. This request is only
* idempotent if a `request_id` is provided.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.AnywhereCache|AnywhereCache}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.pause_anywhere_cache.js</caption>
* region_tag:storage_v2_generated_StorageControl_PauseAnywhereCache_async
*/
pauseAnywhereCache(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.pauseAnywhereCache(request, options);
}
return this.storageControlInternal.pauseAnywhereCache(request, options, callback);
}
/**
* Resumes a disabled or paused Anywhere Cache instance.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name field in the request should be:
* `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted. This request is only
* idempotent if a `request_id` is provided.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.AnywhereCache|AnywhereCache}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.resume_anywhere_cache.js</caption>
* region_tag:storage_v2_generated_StorageControl_ResumeAnywhereCache_async
*/
resumeAnywhereCache(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.resumeAnywhereCache(request, options);
}
return this.storageControlInternal.resumeAnywhereCache(request, options, callback);
}
/**
* Gets an Anywhere Cache instance.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name field in the request should be:
* `projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}`
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.AnywhereCache|AnywhereCache}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.get_anywhere_cache.js</caption>
* region_tag:storage_v2_generated_StorageControl_GetAnywhereCache_async
*/
getAnywhereCache(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.getAnywhereCache(request, options);
}
return this.storageControlInternal.getAnywhereCache(request, options, callback);
}
/**
* Returns the Project scoped singleton IntelligenceConfig resource.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the `IntelligenceConfig` resource associated with
* your project.
*
* Format: `projects/{id}/locations/global/intelligenceConfig`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.IntelligenceConfig|IntelligenceConfig}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.get_project_intelligence_config.js</caption>
* region_tag:storage_v2_generated_StorageControl_GetProjectIntelligenceConfig_async
*/
getProjectIntelligenceConfig(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.getProjectIntelligenceConfig(request, options);
}
return this.storageControlInternal.getProjectIntelligenceConfig(request, options, callback);
}
/**
* Updates the Project scoped singleton IntelligenceConfig resource.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.storage.control.v2.IntelligenceConfig} request.intelligenceConfig
* Required. The `IntelligenceConfig` resource to be updated.
* @param {google.protobuf.FieldMask} request.updateMask
* Required. The `update_mask` that specifies the fields within the
* `IntelligenceConfig` resource that should be modified by this update. Only
* the listed fields are updated.
* @param {string} [request.requestId]
* Optional. The ID that uniquely identifies the request, preventing duplicate
* processing.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.IntelligenceConfig|IntelligenceConfig}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.update_project_intelligence_config.js</caption>
* region_tag:storage_v2_generated_StorageControl_UpdateProjectIntelligenceConfig_async
*/
updateProjectIntelligenceConfig(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.updateProjectIntelligenceConfig(request, options);
}
return this.storageControlInternal.updateProjectIntelligenceConfig(request, options, callback);
}
/**
* Returns the Folder scoped singleton IntelligenceConfig resource.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the `IntelligenceConfig` resource associated with
* your folder.
*
* Format: `folders/{id}/locations/global/intelligenceConfig`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.IntelligenceConfig|IntelligenceConfig}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.get_folder_intelligence_config.js</caption>
* region_tag:storage_v2_generated_StorageControl_GetFolderIntelligenceConfig_async
*/
getFolderIntelligenceConfig(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.getFolderIntelligenceConfig(request, options);
}
return this.storageControlInternal.getFolderIntelligenceConfig(request, options, callback);
}
/**
* Updates the Folder scoped singleton IntelligenceConfig resource.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.storage.control.v2.IntelligenceConfig} request.intelligenceConfig
* Required. The `IntelligenceConfig` resource to be updated.
* @param {google.protobuf.FieldMask} request.updateMask
* Required. The `update_mask` that specifies the fields within the
* `IntelligenceConfig` resource that should be modified by this update. Only
* the listed fields are updated.
* @param {string} [request.requestId]
* Optional. The ID that uniquely identifies the request, preventing duplicate
* processing.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.IntelligenceConfig|IntelligenceConfig}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.update_folder_intelligence_config.js</caption>
* region_tag:storage_v2_generated_StorageControl_UpdateFolderIntelligenceConfig_async
*/
updateFolderIntelligenceConfig(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.updateFolderIntelligenceConfig(request, options);
}
return this.storageControlInternal.updateFolderIntelligenceConfig(request, options, callback);
}
/**
* Returns the Organization scoped singleton IntelligenceConfig resource.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The name of the `IntelligenceConfig` resource associated with
* your organization.
*
* Format: `organizations/{org_id}/locations/global/intelligenceConfig`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.IntelligenceConfig|IntelligenceConfig}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.get_organization_intelligence_config.js</caption>
* region_tag:storage_v2_generated_StorageControl_GetOrganizationIntelligenceConfig_async
*/
getOrganizationIntelligenceConfig(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.getOrganizationIntelligenceConfig(request, options);
}
return this.storageControlInternal.getOrganizationIntelligenceConfig(request, options, callback);
}
/**
* Updates the Organization scoped singleton IntelligenceConfig resource.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.storage.control.v2.IntelligenceConfig} request.intelligenceConfig
* Required. The `IntelligenceConfig` resource to be updated.
* @param {google.protobuf.FieldMask} request.updateMask
* Required. The `update_mask` that specifies the fields within the
* `IntelligenceConfig` resource that should be modified by this update. Only
* the listed fields are updated.
* @param {string} [request.requestId]
* Optional. The ID that uniquely identifies the request, preventing duplicate
* processing.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.storage.control.v2.IntelligenceConfig|IntelligenceConfig}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.update_organization_intelligence_config.js</caption>
* region_tag:storage_v2_generated_StorageControl_UpdateOrganizationIntelligenceConfig_async
*/
updateOrganizationIntelligenceConfig(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.updateOrganizationIntelligenceConfig(request, options);
}
return this.storageControlInternal.updateOrganizationIntelligenceConfig(request, options, callback);
}
/**
* Gets the IAM policy for a specified bucket.
* The `resource` field in the request should be
* `projects/_/buckets/{bucket}` for a bucket, or
* `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
* for a managed folder.
*
* @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 {google.iam.v1.GetPolicyOptions} request.options
* OPTIONAL: A `GetPolicyOptions` object for specifying options to
* `GetIamPolicy`.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.iam.v1.Policy|Policy}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.get_iam_policy.js</caption>
* region_tag:storage_v2_generated_StorageControl_GetIamPolicy_async
*/
getIamPolicy(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.getIamPolicy(request, options);
}
return this.storageControlInternal.getIamPolicy(request, options, callback);
}
/**
* Updates an IAM policy for the specified bucket.
* The `resource` field in the request should be
* `projects/_/buckets/{bucket}` for a bucket, or
* `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
* for a managed folder.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.resource
* REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
* @param {google.iam.v1.Policy} request.policy
* REQUIRED: The complete policy to be applied to the `resource`. The size of
* the policy is limited to a few 10s of KB. An empty policy is a
* valid policy but certain Cloud Platform services (such as Projects)
* might reject them.
* @param {google.protobuf.FieldMask} request.updateMask
* OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
* the fields in the mask will be modified. If no mask is provided, the
* following default mask is used:
*
* `paths: "bindings, etag"`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.iam.v1.Policy|Policy}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.set_iam_policy.js</caption>
* region_tag:storage_v2_generated_StorageControl_SetIamPolicy_async
*/
setIamPolicy(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.setIamPolicy(request, options);
}
return this.storageControlInternal.setIamPolicy(request, options, callback);
}
/**
* Tests a set of permissions on the given bucket, object, or managed folder
* to see which, if any, are held by the caller.
* The `resource` field in the request should be
* `projects/_/buckets/{bucket}` for a bucket,
* `projects/_/buckets/{bucket}/objects/{object}` for an object, or
* `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
* for a managed folder.
*
* @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
* [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing {@link protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.test_iam_permissions.js</caption>
* region_tag:storage_v2_generated_StorageControl_TestIamPermissions_async
*/
testIamPermissions(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.testIamPermissions(request, options);
}
return this.storageControlInternal.testIamPermissions(request, options, callback);
}
/**
* Renames a source folder to a destination folder. This operation is only
* applicable to a hierarchical namespace enabled bucket. During a rename, the
* source and destination folders are locked until the long running operation
* completes.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. Name of the source folder being renamed.
* Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
* @param {string} request.destinationFolderId
* Required. The destination folder ID, e.g. `foo/bar/`.
* @param {number} request.ifMetagenerationMatch
* Makes the operation only succeed conditional on whether the source
* folder's current metageneration matches the given value.
* @param {number} request.ifMetagenerationNotMatch
* Makes the operation only succeed conditional on whether the source
* folder's current metageneration does not match the given value.
* @param {string} [request.requestId]
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted. This request is only
* idempotent if a `request_id` is provided.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* a long running operation. Its `promise()` method returns a promise
* you can `await` for.
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
* for more details and examples.
* @example <caption>include:samples/generated/v2/storage_control.rename_folder.js</caption>
* region_tag:storage_v2_generated_StorageControl_RenameFolder_async
*/
renameFolder(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
if (callback === undefined) {
return this.storageControlInternal.renameFolder(request, options);
}
return this.storageControlInternal.renameFolder(request, options, callback);
}
/**
* Check the status of the long running operation returned by `renameFolder()`.
* @param {String} nam