@Generated(value="by gapic-generator") @BetaApi public class BackendServiceClient 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 (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
Operation response = backendServiceClient.addSignedUrlKeyBackendService(backendService, signedUrlKeyResource);
}
Note: close() needs to be called on the backendServiceClient 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 BackendServiceSettings to create(). For example:
To customize credentials:
BackendServiceSettings backendServiceSettings =
BackendServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
BackendServiceClient backendServiceClient =
BackendServiceClient.create(backendServiceSettings);
To customize the endpoint:
BackendServiceSettings backendServiceSettings =
BackendServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
BackendServiceClient backendServiceClient =
BackendServiceClient.create(backendServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
BackendServiceClient.AggregatedListBackendServicesFixedSizeCollection |
static class |
BackendServiceClient.AggregatedListBackendServicesPage |
static class |
BackendServiceClient.AggregatedListBackendServicesPagedResponse |
static class |
BackendServiceClient.ListBackendServicesFixedSizeCollection |
static class |
BackendServiceClient.ListBackendServicesPage |
static class |
BackendServiceClient.ListBackendServicesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
BackendServiceClient(BackendServiceSettings settings)
Constructs an instance of BackendServiceClient, using the given settings.
|
protected |
BackendServiceClient(BackendServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
Operation |
addSignedUrlKeyBackendService(AddSignedUrlKeyBackendServiceHttpRequest request)
Adds a key for validating requests with signed URLs for this backend service.
|
Operation |
addSignedUrlKeyBackendService(ProjectGlobalBackendServiceName backendService,
SignedUrlKey signedUrlKeyResource)
Adds a key for validating requests with signed URLs for this backend service.
|
Operation |
addSignedUrlKeyBackendService(String backendService,
SignedUrlKey signedUrlKeyResource)
Adds a key for validating requests with signed URLs for this backend service.
|
UnaryCallable<AddSignedUrlKeyBackendServiceHttpRequest,Operation> |
addSignedUrlKeyBackendServiceCallable()
Adds a key for validating requests with signed URLs for this backend service.
|
BackendServiceClient.AggregatedListBackendServicesPagedResponse |
aggregatedListBackendServices(AggregatedListBackendServicesHttpRequest request)
Retrieves the list of all BackendService resources, regional and global, available to the
specified project.
|
BackendServiceClient.AggregatedListBackendServicesPagedResponse |
aggregatedListBackendServices(ProjectName project)
Retrieves the list of all BackendService resources, regional and global, available to the
specified project.
|
BackendServiceClient.AggregatedListBackendServicesPagedResponse |
aggregatedListBackendServices(String project)
Retrieves the list of all BackendService resources, regional and global, available to the
specified project.
|
UnaryCallable<AggregatedListBackendServicesHttpRequest,BackendServiceAggregatedList> |
aggregatedListBackendServicesCallable()
Retrieves the list of all BackendService resources, regional and global, available to the
specified project.
|
UnaryCallable<AggregatedListBackendServicesHttpRequest,BackendServiceClient.AggregatedListBackendServicesPagedResponse> |
aggregatedListBackendServicesPagedCallable()
Retrieves the list of all BackendService resources, regional and global, available to the
specified project.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static BackendServiceClient |
create()
Constructs an instance of BackendServiceClient with default settings.
|
static BackendServiceClient |
create(BackendServiceSettings settings)
Constructs an instance of BackendServiceClient, using the given settings.
|
static BackendServiceClient |
create(BackendServiceStub stub)
Constructs an instance of BackendServiceClient, using the given stub for making calls.
|
Operation |
deleteBackendService(DeleteBackendServiceHttpRequest request)
Deletes the specified BackendService resource.
|
Operation |
deleteBackendService(ProjectGlobalBackendServiceName backendService)
Deletes the specified BackendService resource.
|
Operation |
deleteBackendService(String backendService)
Deletes the specified BackendService resource.
|
UnaryCallable<DeleteBackendServiceHttpRequest,Operation> |
deleteBackendServiceCallable()
Deletes the specified BackendService resource.
|
Operation |
deleteSignedUrlKeyBackendService(DeleteSignedUrlKeyBackendServiceHttpRequest request)
Deletes a key for validating requests with signed URLs for this backend service.
|
Operation |
deleteSignedUrlKeyBackendService(ProjectGlobalBackendServiceName backendService,
String keyName)
Deletes a key for validating requests with signed URLs for this backend service.
|
Operation |
deleteSignedUrlKeyBackendService(String backendService,
String keyName)
Deletes a key for validating requests with signed URLs for this backend service.
|
UnaryCallable<DeleteSignedUrlKeyBackendServiceHttpRequest,Operation> |
deleteSignedUrlKeyBackendServiceCallable()
Deletes a key for validating requests with signed URLs for this backend service.
|
BackendService |
getBackendService(GetBackendServiceHttpRequest request)
Returns the specified BackendService resource.
|
BackendService |
getBackendService(ProjectGlobalBackendServiceName backendService)
Returns the specified BackendService resource.
|
BackendService |
getBackendService(String backendService)
Returns the specified BackendService resource.
|
UnaryCallable<GetBackendServiceHttpRequest,BackendService> |
getBackendServiceCallable()
Returns the specified BackendService resource.
|
BackendServiceGroupHealth |
getHealthBackendService(GetHealthBackendServiceHttpRequest request)
Gets the most recent health check results for this BackendService.
|
BackendServiceGroupHealth |
getHealthBackendService(ProjectGlobalBackendServiceName backendService,
ResourceGroupReference resourceGroupReferenceResource)
Gets the most recent health check results for this BackendService.
|
BackendServiceGroupHealth |
getHealthBackendService(String backendService,
ResourceGroupReference resourceGroupReferenceResource)
Gets the most recent health check results for this BackendService.
|
UnaryCallable<GetHealthBackendServiceHttpRequest,BackendServiceGroupHealth> |
getHealthBackendServiceCallable()
Gets the most recent health check results for this BackendService.
|
BackendServiceSettings |
getSettings() |
BackendServiceStub |
getStub() |
Operation |
insertBackendService(InsertBackendServiceHttpRequest request)
Creates a BackendService resource in the specified project using the data included in the
request.
|
Operation |
insertBackendService(ProjectName project,
BackendService backendServiceResource)
Creates a BackendService resource in the specified project using the data included in the
request.
|
Operation |
insertBackendService(String project,
BackendService backendServiceResource)
Creates a BackendService resource in the specified project using the data included in the
request.
|
UnaryCallable<InsertBackendServiceHttpRequest,Operation> |
insertBackendServiceCallable()
Creates a BackendService resource in the specified project using the data included in the
request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
BackendServiceClient.ListBackendServicesPagedResponse |
listBackendServices(ListBackendServicesHttpRequest request)
Retrieves the list of BackendService resources available to the specified project.
|
BackendServiceClient.ListBackendServicesPagedResponse |
listBackendServices(ProjectName project)
Retrieves the list of BackendService resources available to the specified project.
|
BackendServiceClient.ListBackendServicesPagedResponse |
listBackendServices(String project)
Retrieves the list of BackendService resources available to the specified project.
|
UnaryCallable<ListBackendServicesHttpRequest,BackendServiceList> |
listBackendServicesCallable()
Retrieves the list of BackendService resources available to the specified project.
|
UnaryCallable<ListBackendServicesHttpRequest,BackendServiceClient.ListBackendServicesPagedResponse> |
listBackendServicesPagedCallable()
Retrieves the list of BackendService resources available to the specified project.
|
Operation |
patchBackendService(PatchBackendServiceHttpRequest request)
Patches the specified BackendService resource with the data included in the request.
|
Operation |
patchBackendService(ProjectGlobalBackendServiceName backendService,
BackendService backendServiceResource,
List<String> fieldMask)
Patches the specified BackendService resource with the data included in the request.
|
Operation |
patchBackendService(String backendService,
BackendService backendServiceResource,
List<String> fieldMask)
Patches the specified BackendService resource with the data included in the request.
|
UnaryCallable<PatchBackendServiceHttpRequest,Operation> |
patchBackendServiceCallable()
Patches the specified BackendService resource with the data included in the request.
|
Operation |
setSecurityPolicyBackendService(ProjectGlobalBackendServiceName backendService,
SecurityPolicyReference securityPolicyReferenceResource)
Sets the security policy for the specified backend service.
|
Operation |
setSecurityPolicyBackendService(SetSecurityPolicyBackendServiceHttpRequest request)
Sets the security policy for the specified backend service.
|
Operation |
setSecurityPolicyBackendService(String backendService,
SecurityPolicyReference securityPolicyReferenceResource)
Sets the security policy for the specified backend service.
|
UnaryCallable<SetSecurityPolicyBackendServiceHttpRequest,Operation> |
setSecurityPolicyBackendServiceCallable()
Sets the security policy for the specified backend service.
|
void |
shutdown() |
void |
shutdownNow() |
Operation |
updateBackendService(ProjectGlobalBackendServiceName backendService,
BackendService backendServiceResource,
List<String> fieldMask)
Updates the specified BackendService resource with the data included in the request.
|
Operation |
updateBackendService(String backendService,
BackendService backendServiceResource,
List<String> fieldMask)
Updates the specified BackendService resource with the data included in the request.
|
Operation |
updateBackendService(UpdateBackendServiceHttpRequest request)
Updates the specified BackendService resource with the data included in the request.
|
UnaryCallable<UpdateBackendServiceHttpRequest,Operation> |
updateBackendServiceCallable()
Updates the specified BackendService resource with the data included in the request.
|
protected BackendServiceClient(BackendServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected BackendServiceClient(BackendServiceStub stub)
public static final BackendServiceClient create() throws IOException
IOException
public static final BackendServiceClient create(BackendServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final BackendServiceClient create(BackendServiceStub stub)
public final BackendServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public BackendServiceStub getStub()
@BetaApi public final Operation addSignedUrlKeyBackendService(ProjectGlobalBackendServiceName backendService, SignedUrlKey signedUrlKeyResource)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
Operation response = backendServiceClient.addSignedUrlKeyBackendService(backendService, signedUrlKeyResource);
}
backendService
- Name of the BackendService 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 addSignedUrlKeyBackendService(String backendService, SignedUrlKey signedUrlKeyResource)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
Operation response = backendServiceClient.addSignedUrlKeyBackendService(backendService.toString(), signedUrlKeyResource);
}
backendService
- Name of the BackendService 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 addSignedUrlKeyBackendService(AddSignedUrlKeyBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
AddSignedUrlKeyBackendServiceHttpRequest request = AddSignedUrlKeyBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setSignedUrlKeyResource(signedUrlKeyResource)
.build();
Operation response = backendServiceClient.addSignedUrlKeyBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<AddSignedUrlKeyBackendServiceHttpRequest,Operation> addSignedUrlKeyBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
AddSignedUrlKeyBackendServiceHttpRequest request = AddSignedUrlKeyBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setSignedUrlKeyResource(signedUrlKeyResource)
.build();
ApiFuture<Operation> future = backendServiceClient.addSignedUrlKeyBackendServiceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final BackendServiceClient.AggregatedListBackendServicesPagedResponse aggregatedListBackendServices(ProjectName project)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (BackendServicesScopedList element : backendServiceClient.aggregatedListBackendServices(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Name of the project scoping this request.ApiException
- if the remote call fails@BetaApi public final BackendServiceClient.AggregatedListBackendServicesPagedResponse aggregatedListBackendServices(String project)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (BackendServicesScopedList element : backendServiceClient.aggregatedListBackendServices(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Name of the project scoping this request.ApiException
- if the remote call fails@BetaApi public final BackendServiceClient.AggregatedListBackendServicesPagedResponse aggregatedListBackendServices(AggregatedListBackendServicesHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListBackendServicesHttpRequest request = AggregatedListBackendServicesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (BackendServicesScopedList element : backendServiceClient.aggregatedListBackendServices(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<AggregatedListBackendServicesHttpRequest,BackendServiceClient.AggregatedListBackendServicesPagedResponse> aggregatedListBackendServicesPagedCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListBackendServicesHttpRequest request = AggregatedListBackendServicesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<AggregatedListBackendServicesPagedResponse> future = backendServiceClient.aggregatedListBackendServicesPagedCallable().futureCall(request);
// Do something
for (BackendServicesScopedList element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<AggregatedListBackendServicesHttpRequest,BackendServiceAggregatedList> aggregatedListBackendServicesCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
AggregatedListBackendServicesHttpRequest request = AggregatedListBackendServicesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
BackendServiceAggregatedList response = backendServiceClient.aggregatedListBackendServicesCallable().call(request);
for (BackendServicesScopedList element : response.getItemsMap()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi public final Operation deleteBackendService(ProjectGlobalBackendServiceName backendService)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
Operation response = backendServiceClient.deleteBackendService(backendService);
}
backendService
- Name of the BackendService resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteBackendService(String backendService)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
Operation response = backendServiceClient.deleteBackendService(backendService.toString());
}
backendService
- Name of the BackendService resource to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteBackendService(DeleteBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
DeleteBackendServiceHttpRequest request = DeleteBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.build();
Operation response = backendServiceClient.deleteBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteBackendServiceHttpRequest,Operation> deleteBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
DeleteBackendServiceHttpRequest request = DeleteBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.build();
ApiFuture<Operation> future = backendServiceClient.deleteBackendServiceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation deleteSignedUrlKeyBackendService(ProjectGlobalBackendServiceName backendService, String keyName)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
String keyName = "";
Operation response = backendServiceClient.deleteSignedUrlKeyBackendService(backendService, keyName);
}
backendService
- Name of the BackendService 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 deleteSignedUrlKeyBackendService(String backendService, String keyName)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
String keyName = "";
Operation response = backendServiceClient.deleteSignedUrlKeyBackendService(backendService.toString(), keyName);
}
backendService
- Name of the BackendService 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 deleteSignedUrlKeyBackendService(DeleteSignedUrlKeyBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
String keyName = "";
DeleteSignedUrlKeyBackendServiceHttpRequest request = DeleteSignedUrlKeyBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setKeyName(keyName)
.build();
Operation response = backendServiceClient.deleteSignedUrlKeyBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteSignedUrlKeyBackendServiceHttpRequest,Operation> deleteSignedUrlKeyBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
String keyName = "";
DeleteSignedUrlKeyBackendServiceHttpRequest request = DeleteSignedUrlKeyBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setKeyName(keyName)
.build();
ApiFuture<Operation> future = backendServiceClient.deleteSignedUrlKeyBackendServiceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final BackendService getBackendService(ProjectGlobalBackendServiceName backendService)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
BackendService response = backendServiceClient.getBackendService(backendService);
}
backendService
- Name of the BackendService resource to return.ApiException
- if the remote call fails@BetaApi public final BackendService getBackendService(String backendService)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
BackendService response = backendServiceClient.getBackendService(backendService.toString());
}
backendService
- Name of the BackendService resource to return.ApiException
- if the remote call fails@BetaApi public final BackendService getBackendService(GetBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
GetBackendServiceHttpRequest request = GetBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.build();
BackendService response = backendServiceClient.getBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetBackendServiceHttpRequest,BackendService> getBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
GetBackendServiceHttpRequest request = GetBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.build();
ApiFuture<BackendService> future = backendServiceClient.getBackendServiceCallable().futureCall(request);
// Do something
BackendService response = future.get();
}
@BetaApi public final BackendServiceGroupHealth getHealthBackendService(ProjectGlobalBackendServiceName backendService, ResourceGroupReference resourceGroupReferenceResource)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
BackendServiceGroupHealth response = backendServiceClient.getHealthBackendService(backendService, resourceGroupReferenceResource);
}
backendService
- Name of the BackendService resource to which the queried instance
belongs.resourceGroupReferenceResource
- ApiException
- if the remote call fails@BetaApi public final BackendServiceGroupHealth getHealthBackendService(String backendService, ResourceGroupReference resourceGroupReferenceResource)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
BackendServiceGroupHealth response = backendServiceClient.getHealthBackendService(backendService.toString(), resourceGroupReferenceResource);
}
backendService
- Name of the BackendService resource to which the queried instance
belongs.resourceGroupReferenceResource
- ApiException
- if the remote call fails@BetaApi public final BackendServiceGroupHealth getHealthBackendService(GetHealthBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
GetHealthBackendServiceHttpRequest request = GetHealthBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setResourceGroupReferenceResource(resourceGroupReferenceResource)
.build();
BackendServiceGroupHealth response = backendServiceClient.getHealthBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetHealthBackendServiceHttpRequest,BackendServiceGroupHealth> getHealthBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
ResourceGroupReference resourceGroupReferenceResource = ResourceGroupReference.newBuilder().build();
GetHealthBackendServiceHttpRequest request = GetHealthBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setResourceGroupReferenceResource(resourceGroupReferenceResource)
.build();
ApiFuture<BackendServiceGroupHealth> future = backendServiceClient.getHealthBackendServiceCallable().futureCall(request);
// Do something
BackendServiceGroupHealth response = future.get();
}
@BetaApi public final Operation insertBackendService(ProjectName project, BackendService backendServiceResource)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
BackendService backendServiceResource = BackendService.newBuilder().build();
Operation response = backendServiceClient.insertBackendService(project, backendServiceResource);
}
project
- Project ID for this request.backendServiceResource
- A BackendService resource. This resource defines a group of
backend virtual machines and their serving capacity. (== resource_for v1.backendService ==)
(== resource_for beta.backendService ==)ApiException
- if the remote call fails@BetaApi public final Operation insertBackendService(String project, BackendService backendServiceResource)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
BackendService backendServiceResource = BackendService.newBuilder().build();
Operation response = backendServiceClient.insertBackendService(project.toString(), backendServiceResource);
}
project
- Project ID for this request.backendServiceResource
- A BackendService resource. This resource defines a group of
backend virtual machines and their serving capacity. (== resource_for v1.backendService ==)
(== resource_for beta.backendService ==)ApiException
- if the remote call fails@BetaApi public final Operation insertBackendService(InsertBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
BackendService backendServiceResource = BackendService.newBuilder().build();
InsertBackendServiceHttpRequest request = InsertBackendServiceHttpRequest.newBuilder()
.setProject(formattedProject)
.setBackendServiceResource(backendServiceResource)
.build();
Operation response = backendServiceClient.insertBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertBackendServiceHttpRequest,Operation> insertBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
BackendService backendServiceResource = BackendService.newBuilder().build();
InsertBackendServiceHttpRequest request = InsertBackendServiceHttpRequest.newBuilder()
.setProject(formattedProject)
.setBackendServiceResource(backendServiceResource)
.build();
ApiFuture<Operation> future = backendServiceClient.insertBackendServiceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final BackendServiceClient.ListBackendServicesPagedResponse listBackendServices(ProjectName project)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (BackendService element : backendServiceClient.listBackendServices(project).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final BackendServiceClient.ListBackendServicesPagedResponse listBackendServices(String project)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
for (BackendService element : backendServiceClient.listBackendServices(project.toString()).iterateAll()) {
// doThingsWith(element);
}
}
project
- Project ID for this request.ApiException
- if the remote call fails@BetaApi public final BackendServiceClient.ListBackendServicesPagedResponse listBackendServices(ListBackendServicesHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListBackendServicesHttpRequest request = ListBackendServicesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
for (BackendService element : backendServiceClient.listBackendServices(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<ListBackendServicesHttpRequest,BackendServiceClient.ListBackendServicesPagedResponse> listBackendServicesPagedCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListBackendServicesHttpRequest request = ListBackendServicesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
ApiFuture<ListBackendServicesPagedResponse> future = backendServiceClient.listBackendServicesPagedCallable().futureCall(request);
// Do something
for (BackendService element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListBackendServicesHttpRequest,BackendServiceList> listBackendServicesCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedProject = ProjectName.format("[PROJECT]");
ListBackendServicesHttpRequest request = ListBackendServicesHttpRequest.newBuilder()
.setProject(formattedProject)
.build();
while (true) {
BackendServiceList response = backendServiceClient.listBackendServicesCallable().call(request);
for (BackendService 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 patchBackendService(ProjectGlobalBackendServiceName backendService, BackendService backendServiceResource, List<String> fieldMask)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
BackendService backendServiceResource = BackendService.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = backendServiceClient.patchBackendService(backendService, backendServiceResource, fieldMask);
}
backendService
- Name of the BackendService resource to patch.backendServiceResource
- A BackendService resource. This resource defines a group of
backend virtual machines and their serving capacity. (== resource_for v1.backendService ==)
(== resource_for beta.backendService ==)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 patchBackendService(String backendService, BackendService backendServiceResource, List<String> fieldMask)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
BackendService backendServiceResource = BackendService.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = backendServiceClient.patchBackendService(backendService.toString(), backendServiceResource, fieldMask);
}
backendService
- Name of the BackendService resource to patch.backendServiceResource
- A BackendService resource. This resource defines a group of
backend virtual machines and their serving capacity. (== resource_for v1.backendService ==)
(== resource_for beta.backendService ==)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 patchBackendService(PatchBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
BackendService backendServiceResource = BackendService.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchBackendServiceHttpRequest request = PatchBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setBackendServiceResource(backendServiceResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = backendServiceClient.patchBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<PatchBackendServiceHttpRequest,Operation> patchBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
BackendService backendServiceResource = BackendService.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchBackendServiceHttpRequest request = PatchBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setBackendServiceResource(backendServiceResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = backendServiceClient.patchBackendServiceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation setSecurityPolicyBackendService(ProjectGlobalBackendServiceName backendService, SecurityPolicyReference securityPolicyReferenceResource)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
SecurityPolicyReference securityPolicyReferenceResource = SecurityPolicyReference.newBuilder().build();
Operation response = backendServiceClient.setSecurityPolicyBackendService(backendService, securityPolicyReferenceResource);
}
backendService
- Name of the BackendService resource to which the security policy should
be set. The name should conform to RFC1035.securityPolicyReferenceResource
- ApiException
- if the remote call fails@BetaApi public final Operation setSecurityPolicyBackendService(String backendService, SecurityPolicyReference securityPolicyReferenceResource)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
SecurityPolicyReference securityPolicyReferenceResource = SecurityPolicyReference.newBuilder().build();
Operation response = backendServiceClient.setSecurityPolicyBackendService(backendService.toString(), securityPolicyReferenceResource);
}
backendService
- Name of the BackendService resource to which the security policy should
be set. The name should conform to RFC1035.securityPolicyReferenceResource
- ApiException
- if the remote call fails@BetaApi public final Operation setSecurityPolicyBackendService(SetSecurityPolicyBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
SecurityPolicyReference securityPolicyReferenceResource = SecurityPolicyReference.newBuilder().build();
SetSecurityPolicyBackendServiceHttpRequest request = SetSecurityPolicyBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setSecurityPolicyReferenceResource(securityPolicyReferenceResource)
.build();
Operation response = backendServiceClient.setSecurityPolicyBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<SetSecurityPolicyBackendServiceHttpRequest,Operation> setSecurityPolicyBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
SecurityPolicyReference securityPolicyReferenceResource = SecurityPolicyReference.newBuilder().build();
SetSecurityPolicyBackendServiceHttpRequest request = SetSecurityPolicyBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setSecurityPolicyReferenceResource(securityPolicyReferenceResource)
.build();
ApiFuture<Operation> future = backendServiceClient.setSecurityPolicyBackendServiceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateBackendService(ProjectGlobalBackendServiceName backendService, BackendService backendServiceResource, List<String> fieldMask)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
BackendService backendServiceResource = BackendService.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = backendServiceClient.updateBackendService(backendService, backendServiceResource, fieldMask);
}
backendService
- Name of the BackendService resource to update.backendServiceResource
- A BackendService resource. This resource defines a group of
backend virtual machines and their serving capacity. (== resource_for v1.backendService ==)
(== resource_for beta.backendService ==)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 updateBackendService(String backendService, BackendService backendServiceResource, List<String> fieldMask)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
BackendService backendServiceResource = BackendService.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = backendServiceClient.updateBackendService(backendService.toString(), backendServiceResource, fieldMask);
}
backendService
- Name of the BackendService resource to update.backendServiceResource
- A BackendService resource. This resource defines a group of
backend virtual machines and their serving capacity. (== resource_for v1.backendService ==)
(== resource_for beta.backendService ==)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 updateBackendService(UpdateBackendServiceHttpRequest request)
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
BackendService backendServiceResource = BackendService.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateBackendServiceHttpRequest request = UpdateBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setBackendServiceResource(backendServiceResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = backendServiceClient.updateBackendService(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<UpdateBackendServiceHttpRequest,Operation> updateBackendServiceCallable()
Sample code:
try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
String formattedBackendService = ProjectGlobalBackendServiceName.format("[PROJECT]", "[BACKEND_SERVICE]");
BackendService backendServiceResource = BackendService.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateBackendServiceHttpRequest request = UpdateBackendServiceHttpRequest.newBuilder()
.setBackendService(formattedBackendService)
.setBackendServiceResource(backendServiceResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = backendServiceClient.updateBackendServiceCallable().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.