@Generated(value="by gapic-generator") @BetaApi public class ScalingPoliciesServiceClient 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 (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedName = ScalingPoliciesServiceClient.formatScalingPolicyName("[PROJECT]", "[LOCATION]", "[SCALING_POLICY]");
ScalingPolicy response = scalingPoliciesServiceClient.getScalingPolicy(formattedName);
}
Note: close() needs to be called on the scalingPoliciesServiceClient 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 ScalingPoliciesServiceSettings to create(). For example:
To customize credentials:
ScalingPoliciesServiceSettings scalingPoliciesServiceSettings =
ScalingPoliciesServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ScalingPoliciesServiceClient scalingPoliciesServiceClient =
ScalingPoliciesServiceClient.create(scalingPoliciesServiceSettings);
To customize the endpoint:
ScalingPoliciesServiceSettings scalingPoliciesServiceSettings =
ScalingPoliciesServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ScalingPoliciesServiceClient scalingPoliciesServiceClient =
ScalingPoliciesServiceClient.create(scalingPoliciesServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
ScalingPoliciesServiceClient.ListScalingPoliciesFixedSizeCollection |
static class |
ScalingPoliciesServiceClient.ListScalingPoliciesPage |
static class |
ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
ScalingPoliciesServiceClient(ScalingPoliciesServiceSettings settings)
Constructs an instance of ScalingPoliciesServiceClient, using the given settings.
|
protected |
ScalingPoliciesServiceClient(ScalingPoliciesServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ScalingPoliciesServiceClient |
create()
Constructs an instance of ScalingPoliciesServiceClient with default settings.
|
static ScalingPoliciesServiceClient |
create(ScalingPoliciesServiceSettings settings)
Constructs an instance of ScalingPoliciesServiceClient, using the given settings.
|
static ScalingPoliciesServiceClient |
create(ScalingPoliciesServiceStub stub)
Constructs an instance of ScalingPoliciesServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<ScalingPolicy,Empty> |
createScalingPolicyAsync(CreateScalingPolicyRequest request)
Creates a new scaling policy in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<ScalingPolicy,Empty> |
createScalingPolicyAsync(String parent,
String scalingPolicyId,
ScalingPolicy scalingPolicy)
Creates a new scaling policy in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<CreateScalingPolicyRequest,com.google.longrunning.Operation> |
createScalingPolicyCallable()
Creates a new scaling policy in a given project and location.
|
com.google.api.gax.rpc.OperationCallable<CreateScalingPolicyRequest,ScalingPolicy,Empty> |
createScalingPolicyOperationCallable()
Creates a new scaling policy in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<Empty,Empty> |
deleteScalingPolicyAsync(DeleteScalingPolicyRequest request)
Deletes a single scaling policy.
|
com.google.api.gax.longrunning.OperationFuture<Empty,Empty> |
deleteScalingPolicyAsync(String name)
Deletes a single scaling policy.
|
com.google.api.gax.rpc.UnaryCallable<DeleteScalingPolicyRequest,com.google.longrunning.Operation> |
deleteScalingPolicyCallable()
Deletes a single scaling policy.
|
com.google.api.gax.rpc.OperationCallable<DeleteScalingPolicyRequest,Empty,Empty> |
deleteScalingPolicyOperationCallable()
Deletes a single scaling policy.
|
static String |
formatLocationName(String project,
String location)
Deprecated.
Use the
LocationName class instead. |
static String |
formatScalingPolicyName(String project,
String location,
String scalingPolicy)
Deprecated.
Use the
ScalingPolicyName class instead. |
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.
|
ScalingPolicy |
getScalingPolicy(GetScalingPolicyRequest request)
Gets details of a single scaling policy.
|
ScalingPolicy |
getScalingPolicy(String name)
Gets details of a single scaling policy.
|
com.google.api.gax.rpc.UnaryCallable<GetScalingPolicyRequest,ScalingPolicy> |
getScalingPolicyCallable()
Gets details of a single scaling policy.
|
ScalingPoliciesServiceSettings |
getSettings() |
ScalingPoliciesServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse |
listScalingPolicies(ListScalingPoliciesRequest request)
Lists ScalingPolicies in a given project and location.
|
ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse |
listScalingPolicies(String parent)
Lists ScalingPolicies in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListScalingPoliciesRequest,ListScalingPoliciesResponse> |
listScalingPoliciesCallable()
Lists ScalingPolicies in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListScalingPoliciesRequest,ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse> |
listScalingPoliciesPagedCallable()
Lists ScalingPolicies in a given project and location.
|
static String |
parseLocationFromLocationName(String locationName)
Deprecated.
Use the
LocationName class instead. |
static String |
parseLocationFromScalingPolicyName(String scalingPolicyName)
Deprecated.
Use the
ScalingPolicyName class instead. |
static String |
parseProjectFromLocationName(String locationName)
Deprecated.
Use the
LocationName class instead. |
static String |
parseProjectFromScalingPolicyName(String scalingPolicyName)
Deprecated.
Use the
ScalingPolicyName class instead. |
static String |
parseScalingPolicyFromScalingPolicyName(String scalingPolicyName)
Deprecated.
Use the
ScalingPolicyName class instead. |
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<ScalingPolicy,Empty> |
updateScalingPolicyAsync(ScalingPolicy scalingPolicy,
FieldMask updateMask)
Patches a single scaling policy.
|
com.google.api.gax.longrunning.OperationFuture<ScalingPolicy,Empty> |
updateScalingPolicyAsync(UpdateScalingPolicyRequest request)
Patches a single scaling policy.
|
com.google.api.gax.rpc.UnaryCallable<UpdateScalingPolicyRequest,com.google.longrunning.Operation> |
updateScalingPolicyCallable()
Patches a single scaling policy.
|
com.google.api.gax.rpc.OperationCallable<UpdateScalingPolicyRequest,ScalingPolicy,Empty> |
updateScalingPolicyOperationCallable()
Patches a single scaling policy.
|
protected ScalingPoliciesServiceClient(ScalingPoliciesServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected ScalingPoliciesServiceClient(ScalingPoliciesServiceStub stub)
@Deprecated public static final String formatLocationName(String project, String location)
LocationName
class instead.@Deprecated public static final String formatScalingPolicyName(String project, String location, String scalingPolicy)
ScalingPolicyName
class instead.@Deprecated public static final String parseProjectFromLocationName(String locationName)
LocationName
class instead.@Deprecated public static final String parseLocationFromLocationName(String locationName)
LocationName
class instead.@Deprecated public static final String parseProjectFromScalingPolicyName(String scalingPolicyName)
ScalingPolicyName
class instead.@Deprecated public static final String parseLocationFromScalingPolicyName(String scalingPolicyName)
ScalingPolicyName
class instead.@Deprecated public static final String parseScalingPolicyFromScalingPolicyName(String scalingPolicyName)
ScalingPolicyName
class instead.public static final ScalingPoliciesServiceClient create() throws IOException
IOException
public static final ScalingPoliciesServiceClient create(ScalingPoliciesServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final ScalingPoliciesServiceClient create(ScalingPoliciesServiceStub stub)
public final ScalingPoliciesServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public ScalingPoliciesServiceStub 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 ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse listScalingPolicies(String parent)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedParent = ScalingPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
for (ScalingPolicy element : scalingPoliciesServiceClient.listScalingPolicies(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 ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse listScalingPolicies(ListScalingPoliciesRequest request)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedParent = ScalingPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
ListScalingPoliciesRequest request = ListScalingPoliciesRequest.newBuilder()
.setParent(formattedParent)
.build();
for (ScalingPolicy element : scalingPoliciesServiceClient.listScalingPolicies(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<ListScalingPoliciesRequest,ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse> listScalingPoliciesPagedCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedParent = ScalingPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
ListScalingPoliciesRequest request = ListScalingPoliciesRequest.newBuilder()
.setParent(formattedParent)
.build();
ApiFuture<ListScalingPoliciesPagedResponse> future = scalingPoliciesServiceClient.listScalingPoliciesPagedCallable().futureCall(request);
// Do something
for (ScalingPolicy element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListScalingPoliciesRequest,ListScalingPoliciesResponse> listScalingPoliciesCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedParent = ScalingPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
ListScalingPoliciesRequest request = ListScalingPoliciesRequest.newBuilder()
.setParent(formattedParent)
.build();
while (true) {
ListScalingPoliciesResponse response = scalingPoliciesServiceClient.listScalingPoliciesCallable().call(request);
for (ScalingPolicy element : response.getScalingPoliciesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ScalingPolicy getScalingPolicy(String name)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedName = ScalingPoliciesServiceClient.formatScalingPolicyName("[PROJECT]", "[LOCATION]", "[SCALING_POLICY]");
ScalingPolicy response = scalingPoliciesServiceClient.getScalingPolicy(formattedName);
}
name
- Required. The name of the scaling policy to retrieve, using the form:
`projects/{project_id}/locations/{location}/scalingPolicies/{scaling_policy_id}`
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ScalingPolicy getScalingPolicy(GetScalingPolicyRequest request)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedName = ScalingPoliciesServiceClient.formatScalingPolicyName("[PROJECT]", "[LOCATION]", "[SCALING_POLICY]");
GetScalingPolicyRequest request = GetScalingPolicyRequest.newBuilder()
.setName(formattedName)
.build();
ScalingPolicy response = scalingPoliciesServiceClient.getScalingPolicy(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<GetScalingPolicyRequest,ScalingPolicy> getScalingPolicyCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedName = ScalingPoliciesServiceClient.formatScalingPolicyName("[PROJECT]", "[LOCATION]", "[SCALING_POLICY]");
GetScalingPolicyRequest request = GetScalingPolicyRequest.newBuilder()
.setName(formattedName)
.build();
ApiFuture<ScalingPolicy> future = scalingPoliciesServiceClient.getScalingPolicyCallable().futureCall(request);
// Do something
ScalingPolicy 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<ScalingPolicy,Empty> createScalingPolicyAsync(String parent, String scalingPolicyId, ScalingPolicy scalingPolicy)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedParent = ScalingPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
String scalingPolicyId = "";
ScalingPolicy scalingPolicy = ScalingPolicy.newBuilder().build();
ScalingPolicy response = scalingPoliciesServiceClient.createScalingPolicyAsync(formattedParent, scalingPolicyId, scalingPolicy).get();
}
parent
- Required. The parent resource name, using the form:
`projects/{project_id}/locations/{location}`.scalingPolicyId
- Required. The ID of the scaling policy resource to be created.scalingPolicy
- Required. The scaling 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<ScalingPolicy,Empty> createScalingPolicyAsync(CreateScalingPolicyRequest request)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedParent = ScalingPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
String scalingPolicyId = "";
ScalingPolicy scalingPolicy = ScalingPolicy.newBuilder().build();
CreateScalingPolicyRequest request = CreateScalingPolicyRequest.newBuilder()
.setParent(formattedParent)
.setScalingPolicyId(scalingPolicyId)
.setScalingPolicy(scalingPolicy)
.build();
ScalingPolicy response = scalingPoliciesServiceClient.createScalingPolicyAsync(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<CreateScalingPolicyRequest,ScalingPolicy,Empty> createScalingPolicyOperationCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedParent = ScalingPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
String scalingPolicyId = "";
ScalingPolicy scalingPolicy = ScalingPolicy.newBuilder().build();
CreateScalingPolicyRequest request = CreateScalingPolicyRequest.newBuilder()
.setParent(formattedParent)
.setScalingPolicyId(scalingPolicyId)
.setScalingPolicy(scalingPolicy)
.build();
OperationFuture<ScalingPolicy, Empty> future = scalingPoliciesServiceClient.createScalingPolicyOperationCallable().futureCall(request);
// Do something
ScalingPolicy response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateScalingPolicyRequest,com.google.longrunning.Operation> createScalingPolicyCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedParent = ScalingPoliciesServiceClient.formatLocationName("[PROJECT]", "[LOCATION]");
String scalingPolicyId = "";
ScalingPolicy scalingPolicy = ScalingPolicy.newBuilder().build();
CreateScalingPolicyRequest request = CreateScalingPolicyRequest.newBuilder()
.setParent(formattedParent)
.setScalingPolicyId(scalingPolicyId)
.setScalingPolicy(scalingPolicy)
.build();
ApiFuture<Operation> future = scalingPoliciesServiceClient.createScalingPolicyCallable().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> deleteScalingPolicyAsync(String name)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedName = ScalingPoliciesServiceClient.formatScalingPolicyName("[PROJECT]", "[LOCATION]", "[SCALING_POLICY]");
scalingPoliciesServiceClient.deleteScalingPolicyAsync(formattedName).get();
}
name
- Required. The name of the scaling policy to delete, using the form:
`projects/{project_id}/locations/{location}/scalingPolicies/{scaling_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> deleteScalingPolicyAsync(DeleteScalingPolicyRequest request)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedName = ScalingPoliciesServiceClient.formatScalingPolicyName("[PROJECT]", "[LOCATION]", "[SCALING_POLICY]");
DeleteScalingPolicyRequest request = DeleteScalingPolicyRequest.newBuilder()
.setName(formattedName)
.build();
scalingPoliciesServiceClient.deleteScalingPolicyAsync(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<DeleteScalingPolicyRequest,Empty,Empty> deleteScalingPolicyOperationCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedName = ScalingPoliciesServiceClient.formatScalingPolicyName("[PROJECT]", "[LOCATION]", "[SCALING_POLICY]");
DeleteScalingPolicyRequest request = DeleteScalingPolicyRequest.newBuilder()
.setName(formattedName)
.build();
OperationFuture<Empty, Empty> future = scalingPoliciesServiceClient.deleteScalingPolicyOperationCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteScalingPolicyRequest,com.google.longrunning.Operation> deleteScalingPolicyCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
String formattedName = ScalingPoliciesServiceClient.formatScalingPolicyName("[PROJECT]", "[LOCATION]", "[SCALING_POLICY]");
DeleteScalingPolicyRequest request = DeleteScalingPolicyRequest.newBuilder()
.setName(formattedName)
.build();
ApiFuture<Operation> future = scalingPoliciesServiceClient.deleteScalingPolicyCallable().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<ScalingPolicy,Empty> updateScalingPolicyAsync(ScalingPolicy scalingPolicy, FieldMask updateMask)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
ScalingPolicy scalingPolicy = ScalingPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
ScalingPolicy response = scalingPoliciesServiceClient.updateScalingPolicyAsync(scalingPolicy, updateMask).get();
}
scalingPolicy
- Required. The scaling 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<ScalingPolicy,Empty> updateScalingPolicyAsync(UpdateScalingPolicyRequest request)
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
ScalingPolicy scalingPolicy = ScalingPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateScalingPolicyRequest request = UpdateScalingPolicyRequest.newBuilder()
.setScalingPolicy(scalingPolicy)
.setUpdateMask(updateMask)
.build();
ScalingPolicy response = scalingPoliciesServiceClient.updateScalingPolicyAsync(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<UpdateScalingPolicyRequest,ScalingPolicy,Empty> updateScalingPolicyOperationCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
ScalingPolicy scalingPolicy = ScalingPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateScalingPolicyRequest request = UpdateScalingPolicyRequest.newBuilder()
.setScalingPolicy(scalingPolicy)
.setUpdateMask(updateMask)
.build();
OperationFuture<ScalingPolicy, Empty> future = scalingPoliciesServiceClient.updateScalingPolicyOperationCallable().futureCall(request);
// Do something
ScalingPolicy response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateScalingPolicyRequest,com.google.longrunning.Operation> updateScalingPolicyCallable()
Sample code:
try (ScalingPoliciesServiceClient scalingPoliciesServiceClient = ScalingPoliciesServiceClient.create()) {
ScalingPolicy scalingPolicy = ScalingPolicy.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
UpdateScalingPolicyRequest request = UpdateScalingPolicyRequest.newBuilder()
.setScalingPolicy(scalingPolicy)
.setUpdateMask(updateMask)
.build();
ApiFuture<Operation> future = scalingPoliciesServiceClient.updateScalingPolicyCallable().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.