@Generated(value="by gapic-generator") @BetaApi public class AllocationPoliciesServiceClient extends Object implements com.google.api.gax.core.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 (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedName = AllocationPoliciesServiceClient.formatAllocationPolicyName("[PROJECT]", "[LOCATION]", "[ALLOCATION_POLICY]");
AllocationPolicy response = allocationPoliciesServiceClient.getAllocationPolicy(formattedName);
}
Note: close() needs to be called on the allocationPoliciesServiceClient 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 AllocationPoliciesServiceSettings to create(). For example:
To customize credentials:
AllocationPoliciesServiceSettings allocationPoliciesServiceSettings =
AllocationPoliciesServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AllocationPoliciesServiceClient allocationPoliciesServiceClient =
AllocationPoliciesServiceClient.create(allocationPoliciesServiceSettings);
To customize the endpoint:
AllocationPoliciesServiceSettings allocationPoliciesServiceSettings =
AllocationPoliciesServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AllocationPoliciesServiceClient allocationPoliciesServiceClient =
AllocationPoliciesServiceClient.create(allocationPoliciesServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
AllocationPoliciesServiceClient.ListAllocationPoliciesFixedSizeCollection |
static class |
AllocationPoliciesServiceClient.ListAllocationPoliciesPage |
static class |
AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
AllocationPoliciesServiceClient(AllocationPoliciesServiceSettings settings)
Constructs an instance of AllocationPoliciesServiceClient, using the given settings.
|
protected |
AllocationPoliciesServiceClient(AllocationPoliciesServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static AllocationPoliciesServiceClient |
create()
Constructs an instance of AllocationPoliciesServiceClient with default settings.
|
static AllocationPoliciesServiceClient |
create(AllocationPoliciesServiceSettings settings)
Constructs an instance of AllocationPoliciesServiceClient, using the given settings.
|
static AllocationPoliciesServiceClient |
create(AllocationPoliciesServiceStub stub)
Constructs an instance of AllocationPoliciesServiceClient, using the given stub for making
calls.
|
com.google.api.gax.longrunning.OperationFuture<AllocationPolicy,Empty> |
createAllocationPolicyAsync(CreateAllocationPolicyRequest request)
Creates a new allocation policy in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<AllocationPolicy,Empty> |
createAllocationPolicyAsync(String parent,
String allocationPolicyId,
AllocationPolicy allocationPolicy)
Creates a new allocation policy in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<CreateAllocationPolicyRequest,com.google.longrunning.Operation> |
createAllocationPolicyCallable()
Creates a new allocation policy in a given project and location.
|
com.google.api.gax.rpc.OperationCallable<CreateAllocationPolicyRequest,AllocationPolicy,Empty> |
createAllocationPolicyOperationCallable()
Creates a new allocation policy in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<Empty,Empty> |
deleteAllocationPolicyAsync(DeleteAllocationPolicyRequest request)
Deletes a single allocation policy.
|
com.google.api.gax.longrunning.OperationFuture<Empty,Empty> |
deleteAllocationPolicyAsync(String name)
Deletes a single allocation policy.
|
com.google.api.gax.rpc.UnaryCallable<DeleteAllocationPolicyRequest,com.google.longrunning.Operation> |
deleteAllocationPolicyCallable()
Deletes a single allocation policy.
|
com.google.api.gax.rpc.OperationCallable<DeleteAllocationPolicyRequest,Empty,Empty> |
deleteAllocationPolicyOperationCallable()
Deletes a single allocation policy.
|
static String |
formatAllocationPolicyName(String project,
String location,
String allocationPolicy)
Deprecated.
Use the
AllocationPolicyName class instead. |
static String |
formatLocationName(String project,
String location)
Deprecated.
Use the
LocationName class instead. |
AllocationPolicy |
getAllocationPolicy(GetAllocationPolicyRequest request)
Gets details of a single allocation policy.
|
AllocationPolicy |
getAllocationPolicy(String name)
Gets details of a single allocation policy.
|
com.google.api.gax.rpc.UnaryCallable<GetAllocationPolicyRequest,AllocationPolicy> |
getAllocationPolicyCallable()
Gets details of a single allocation policy.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
AllocationPoliciesServiceSettings |
getSettings() |
AllocationPoliciesServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse |
listAllocationPolicies(ListAllocationPoliciesRequest request)
List allocation policies in a given project and location.
|
AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse |
listAllocationPolicies(String parent)
List allocation policies in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListAllocationPoliciesRequest,ListAllocationPoliciesResponse> |
listAllocationPoliciesCallable()
List allocation policies in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListAllocationPoliciesRequest,AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse> |
listAllocationPoliciesPagedCallable()
List allocation policies in a given project and location.
|
static String |
parseAllocationPolicyFromAllocationPolicyName(String allocationPolicyName)
Deprecated.
Use the
AllocationPolicyName class instead. |
static String |
parseLocationFromAllocationPolicyName(String allocationPolicyName)
Deprecated.
Use the
AllocationPolicyName class instead. |
static String |
parseLocationFromLocationName(String locationName)
Deprecated.
Use the
LocationName class instead. |
static String |
parseProjectFromAllocationPolicyName(String allocationPolicyName)
Deprecated.
Use the
AllocationPolicyName class instead. |
static String |
parseProjectFromLocationName(String locationName)
Deprecated.
Use the
LocationName class instead. |
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<AllocationPolicy,Empty> |
updateAllocationPolicyAsync(AllocationPolicy allocationPolicy,
FieldMask updateMask)
Patches a single allocation policy.
|
com.google.api.gax.longrunning.OperationFuture<AllocationPolicy,Empty> |
updateAllocationPolicyAsync(UpdateAllocationPolicyRequest request)
Patches a single allocation policy.
|
com.google.api.gax.rpc.UnaryCallable<UpdateAllocationPolicyRequest,com.google.longrunning.Operation> |
updateAllocationPolicyCallable()
Patches a single allocation policy.
|
com.google.api.gax.rpc.OperationCallable<UpdateAllocationPolicyRequest,AllocationPolicy,Empty> |
updateAllocationPolicyOperationCallable()
Patches a single allocation policy.
|
protected AllocationPoliciesServiceClient(AllocationPoliciesServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected AllocationPoliciesServiceClient(AllocationPoliciesServiceStub stub)
@Deprecated public static final String formatAllocationPolicyName(String project, String location, String allocationPolicy)
AllocationPolicyName
class instead.@Deprecated public static final String formatLocationName(String project, String location)
LocationName
class instead.@Deprecated public static final String parseProjectFromAllocationPolicyName(String allocationPolicyName)
AllocationPolicyName
class instead.@Deprecated public static final String parseLocationFromAllocationPolicyName(String allocationPolicyName)
AllocationPolicyName
class instead.@Deprecated public static final String parseAllocationPolicyFromAllocationPolicyName(String allocationPolicyName)
AllocationPolicyName
class instead.@Deprecated public static final String parseProjectFromLocationName(String locationName)
LocationName
class instead.@Deprecated public static final String parseLocationFromLocationName(String locationName)
LocationName
class instead.public static final AllocationPoliciesServiceClient create() throws IOException
IOException
public static final AllocationPoliciesServiceClient create(AllocationPoliciesServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final AllocationPoliciesServiceClient create(AllocationPoliciesServiceStub stub)
public final AllocationPoliciesServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public AllocationPoliciesServiceStub getStub()
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.longrunning.OperationsClient getOperationsClient()
public final AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse listAllocationPolicies(String parent)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedParent = AllocationPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
for (AllocationPolicy element : allocationPoliciesServiceClient.listAllocationPolicies(formattedParent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent resource name, using the form:
`projects/{project_id}/locations/{location}`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse listAllocationPolicies(ListAllocationPoliciesRequest request)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedParent = AllocationPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
ListAllocationPoliciesRequest request = ListAllocationPoliciesRequest.newBuilder()
.setParent(formattedParent)
.build();
for (AllocationPolicy element : allocationPoliciesServiceClient.listAllocationPolicies(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListAllocationPoliciesRequest,AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse> listAllocationPoliciesPagedCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedParent = AllocationPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
ListAllocationPoliciesRequest request = ListAllocationPoliciesRequest.newBuilder()
.setParent(formattedParent)
.build();
ApiFuture<ListAllocationPoliciesPagedResponse> future = allocationPoliciesServiceClient.listAllocationPoliciesPagedCallable().futureCall(request);
// Do something
for (AllocationPolicy element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListAllocationPoliciesRequest,ListAllocationPoliciesResponse> listAllocationPoliciesCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedParent = AllocationPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
ListAllocationPoliciesRequest request = ListAllocationPoliciesRequest.newBuilder()
.setParent(formattedParent)
.build();
while (true) {
ListAllocationPoliciesResponse response = allocationPoliciesServiceClient.listAllocationPoliciesCallable().call(request);
for (AllocationPolicy element : response.getAllocationPoliciesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final AllocationPolicy getAllocationPolicy(String name)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedName = AllocationPoliciesServiceClient.formatAllocationPolicyName("[PROJECT]", "[LOCATION]", "[ALLOCATION_POLICY]");
AllocationPolicy response = allocationPoliciesServiceClient.getAllocationPolicy(formattedName);
}
name
- Required. The name of the allocation policy to retrieve, using the form:
`projects/{project_id}/locations/{location}/allocationPolicies/{allocation_policy_id}`
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final AllocationPolicy getAllocationPolicy(GetAllocationPolicyRequest request)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedName = AllocationPoliciesServiceClient.formatAllocationPolicyName("[PROJECT]", "[LOCATION]", "[ALLOCATION_POLICY]");
GetAllocationPolicyRequest request = GetAllocationPolicyRequest.newBuilder()
.setName(formattedName)
.build();
AllocationPolicy response = allocationPoliciesServiceClient.getAllocationPolicy(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetAllocationPolicyRequest,AllocationPolicy> getAllocationPolicyCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedName = AllocationPoliciesServiceClient.formatAllocationPolicyName("[PROJECT]", "[LOCATION]", "[ALLOCATION_POLICY]");
GetAllocationPolicyRequest request = GetAllocationPolicyRequest.newBuilder()
.setName(formattedName)
.build();
ApiFuture<AllocationPolicy> future = allocationPoliciesServiceClient.getAllocationPolicyCallable().futureCall(request);
// Do something
AllocationPolicy response = future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<AllocationPolicy,Empty> createAllocationPolicyAsync(String parent, String allocationPolicyId, AllocationPolicy allocationPolicy)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedParent = AllocationPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
String allocationPolicyId = "";
AllocationPolicy allocationPolicy = AllocationPolicy.newBuilder().build();
AllocationPolicy response = allocationPoliciesServiceClient.createAllocationPolicyAsync(formattedParent, allocationPolicyId, allocationPolicy).get();
}
parent
- Required. The parent resource name, using the form:
`projects/{project_id}/locations/{location}`.allocationPolicyId
- Required. The ID of the allocation policy resource to be created.allocationPolicy
- Required. The allocation policy resource to be created.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<AllocationPolicy,Empty> createAllocationPolicyAsync(CreateAllocationPolicyRequest request)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedParent = AllocationPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
String allocationPolicyId = "";
AllocationPolicy allocationPolicy = AllocationPolicy.newBuilder().build();
CreateAllocationPolicyRequest request = CreateAllocationPolicyRequest.newBuilder()
.setParent(formattedParent)
.setAllocationPolicyId(allocationPolicyId)
.setAllocationPolicy(allocationPolicy)
.build();
AllocationPolicy response = allocationPoliciesServiceClient.createAllocationPolicyAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final com.google.api.gax.rpc.OperationCallable<CreateAllocationPolicyRequest,AllocationPolicy,Empty> createAllocationPolicyOperationCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedParent = AllocationPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
String allocationPolicyId = "";
AllocationPolicy allocationPolicy = AllocationPolicy.newBuilder().build();
CreateAllocationPolicyRequest request = CreateAllocationPolicyRequest.newBuilder()
.setParent(formattedParent)
.setAllocationPolicyId(allocationPolicyId)
.setAllocationPolicy(allocationPolicy)
.build();
OperationFuture<AllocationPolicy, Empty> future = allocationPoliciesServiceClient.createAllocationPolicyOperationCallable().futureCall(request);
// Do something
AllocationPolicy response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateAllocationPolicyRequest,com.google.longrunning.Operation> createAllocationPolicyCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedParent = AllocationPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
String allocationPolicyId = "";
AllocationPolicy allocationPolicy = AllocationPolicy.newBuilder().build();
CreateAllocationPolicyRequest request = CreateAllocationPolicyRequest.newBuilder()
.setParent(formattedParent)
.setAllocationPolicyId(allocationPolicyId)
.setAllocationPolicy(allocationPolicy)
.build();
ApiFuture<Operation> future = allocationPoliciesServiceClient.createAllocationPolicyCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Empty,Empty> deleteAllocationPolicyAsync(String name)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedName = AllocationPoliciesServiceClient.formatAllocationPolicyName("[PROJECT]", "[LOCATION]", "[ALLOCATION_POLICY]");
allocationPoliciesServiceClient.deleteAllocationPolicyAsync(formattedName).get();
}
name
- Required. The name of the allocation policy to delete, using the form:
`projects/{project_id}/locations/{location}/allocationPolicies/{allocation_policy_id}`
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<Empty,Empty> deleteAllocationPolicyAsync(DeleteAllocationPolicyRequest request)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedName = AllocationPoliciesServiceClient.formatAllocationPolicyName("[PROJECT]", "[LOCATION]", "[ALLOCATION_POLICY]");
DeleteAllocationPolicyRequest request = DeleteAllocationPolicyRequest.newBuilder()
.setName(formattedName)
.build();
allocationPoliciesServiceClient.deleteAllocationPolicyAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final com.google.api.gax.rpc.OperationCallable<DeleteAllocationPolicyRequest,Empty,Empty> deleteAllocationPolicyOperationCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedName = AllocationPoliciesServiceClient.formatAllocationPolicyName("[PROJECT]", "[LOCATION]", "[ALLOCATION_POLICY]");
DeleteAllocationPolicyRequest request = DeleteAllocationPolicyRequest.newBuilder()
.setName(formattedName)
.build();
OperationFuture<Empty, Empty> future = allocationPoliciesServiceClient.deleteAllocationPolicyOperationCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteAllocationPolicyRequest,com.google.longrunning.Operation> deleteAllocationPolicyCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
String formattedName = AllocationPoliciesServiceClient.formatAllocationPolicyName("[PROJECT]", "[LOCATION]", "[ALLOCATION_POLICY]");
DeleteAllocationPolicyRequest request = DeleteAllocationPolicyRequest.newBuilder()
.setName(formattedName)
.build();
ApiFuture<Operation> future = allocationPoliciesServiceClient.deleteAllocationPolicyCallable().futureCall(request);
// Do something
future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<AllocationPolicy,Empty> updateAllocationPolicyAsync(AllocationPolicy allocationPolicy, FieldMask updateMask)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
AllocationPolicy allocationPolicy = AllocationPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
AllocationPolicy response = allocationPoliciesServiceClient.updateAllocationPolicyAsync(allocationPolicy, updateMask).get();
}
allocationPolicy
- Required. The allocation policy to be updated. Only fields specified in
update_mask are updated.updateMask
- Required. Mask of fields to update. At least one path must be supplied in
this field. For the `FieldMask` definition, see
https: //developers.google.com/protocol-buffers // /docs/reference/google.protobuf#fieldmask
com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<AllocationPolicy,Empty> updateAllocationPolicyAsync(UpdateAllocationPolicyRequest request)
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
AllocationPolicy allocationPolicy = AllocationPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateAllocationPolicyRequest request = UpdateAllocationPolicyRequest.newBuilder()
.setAllocationPolicy(allocationPolicy)
.setUpdateMask(updateMask)
.build();
AllocationPolicy response = allocationPoliciesServiceClient.updateAllocationPolicyAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final com.google.api.gax.rpc.OperationCallable<UpdateAllocationPolicyRequest,AllocationPolicy,Empty> updateAllocationPolicyOperationCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
AllocationPolicy allocationPolicy = AllocationPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateAllocationPolicyRequest request = UpdateAllocationPolicyRequest.newBuilder()
.setAllocationPolicy(allocationPolicy)
.setUpdateMask(updateMask)
.build();
OperationFuture<AllocationPolicy, Empty> future = allocationPoliciesServiceClient.updateAllocationPolicyOperationCallable().futureCall(request);
// Do something
AllocationPolicy response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateAllocationPolicyRequest,com.google.longrunning.Operation> updateAllocationPolicyCallable()
Sample code:
try (AllocationPoliciesServiceClient allocationPoliciesServiceClient = AllocationPoliciesServiceClient.create()) {
AllocationPolicy allocationPolicy = AllocationPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateAllocationPolicyRequest request = UpdateAllocationPolicyRequest.newBuilder()
.setAllocationPolicy(allocationPolicy)
.setUpdateMask(updateMask)
.build();
ApiFuture<Operation> future = allocationPoliciesServiceClient.updateAllocationPolicyCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.