@Generated(value="by gapic-generator") @BetaApi public class BackendBucketClient extends Object implements BackgroundResource
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:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
Operation response = backendBucketClient.addSignedUrlKeyBackendBucket(backendBucket, signedUrlKeyResource);
}
Note: close() needs to be called on the backendBucketClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
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 BackendBucketSettings to create(). For example:
To customize credentials:
BackendBucketSettings backendBucketSettings =
BackendBucketSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
BackendBucketClient backendBucketClient =
BackendBucketClient.create(backendBucketSettings);
To customize the endpoint:
BackendBucketSettings backendBucketSettings =
BackendBucketSettings.newBuilder().setEndpoint(myEndpoint).build();
BackendBucketClient backendBucketClient =
BackendBucketClient.create(backendBucketSettings);
Modifier and Type | Class and Description |
---|---|
static class |
BackendBucketClient.ListBackendBucketsFixedSizeCollection |
static class |
BackendBucketClient.ListBackendBucketsPage |
static class |
BackendBucketClient.ListBackendBucketsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
BackendBucketClient(BackendBucketSettings settings)
Constructs an instance of BackendBucketClient, using the given settings.
|
protected |
BackendBucketClient(BackendBucketStub stub) |
Modifier and Type | Method and Description |
---|---|
Operation |
addSignedUrlKeyBackendBucket(AddSignedUrlKeyBackendBucketHttpRequest request)
Adds a key for validating requests with signed URLs for this backend bucket.
|
Operation |
addSignedUrlKeyBackendBucket(ProjectGlobalBackendBucketName backendBucket,
SignedUrlKey signedUrlKeyResource)
Adds a key for validating requests with signed URLs for this backend bucket.
|
Operation |
addSignedUrlKeyBackendBucket(String backendBucket,
SignedUrlKey signedUrlKeyResource)
Adds a key for validating requests with signed URLs for this backend bucket.
|
UnaryCallable<AddSignedUrlKeyBackendBucketHttpRequest,Operation> |
addSignedUrlKeyBackendBucketCallable()
Adds a key for validating requests with signed URLs for this backend bucket.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static BackendBucketClient |
create()
Constructs an instance of BackendBucketClient with default settings.
|
static BackendBucketClient |
create(BackendBucketSettings settings)
Constructs an instance of BackendBucketClient, using the given settings.
|
static BackendBucketClient |
create(BackendBucketStub stub)
Constructs an instance of BackendBucketClient, using the given stub for making calls.
|
Operation |
deleteBackendBucket(DeleteBackendBucketHttpRequest request)
Deletes the specified BackendBucket resource.
|
Operation |
deleteBackendBucket(ProjectGlobalBackendBucketName backendBucket)
Deletes the specified BackendBucket resource.
|
Operation |
deleteBackendBucket(String backendBucket)
Deletes the specified BackendBucket resource.
|
UnaryCallable<DeleteBackendBucketHttpRequest,Operation> |
deleteBackendBucketCallable()
Deletes the specified BackendBucket resource.
|
Operation |
deleteSignedUrlKeyBackendBucket(DeleteSignedUrlKeyBackendBucketHttpRequest request)
Deletes a key for validating requests with signed URLs for this backend bucket.
|
Operation |
deleteSignedUrlKeyBackendBucket(ProjectGlobalBackendBucketName backendBucket,
String keyName)
Deletes a key for validating requests with signed URLs for this backend bucket.
|
Operation |
deleteSignedUrlKeyBackendBucket(String backendBucket,
String keyName)
Deletes a key for validating requests with signed URLs for this backend bucket.
|
UnaryCallable<DeleteSignedUrlKeyBackendBucketHttpRequest,Operation> |
deleteSignedUrlKeyBackendBucketCallable()
Deletes a key for validating requests with signed URLs for this backend bucket.
|
BackendBucket |
getBackendBucket(GetBackendBucketHttpRequest request)
Returns the specified BackendBucket resource.
|
BackendBucket |
getBackendBucket(ProjectGlobalBackendBucketName backendBucket)
Returns the specified BackendBucket resource.
|
BackendBucket |
getBackendBucket(String backendBucket)
Returns the specified BackendBucket resource.
|
UnaryCallable<GetBackendBucketHttpRequest,BackendBucket> |
getBackendBucketCallable()
Returns the specified BackendBucket resource.
|
BackendBucketSettings |
getSettings() |
BackendBucketStub |
getStub() |
Operation |
insertBackendBucket(InsertBackendBucketHttpRequest request)
Creates a BackendBucket resource in the specified project using the data included in the
request.
|
Operation |
insertBackendBucket(ProjectName project,
BackendBucket backendBucketResource)
Creates a BackendBucket resource in the specified project using the data included in the
request.
|
Operation |
insertBackendBucket(String project,
BackendBucket backendBucketResource)
Creates a BackendBucket resource in the specified project using the data included in the
request.
|
UnaryCallable<InsertBackendBucketHttpRequest,Operation> |
insertBackendBucketCallable()
Creates a BackendBucket resource in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
BackendBucketClient.ListBackendBucketsPagedResponse |
listBackendBuckets(ListBackendBucketsHttpRequest request)
Retrieves the list of BackendBucket resources available to the specified project.
|
BackendBucketClient.ListBackendBucketsPagedResponse |
listBackendBuckets(ProjectName project)
Retrieves the list of BackendBucket resources available to the specified project.
|
BackendBucketClient.ListBackendBucketsPagedResponse |
listBackendBuckets(String project)
Retrieves the list of BackendBucket resources available to the specified project.
|
UnaryCallable<ListBackendBucketsHttpRequest,BackendBucketList> |
listBackendBucketsCallable()
Retrieves the list of BackendBucket resources available to the specified project.
|
UnaryCallable<ListBackendBucketsHttpRequest,BackendBucketClient.ListBackendBucketsPagedResponse> |
listBackendBucketsPagedCallable()
Retrieves the list of BackendBucket resources available to the specified project.
|
Operation |
patchBackendBucket(PatchBackendBucketHttpRequest request)
Updates the specified BackendBucket resource with the data included in the request.
|
Operation |
patchBackendBucket(ProjectGlobalBackendBucketName backendBucket,
BackendBucket backendBucketResource,
List<String> fieldMask)
Updates the specified BackendBucket resource with the data included in the request.
|
Operation |
patchBackendBucket(String backendBucket,
BackendBucket backendBucketResource,
List<String> fieldMask)
Updates the specified BackendBucket resource with the data included in the request.
|
UnaryCallable<PatchBackendBucketHttpRequest,Operation> |
patchBackendBucketCallable()
Updates the specified BackendBucket resource with the data included in the request.
|
void |
shutdown() |
void |
shutdownNow() |
Operation |
updateBackendBucket(ProjectGlobalBackendBucketName backendBucket,
BackendBucket backendBucketResource,
List<String> fieldMask)
Updates the specified BackendBucket resource with the data included in the request.
|
Operation |
updateBackendBucket(String backendBucket,
BackendBucket backendBucketResource,
List<String> fieldMask)
Updates the specified BackendBucket resource with the data included in the request.
|
Operation |
updateBackendBucket(UpdateBackendBucketHttpRequest request)
Updates the specified BackendBucket resource with the data included in the request.
|
UnaryCallable<UpdateBackendBucketHttpRequest,Operation> |
updateBackendBucketCallable()
Updates the specified BackendBucket resource with the data included in the request.
|
protected BackendBucketClient(BackendBucketSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected BackendBucketClient(BackendBucketStub stub)
public static final BackendBucketClient create() throws IOException
IOException
public static final BackendBucketClient create(BackendBucketSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final BackendBucketClient create(BackendBucketStub stub)
public final BackendBucketSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public BackendBucketStub getStub()
@BetaApi public final Operation addSignedUrlKeyBackendBucket(ProjectGlobalBackendBucketName backendBucket, SignedUrlKey signedUrlKeyResource)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
Operation response = backendBucketClient.addSignedUrlKeyBackendBucket(backendBucket, signedUrlKeyResource);
}
backendBucket
- Name of the BackendBucket resource to which the Signed URL Key should be
added. The name should conform to RFC1035.signedUrlKeyResource
- Represents a customer-supplied Signing Key used by Cloud CDN Signed
URLsApiException
- if the remote call fails@BetaApi public final Operation addSignedUrlKeyBackendBucket(String backendBucket, SignedUrlKey signedUrlKeyResource)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
Operation response = backendBucketClient.addSignedUrlKeyBackendBucket(backendBucket.toString(), signedUrlKeyResource);
}
backendBucket
- Name of the BackendBucket resource to which the Signed URL Key should be
added. The name should conform to RFC1035.signedUrlKeyResource
- Represents a customer-supplied Signing Key used by Cloud CDN Signed
URLsApiException
- if the remote call fails@BetaApi public final Operation addSignedUrlKeyBackendBucket(AddSignedUrlKeyBackendBucketHttpRequest request)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
AddSignedUrlKeyBackendBucketHttpRequest request = AddSignedUrlKeyBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.setSignedUrlKeyResource(signedUrlKeyResource)
.build();
Operation response = backendBucketClient.addSignedUrlKeyBackendBucket(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<AddSignedUrlKeyBackendBucketHttpRequest,Operation> addSignedUrlKeyBackendBucketCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
AddSignedUrlKeyBackendBucketHttpRequest request = AddSignedUrlKeyBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.setSignedUrlKeyResource(signedUrlKeyResource)
.build();
ApiFuture<Operation> future = backendBucketClient.addSignedUrlKeyBackendBucketCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteBackendBucket(ProjectGlobalBackendBucketName backendBucket)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
Operation response = backendBucketClient.deleteBackendBucket(backendBucket);
}
backendBucket
- Name of the BackendBucket resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteBackendBucket(String backendBucket)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
Operation response = backendBucketClient.deleteBackendBucket(backendBucket.toString());
}
backendBucket
- Name of the BackendBucket resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteBackendBucket(DeleteBackendBucketHttpRequest request)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
DeleteBackendBucketHttpRequest request = DeleteBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.build();
Operation response = backendBucketClient.deleteBackendBucket(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteBackendBucketHttpRequest,Operation> deleteBackendBucketCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
DeleteBackendBucketHttpRequest request = DeleteBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.build();
ApiFuture<Operation> future = backendBucketClient.deleteBackendBucketCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteSignedUrlKeyBackendBucket(ProjectGlobalBackendBucketName backendBucket, String keyName)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
String keyName = "";
Operation response = backendBucketClient.deleteSignedUrlKeyBackendBucket(backendBucket, keyName);
}
backendBucket
- Name of the BackendBucket resource to which the Signed URL Key should be
added. The name should conform to RFC1035.keyName
- The name of the Signed URL Key to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteSignedUrlKeyBackendBucket(String backendBucket, String keyName)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
String keyName = "";
Operation response = backendBucketClient.deleteSignedUrlKeyBackendBucket(backendBucket.toString(), keyName);
}
backendBucket
- Name of the BackendBucket resource to which the Signed URL Key should be
added. The name should conform to RFC1035.keyName
- The name of the Signed URL Key to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteSignedUrlKeyBackendBucket(DeleteSignedUrlKeyBackendBucketHttpRequest request)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
String keyName = "";
DeleteSignedUrlKeyBackendBucketHttpRequest request = DeleteSignedUrlKeyBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.setKeyName(keyName)
.build();
Operation response = backendBucketClient.deleteSignedUrlKeyBackendBucket(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteSignedUrlKeyBackendBucketHttpRequest,Operation> deleteSignedUrlKeyBackendBucketCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
String keyName = "";
DeleteSignedUrlKeyBackendBucketHttpRequest request = DeleteSignedUrlKeyBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.setKeyName(keyName)
.build();
ApiFuture<Operation> future = backendBucketClient.deleteSignedUrlKeyBackendBucketCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final BackendBucket getBackendBucket(ProjectGlobalBackendBucketName backendBucket)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket response = backendBucketClient.getBackendBucket(backendBucket);
}
backendBucket
- Name of the BackendBucket resource to return.ApiException
- if the remote call fails@BetaApi public final BackendBucket getBackendBucket(String backendBucket)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket response = backendBucketClient.getBackendBucket(backendBucket.toString());
}
backendBucket
- Name of the BackendBucket resource to return.ApiException
- if the remote call fails@BetaApi public final BackendBucket getBackendBucket(GetBackendBucketHttpRequest request)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
GetBackendBucketHttpRequest request = GetBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.build();
BackendBucket response = backendBucketClient.getBackendBucket(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetBackendBucketHttpRequest,BackendBucket> getBackendBucketCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
GetBackendBucketHttpRequest request = GetBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.build();
ApiFuture<BackendBucket> future = backendBucketClient.getBackendBucketCallable().futureCall(request);
// Do something
BackendBucket response = future.get();
}
@BetaApi public final Operation insertBackendBucket(ProjectName project, BackendBucket backendBucketResource)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
Operation response = backendBucketClient.insertBackendBucket(project, backendBucketResource);
}
project
- Project ID for this request.backendBucketResource
- A BackendBucket resource. This resource defines a Cloud Storage
bucket.ApiException
- if the remote call fails@BetaApi public final Operation insertBackendBucket(String project, BackendBucket backendBucketResource)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
Operation response = backendBucketClient.insertBackendBucket(project.toString(), backendBucketResource);
}
project
- Project ID for this request.backendBucketResource
- A BackendBucket resource. This resource defines a Cloud Storage
bucket.ApiException
- if the remote call fails@BetaApi public final Operation insertBackendBucket(InsertBackendBucketHttpRequest request)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
InsertBackendBucketHttpRequest request = InsertBackendBucketHttpRequest.newBuilder()
.setProject(formattedProject)
.setBackendBucketResource(backendBucketResource)
.build();
Operation response = backendBucketClient.insertBackendBucket(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertBackendBucketHttpRequest,Operation> insertBackendBucketCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
InsertBackendBucketHttpRequest request = InsertBackendBucketHttpRequest.newBuilder()
.setProject(formattedProject)
.setBackendBucketResource(backendBucketResource)
.build();
ApiFuture<Operation> future = backendBucketClient.insertBackendBucketCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final BackendBucketClient.ListBackendBucketsPagedResponse listBackendBuckets(ProjectName project)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (BackendBucket element : backendBucketClient.listBackendBuckets(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final BackendBucketClient.ListBackendBucketsPagedResponse listBackendBuckets(String project)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (BackendBucket element : backendBucketClient.listBackendBuckets(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final BackendBucketClient.ListBackendBucketsPagedResponse listBackendBuckets(ListBackendBucketsHttpRequest request)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListBackendBucketsHttpRequest request = ListBackendBucketsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (BackendBucket element : backendBucketClient.listBackendBuckets(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<ListBackendBucketsHttpRequest,BackendBucketClient.ListBackendBucketsPagedResponse> listBackendBucketsPagedCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListBackendBucketsHttpRequest request = ListBackendBucketsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListBackendBucketsPagedResponse> future = backendBucketClient.listBackendBucketsPagedCallable().futureCall(request);
// Do something
for (BackendBucket element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListBackendBucketsHttpRequest,BackendBucketList> listBackendBucketsCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListBackendBucketsHttpRequest request = ListBackendBucketsHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
BackendBucketList response = backendBucketClient.listBackendBucketsCallable().call(request);
for (BackendBucket element : response.getItemsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation patchBackendBucket(ProjectGlobalBackendBucketName backendBucket, BackendBucket backendBucketResource, List<String> fieldMask)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = backendBucketClient.patchBackendBucket(backendBucket, backendBucketResource, fieldMask);
}
backendBucket
- Name of the BackendBucket resource to patch.backendBucketResource
- A BackendBucket resource. This resource defines a Cloud Storage
bucket.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.ApiException
- if the remote call fails@BetaApi public final Operation patchBackendBucket(String backendBucket, BackendBucket backendBucketResource, List<String> fieldMask)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = backendBucketClient.patchBackendBucket(backendBucket.toString(), backendBucketResource, fieldMask);
}
backendBucket
- Name of the BackendBucket resource to patch.backendBucketResource
- A BackendBucket resource. This resource defines a Cloud Storage
bucket.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.ApiException
- if the remote call fails@BetaApi public final Operation patchBackendBucket(PatchBackendBucketHttpRequest request)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchBackendBucketHttpRequest request = PatchBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.setBackendBucketResource(backendBucketResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = backendBucketClient.patchBackendBucket(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<PatchBackendBucketHttpRequest,Operation> patchBackendBucketCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchBackendBucketHttpRequest request = PatchBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.setBackendBucketResource(backendBucketResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = backendBucketClient.patchBackendBucketCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateBackendBucket(ProjectGlobalBackendBucketName backendBucket, BackendBucket backendBucketResource, List<String> fieldMask)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = backendBucketClient.updateBackendBucket(backendBucket, backendBucketResource, fieldMask);
}
backendBucket
- Name of the BackendBucket resource to update.backendBucketResource
- A BackendBucket resource. This resource defines a Cloud Storage
bucket.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.ApiException
- if the remote call fails@BetaApi public final Operation updateBackendBucket(String backendBucket, BackendBucket backendBucketResource, List<String> fieldMask)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = backendBucketClient.updateBackendBucket(backendBucket.toString(), backendBucketResource, fieldMask);
}
backendBucket
- Name of the BackendBucket resource to update.backendBucketResource
- A BackendBucket resource. This resource defines a Cloud Storage
bucket.fieldMask
- The fields that should be serialized (even if they have empty values). If the
containing message object has a non-null fieldmask, then all the fields in the field mask
(and only those fields in the field mask) will be serialized. If the containing object does
not have a fieldmask, then only non-empty fields will be serialized.ApiException
- if the remote call fails@BetaApi public final Operation updateBackendBucket(UpdateBackendBucketHttpRequest request)
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateBackendBucketHttpRequest request = UpdateBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.setBackendBucketResource(backendBucketResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = backendBucketClient.updateBackendBucket(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<UpdateBackendBucketHttpRequest,Operation> updateBackendBucketCallable()
Sample code:
try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
String formattedBackendBucket = ProjectGlobalBackendBucketName.format("[PROJECT]", "[BACKEND_BUCKET]");
BackendBucket backendBucketResource = BackendBucket.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateBackendBucketHttpRequest request = UpdateBackendBucketHttpRequest.newBuilder()
.setBackendBucket(formattedBackendBucket)
.setBackendBucketResource(backendBucketResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = backendBucketClient.updateBackendBucketCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.