| GitHub Repository | Product Reference |
Service Description: Provides methods for handling Placement objects.
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
PlacementName name = PlacementName.of("[NETWORK_CODE]", "[PLACEMENT]");
Placement response = placementServiceClient.getPlacement(name);
}
Note: close() needs to be called on the PlacementServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetPlacement |
API to retrieve a |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPlacements |
API to retrieve a list of |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreatePlacement |
API to create an |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdatePlacement |
API to update an |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchCreatePlacements |
API to batch create |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchUpdatePlacements |
API to batch update |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchActivatePlacements |
Activates a list of |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchDeactivatePlacements |
Deactivates a list of |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BatchArchivePlacements |
Archives a list of |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 PlacementServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
PlacementServiceSettings placementServiceSettings =
PlacementServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
PlacementServiceClient placementServiceClient =
PlacementServiceClient.create(placementServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
PlacementServiceSettings placementServiceSettings =
PlacementServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
PlacementServiceClient placementServiceClient =
PlacementServiceClient.create(placementServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final PlacementServiceClient create()Constructs an instance of PlacementServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
PlacementServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(PlacementServiceSettings settings)
public static final PlacementServiceClient create(PlacementServiceSettings settings)Constructs an instance of PlacementServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
PlacementServiceSettings |
| Returns | |
|---|---|
| Type | Description |
PlacementServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(PlacementServiceStub stub)
public static final PlacementServiceClient create(PlacementServiceStub stub)Constructs an instance of PlacementServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(PlacementServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
PlacementServiceStub |
| Returns | |
|---|---|
| Type | Description |
PlacementServiceClient |
|
Constructors
PlacementServiceClient(PlacementServiceSettings settings)
protected PlacementServiceClient(PlacementServiceSettings settings)Constructs an instance of PlacementServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
PlacementServiceSettings |
PlacementServiceClient(PlacementServiceStub stub)
protected PlacementServiceClient(PlacementServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
PlacementServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
batchActivatePlacements(BatchActivatePlacementsRequest request)
public final BatchActivatePlacementsResponse batchActivatePlacements(BatchActivatePlacementsRequest request)Activates a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchActivatePlacementsRequest request =
BatchActivatePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchActivatePlacementsResponse response =
placementServiceClient.batchActivatePlacements(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchActivatePlacementsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchActivatePlacementsResponse |
|
batchActivatePlacements(NetworkName parent, List<String> names)
public final BatchActivatePlacementsResponse batchActivatePlacements(NetworkName parent, List<String> names)Activates a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
BatchActivatePlacementsResponse response =
placementServiceClient.batchActivatePlacements(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. Format: |
names |
List<String>Required. The names of the |
| Returns | |
|---|---|
| Type | Description |
BatchActivatePlacementsResponse |
|
batchActivatePlacements(String parent, List<String> names)
public final BatchActivatePlacementsResponse batchActivatePlacements(String parent, List<String> names)Activates a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
BatchActivatePlacementsResponse response =
placementServiceClient.batchActivatePlacements(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. The names of the |
| Returns | |
|---|---|
| Type | Description |
BatchActivatePlacementsResponse |
|
batchActivatePlacementsCallable()
public final UnaryCallable<BatchActivatePlacementsRequest,BatchActivatePlacementsResponse> batchActivatePlacementsCallable()Activates a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchActivatePlacementsRequest request =
BatchActivatePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchActivatePlacementsResponse> future =
placementServiceClient.batchActivatePlacementsCallable().futureCall(request);
// Do something.
BatchActivatePlacementsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchActivatePlacementsRequest,BatchActivatePlacementsResponse> |
|
batchArchivePlacements(BatchArchivePlacementsRequest request)
public final BatchArchivePlacementsResponse batchArchivePlacements(BatchArchivePlacementsRequest request)Archives a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchArchivePlacementsRequest request =
BatchArchivePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchArchivePlacementsResponse response =
placementServiceClient.batchArchivePlacements(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchArchivePlacementsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchArchivePlacementsResponse |
|
batchArchivePlacements(NetworkName parent, List<String> names)
public final BatchArchivePlacementsResponse batchArchivePlacements(NetworkName parent, List<String> names)Archives a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
BatchArchivePlacementsResponse response =
placementServiceClient.batchArchivePlacements(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. Format: |
names |
List<String>Required. The names of the |
| Returns | |
|---|---|
| Type | Description |
BatchArchivePlacementsResponse |
|
batchArchivePlacements(String parent, List<String> names)
public final BatchArchivePlacementsResponse batchArchivePlacements(String parent, List<String> names)Archives a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
BatchArchivePlacementsResponse response =
placementServiceClient.batchArchivePlacements(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. The names of the |
| Returns | |
|---|---|
| Type | Description |
BatchArchivePlacementsResponse |
|
batchArchivePlacementsCallable()
public final UnaryCallable<BatchArchivePlacementsRequest,BatchArchivePlacementsResponse> batchArchivePlacementsCallable()Archives a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchArchivePlacementsRequest request =
BatchArchivePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchArchivePlacementsResponse> future =
placementServiceClient.batchArchivePlacementsCallable().futureCall(request);
// Do something.
BatchArchivePlacementsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchArchivePlacementsRequest,BatchArchivePlacementsResponse> |
|
batchCreatePlacements(BatchCreatePlacementsRequest request)
public final BatchCreatePlacementsResponse batchCreatePlacements(BatchCreatePlacementsRequest request)API to batch create Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchCreatePlacementsRequest request =
BatchCreatePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<CreatePlacementRequest>())
.build();
BatchCreatePlacementsResponse response =
placementServiceClient.batchCreatePlacements(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchCreatePlacementsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchCreatePlacementsResponse |
|
batchCreatePlacements(NetworkName parent, List<CreatePlacementRequest> requests)
public final BatchCreatePlacementsResponse batchCreatePlacements(NetworkName parent, List<CreatePlacementRequest> requests)API to batch create Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<CreatePlacementRequest> requests = new ArrayList<>();
BatchCreatePlacementsResponse response =
placementServiceClient.batchCreatePlacements(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. The parent resource where the |
requests |
List<CreatePlacementRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreatePlacementsResponse |
|
batchCreatePlacements(String parent, List<CreatePlacementRequest> requests)
public final BatchCreatePlacementsResponse batchCreatePlacements(String parent, List<CreatePlacementRequest> requests)API to batch create Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<CreatePlacementRequest> requests = new ArrayList<>();
BatchCreatePlacementsResponse response =
placementServiceClient.batchCreatePlacements(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where the |
requests |
List<CreatePlacementRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchCreatePlacementsResponse |
|
batchCreatePlacementsCallable()
public final UnaryCallable<BatchCreatePlacementsRequest,BatchCreatePlacementsResponse> batchCreatePlacementsCallable()API to batch create Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchCreatePlacementsRequest request =
BatchCreatePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<CreatePlacementRequest>())
.build();
ApiFuture<BatchCreatePlacementsResponse> future =
placementServiceClient.batchCreatePlacementsCallable().futureCall(request);
// Do something.
BatchCreatePlacementsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchCreatePlacementsRequest,BatchCreatePlacementsResponse> |
|
batchDeactivatePlacements(BatchDeactivatePlacementsRequest request)
public final BatchDeactivatePlacementsResponse batchDeactivatePlacements(BatchDeactivatePlacementsRequest request)Deactivates a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchDeactivatePlacementsRequest request =
BatchDeactivatePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchDeactivatePlacementsResponse response =
placementServiceClient.batchDeactivatePlacements(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchDeactivatePlacementsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivatePlacementsResponse |
|
batchDeactivatePlacements(NetworkName parent, List<String> names)
public final BatchDeactivatePlacementsResponse batchDeactivatePlacements(NetworkName parent, List<String> names)Deactivates a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<String> names = new ArrayList<>();
BatchDeactivatePlacementsResponse response =
placementServiceClient.batchDeactivatePlacements(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. Format: |
names |
List<String>Required. The names of the |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivatePlacementsResponse |
|
batchDeactivatePlacements(String parent, List<String> names)
public final BatchDeactivatePlacementsResponse batchDeactivatePlacements(String parent, List<String> names)Deactivates a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<String> names = new ArrayList<>();
BatchDeactivatePlacementsResponse response =
placementServiceClient.batchDeactivatePlacements(parent, names);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. Format: |
names |
List<String>Required. The names of the |
| Returns | |
|---|---|
| Type | Description |
BatchDeactivatePlacementsResponse |
|
batchDeactivatePlacementsCallable()
public final UnaryCallable<BatchDeactivatePlacementsRequest,BatchDeactivatePlacementsResponse> batchDeactivatePlacementsCallable()Deactivates a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchDeactivatePlacementsRequest request =
BatchDeactivatePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<BatchDeactivatePlacementsResponse> future =
placementServiceClient.batchDeactivatePlacementsCallable().futureCall(request);
// Do something.
BatchDeactivatePlacementsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchDeactivatePlacementsRequest,BatchDeactivatePlacementsResponse> |
|
batchUpdatePlacements(BatchUpdatePlacementsRequest request)
public final BatchUpdatePlacementsResponse batchUpdatePlacements(BatchUpdatePlacementsRequest request)API to batch update Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchUpdatePlacementsRequest request =
BatchUpdatePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<UpdatePlacementRequest>())
.build();
BatchUpdatePlacementsResponse response =
placementServiceClient.batchUpdatePlacements(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
BatchUpdatePlacementsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
BatchUpdatePlacementsResponse |
|
batchUpdatePlacements(NetworkName parent, List<UpdatePlacementRequest> requests)
public final BatchUpdatePlacementsResponse batchUpdatePlacements(NetworkName parent, List<UpdatePlacementRequest> requests)API to batch update Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
List<UpdatePlacementRequest> requests = new ArrayList<>();
BatchUpdatePlacementsResponse response =
placementServiceClient.batchUpdatePlacements(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. The parent resource where |
requests |
List<UpdatePlacementRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdatePlacementsResponse |
|
batchUpdatePlacements(String parent, List<UpdatePlacementRequest> requests)
public final BatchUpdatePlacementsResponse batchUpdatePlacements(String parent, List<UpdatePlacementRequest> requests)API to batch update Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
List<UpdatePlacementRequest> requests = new ArrayList<>();
BatchUpdatePlacementsResponse response =
placementServiceClient.batchUpdatePlacements(parent, requests);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where |
requests |
List<UpdatePlacementRequest>Required. The |
| Returns | |
|---|---|
| Type | Description |
BatchUpdatePlacementsResponse |
|
batchUpdatePlacementsCallable()
public final UnaryCallable<BatchUpdatePlacementsRequest,BatchUpdatePlacementsResponse> batchUpdatePlacementsCallable()API to batch update Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
BatchUpdatePlacementsRequest request =
BatchUpdatePlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.addAllRequests(new ArrayList<UpdatePlacementRequest>())
.build();
ApiFuture<BatchUpdatePlacementsResponse> future =
placementServiceClient.batchUpdatePlacementsCallable().futureCall(request);
// Do something.
BatchUpdatePlacementsResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<BatchUpdatePlacementsRequest,BatchUpdatePlacementsResponse> |
|
close()
public final void close()createPlacement(CreatePlacementRequest request)
public final Placement createPlacement(CreatePlacementRequest request)API to create an Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
CreatePlacementRequest request =
CreatePlacementRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPlacement(Placement.newBuilder().build())
.build();
Placement response = placementServiceClient.createPlacement(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreatePlacementRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Placement |
|
createPlacement(NetworkName parent, Placement placement)
public final Placement createPlacement(NetworkName parent, Placement placement)API to create an Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
Placement placement = Placement.newBuilder().build();
Placement response = placementServiceClient.createPlacement(parent, placement);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. The parent resource where this |
placement |
PlacementRequired. The |
| Returns | |
|---|---|
| Type | Description |
Placement |
|
createPlacement(String parent, Placement placement)
public final Placement createPlacement(String parent, Placement placement)API to create an Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
Placement placement = Placement.newBuilder().build();
Placement response = placementServiceClient.createPlacement(parent, placement);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where this |
placement |
PlacementRequired. The |
| Returns | |
|---|---|
| Type | Description |
Placement |
|
createPlacementCallable()
public final UnaryCallable<CreatePlacementRequest,Placement> createPlacementCallable()API to create an Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
CreatePlacementRequest request =
CreatePlacementRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPlacement(Placement.newBuilder().build())
.build();
ApiFuture<Placement> future =
placementServiceClient.createPlacementCallable().futureCall(request);
// Do something.
Placement response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreatePlacementRequest,Placement> |
|
getPlacement(GetPlacementRequest request)
public final Placement getPlacement(GetPlacementRequest request)API to retrieve a Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
GetPlacementRequest request =
GetPlacementRequest.newBuilder()
.setName(PlacementName.of("[NETWORK_CODE]", "[PLACEMENT]").toString())
.build();
Placement response = placementServiceClient.getPlacement(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetPlacementRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Placement |
|
getPlacement(PlacementName name)
public final Placement getPlacement(PlacementName name)API to retrieve a Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
PlacementName name = PlacementName.of("[NETWORK_CODE]", "[PLACEMENT]");
Placement response = placementServiceClient.getPlacement(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
PlacementNameRequired. The resource name of the Placement. Format:
|
| Returns | |
|---|---|
| Type | Description |
Placement |
|
getPlacement(String name)
public final Placement getPlacement(String name)API to retrieve a Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
String name = PlacementName.of("[NETWORK_CODE]", "[PLACEMENT]").toString();
Placement response = placementServiceClient.getPlacement(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The resource name of the Placement. Format:
|
| Returns | |
|---|---|
| Type | Description |
Placement |
|
getPlacementCallable()
public final UnaryCallable<GetPlacementRequest,Placement> getPlacementCallable()API to retrieve a Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
GetPlacementRequest request =
GetPlacementRequest.newBuilder()
.setName(PlacementName.of("[NETWORK_CODE]", "[PLACEMENT]").toString())
.build();
ApiFuture<Placement> future =
placementServiceClient.getPlacementCallable().futureCall(request);
// Do something.
Placement response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetPlacementRequest,Placement> |
|
getSettings()
public final PlacementServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
PlacementServiceSettings |
|
getStub()
public PlacementServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
PlacementServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listPlacements(ListPlacementsRequest request)
public final PlacementServiceClient.ListPlacementsPagedResponse listPlacements(ListPlacementsRequest request)API to retrieve a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
ListPlacementsRequest request =
ListPlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
for (Placement element : placementServiceClient.listPlacements(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListPlacementsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
PlacementServiceClient.ListPlacementsPagedResponse |
|
listPlacements(NetworkName parent)
public final PlacementServiceClient.ListPlacementsPagedResponse listPlacements(NetworkName parent)API to retrieve a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
NetworkName parent = NetworkName.of("[NETWORK_CODE]");
for (Placement element : placementServiceClient.listPlacements(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
NetworkNameRequired. The parent, which owns this collection of Placements. Format:
|
| Returns | |
|---|---|
| Type | Description |
PlacementServiceClient.ListPlacementsPagedResponse |
|
listPlacements(String parent)
public final PlacementServiceClient.ListPlacementsPagedResponse listPlacements(String parent)API to retrieve a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
String parent = NetworkName.of("[NETWORK_CODE]").toString();
for (Placement element : placementServiceClient.listPlacements(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent, which owns this collection of Placements. Format:
|
| Returns | |
|---|---|
| Type | Description |
PlacementServiceClient.ListPlacementsPagedResponse |
|
listPlacementsCallable()
public final UnaryCallable<ListPlacementsRequest,ListPlacementsResponse> listPlacementsCallable()API to retrieve a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
ListPlacementsRequest request =
ListPlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
while (true) {
ListPlacementsResponse response =
placementServiceClient.listPlacementsCallable().call(request);
for (Placement element : response.getPlacementsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListPlacementsRequest,ListPlacementsResponse> |
|
listPlacementsPagedCallable()
public final UnaryCallable<ListPlacementsRequest,PlacementServiceClient.ListPlacementsPagedResponse> listPlacementsPagedCallable()API to retrieve a list of Placement objects.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
ListPlacementsRequest request =
ListPlacementsRequest.newBuilder()
.setParent(NetworkName.of("[NETWORK_CODE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.setSkip(3532159)
.build();
ApiFuture<Placement> future =
placementServiceClient.listPlacementsPagedCallable().futureCall(request);
// Do something.
for (Placement element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListPlacementsRequest,ListPlacementsPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updatePlacement(Placement placement, FieldMask updateMask)
public final Placement updatePlacement(Placement placement, FieldMask updateMask)API to update an Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
Placement placement = Placement.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Placement response = placementServiceClient.updatePlacement(placement, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
placement |
PlacementRequired. The The |
updateMask |
FieldMaskRequired. The list of fields to update. |
| Returns | |
|---|---|
| Type | Description |
Placement |
|
updatePlacement(UpdatePlacementRequest request)
public final Placement updatePlacement(UpdatePlacementRequest request)API to update an Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
UpdatePlacementRequest request =
UpdatePlacementRequest.newBuilder()
.setPlacement(Placement.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Placement response = placementServiceClient.updatePlacement(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdatePlacementRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Placement |
|
updatePlacementCallable()
public final UnaryCallable<UpdatePlacementRequest,Placement> updatePlacementCallable()API to update an Placement object.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (PlacementServiceClient placementServiceClient = PlacementServiceClient.create()) {
UpdatePlacementRequest request =
UpdatePlacementRequest.newBuilder()
.setPlacement(Placement.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Placement> future =
placementServiceClient.updatePlacementCallable().futureCall(request);
// Do something.
Placement response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdatePlacementRequest,Placement> |
|