StorageControl service includes selected control plane operations. v2
Package
@google-cloud/storage-controlConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of StorageControlClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
operationsClient
operationsClient: gax.OperationsClient;
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
storageControlStub
storageControlStub?: Promise<{
[name: string]: Function;
}>;
universeDomain
get universeDomain(): string;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
bucketPath(project, bucket)
bucketPath(project: string, bucket: string): string;
Return a fully-qualified bucket resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
bucket |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
cancelOperation(request, options, callback)
cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED
.
Parameters | |
---|---|
Name | Description |
request |
CancelOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<protos.google.protobuf.Empty> |
const client = longrunning.operationsClient();
await client.cancelOperation({name: ''});
checkRenameFolderProgress(name)
checkRenameFolderProgress(name: string): Promise<LROperation<protos.google.storage.control.v2.Folder, protos.google.storage.control.v2.RenameFolderMetadata>>;
Check the status of the long running operation returned by renameFolder()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.storage.control.v2.Folder, protos.google.storage.control.v2.RenameFolderMetadata>> |
{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the source folder being renamed.
* Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
*/
// const name = 'abc123'
/**
* Required. The destination folder ID, e.g. `foo/bar/`.
*/
// const destinationFolderId = 'abc123'
/**
* Makes the operation only succeed conditional on whether the source
* folder's current metageneration matches the given value.
*/
// const ifMetagenerationMatch = 1234
/**
* Makes the operation only succeed conditional on whether the source
* folder's current metageneration does not match the given value.
*/
// const ifMetagenerationNotMatch = 1234
/**
* 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.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callRenameFolder() {
// Construct request
const request = {
name,
destinationFolderId,
};
// Run request
const [operation] = await controlClient.renameFolder(request);
const [response] = await operation.promise();
console.log(response);
}
callRenameFolder();
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns | |
---|---|
Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
createFolder(request, options)
createFolder(request?: protos.google.storage.control.v2.ICreateFolderRequest, options?: CallOptions): Promise<[
protos.google.storage.control.v2.IFolder,
protos.google.storage.control.v2.ICreateFolderRequest | undefined,
{} | undefined
]>;
Creates a new folder. This operation is only applicable to a hierarchical namespace enabled bucket. Hierarchical namespace buckets are in allowlist preview.
Parameters | |
---|---|
Name | Description |
request |
ICreateFolderRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.storage.control.v2.IFolder,
protos.google.storage.control.v2.ICreateFolderRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Folder. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the bucket in which the folder will reside. The bucket
* must be a hierarchical namespace enabled bucket.
*/
// const parent = 'abc123'
/**
* 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.
*/
// const folder = {}
/**
* 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.
*/
// const folderId = 'abc123'
/**
* Optional. If true, parent folder doesn't have to be present and all missing
* ancestor folders will be created atomically.
*/
// const recursive = true
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callCreateFolder() {
// Construct request
const request = {
parent,
folder,
folderId,
};
// Run request
const response = await controlClient.createFolder(request);
console.log(response);
}
callCreateFolder();
createFolder(request, options, callback)
createFolder(request: protos.google.storage.control.v2.ICreateFolderRequest, options: CallOptions, callback: Callback<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.ICreateFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateFolderRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.ICreateFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createFolder(request, callback)
createFolder(request: protos.google.storage.control.v2.ICreateFolderRequest, callback: Callback<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.ICreateFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateFolderRequest
|
callback |
Callback<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.ICreateFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createManagedFolder(request, options)
createManagedFolder(request?: protos.google.storage.control.v2.ICreateManagedFolderRequest, options?: CallOptions): Promise<[
protos.google.storage.control.v2.IManagedFolder,
protos.google.storage.control.v2.ICreateManagedFolderRequest | undefined,
{} | undefined
]>;
Creates a new managed folder.
Parameters | |
---|---|
Name | Description |
request |
ICreateManagedFolderRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.storage.control.v2.IManagedFolder,
protos.google.storage.control.v2.ICreateManagedFolderRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ManagedFolder. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the bucket this managed folder belongs to.
*/
// const parent = 'abc123'
/**
* 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.
*/
// const managedFolder = {}
/**
* Required. The name of the managed folder. It uses a single `/` as delimiter
* and leading and trailing `/` are allowed.
*/
// const managedFolderId = 'abc123'
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callCreateManagedFolder() {
// Construct request
const request = {
parent,
managedFolder,
managedFolderId,
};
// Run request
const response = await controlClient.createManagedFolder(request);
console.log(response);
}
callCreateManagedFolder();
createManagedFolder(request, options, callback)
createManagedFolder(request: protos.google.storage.control.v2.ICreateManagedFolderRequest, options: CallOptions, callback: Callback<protos.google.storage.control.v2.IManagedFolder, protos.google.storage.control.v2.ICreateManagedFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateManagedFolderRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storage.control.v2.IManagedFolder, protos.google.storage.control.v2.ICreateManagedFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
createManagedFolder(request, callback)
createManagedFolder(request: protos.google.storage.control.v2.ICreateManagedFolderRequest, callback: Callback<protos.google.storage.control.v2.IManagedFolder, protos.google.storage.control.v2.ICreateManagedFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ICreateManagedFolderRequest
|
callback |
Callback<protos.google.storage.control.v2.IManagedFolder, protos.google.storage.control.v2.ICreateManagedFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteFolder(request, options)
deleteFolder(request?: protos.google.storage.control.v2.IDeleteFolderRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
protos.google.storage.control.v2.IDeleteFolderRequest | undefined,
{} | undefined
]>;
Permanently deletes an empty folder. This operation is only applicable to a hierarchical namespace enabled bucket. Hierarchical namespace buckets are in allowlist preview.
Parameters | |
---|---|
Name | Description |
request |
IDeleteFolderRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.protobuf.IEmpty,
protos.google.storage.control.v2.IDeleteFolderRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the folder.
* Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
*/
// const name = 'abc123'
/**
* Makes the operation only succeed conditional on whether the folder's
* current metageneration matches the given value.
*/
// const ifMetagenerationMatch = 1234
/**
* Makes the operation only succeed conditional on whether the folder's
* current metageneration does not match the given value.
*/
// const ifMetagenerationNotMatch = 1234
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callDeleteFolder() {
// Construct request
const request = {
name,
};
// Run request
const response = await controlClient.deleteFolder(request);
console.log(response);
}
callDeleteFolder();
deleteFolder(request, options, callback)
deleteFolder(request: protos.google.storage.control.v2.IDeleteFolderRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.storage.control.v2.IDeleteFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteFolderRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.storage.control.v2.IDeleteFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteFolder(request, callback)
deleteFolder(request: protos.google.storage.control.v2.IDeleteFolderRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.storage.control.v2.IDeleteFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteFolderRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.storage.control.v2.IDeleteFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteManagedFolder(request, options)
deleteManagedFolder(request?: protos.google.storage.control.v2.IDeleteManagedFolderRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
protos.google.storage.control.v2.IDeleteManagedFolderRequest | undefined,
{} | undefined
]>;
Permanently deletes an empty managed folder.
Parameters | |
---|---|
Name | Description |
request |
IDeleteManagedFolderRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.protobuf.IEmpty,
protos.google.storage.control.v2.IDeleteManagedFolderRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the managed folder.
* Format:
* `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
*/
// const name = 'abc123'
/**
* The operation succeeds conditional on the managed folder's current
* metageneration matching the value here specified.
*/
// const ifMetagenerationMatch = 1234
/**
* The operation succeeds conditional on the managed folder's current
* metageneration NOT matching the value here specified.
*/
// const ifMetagenerationNotMatch = 1234
/**
* 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.
*/
// const allowNonEmpty = true
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callDeleteManagedFolder() {
// Construct request
const request = {
name,
};
// Run request
const response = await controlClient.deleteManagedFolder(request);
console.log(response);
}
callDeleteManagedFolder();
deleteManagedFolder(request, options, callback)
deleteManagedFolder(request: protos.google.storage.control.v2.IDeleteManagedFolderRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.storage.control.v2.IDeleteManagedFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteManagedFolderRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.storage.control.v2.IDeleteManagedFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteManagedFolder(request, callback)
deleteManagedFolder(request: protos.google.storage.control.v2.IDeleteManagedFolderRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.storage.control.v2.IDeleteManagedFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteManagedFolderRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.storage.control.v2.IDeleteManagedFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteOperation(request, options, callback)
deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
DeleteOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<protos.google.protobuf.Empty> |
const client = longrunning.operationsClient();
await client.deleteOperation({name: ''});
folderPath(project, bucket, folder)
folderPath(project: string, bucket: string, folder: string): string;
Return a fully-qualified folder resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
bucket |
string
|
folder |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
getFolder(request, options)
getFolder(request?: protos.google.storage.control.v2.IGetFolderRequest, options?: CallOptions): Promise<[
protos.google.storage.control.v2.IFolder,
protos.google.storage.control.v2.IGetFolderRequest | undefined,
{} | undefined
]>;
Returns metadata for the specified folder. This operation is only applicable to a hierarchical namespace enabled bucket. Hierarchical namespace buckets are in allowlist preview.
Parameters | |
---|---|
Name | Description |
request |
IGetFolderRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.storage.control.v2.IFolder,
protos.google.storage.control.v2.IGetFolderRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Folder. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the folder.
* Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
*/
// const name = 'abc123'
/**
* Makes the operation only succeed conditional on whether the folder's
* current metageneration matches the given value.
*/
// const ifMetagenerationMatch = 1234
/**
* Makes the operation only succeed conditional on whether the folder's
* current metageneration does not match the given value.
*/
// const ifMetagenerationNotMatch = 1234
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callGetFolder() {
// Construct request
const request = {
name,
};
// Run request
const response = await controlClient.getFolder(request);
console.log(response);
}
callGetFolder();
getFolder(request, options, callback)
getFolder(request: protos.google.storage.control.v2.IGetFolderRequest, options: CallOptions, callback: Callback<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IGetFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetFolderRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IGetFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getFolder(request, callback)
getFolder(request: protos.google.storage.control.v2.IGetFolderRequest, callback: Callback<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IGetFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetFolderRequest
|
callback |
Callback<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IGetFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getManagedFolder(request, options)
getManagedFolder(request?: protos.google.storage.control.v2.IGetManagedFolderRequest, options?: CallOptions): Promise<[
protos.google.storage.control.v2.IManagedFolder,
protos.google.storage.control.v2.IGetManagedFolderRequest | undefined,
{} | undefined
]>;
Returns metadata for the specified managed folder.
Parameters | |
---|---|
Name | Description |
request |
IGetManagedFolderRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.storage.control.v2.IManagedFolder,
protos.google.storage.control.v2.IGetManagedFolderRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ManagedFolder. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the managed folder.
* Format:
* `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder}`
*/
// const name = 'abc123'
/**
* The operation succeeds conditional on the managed folder's current
* metageneration matching the value here specified.
*/
// const ifMetagenerationMatch = 1234
/**
* The operation succeeds conditional on the managed folder's current
* metageneration NOT matching the value here specified.
*/
// const ifMetagenerationNotMatch = 1234
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callGetManagedFolder() {
// Construct request
const request = {
name,
};
// Run request
const response = await controlClient.getManagedFolder(request);
console.log(response);
}
callGetManagedFolder();
getManagedFolder(request, options, callback)
getManagedFolder(request: protos.google.storage.control.v2.IGetManagedFolderRequest, options: CallOptions, callback: Callback<protos.google.storage.control.v2.IManagedFolder, protos.google.storage.control.v2.IGetManagedFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetManagedFolderRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storage.control.v2.IManagedFolder, protos.google.storage.control.v2.IGetManagedFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getManagedFolder(request, callback)
getManagedFolder(request: protos.google.storage.control.v2.IGetManagedFolderRequest, callback: Callback<protos.google.storage.control.v2.IManagedFolder, protos.google.storage.control.v2.IGetManagedFolderRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetManagedFolderRequest
|
callback |
Callback<protos.google.storage.control.v2.IManagedFolder, protos.google.storage.control.v2.IGetManagedFolderRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getOperation(request, options, callback)
getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
Parameters | |
---|---|
Name | Description |
request |
GetOperationRequest
The request object that will be sent. |
options |
CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
callback |
Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>
The function which will be called with the result of the API call. The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call. |
Returns | |
---|---|
Type | Description |
Promise<[protos.google.longrunning.Operation]> |
const client = longrunning.operationsClient();
const name = '';
const [response] = await client.getOperation({name});
// doThingsWith(response)
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
Type | Description |
void |
getStorageLayout(request, options)
getStorageLayout(request?: protos.google.storage.control.v2.IGetStorageLayoutRequest, options?: CallOptions): Promise<[
protos.google.storage.control.v2.IStorageLayout,
protos.google.storage.control.v2.IGetStorageLayoutRequest | undefined,
{} | undefined
]>;
Returns the storage layout configuration for a given bucket.
Parameters | |
---|---|
Name | Description |
request |
IGetStorageLayoutRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.storage.control.v2.IStorageLayout,
protos.google.storage.control.v2.IGetStorageLayoutRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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 name of the StorageLayout resource.
* Format: `projects/{project}/buckets/{bucket}/storageLayout`
*/
// const name = 'abc123'
/**
* An optional prefix used for permission check. It is useful when the caller
* only has limited permissions under a specific prefix.
*/
// const prefix = 'abc123'
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callGetStorageLayout() {
// Construct request
const request = {
name,
};
// Run request
const response = await controlClient.getStorageLayout(request);
console.log(response);
}
callGetStorageLayout();
getStorageLayout(request, options, callback)
getStorageLayout(request: protos.google.storage.control.v2.IGetStorageLayoutRequest, options: CallOptions, callback: Callback<protos.google.storage.control.v2.IStorageLayout, protos.google.storage.control.v2.IGetStorageLayoutRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetStorageLayoutRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storage.control.v2.IStorageLayout, protos.google.storage.control.v2.IGetStorageLayoutRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getStorageLayout(request, callback)
getStorageLayout(request: protos.google.storage.control.v2.IGetStorageLayoutRequest, callback: Callback<protos.google.storage.control.v2.IStorageLayout, protos.google.storage.control.v2.IGetStorageLayoutRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetStorageLayoutRequest
|
callback |
Callback<protos.google.storage.control.v2.IStorageLayout, protos.google.storage.control.v2.IGetStorageLayoutRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
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 | |
---|---|
Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
listFolders(request, options)
listFolders(request?: protos.google.storage.control.v2.IListFoldersRequest, options?: CallOptions): Promise<[
protos.google.storage.control.v2.IFolder[],
protos.google.storage.control.v2.IListFoldersRequest | null,
protos.google.storage.control.v2.IListFoldersResponse
]>;
Retrieves a list of folders. This operation is only applicable to a hierarchical namespace enabled bucket. Hierarchical namespace buckets are in allowlist preview.
Parameters | |
---|---|
Name | Description |
request |
IListFoldersRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.storage.control.v2.IFolder[],
protos.google.storage.control.v2.IListFoldersRequest | null,
protos.google.storage.control.v2.IListFoldersResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of Folder. 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 |
listFolders(request, options, callback)
listFolders(request: protos.google.storage.control.v2.IListFoldersRequest, options: CallOptions, callback: PaginationCallback<protos.google.storage.control.v2.IListFoldersRequest, protos.google.storage.control.v2.IListFoldersResponse | null | undefined, protos.google.storage.control.v2.IFolder>): void;
Parameters | |
---|---|
Name | Description |
request |
IListFoldersRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.storage.control.v2.IListFoldersRequest, protos.google.storage.control.v2.IListFoldersResponse | null | undefined, protos.google.storage.control.v2.IFolder>
|
Returns | |
---|---|
Type | Description |
void |
listFolders(request, callback)
listFolders(request: protos.google.storage.control.v2.IListFoldersRequest, callback: PaginationCallback<protos.google.storage.control.v2.IListFoldersRequest, protos.google.storage.control.v2.IListFoldersResponse | null | undefined, protos.google.storage.control.v2.IFolder>): void;
Parameters | |
---|---|
Name | Description |
request |
IListFoldersRequest
|
callback |
PaginationCallback<protos.google.storage.control.v2.IListFoldersRequest, protos.google.storage.control.v2.IListFoldersResponse | null | undefined, protos.google.storage.control.v2.IFolder>
|
Returns | |
---|---|
Type | Description |
void |
listFoldersAsync(request, options)
listFoldersAsync(request?: protos.google.storage.control.v2.IListFoldersRequest, options?: CallOptions): AsyncIterable<protos.google.storage.control.v2.IFolder>;
Equivalent to listFolders
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
IListFoldersRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.storage.control.v2.IFolder> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Folder. 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 documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the bucket in which to look for folders. The bucket must
* be a hierarchical namespace enabled bucket.
*/
// const parent = 'abc123'
/**
* Optional. Maximum number of folders to return in a single response. The
* service will use this parameter or 1,000 items, whichever is smaller.
*/
// const pageSize = 1234
/**
* Optional. A previously-returned page token representing part of the larger
* set of results to view.
*/
// const pageToken = 'abc123'
/**
* Optional. Filter results to folders whose names begin with this prefix.
* If set, the value must either be an empty string or end with a '/'.
*/
// const prefix = 'abc123'
/**
* Optional. If set, returns results in a directory-like mode. The results
* will only include folders that either exactly match the above prefix, or
* are one level below the prefix. The only supported value is '/'.
*/
// const delimiter = 'abc123'
/**
* Optional. Filter results to folders whose names are lexicographically equal
* to or after lexicographic_start. If lexicographic_end is also set, the
* folders listed have names between lexicographic_start (inclusive) and
* lexicographic_end (exclusive).
*/
// const lexicographicStart = 'abc123'
/**
* Optional. Filter results to folders whose names are lexicographically
* before lexicographic_end. If lexicographic_start is also set, the folders
* listed have names between lexicographic_start (inclusive) and
* lexicographic_end (exclusive).
*/
// const lexicographicEnd = 'abc123'
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callListFolders() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = controlClient.listFoldersAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListFolders();
listFoldersStream(request, options)
listFoldersStream(request?: protos.google.storage.control.v2.IListFoldersRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
IListFoldersRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform |
{Stream} An object stream which emits an object representing Folder 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 |
listManagedFolders(request, options)
listManagedFolders(request?: protos.google.storage.control.v2.IListManagedFoldersRequest, options?: CallOptions): Promise<[
protos.google.storage.control.v2.IManagedFolder[],
protos.google.storage.control.v2.IListManagedFoldersRequest | null,
protos.google.storage.control.v2.IListManagedFoldersResponse
]>;
Retrieves a list of managed folders for a given bucket.
Parameters | |
---|---|
Name | Description |
request |
IListManagedFoldersRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.storage.control.v2.IManagedFolder[],
protos.google.storage.control.v2.IListManagedFoldersRequest | null,
protos.google.storage.control.v2.IListManagedFoldersResponse
]> |
{Promise} - The promise which resolves to an array. The first element of the array is Array of ManagedFolder. 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 |
listManagedFolders(request, options, callback)
listManagedFolders(request: protos.google.storage.control.v2.IListManagedFoldersRequest, options: CallOptions, callback: PaginationCallback<protos.google.storage.control.v2.IListManagedFoldersRequest, protos.google.storage.control.v2.IListManagedFoldersResponse | null | undefined, protos.google.storage.control.v2.IManagedFolder>): void;
Parameters | |
---|---|
Name | Description |
request |
IListManagedFoldersRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.storage.control.v2.IListManagedFoldersRequest, protos.google.storage.control.v2.IListManagedFoldersResponse | null | undefined, protos.google.storage.control.v2.IManagedFolder>
|
Returns | |
---|---|
Type | Description |
void |
listManagedFolders(request, callback)
listManagedFolders(request: protos.google.storage.control.v2.IListManagedFoldersRequest, callback: PaginationCallback<protos.google.storage.control.v2.IListManagedFoldersRequest, protos.google.storage.control.v2.IListManagedFoldersResponse | null | undefined, protos.google.storage.control.v2.IManagedFolder>): void;
Parameters | |
---|---|
Name | Description |
request |
IListManagedFoldersRequest
|
callback |
PaginationCallback<protos.google.storage.control.v2.IListManagedFoldersRequest, protos.google.storage.control.v2.IListManagedFoldersResponse | null | undefined, protos.google.storage.control.v2.IManagedFolder>
|
Returns | |
---|---|
Type | Description |
void |
listManagedFoldersAsync(request, options)
listManagedFoldersAsync(request?: protos.google.storage.control.v2.IListManagedFoldersRequest, options?: CallOptions): AsyncIterable<protos.google.storage.control.v2.IManagedFolder>;
Equivalent to listManagedFolders
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
IListManagedFoldersRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.storage.control.v2.IManagedFolder> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing ManagedFolder. 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 documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the bucket this managed folder belongs to.
*/
// const parent = 'abc123'
/**
* Optional. Maximum number of managed folders to return in a single response.
* The service will use this parameter or 1,000 items, whichever is smaller.
*/
// const pageSize = 1234
/**
* Optional. A previously-returned page token representing part of the larger
* set of results to view.
*/
// const pageToken = 'abc123'
/**
* Optional. Filter results to match managed folders with name starting with
* this prefix.
*/
// const prefix = 'abc123'
/**
* Optional. A unique identifier for this request. UUID is the recommended
* format, but other formats are still accepted.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callListManagedFolders() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = controlClient.listManagedFoldersAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListManagedFolders();
listManagedFoldersStream(request, options)
listManagedFoldersStream(request?: protos.google.storage.control.v2.IListManagedFoldersRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
IListManagedFoldersRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Transform |
{Stream} An object stream which emits an object representing ManagedFolder 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 |
listOperationsAsync(request, options)
listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED
. Returns an iterable object.
For-await-of syntax is used with the iterable to recursively get response element on-demand.
Parameters | |
---|---|
Name | Description |
request |
ListOperationsRequest
The request object that will be sent. |
options |
CallOptions
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.longrunning.ListOperationsResponse> |
{Object} An iterable Object that conforms to iteration protocols. |
const client = longrunning.operationsClient();
for await (const response of client.listOperationsAsync(request));
// doThingsWith(response)
managedFolderPath(project, bucket, managedFolder)
managedFolderPath(project: string, bucket: string, managedFolder: string): string;
Return a fully-qualified managedFolder resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
bucket |
string
|
managedFolder |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
matchBucketFromBucketName(bucketName)
matchBucketFromBucketName(bucketName: string): string | number;
Parse the bucket from Bucket resource.
Parameter | |
---|---|
Name | Description |
bucketName |
string
A fully-qualified path representing Bucket resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the bucket. |
matchBucketFromFolderName(folderName)
matchBucketFromFolderName(folderName: string): string | number;
Parse the bucket from Folder resource.
Parameter | |
---|---|
Name | Description |
folderName |
string
A fully-qualified path representing Folder resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the bucket. |
matchBucketFromManagedFolderName(managedFolderName)
matchBucketFromManagedFolderName(managedFolderName: string): string | number;
Parse the bucket from ManagedFolder resource.
Parameter | |
---|---|
Name | Description |
managedFolderName |
string
A fully-qualified path representing ManagedFolder resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the bucket. |
matchBucketFromStorageLayoutName(storageLayoutName)
matchBucketFromStorageLayoutName(storageLayoutName: string): string | number;
Parse the bucket from StorageLayout resource.
Parameter | |
---|---|
Name | Description |
storageLayoutName |
string
A fully-qualified path representing StorageLayout resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the bucket. |
matchFolderFromFolderName(folderName)
matchFolderFromFolderName(folderName: string): string | number;
Parse the folder from Folder resource.
Parameter | |
---|---|
Name | Description |
folderName |
string
A fully-qualified path representing Folder resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the folder. |
matchManagedFolderFromManagedFolderName(managedFolderName)
matchManagedFolderFromManagedFolderName(managedFolderName: string): string | number;
Parse the managed_folder from ManagedFolder resource.
Parameter | |
---|---|
Name | Description |
managedFolderName |
string
A fully-qualified path representing ManagedFolder resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the managed_folder. |
matchProjectFromBucketName(bucketName)
matchProjectFromBucketName(bucketName: string): string | number;
Parse the project from Bucket resource.
Parameter | |
---|---|
Name | Description |
bucketName |
string
A fully-qualified path representing Bucket resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromFolderName(folderName)
matchProjectFromFolderName(folderName: string): string | number;
Parse the project from Folder resource.
Parameter | |
---|---|
Name | Description |
folderName |
string
A fully-qualified path representing Folder resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromManagedFolderName(managedFolderName)
matchProjectFromManagedFolderName(managedFolderName: string): string | number;
Parse the project from ManagedFolder resource.
Parameter | |
---|---|
Name | Description |
managedFolderName |
string
A fully-qualified path representing ManagedFolder resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromProjectName(projectName)
matchProjectFromProjectName(projectName: string): string | number;
Parse the project from Project resource.
Parameter | |
---|---|
Name | Description |
projectName |
string
A fully-qualified path representing Project resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromStorageLayoutName(storageLayoutName)
matchProjectFromStorageLayoutName(storageLayoutName: string): string | number;
Parse the project from StorageLayout resource.
Parameter | |
---|---|
Name | Description |
storageLayoutName |
string
A fully-qualified path representing StorageLayout resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
projectPath(project)
projectPath(project: string): string;
Return a fully-qualified project resource name string.
Parameter | |
---|---|
Name | Description |
project |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
renameFolder(request, options)
renameFolder(request?: protos.google.storage.control.v2.IRenameFolderRequest, options?: CallOptions): Promise<[
LROperation<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IRenameFolderMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
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. Hierarchical namespace buckets are in allowlist preview.
Parameters | |
---|---|
Name | Description |
request |
IRenameFolderRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IRenameFolderMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. Name of the source folder being renamed.
* Format: `projects/{project}/buckets/{bucket}/folders/{folder}`
*/
// const name = 'abc123'
/**
* Required. The destination folder ID, e.g. `foo/bar/`.
*/
// const destinationFolderId = 'abc123'
/**
* Makes the operation only succeed conditional on whether the source
* folder's current metageneration matches the given value.
*/
// const ifMetagenerationMatch = 1234
/**
* Makes the operation only succeed conditional on whether the source
* folder's current metageneration does not match the given value.
*/
// const ifMetagenerationNotMatch = 1234
/**
* 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.
*/
// const requestId = 'abc123'
// Imports the Control library
const {StorageControlClient} = require('@google-cloud/storage-control').v2;
// Instantiates a client
const controlClient = new StorageControlClient();
async function callRenameFolder() {
// Construct request
const request = {
name,
destinationFolderId,
};
// Run request
const [operation] = await controlClient.renameFolder(request);
const [response] = await operation.promise();
console.log(response);
}
callRenameFolder();
renameFolder(request, options, callback)
renameFolder(request: protos.google.storage.control.v2.IRenameFolderRequest, options: CallOptions, callback: Callback<LROperation<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IRenameFolderMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IRenameFolderRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IRenameFolderMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
renameFolder(request, callback)
renameFolder(request: protos.google.storage.control.v2.IRenameFolderRequest, callback: Callback<LROperation<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IRenameFolderMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IRenameFolderRequest
|
callback |
Callback<LROperation<protos.google.storage.control.v2.IFolder, protos.google.storage.control.v2.IRenameFolderMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
storageLayoutPath(project, bucket)
storageLayoutPath(project: string, bucket: string): string;
Return a fully-qualified storageLayout resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
bucket |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |