public class StorageControlClient implements BackgroundResource
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().
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.
Implements
BackgroundResourceStatic Methods
create()
public static final StorageControlClient create()
Constructs an instance of StorageControlClient with default settings.
Returns | |
---|---|
Type | Description |
StorageControlClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(StorageControlSettings settings)
public static final StorageControlClient create(StorageControlSettings settings)
Constructs an instance of StorageControlClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings |
StorageControlSettings |
Returns | |
---|---|
Type | Description |
StorageControlClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(StorageControlStub stub)
public static final StorageControlClient create(StorageControlStub stub)
Constructs an instance of StorageControlClient, using the given stub for making calls. This is for advanced usage - prefer using create(StorageControlSettings).
Parameter | |
---|---|
Name | Description |
stub |
StorageControlStub |
Returns | |
---|---|
Type | Description |
StorageControlClient |
Constructors
StorageControlClient(StorageControlSettings settings)
protected StorageControlClient(StorageControlSettings settings)
Constructs an instance of StorageControlClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings |
StorageControlSettings |
StorageControlClient(StorageControlStub stub)
protected StorageControlClient(StorageControlStub stub)
Parameter | |
---|---|
Name | Description |
stub |
StorageControlStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration |
long |
unit |
TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createFolder(BucketName parent, Folder folder, String folderId)
public final Folder createFolder(BucketName parent, Folder folder, String folderId)
Creates a new folder.
Sample code:
// 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);
}
Parameters | |
---|---|
Name | Description |
parent |
BucketName Required. Name of the bucket in which the folder will reside. |
folder |
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 |
folderId |
String Required. The absolute path of the folder, using a single |
Returns | |
---|---|
Type | Description |
Folder |
createFolder(CreateFolderRequest request)
public final Folder createFolder(CreateFolderRequest request)
Creates a new folder.
Sample code:
// 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()) {
CreateFolderRequest request =
CreateFolderRequest.newBuilder()
.setParent(BucketName.of("[PROJECT]", "[BUCKET]").toString())
.setFolder(Folder.newBuilder().build())
.setFolderId("folderId294109737")
.setRecursive(true)
.setRequestId("requestId693933066")
.build();
Folder response = storageControlClient.createFolder(request);
}
Parameter | |
---|---|
Name | Description |
request |
CreateFolderRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Folder |
createFolder(String parent, Folder folder, String folderId)
public final Folder createFolder(String parent, Folder folder, String folderId)
Creates a new folder.
Sample code:
// 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()) {
String parent = BucketName.of("[PROJECT]", "[BUCKET]").toString();
Folder folder = Folder.newBuilder().build();
String folderId = "folderId294109737";
Folder response = storageControlClient.createFolder(parent, folder, folderId);
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. Name of the bucket in which the folder will reside. |
folder |
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 |
folderId |
String Required. The absolute path of the folder, using a single |
Returns | |
---|---|
Type | Description |
Folder |
createFolderCallable()
public final UnaryCallable<CreateFolderRequest,Folder> createFolderCallable()
Creates a new folder.
Sample code:
// 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()) {
CreateFolderRequest request =
CreateFolderRequest.newBuilder()
.setParent(BucketName.of("[PROJECT]", "[BUCKET]").toString())
.setFolder(Folder.newBuilder().build())
.setFolderId("folderId294109737")
.setRecursive(true)
.setRequestId("requestId693933066")
.build();
ApiFuture<Folder> future = storageControlClient.createFolderCallable().futureCall(request);
// Do something.
Folder response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateFolderRequest,Folder> |
deleteFolder(DeleteFolderRequest request)
public final void deleteFolder(DeleteFolderRequest request)
Permanently deletes an empty folder.
Sample code:
// 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()) {
DeleteFolderRequest request =
DeleteFolderRequest.newBuilder()
.setName(FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString())
.setIfMetagenerationMatch(1043427781)
.setIfMetagenerationNotMatch(1025430873)
.setRequestId("requestId693933066")
.build();
storageControlClient.deleteFolder(request);
}
Parameter | |
---|---|
Name | Description |
request |
DeleteFolderRequest The request object containing all of the parameters for the API call. |
deleteFolder(FolderName name)
public final void deleteFolder(FolderName name)
Permanently deletes an empty folder.
Sample code:
// 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()) {
FolderName name = FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]");
storageControlClient.deleteFolder(name);
}
Parameter | |
---|---|
Name | Description |
name |
FolderName Required. Name of the folder. Format:
|
deleteFolder(String name)
public final void deleteFolder(String name)
Permanently deletes an empty folder.
Sample code:
// 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()) {
String name = FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString();
storageControlClient.deleteFolder(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Name of the folder. Format:
|
deleteFolderCallable()
public final UnaryCallable<DeleteFolderRequest,Empty> deleteFolderCallable()
Permanently deletes an empty folder.
Sample code:
// 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()) {
DeleteFolderRequest request =
DeleteFolderRequest.newBuilder()
.setName(FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString())
.setIfMetagenerationMatch(1043427781)
.setIfMetagenerationNotMatch(1025430873)
.setRequestId("requestId693933066")
.build();
ApiFuture<Empty> future = storageControlClient.deleteFolderCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteFolderRequest,Empty> |
getFolder(FolderName name)
public final Folder getFolder(FolderName name)
Returns metadata for the specified folder.
Sample code:
// 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()) {
FolderName name = FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]");
Folder response = storageControlClient.getFolder(name);
}
Parameter | |
---|---|
Name | Description |
name |
FolderName Required. Name of the folder. Format:
|
Returns | |
---|---|
Type | Description |
Folder |
getFolder(GetFolderRequest request)
public final Folder getFolder(GetFolderRequest request)
Returns metadata for the specified folder.
Sample code:
// 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()) {
GetFolderRequest request =
GetFolderRequest.newBuilder()
.setName(FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString())
.setIfMetagenerationMatch(1043427781)
.setIfMetagenerationNotMatch(1025430873)
.setRequestId("requestId693933066")
.build();
Folder response = storageControlClient.getFolder(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetFolderRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Folder |
getFolder(String name)
public final Folder getFolder(String name)
Returns metadata for the specified folder.
Sample code:
// 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()) {
String name = FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString();
Folder response = storageControlClient.getFolder(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. Name of the folder. Format:
|
Returns | |
---|---|
Type | Description |
Folder |
getFolderCallable()
public final UnaryCallable<GetFolderRequest,Folder> getFolderCallable()
Returns metadata for the specified folder.
Sample code:
// 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()) {
GetFolderRequest request =
GetFolderRequest.newBuilder()
.setName(FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString())
.setIfMetagenerationMatch(1043427781)
.setIfMetagenerationNotMatch(1025430873)
.setRequestId("requestId693933066")
.build();
ApiFuture<Folder> future = storageControlClient.getFolderCallable().futureCall(request);
// Do something.
Folder response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetFolderRequest,Folder> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final StorageControlSettings getSettings()
Returns | |
---|---|
Type | Description |
StorageControlSettings |
getStorageLayout(GetStorageLayoutRequest request)
public final StorageLayout getStorageLayout(GetStorageLayoutRequest request)
Returns the storage layout configuration for a given bucket.
Sample code:
// 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()) {
GetStorageLayoutRequest request =
GetStorageLayoutRequest.newBuilder()
.setName(StorageLayoutName.of("[PROJECT]", "[BUCKET]").toString())
.setPrefix("prefix-980110702")
.setRequestId("requestId693933066")
.build();
StorageLayout response = storageControlClient.getStorageLayout(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetStorageLayoutRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
StorageLayout |
getStorageLayout(StorageLayoutName name)
public final StorageLayout getStorageLayout(StorageLayoutName name)
Returns the storage layout configuration for a given bucket.
Sample code:
// 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()) {
StorageLayoutName name = StorageLayoutName.of("[PROJECT]", "[BUCKET]");
StorageLayout response = storageControlClient.getStorageLayout(name);
}
Parameter | |
---|---|
Name | Description |
name |
StorageLayoutName Required. The name of the StorageLayout resource. Format:
|
Returns | |
---|---|
Type | Description |
StorageLayout |
getStorageLayout(String name)
public final StorageLayout getStorageLayout(String name)
Returns the storage layout configuration for a given bucket.
Sample code:
// 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()) {
String name = StorageLayoutName.of("[PROJECT]", "[BUCKET]").toString();
StorageLayout response = storageControlClient.getStorageLayout(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. The name of the StorageLayout resource. Format:
|
Returns | |
---|---|
Type | Description |
StorageLayout |
getStorageLayoutCallable()
public final UnaryCallable<GetStorageLayoutRequest,StorageLayout> getStorageLayoutCallable()
Returns the storage layout configuration for a given bucket.
Sample code:
// 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()) {
GetStorageLayoutRequest request =
GetStorageLayoutRequest.newBuilder()
.setName(StorageLayoutName.of("[PROJECT]", "[BUCKET]").toString())
.setPrefix("prefix-980110702")
.setRequestId("requestId693933066")
.build();
ApiFuture<StorageLayout> future =
storageControlClient.getStorageLayoutCallable().futureCall(request);
// Do something.
StorageLayout response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetStorageLayoutRequest,StorageLayout> |
getStub()
public StorageControlStub getStub()
Returns | |
---|---|
Type | Description |
StorageControlStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listFolders(BucketName parent)
public final StorageControlClient.ListFoldersPagedResponse listFolders(BucketName parent)
Retrieves a list of folders for a given bucket.
Sample code:
// 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]");
for (Folder element : storageControlClient.listFolders(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
BucketName Required. Name of the bucket in which to look for folders. |
Returns | |
---|---|
Type | Description |
StorageControlClient.ListFoldersPagedResponse |
listFolders(ListFoldersRequest request)
public final StorageControlClient.ListFoldersPagedResponse listFolders(ListFoldersRequest request)
Retrieves a list of folders for a given bucket.
Sample code:
// 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()) {
ListFoldersRequest request =
ListFoldersRequest.newBuilder()
.setParent(BucketName.of("[PROJECT]", "[BUCKET]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setPrefix("prefix-980110702")
.setDelimiter("delimiter-250518009")
.setLexicographicStart("lexicographicStart-2093413008")
.setLexicographicEnd("lexicographicEnd1646968169")
.setRequestId("requestId693933066")
.build();
for (Folder element : storageControlClient.listFolders(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListFoldersRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
StorageControlClient.ListFoldersPagedResponse |
listFolders(String parent)
public final StorageControlClient.ListFoldersPagedResponse listFolders(String parent)
Retrieves a list of folders for a given bucket.
Sample code:
// 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()) {
String parent = BucketName.of("[PROJECT]", "[BUCKET]").toString();
for (Folder element : storageControlClient.listFolders(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. Name of the bucket in which to look for folders. |
Returns | |
---|---|
Type | Description |
StorageControlClient.ListFoldersPagedResponse |
listFoldersCallable()
public final UnaryCallable<ListFoldersRequest,ListFoldersResponse> listFoldersCallable()
Retrieves a list of folders for a given bucket.
Sample code:
// 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()) {
ListFoldersRequest request =
ListFoldersRequest.newBuilder()
.setParent(BucketName.of("[PROJECT]", "[BUCKET]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setPrefix("prefix-980110702")
.setDelimiter("delimiter-250518009")
.setLexicographicStart("lexicographicStart-2093413008")
.setLexicographicEnd("lexicographicEnd1646968169")
.setRequestId("requestId693933066")
.build();
while (true) {
ListFoldersResponse response = storageControlClient.listFoldersCallable().call(request);
for (Folder element : response.getFoldersList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListFoldersRequest,ListFoldersResponse> |
listFoldersPagedCallable()
public final UnaryCallable<ListFoldersRequest,StorageControlClient.ListFoldersPagedResponse> listFoldersPagedCallable()
Retrieves a list of folders for a given bucket.
Sample code:
// 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()) {
ListFoldersRequest request =
ListFoldersRequest.newBuilder()
.setParent(BucketName.of("[PROJECT]", "[BUCKET]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setPrefix("prefix-980110702")
.setDelimiter("delimiter-250518009")
.setLexicographicStart("lexicographicStart-2093413008")
.setLexicographicEnd("lexicographicEnd1646968169")
.setRequestId("requestId693933066")
.build();
ApiFuture<Folder> future =
storageControlClient.listFoldersPagedCallable().futureCall(request);
// Do something.
for (Folder element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListFoldersRequest,ListFoldersPagedResponse> |
renameFolderAsync(FolderName name, String destinationFolderId)
public final OperationFuture<Folder,RenameFolderMetadata> renameFolderAsync(FolderName name, String destinationFolderId)
Renames a source folder to a destination folder. During a rename, the source and destination folders are locked until the long running operation completes.
Sample code:
// 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()) {
FolderName name = FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]");
String destinationFolderId = "destinationFolderId-480084905";
Folder response = storageControlClient.renameFolderAsync(name, destinationFolderId).get();
}
Parameters | |
---|---|
Name | Description |
name |
FolderName Required. Name of the source folder being renamed. Format:
|
destinationFolderId |
String Required. The destination folder ID, e.g. |
Returns | |
---|---|
Type | Description |
OperationFuture<Folder,RenameFolderMetadata> |
renameFolderAsync(RenameFolderRequest request)
public final OperationFuture<Folder,RenameFolderMetadata> renameFolderAsync(RenameFolderRequest request)
Renames a source folder to a destination folder. During a rename, the source and destination folders are locked until the long running operation completes.
Sample code:
// 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()) {
RenameFolderRequest request =
RenameFolderRequest.newBuilder()
.setName(FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString())
.setDestinationFolderId("destinationFolderId-480084905")
.setIfMetagenerationMatch(1043427781)
.setIfMetagenerationNotMatch(1025430873)
.setRequestId("requestId693933066")
.build();
Folder response = storageControlClient.renameFolderAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
RenameFolderRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Folder,RenameFolderMetadata> |
renameFolderAsync(String name, String destinationFolderId)
public final OperationFuture<Folder,RenameFolderMetadata> renameFolderAsync(String name, String destinationFolderId)
Renames a source folder to a destination folder. During a rename, the source and destination folders are locked until the long running operation completes.
Sample code:
// 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()) {
String name = FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString();
String destinationFolderId = "destinationFolderId-480084905";
Folder response = storageControlClient.renameFolderAsync(name, destinationFolderId).get();
}
Parameters | |
---|---|
Name | Description |
name |
String Required. Name of the source folder being renamed. Format:
|
destinationFolderId |
String Required. The destination folder ID, e.g. |
Returns | |
---|---|
Type | Description |
OperationFuture<Folder,RenameFolderMetadata> |
renameFolderCallable()
public final UnaryCallable<RenameFolderRequest,Operation> renameFolderCallable()
Renames a source folder to a destination folder. During a rename, the source and destination folders are locked until the long running operation completes.
Sample code:
// 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()) {
RenameFolderRequest request =
RenameFolderRequest.newBuilder()
.setName(FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString())
.setDestinationFolderId("destinationFolderId-480084905")
.setIfMetagenerationMatch(1043427781)
.setIfMetagenerationNotMatch(1025430873)
.setRequestId("requestId693933066")
.build();
ApiFuture<Operation> future = storageControlClient.renameFolderCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<RenameFolderRequest,Operation> |
renameFolderOperationCallable()
public final OperationCallable<RenameFolderRequest,Folder,RenameFolderMetadata> renameFolderOperationCallable()
Renames a source folder to a destination folder. During a rename, the source and destination folders are locked until the long running operation completes.
Sample code:
// 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()) {
RenameFolderRequest request =
RenameFolderRequest.newBuilder()
.setName(FolderName.of("[PROJECT]", "[BUCKET]", "[FOLDER]").toString())
.setDestinationFolderId("destinationFolderId-480084905")
.setIfMetagenerationMatch(1043427781)
.setIfMetagenerationNotMatch(1025430873)
.setRequestId("requestId693933066")
.build();
OperationFuture<Folder, RenameFolderMetadata> future =
storageControlClient.renameFolderOperationCallable().futureCall(request);
// Do something.
Folder response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<RenameFolderRequest,Folder,RenameFolderMetadata> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()