Class PlacementServiceClient (0.39.0)

GitHub RepositoryProduct 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().

Methods
Method Description Method Variants

GetPlacement

API to retrieve a Placement object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getPlacement(GetPlacementRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getPlacement(PlacementName name)

  • getPlacement(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getPlacementCallable()

ListPlacements

API to retrieve a list of Placement objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listPlacements(ListPlacementsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listPlacements(NetworkName parent)

  • listPlacements(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPlacementsPagedCallable()

  • listPlacementsCallable()

CreatePlacement

API to create an Placement object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createPlacement(CreatePlacementRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • createPlacement(NetworkName parent, Placement placement)

  • createPlacement(String parent, Placement placement)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createPlacementCallable()

UpdatePlacement

API to update an Placement object.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updatePlacement(UpdatePlacementRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updatePlacement(Placement placement, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updatePlacementCallable()

BatchCreatePlacements

API to batch create Placement objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchCreatePlacements(NetworkName parent, List<CreatePlacementRequest> requests)

  • batchCreatePlacements(String parent, List<CreatePlacementRequest> requests)

  • batchCreatePlacements(BatchCreatePlacementsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchCreatePlacementsCallable()

BatchUpdatePlacements

API to batch update Placement objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchUpdatePlacements(NetworkName parent, List<UpdatePlacementRequest> requests)

  • batchUpdatePlacements(String parent, List<UpdatePlacementRequest> requests)

  • batchUpdatePlacements(BatchUpdatePlacementsRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchUpdatePlacementsCallable()

BatchActivatePlacements

Activates a list of Placement objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchActivatePlacements(BatchActivatePlacementsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • batchActivatePlacements(NetworkName parent, List<String> names)

  • batchActivatePlacements(String parent, List<String> names)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchActivatePlacementsCallable()

BatchDeactivatePlacements

Deactivates a list of Placement objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchDeactivatePlacements(BatchDeactivatePlacementsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • batchDeactivatePlacements(NetworkName parent, List<String> names)

  • batchDeactivatePlacements(String parent, List<String> names)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchDeactivatePlacementsCallable()

BatchArchivePlacements

Archives a list of Placement objects.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • batchArchivePlacements(BatchArchivePlacementsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • batchArchivePlacements(NetworkName parent, List<String> names)

  • batchArchivePlacements(String parent, List<String> names)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • batchArchivePlacementsCallable()

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.

Inheritance

java.lang.Object > PlacementServiceClient

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 BatchActivatePlacementsRequest

The 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 NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The names of the Placement objects to activate. Format: networks/{network_code}/placements/{placement_id}

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 String

Required. Format: networks/{network_code}

names List<String>

Required. The names of the Placement objects to activate. Format: networks/{network_code}/placements/{placement_id}

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 BatchArchivePlacementsRequest

The 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 NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The names of the Placement objects to archive. Format: networks/{network_code}/placements/{placement_id}

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 String

Required. Format: networks/{network_code}

names List<String>

Required. The names of the Placement objects to archive. Format: networks/{network_code}/placements/{placement_id}

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 BatchCreatePlacementsRequest

The 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 NetworkName

Required. The parent resource where the Placements will be created. Format: networks/{network_code} The parent field in the CreatePlacementRequest messages match this field.

requests List<CreatePlacementRequest>

Required. The Placement objects to create. A maximum of 100 objects can be created in a batch.

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 String

Required. The parent resource where the Placements will be created. Format: networks/{network_code} The parent field in the CreatePlacementRequest messages match this field.

requests List<CreatePlacementRequest>

Required. The Placement objects to create. A maximum of 100 objects can be created in a batch.

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 BatchDeactivatePlacementsRequest

The 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 NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The names of the Placement objects to deactivate. Format: networks/{network_code}/placements/{placement_id}

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 String

Required. Format: networks/{network_code}

names List<String>

Required. The names of the Placement objects to deactivate. Format: networks/{network_code}/placements/{placement_id}

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 BatchUpdatePlacementsRequest

The 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 NetworkName

Required. The parent resource where Placements will be updated. Format: networks/{network_code} The parent field in the UpdatePlacementsRequest must match this field.

requests List<UpdatePlacementRequest>

Required. The Placement objects to update. A maximum of 100 objects can be updated in a batch.

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 String

Required. The parent resource where Placements will be updated. Format: networks/{network_code} The parent field in the UpdatePlacementsRequest must match this field.

requests List<UpdatePlacementRequest>

Required. The Placement objects to update. A maximum of 100 objects can be updated in a batch.

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 CreatePlacementRequest

The 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 NetworkName

Required. The parent resource where this Placement will be created. Format: networks/{network_code}

placement Placement

Required. The Placement to create.

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 String

Required. The parent resource where this Placement will be created. Format: networks/{network_code}

placement Placement

Required. The Placement to create.

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 GetPlacementRequest

The 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 PlacementName

Required. The resource name of the Placement. Format: networks/{network_code}/placements/{placement_id}

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 String

Required. The resource name of the Placement. Format: networks/{network_code}/placements/{placement_id}

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 ListPlacementsRequest

The 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 NetworkName

Required. The parent, which owns this collection of Placements. Format: networks/{network_code}

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 String

Required. The parent, which owns this collection of Placements. Format: networks/{network_code}

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 Placement

Required. The Placement to update.

The Placement's name is used to identify the Placement to update. Format: networks/{network_code}/placements/{placement_id}

updateMask FieldMask

Required. 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 UpdatePlacementRequest

The 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>