@Generated(value="by gapic-generator") @BetaApi public class RegionAutoscalerClient 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 (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
Operation response = regionAutoscalerClient.deleteRegionAutoscaler(autoscaler);
}
Note: close() needs to be called on the regionAutoscalerClient 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 RegionAutoscalerSettings to create(). For example:
To customize credentials:
RegionAutoscalerSettings regionAutoscalerSettings =
RegionAutoscalerSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
RegionAutoscalerClient regionAutoscalerClient =
RegionAutoscalerClient.create(regionAutoscalerSettings);
To customize the endpoint:
RegionAutoscalerSettings regionAutoscalerSettings =
RegionAutoscalerSettings.newBuilder().setEndpoint(myEndpoint).build();
RegionAutoscalerClient regionAutoscalerClient =
RegionAutoscalerClient.create(regionAutoscalerSettings);
Modifier and Type | Class and Description |
---|---|
static class |
RegionAutoscalerClient.ListRegionAutoscalersFixedSizeCollection |
static class |
RegionAutoscalerClient.ListRegionAutoscalersPage |
static class |
RegionAutoscalerClient.ListRegionAutoscalersPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
RegionAutoscalerClient(RegionAutoscalerSettings settings)
Constructs an instance of RegionAutoscalerClient, using the given settings.
|
protected |
RegionAutoscalerClient(RegionAutoscalerStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static RegionAutoscalerClient |
create()
Constructs an instance of RegionAutoscalerClient with default settings.
|
static RegionAutoscalerClient |
create(RegionAutoscalerSettings settings)
Constructs an instance of RegionAutoscalerClient, using the given settings.
|
static RegionAutoscalerClient |
create(RegionAutoscalerStub stub)
Constructs an instance of RegionAutoscalerClient, using the given stub for making calls.
|
Operation |
deleteRegionAutoscaler(DeleteRegionAutoscalerHttpRequest request)
Deletes the specified autoscaler.
|
Operation |
deleteRegionAutoscaler(ProjectRegionAutoscalerName autoscaler)
Deletes the specified autoscaler.
|
Operation |
deleteRegionAutoscaler(String autoscaler)
Deletes the specified autoscaler.
|
UnaryCallable<DeleteRegionAutoscalerHttpRequest,Operation> |
deleteRegionAutoscalerCallable()
Deletes the specified autoscaler.
|
Autoscaler |
getRegionAutoscaler(GetRegionAutoscalerHttpRequest request)
Returns the specified autoscaler.
|
Autoscaler |
getRegionAutoscaler(ProjectRegionAutoscalerName autoscaler)
Returns the specified autoscaler.
|
Autoscaler |
getRegionAutoscaler(String autoscaler)
Returns the specified autoscaler.
|
UnaryCallable<GetRegionAutoscalerHttpRequest,Autoscaler> |
getRegionAutoscalerCallable()
Returns the specified autoscaler.
|
RegionAutoscalerSettings |
getSettings() |
RegionAutoscalerStub |
getStub() |
Operation |
insertRegionAutoscaler(InsertRegionAutoscalerHttpRequest request)
Creates an autoscaler in the specified project using the data included in the request.
|
Operation |
insertRegionAutoscaler(ProjectRegionName region,
Autoscaler autoscalerResource)
Creates an autoscaler in the specified project using the data included in the request.
|
Operation |
insertRegionAutoscaler(String region,
Autoscaler autoscalerResource)
Creates an autoscaler in the specified project using the data included in the request.
|
UnaryCallable<InsertRegionAutoscalerHttpRequest,Operation> |
insertRegionAutoscalerCallable()
Creates an autoscaler in the specified project using the data included in the request.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
RegionAutoscalerClient.ListRegionAutoscalersPagedResponse |
listRegionAutoscalers(ListRegionAutoscalersHttpRequest request)
Retrieves a list of autoscalers contained within the specified region.
|
RegionAutoscalerClient.ListRegionAutoscalersPagedResponse |
listRegionAutoscalers(ProjectRegionName region)
Retrieves a list of autoscalers contained within the specified region.
|
RegionAutoscalerClient.ListRegionAutoscalersPagedResponse |
listRegionAutoscalers(String region)
Retrieves a list of autoscalers contained within the specified region.
|
UnaryCallable<ListRegionAutoscalersHttpRequest,RegionAutoscalerList> |
listRegionAutoscalersCallable()
Retrieves a list of autoscalers contained within the specified region.
|
UnaryCallable<ListRegionAutoscalersHttpRequest,RegionAutoscalerClient.ListRegionAutoscalersPagedResponse> |
listRegionAutoscalersPagedCallable()
Retrieves a list of autoscalers contained within the specified region.
|
Operation |
patchRegionAutoscaler(PatchRegionAutoscalerHttpRequest request)
Updates an autoscaler in the specified project using the data included in the request.
|
Operation |
patchRegionAutoscaler(String autoscaler,
ProjectRegionName region,
Autoscaler autoscalerResource,
List<String> fieldMask)
Updates an autoscaler in the specified project using the data included in the request.
|
Operation |
patchRegionAutoscaler(String autoscaler,
String region,
Autoscaler autoscalerResource,
List<String> fieldMask)
Updates an autoscaler in the specified project using the data included in the request.
|
UnaryCallable<PatchRegionAutoscalerHttpRequest,Operation> |
patchRegionAutoscalerCallable()
Updates an autoscaler in the specified project using the data included in the request.
|
void |
shutdown() |
void |
shutdownNow() |
Operation |
updateRegionAutoscaler(String autoscaler,
ProjectRegionName region,
Autoscaler autoscalerResource,
List<String> fieldMask)
Updates an autoscaler in the specified project using the data included in the request.
|
Operation |
updateRegionAutoscaler(String autoscaler,
String region,
Autoscaler autoscalerResource,
List<String> fieldMask)
Updates an autoscaler in the specified project using the data included in the request.
|
Operation |
updateRegionAutoscaler(UpdateRegionAutoscalerHttpRequest request)
Updates an autoscaler in the specified project using the data included in the request.
|
UnaryCallable<UpdateRegionAutoscalerHttpRequest,Operation> |
updateRegionAutoscalerCallable()
Updates an autoscaler in the specified project using the data included in the request.
|
protected RegionAutoscalerClient(RegionAutoscalerSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected RegionAutoscalerClient(RegionAutoscalerStub stub)
public static final RegionAutoscalerClient create() throws IOException
IOException
public static final RegionAutoscalerClient create(RegionAutoscalerSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final RegionAutoscalerClient create(RegionAutoscalerStub stub)
public final RegionAutoscalerSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public RegionAutoscalerStub getStub()
@BetaApi public final Operation deleteRegionAutoscaler(ProjectRegionAutoscalerName autoscaler)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
Operation response = regionAutoscalerClient.deleteRegionAutoscaler(autoscaler);
}
autoscaler
- Name of the autoscaler to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteRegionAutoscaler(String autoscaler)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
Operation response = regionAutoscalerClient.deleteRegionAutoscaler(autoscaler.toString());
}
autoscaler
- Name of the autoscaler to delete.ApiException
- if the remote call fails@BetaApi public final Operation deleteRegionAutoscaler(DeleteRegionAutoscalerHttpRequest request)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedAutoscaler = ProjectRegionAutoscalerName.format("[PROJECT]", "[REGION]", "[AUTOSCALER]");
DeleteRegionAutoscalerHttpRequest request = DeleteRegionAutoscalerHttpRequest.newBuilder()
.setAutoscaler(formattedAutoscaler)
.build();
Operation response = regionAutoscalerClient.deleteRegionAutoscaler(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<DeleteRegionAutoscalerHttpRequest,Operation> deleteRegionAutoscalerCallable()
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedAutoscaler = ProjectRegionAutoscalerName.format("[PROJECT]", "[REGION]", "[AUTOSCALER]");
DeleteRegionAutoscalerHttpRequest request = DeleteRegionAutoscalerHttpRequest.newBuilder()
.setAutoscaler(formattedAutoscaler)
.build();
ApiFuture<Operation> future = regionAutoscalerClient.deleteRegionAutoscalerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Autoscaler getRegionAutoscaler(ProjectRegionAutoscalerName autoscaler)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
Autoscaler response = regionAutoscalerClient.getRegionAutoscaler(autoscaler);
}
autoscaler
- Name of the autoscaler to return.ApiException
- if the remote call fails@BetaApi public final Autoscaler getRegionAutoscaler(String autoscaler)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
Autoscaler response = regionAutoscalerClient.getRegionAutoscaler(autoscaler.toString());
}
autoscaler
- Name of the autoscaler to return.ApiException
- if the remote call fails@BetaApi public final Autoscaler getRegionAutoscaler(GetRegionAutoscalerHttpRequest request)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedAutoscaler = ProjectRegionAutoscalerName.format("[PROJECT]", "[REGION]", "[AUTOSCALER]");
GetRegionAutoscalerHttpRequest request = GetRegionAutoscalerHttpRequest.newBuilder()
.setAutoscaler(formattedAutoscaler)
.build();
Autoscaler response = regionAutoscalerClient.getRegionAutoscaler(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<GetRegionAutoscalerHttpRequest,Autoscaler> getRegionAutoscalerCallable()
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedAutoscaler = ProjectRegionAutoscalerName.format("[PROJECT]", "[REGION]", "[AUTOSCALER]");
GetRegionAutoscalerHttpRequest request = GetRegionAutoscalerHttpRequest.newBuilder()
.setAutoscaler(formattedAutoscaler)
.build();
ApiFuture<Autoscaler> future = regionAutoscalerClient.getRegionAutoscalerCallable().futureCall(request);
// Do something
Autoscaler response = future.get();
}
@BetaApi public final Operation insertRegionAutoscaler(ProjectRegionName region, Autoscaler autoscalerResource)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
Operation response = regionAutoscalerClient.insertRegionAutoscaler(region, autoscalerResource);
}
region
- Name of the region scoping this request.autoscalerResource
- Represents an Autoscaler resource. Autoscalers allow you to
automatically scale virtual machine instances in managed instance groups according to an
autoscaling policy that you define. For more information, read Autoscaling Groups of
Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (==
resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==)ApiException
- if the remote call fails@BetaApi public final Operation insertRegionAutoscaler(String region, Autoscaler autoscalerResource)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
Operation response = regionAutoscalerClient.insertRegionAutoscaler(region.toString(), autoscalerResource);
}
region
- Name of the region scoping this request.autoscalerResource
- Represents an Autoscaler resource. Autoscalers allow you to
automatically scale virtual machine instances in managed instance groups according to an
autoscaling policy that you define. For more information, read Autoscaling Groups of
Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (==
resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==)ApiException
- if the remote call fails@BetaApi public final Operation insertRegionAutoscaler(InsertRegionAutoscalerHttpRequest request)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
InsertRegionAutoscalerHttpRequest request = InsertRegionAutoscalerHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setAutoscalerResource(autoscalerResource)
.build();
Operation response = regionAutoscalerClient.insertRegionAutoscaler(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<InsertRegionAutoscalerHttpRequest,Operation> insertRegionAutoscalerCallable()
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
InsertRegionAutoscalerHttpRequest request = InsertRegionAutoscalerHttpRequest.newBuilder()
.setRegion(formattedRegion)
.setAutoscalerResource(autoscalerResource)
.build();
ApiFuture<Operation> future = regionAutoscalerClient.insertRegionAutoscalerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final RegionAutoscalerClient.ListRegionAutoscalersPagedResponse listRegionAutoscalers(ProjectRegionName region)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (Autoscaler element : regionAutoscalerClient.listRegionAutoscalers(region).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region scoping this request.ApiException
- if the remote call fails@BetaApi public final RegionAutoscalerClient.ListRegionAutoscalersPagedResponse listRegionAutoscalers(String region)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
for (Autoscaler element : regionAutoscalerClient.listRegionAutoscalers(region.toString()).iterateAll()) {
// doThingsWith(element);
}
}
region
- Name of the region scoping this request.ApiException
- if the remote call fails@BetaApi public final RegionAutoscalerClient.ListRegionAutoscalersPagedResponse listRegionAutoscalers(ListRegionAutoscalersHttpRequest request)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionAutoscalersHttpRequest request = ListRegionAutoscalersHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
for (Autoscaler element : regionAutoscalerClient.listRegionAutoscalers(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<ListRegionAutoscalersHttpRequest,RegionAutoscalerClient.ListRegionAutoscalersPagedResponse> listRegionAutoscalersPagedCallable()
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionAutoscalersHttpRequest request = ListRegionAutoscalersHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
ApiFuture<ListRegionAutoscalersPagedResponse> future = regionAutoscalerClient.listRegionAutoscalersPagedCallable().futureCall(request);
// Do something
for (Autoscaler element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
@BetaApi public final UnaryCallable<ListRegionAutoscalersHttpRequest,RegionAutoscalerList> listRegionAutoscalersCallable()
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
ListRegionAutoscalersHttpRequest request = ListRegionAutoscalersHttpRequest.newBuilder()
.setRegion(formattedRegion)
.build();
while (true) {
RegionAutoscalerList response = regionAutoscalerClient.listRegionAutoscalersCallable().call(request);
for (Autoscaler 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 patchRegionAutoscaler(String autoscaler, ProjectRegionName region, Autoscaler autoscalerResource, List<String> fieldMask)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String autoscaler = "";
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionAutoscalerClient.patchRegionAutoscaler(autoscaler, region, autoscalerResource, fieldMask);
}
autoscaler
- Name of the autoscaler to patch.region
- Name of the region scoping this request.autoscalerResource
- Represents an Autoscaler resource. Autoscalers allow you to
automatically scale virtual machine instances in managed instance groups according to an
autoscaling policy that you define. For more information, read Autoscaling Groups of
Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (==
resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==)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 patchRegionAutoscaler(String autoscaler, String region, Autoscaler autoscalerResource, List<String> fieldMask)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String autoscaler = "";
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionAutoscalerClient.patchRegionAutoscaler(autoscaler, region.toString(), autoscalerResource, fieldMask);
}
autoscaler
- Name of the autoscaler to patch.region
- Name of the region scoping this request.autoscalerResource
- Represents an Autoscaler resource. Autoscalers allow you to
automatically scale virtual machine instances in managed instance groups according to an
autoscaling policy that you define. For more information, read Autoscaling Groups of
Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (==
resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==)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 patchRegionAutoscaler(PatchRegionAutoscalerHttpRequest request)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String autoscaler = "";
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchRegionAutoscalerHttpRequest request = PatchRegionAutoscalerHttpRequest.newBuilder()
.setAutoscaler(autoscaler)
.setRegion(formattedRegion)
.setAutoscalerResource(autoscalerResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = regionAutoscalerClient.patchRegionAutoscaler(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<PatchRegionAutoscalerHttpRequest,Operation> patchRegionAutoscalerCallable()
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String autoscaler = "";
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
PatchRegionAutoscalerHttpRequest request = PatchRegionAutoscalerHttpRequest.newBuilder()
.setAutoscaler(autoscaler)
.setRegion(formattedRegion)
.setAutoscalerResource(autoscalerResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = regionAutoscalerClient.patchRegionAutoscalerCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi public final Operation updateRegionAutoscaler(String autoscaler, ProjectRegionName region, Autoscaler autoscalerResource, List<String> fieldMask)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String autoscaler = "";
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionAutoscalerClient.updateRegionAutoscaler(autoscaler, region, autoscalerResource, fieldMask);
}
autoscaler
- Name of the autoscaler to update.region
- Name of the region scoping this request.autoscalerResource
- Represents an Autoscaler resource. Autoscalers allow you to
automatically scale virtual machine instances in managed instance groups according to an
autoscaling policy that you define. For more information, read Autoscaling Groups of
Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (==
resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==)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 updateRegionAutoscaler(String autoscaler, String region, Autoscaler autoscalerResource, List<String> fieldMask)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String autoscaler = "";
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
Operation response = regionAutoscalerClient.updateRegionAutoscaler(autoscaler, region.toString(), autoscalerResource, fieldMask);
}
autoscaler
- Name of the autoscaler to update.region
- Name of the region scoping this request.autoscalerResource
- Represents an Autoscaler resource. Autoscalers allow you to
automatically scale virtual machine instances in managed instance groups according to an
autoscaling policy that you define. For more information, read Autoscaling Groups of
Instances. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (==
resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==)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 updateRegionAutoscaler(UpdateRegionAutoscalerHttpRequest request)
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String autoscaler = "";
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateRegionAutoscalerHttpRequest request = UpdateRegionAutoscalerHttpRequest.newBuilder()
.setAutoscaler(autoscaler)
.setRegion(formattedRegion)
.setAutoscalerResource(autoscalerResource)
.addAllFieldMask(fieldMask)
.build();
Operation response = regionAutoscalerClient.updateRegionAutoscaler(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi public final UnaryCallable<UpdateRegionAutoscalerHttpRequest,Operation> updateRegionAutoscalerCallable()
Sample code:
try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
String autoscaler = "";
String formattedRegion = ProjectRegionName.format("[PROJECT]", "[REGION]");
Autoscaler autoscalerResource = Autoscaler.newBuilder().build();
List<String> fieldMask = new ArrayList<>();
UpdateRegionAutoscalerHttpRequest request = UpdateRegionAutoscalerHttpRequest.newBuilder()
.setAutoscaler(autoscaler)
.setRegion(formattedRegion)
.setAutoscalerResource(autoscalerResource)
.addAllFieldMask(fieldMask)
.build();
ApiFuture<Operation> future = regionAutoscalerClient.updateRegionAutoscalerCallable().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.