A client to Cloud Storage API
The interfaces provided are listed below, along with usage samples.
StorageControlClient
Service Description: StorageControl service includes selected control plane operations.
Sample for StorageControlClient:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageControlClient storageControlClient = StorageControlClient.create()) {
BucketName parent = BucketName.of("[PROJECT]", "[BUCKET]");
Folder folder = Folder.newBuilder().build();
String folderId = "folderId294109737";
Folder response = storageControlClient.createFolder(parent, folder, folderId);
}
Classes
BucketName
BucketName.Builder
Builder for projects/{project}/buckets/{bucket}.
CommonLongRunningOperationMetadata
The message contains metadata that is common to all Storage Control
long-running operations, present in its google.longrunning.Operation
messages, and accessible via metadata.common_metadata
.
Protobuf type google.storage.control.v2.CommonLongRunningOperationMetadata
CommonLongRunningOperationMetadata.Builder
The message contains metadata that is common to all Storage Control
long-running operations, present in its google.longrunning.Operation
messages, and accessible via metadata.common_metadata
.
Protobuf type google.storage.control.v2.CommonLongRunningOperationMetadata
CreateFolderRequest
Request message for CreateFolder.
Protobuf type google.storage.control.v2.CreateFolderRequest
CreateFolderRequest.Builder
Request message for CreateFolder.
Protobuf type google.storage.control.v2.CreateFolderRequest
DeleteFolderRequest
Request message for DeleteFolder.
Protobuf type google.storage.control.v2.DeleteFolderRequest
DeleteFolderRequest.Builder
Request message for DeleteFolder.
Protobuf type google.storage.control.v2.DeleteFolderRequest
Folder
A folder.
Protobuf type google.storage.control.v2.Folder
Folder.Builder
A folder.
Protobuf type google.storage.control.v2.Folder
FolderName
FolderName.Builder
Builder for projects/{project}/buckets/{bucket}/folders/{folder=**}.
GetFolderRequest
Request message for GetFolder.
Protobuf type google.storage.control.v2.GetFolderRequest
GetFolderRequest.Builder
Request message for GetFolder.
Protobuf type google.storage.control.v2.GetFolderRequest
GetStorageLayoutRequest
Request message for GetStorageLayout.
Protobuf type google.storage.control.v2.GetStorageLayoutRequest
GetStorageLayoutRequest.Builder
Request message for GetStorageLayout.
Protobuf type google.storage.control.v2.GetStorageLayoutRequest
ListFoldersRequest
Request message for ListFolders.
Protobuf type google.storage.control.v2.ListFoldersRequest
ListFoldersRequest.Builder
Request message for ListFolders.
Protobuf type google.storage.control.v2.ListFoldersRequest
ListFoldersResponse
Response message for ListFolders.
Protobuf type google.storage.control.v2.ListFoldersResponse
ListFoldersResponse.Builder
Response message for ListFolders.
Protobuf type google.storage.control.v2.ListFoldersResponse
PendingRenameInfo
Contains information about a pending rename operation.
Protobuf type google.storage.control.v2.PendingRenameInfo
PendingRenameInfo.Builder
Contains information about a pending rename operation.
Protobuf type google.storage.control.v2.PendingRenameInfo
RenameFolderMetadata
Message returned in the metadata field of the Operation resource for RenameFolder operations.
Protobuf type google.storage.control.v2.RenameFolderMetadata
RenameFolderMetadata.Builder
Message returned in the metadata field of the Operation resource for RenameFolder operations.
Protobuf type google.storage.control.v2.RenameFolderMetadata
RenameFolderRequest
Request message for RenameFolder.
Protobuf type google.storage.control.v2.RenameFolderRequest
RenameFolderRequest.Builder
Request message for RenameFolder.
Protobuf type google.storage.control.v2.RenameFolderRequest
StorageControlClient
Service Description: StorageControl service includes selected control plane operations.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageControlClient storageControlClient = StorageControlClient.create()) {
BucketName parent = BucketName.of("[PROJECT]", "[BUCKET]");
Folder folder = Folder.newBuilder().build();
String folderId = "folderId294109737";
Folder response = storageControlClient.createFolder(parent, folder, folderId);
}
Note: close() needs to be called on the StorageControlClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
Method | Description | Method Variants |
---|---|---|
CreateFolder |
Creates a new folder. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteFolder |
Permanently deletes an empty folder. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetFolder |
Returns metadata for the specified folder. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListFolders |
Retrieves a list of folders for a given bucket. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RenameFolder |
Renames a source folder to a destination folder. During a rename, the source and destination folders are locked until the long running operation completes. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetStorageLayout |
Returns the storage layout configuration for a given bucket. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of StorageControlSettings to create(). For example:
To customize credentials:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageControlSettings storageControlSettings =
StorageControlSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
StorageControlClient storageControlClient = StorageControlClient.create(storageControlSettings);
To customize the endpoint:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageControlSettings storageControlSettings =
StorageControlSettings.newBuilder().setEndpoint(myEndpoint).build();
StorageControlClient storageControlClient = StorageControlClient.create(storageControlSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
StorageControlClient.ListFoldersFixedSizeCollection
StorageControlClient.ListFoldersPage
StorageControlClient.ListFoldersPagedResponse
StorageControlGrpc
StorageControl service includes selected control plane operations.
StorageControlGrpc.StorageControlBlockingStub
A stub to allow clients to do synchronous rpc calls to service StorageControl.
StorageControl service includes selected control plane operations.
StorageControlGrpc.StorageControlFutureStub
A stub to allow clients to do ListenableFuture-style rpc calls to service StorageControl.
StorageControl service includes selected control plane operations.
StorageControlGrpc.StorageControlImplBase
Base class for the server implementation of the service StorageControl.
StorageControl service includes selected control plane operations.
StorageControlGrpc.StorageControlStub
A stub to allow clients to do asynchronous rpc calls to service StorageControl.
StorageControl service includes selected control plane operations.
StorageControlProto
StorageControlSettings
Settings class to configure an instance of StorageControlClient.
The default instance has everything set to sensible defaults:
- The default service address (storage.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of createFolder to 30 seconds:
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageControlSettings.Builder storageControlSettingsBuilder =
StorageControlSettings.newBuilder();
storageControlSettingsBuilder
.createFolderSettings()
.setRetrySettings(
storageControlSettingsBuilder
.createFolderSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
StorageControlSettings storageControlSettings = storageControlSettingsBuilder.build();
StorageControlSettings.Builder
Builder for StorageControlSettings.
StorageLayout
The storage layout configuration of a bucket.
Protobuf type google.storage.control.v2.StorageLayout
StorageLayout.Builder
The storage layout configuration of a bucket.
Protobuf type google.storage.control.v2.StorageLayout
StorageLayout.CustomPlacementConfig
Configuration for Custom Dual Regions. It should specify precisely two eligible regions within the same Multiregion. More information on regions may be found https://cloud.google.com/storage/docs/locations.
Protobuf type google.storage.control.v2.StorageLayout.CustomPlacementConfig
StorageLayout.CustomPlacementConfig.Builder
Configuration for Custom Dual Regions. It should specify precisely two eligible regions within the same Multiregion. More information on regions may be found https://cloud.google.com/storage/docs/locations.
Protobuf type google.storage.control.v2.StorageLayout.CustomPlacementConfig
StorageLayout.HierarchicalNamespace
Configuration for a bucket's hierarchical namespace feature.
Protobuf type google.storage.control.v2.StorageLayout.HierarchicalNamespace
StorageLayout.HierarchicalNamespace.Builder
Configuration for a bucket's hierarchical namespace feature.
Protobuf type google.storage.control.v2.StorageLayout.HierarchicalNamespace
StorageLayoutName
StorageLayoutName.Builder
Builder for projects/{project}/buckets/{bucket}/storageLayout.
Interfaces
CommonLongRunningOperationMetadataOrBuilder
CreateFolderRequestOrBuilder
DeleteFolderRequestOrBuilder
FolderOrBuilder
GetFolderRequestOrBuilder
GetStorageLayoutRequestOrBuilder
ListFoldersRequestOrBuilder
ListFoldersResponseOrBuilder
PendingRenameInfoOrBuilder
RenameFolderMetadataOrBuilder
RenameFolderRequestOrBuilder
StorageControlGrpc.AsyncService
StorageControl service includes selected control plane operations.