Class SiteServiceClient (0.39.0)

GitHub RepositoryProduct Reference

Service Description: Provides methods for handling Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   SiteName name = SiteName.of("[NETWORK_CODE]", "[SITE]");
   Site response = siteServiceClient.getSite(name);
 }
 

Note: close() needs to be called on the SiteServiceClient 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

GetSite

API to retrieve a Site object.

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

  • getSite(GetSiteRequest request)

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

  • getSite(SiteName name)

  • getSite(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.

  • getSiteCallable()

ListSites

API to retrieve a list of Site objects.

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

  • listSites(ListSitesRequest request)

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

  • listSites(NetworkName parent)

  • listSites(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.

  • listSitesPagedCallable()

  • listSitesCallable()

CreateSite

API to create a Site object.

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

  • createSite(CreateSiteRequest request)

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

  • createSite(NetworkName parent, Site site)

  • createSite(String parent, Site site)

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

  • createSiteCallable()

BatchCreateSites

API to batch create Site objects.

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

  • batchCreateSites(NetworkName parent, List<CreateSiteRequest> requests)

  • batchCreateSites(String parent, List<CreateSiteRequest> requests)

  • batchCreateSites(BatchCreateSitesRequest request)

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

  • batchCreateSitesCallable()

UpdateSite

API to update a Site object.

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

  • updateSite(UpdateSiteRequest request)

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

  • updateSite(Site site, 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.

  • updateSiteCallable()

BatchUpdateSites

API to batch update Site objects.

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

  • batchUpdateSites(NetworkName parent, List<UpdateSiteRequest> requests)

  • batchUpdateSites(String parent, List<UpdateSiteRequest> requests)

  • batchUpdateSites(BatchUpdateSitesRequest request)

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

  • batchUpdateSitesCallable()

BatchDeactivateSites

Deactivates a list of Site objects.

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

  • batchDeactivateSites(BatchDeactivateSitesRequest request)

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

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

  • batchDeactivateSites(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.

  • batchDeactivateSitesCallable()

BatchSubmitSitesForApproval

Submits a list of Site objects for approval.

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

  • batchSubmitSitesForApproval(BatchSubmitSitesForApprovalRequest request)

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

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

  • batchSubmitSitesForApproval(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.

  • batchSubmitSitesForApprovalCallable()

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 SiteServiceSettings 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
 SiteServiceSettings siteServiceSettings =
     SiteServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 SiteServiceClient siteServiceClient = SiteServiceClient.create(siteServiceSettings);
 

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
 SiteServiceSettings siteServiceSettings =
     SiteServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 SiteServiceClient siteServiceClient = SiteServiceClient.create(siteServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > SiteServiceClient

Static Methods

create()

public static final SiteServiceClient create()

Constructs an instance of SiteServiceClient with default settings.

Returns
Type Description
SiteServiceClient
Exceptions
Type Description
IOException

create(SiteServiceSettings settings)

public static final SiteServiceClient create(SiteServiceSettings settings)

Constructs an instance of SiteServiceClient, 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 SiteServiceSettings
Returns
Type Description
SiteServiceClient
Exceptions
Type Description
IOException

create(SiteServiceStub stub)

public static final SiteServiceClient create(SiteServiceStub stub)

Constructs an instance of SiteServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(SiteServiceSettings).

Parameter
Name Description
stub SiteServiceStub
Returns
Type Description
SiteServiceClient

Constructors

SiteServiceClient(SiteServiceSettings settings)

protected SiteServiceClient(SiteServiceSettings settings)

Constructs an instance of SiteServiceClient, 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 SiteServiceSettings

SiteServiceClient(SiteServiceStub stub)

protected SiteServiceClient(SiteServiceStub stub)
Parameter
Name Description
stub SiteServiceStub

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

batchCreateSites(BatchCreateSitesRequest request)

public final BatchCreateSitesResponse batchCreateSites(BatchCreateSitesRequest request)

API to batch create Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   BatchCreateSitesRequest request =
       BatchCreateSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateSiteRequest>())
           .build();
   BatchCreateSitesResponse response = siteServiceClient.batchCreateSites(request);
 }
 
Parameter
Name Description
request BatchCreateSitesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchCreateSitesResponse

batchCreateSites(NetworkName parent, List<CreateSiteRequest> requests)

public final BatchCreateSitesResponse batchCreateSites(NetworkName parent, List<CreateSiteRequest> requests)

API to batch create Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<CreateSiteRequest> requests = new ArrayList<>();
   BatchCreateSitesResponse response = siteServiceClient.batchCreateSites(parent, requests);
 }
 
Parameters
Name Description
parent NetworkName

Required. The parent resource where Sites will be created. Format: networks/{network_code} The parent field in the CreateSiteRequest must match this field.

requests List<CreateSiteRequest>

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

Returns
Type Description
BatchCreateSitesResponse

batchCreateSites(String parent, List<CreateSiteRequest> requests)

public final BatchCreateSitesResponse batchCreateSites(String parent, List<CreateSiteRequest> requests)

API to batch create Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<CreateSiteRequest> requests = new ArrayList<>();
   BatchCreateSitesResponse response = siteServiceClient.batchCreateSites(parent, requests);
 }
 
Parameters
Name Description
parent String

Required. The parent resource where Sites will be created. Format: networks/{network_code} The parent field in the CreateSiteRequest must match this field.

requests List<CreateSiteRequest>

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

Returns
Type Description
BatchCreateSitesResponse

batchCreateSitesCallable()

public final UnaryCallable<BatchCreateSitesRequest,BatchCreateSitesResponse> batchCreateSitesCallable()

API to batch create Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   BatchCreateSitesRequest request =
       BatchCreateSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<CreateSiteRequest>())
           .build();
   ApiFuture<BatchCreateSitesResponse> future =
       siteServiceClient.batchCreateSitesCallable().futureCall(request);
   // Do something.
   BatchCreateSitesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchCreateSitesRequest,BatchCreateSitesResponse>

batchDeactivateSites(BatchDeactivateSitesRequest request)

public final BatchDeactivateSitesResponse batchDeactivateSites(BatchDeactivateSitesRequest request)

Deactivates a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   BatchDeactivateSitesRequest request =
       BatchDeactivateSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchDeactivateSitesResponse response = siteServiceClient.batchDeactivateSites(request);
 }
 
Parameter
Name Description
request BatchDeactivateSitesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchDeactivateSitesResponse

batchDeactivateSites(NetworkName parent, List<String> names)

public final BatchDeactivateSitesResponse batchDeactivateSites(NetworkName parent, List<String> names)

Deactivates a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<String> names = new ArrayList<>();
   BatchDeactivateSitesResponse response = siteServiceClient.batchDeactivateSites(parent, names);
 }
 
Parameters
Name Description
parent NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the Site objects to deactivate.

Returns
Type Description
BatchDeactivateSitesResponse

batchDeactivateSites(String parent, List<String> names)

public final BatchDeactivateSitesResponse batchDeactivateSites(String parent, List<String> names)

Deactivates a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<String> names = new ArrayList<>();
   BatchDeactivateSitesResponse response = siteServiceClient.batchDeactivateSites(parent, names);
 }
 
Parameters
Name Description
parent String

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the Site objects to deactivate.

Returns
Type Description
BatchDeactivateSitesResponse

batchDeactivateSitesCallable()

public final UnaryCallable<BatchDeactivateSitesRequest,BatchDeactivateSitesResponse> batchDeactivateSitesCallable()

Deactivates a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   BatchDeactivateSitesRequest request =
       BatchDeactivateSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchDeactivateSitesResponse> future =
       siteServiceClient.batchDeactivateSitesCallable().futureCall(request);
   // Do something.
   BatchDeactivateSitesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchDeactivateSitesRequest,BatchDeactivateSitesResponse>

batchSubmitSitesForApproval(BatchSubmitSitesForApprovalRequest request)

public final BatchSubmitSitesForApprovalResponse batchSubmitSitesForApproval(BatchSubmitSitesForApprovalRequest request)

Submits a list of Site objects for approval.

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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   BatchSubmitSitesForApprovalRequest request =
       BatchSubmitSitesForApprovalRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   BatchSubmitSitesForApprovalResponse response =
       siteServiceClient.batchSubmitSitesForApproval(request);
 }
 
Parameter
Name Description
request BatchSubmitSitesForApprovalRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchSubmitSitesForApprovalResponse

batchSubmitSitesForApproval(NetworkName parent, List<String> names)

public final BatchSubmitSitesForApprovalResponse batchSubmitSitesForApproval(NetworkName parent, List<String> names)

Submits a list of Site objects for approval.

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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<String> names = new ArrayList<>();
   BatchSubmitSitesForApprovalResponse response =
       siteServiceClient.batchSubmitSitesForApproval(parent, names);
 }
 
Parameters
Name Description
parent NetworkName

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the Site objects to submit for approval.

Returns
Type Description
BatchSubmitSitesForApprovalResponse

batchSubmitSitesForApproval(String parent, List<String> names)

public final BatchSubmitSitesForApprovalResponse batchSubmitSitesForApproval(String parent, List<String> names)

Submits a list of Site objects for approval.

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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<String> names = new ArrayList<>();
   BatchSubmitSitesForApprovalResponse response =
       siteServiceClient.batchSubmitSitesForApproval(parent, names);
 }
 
Parameters
Name Description
parent String

Required. Format: networks/{network_code}

names List<String>

Required. The resource names of the Site objects to submit for approval.

Returns
Type Description
BatchSubmitSitesForApprovalResponse

batchSubmitSitesForApprovalCallable()

public final UnaryCallable<BatchSubmitSitesForApprovalRequest,BatchSubmitSitesForApprovalResponse> batchSubmitSitesForApprovalCallable()

Submits a list of Site objects for approval.

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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   BatchSubmitSitesForApprovalRequest request =
       BatchSubmitSitesForApprovalRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<BatchSubmitSitesForApprovalResponse> future =
       siteServiceClient.batchSubmitSitesForApprovalCallable().futureCall(request);
   // Do something.
   BatchSubmitSitesForApprovalResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchSubmitSitesForApprovalRequest,BatchSubmitSitesForApprovalResponse>

batchUpdateSites(BatchUpdateSitesRequest request)

public final BatchUpdateSitesResponse batchUpdateSites(BatchUpdateSitesRequest request)

API to batch update Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   BatchUpdateSitesRequest request =
       BatchUpdateSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateSiteRequest>())
           .build();
   BatchUpdateSitesResponse response = siteServiceClient.batchUpdateSites(request);
 }
 
Parameter
Name Description
request BatchUpdateSitesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
BatchUpdateSitesResponse

batchUpdateSites(NetworkName parent, List<UpdateSiteRequest> requests)

public final BatchUpdateSitesResponse batchUpdateSites(NetworkName parent, List<UpdateSiteRequest> requests)

API to batch update Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   List<UpdateSiteRequest> requests = new ArrayList<>();
   BatchUpdateSitesResponse response = siteServiceClient.batchUpdateSites(parent, requests);
 }
 
Parameters
Name Description
parent NetworkName

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

requests List<UpdateSiteRequest>

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

Returns
Type Description
BatchUpdateSitesResponse

batchUpdateSites(String parent, List<UpdateSiteRequest> requests)

public final BatchUpdateSitesResponse batchUpdateSites(String parent, List<UpdateSiteRequest> requests)

API to batch update Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   List<UpdateSiteRequest> requests = new ArrayList<>();
   BatchUpdateSitesResponse response = siteServiceClient.batchUpdateSites(parent, requests);
 }
 
Parameters
Name Description
parent String

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

requests List<UpdateSiteRequest>

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

Returns
Type Description
BatchUpdateSitesResponse

batchUpdateSitesCallable()

public final UnaryCallable<BatchUpdateSitesRequest,BatchUpdateSitesResponse> batchUpdateSitesCallable()

API to batch update Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   BatchUpdateSitesRequest request =
       BatchUpdateSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .addAllRequests(new ArrayList<UpdateSiteRequest>())
           .build();
   ApiFuture<BatchUpdateSitesResponse> future =
       siteServiceClient.batchUpdateSitesCallable().futureCall(request);
   // Do something.
   BatchUpdateSitesResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<BatchUpdateSitesRequest,BatchUpdateSitesResponse>

close()

public final void close()

createSite(CreateSiteRequest request)

public final Site createSite(CreateSiteRequest request)

API to create a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   CreateSiteRequest request =
       CreateSiteRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setSite(Site.newBuilder().build())
           .build();
   Site response = siteServiceClient.createSite(request);
 }
 
Parameter
Name Description
request CreateSiteRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Site

createSite(NetworkName parent, Site site)

public final Site createSite(NetworkName parent, Site site)

API to create a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   Site site = Site.newBuilder().build();
   Site response = siteServiceClient.createSite(parent, site);
 }
 
Parameters
Name Description
parent NetworkName

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

site Site

Required. The Site to create.

Returns
Type Description
Site

createSite(String parent, Site site)

public final Site createSite(String parent, Site site)

API to create a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   Site site = Site.newBuilder().build();
   Site response = siteServiceClient.createSite(parent, site);
 }
 
Parameters
Name Description
parent String

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

site Site

Required. The Site to create.

Returns
Type Description
Site

createSiteCallable()

public final UnaryCallable<CreateSiteRequest,Site> createSiteCallable()

API to create a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   CreateSiteRequest request =
       CreateSiteRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setSite(Site.newBuilder().build())
           .build();
   ApiFuture<Site> future = siteServiceClient.createSiteCallable().futureCall(request);
   // Do something.
   Site response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateSiteRequest,Site>

getSettings()

public final SiteServiceSettings getSettings()
Returns
Type Description
SiteServiceSettings

getSite(GetSiteRequest request)

public final Site getSite(GetSiteRequest request)

API to retrieve a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   GetSiteRequest request =
       GetSiteRequest.newBuilder()
           .setName(SiteName.of("[NETWORK_CODE]", "[SITE]").toString())
           .build();
   Site response = siteServiceClient.getSite(request);
 }
 
Parameter
Name Description
request GetSiteRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Site

getSite(SiteName name)

public final Site getSite(SiteName name)

API to retrieve a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   SiteName name = SiteName.of("[NETWORK_CODE]", "[SITE]");
   Site response = siteServiceClient.getSite(name);
 }
 
Parameter
Name Description
name SiteName

Required. The resource name of the Site. Format: networks/{network_code}/sites/{site_id}

Returns
Type Description
Site

getSite(String name)

public final Site getSite(String name)

API to retrieve a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   String name = SiteName.of("[NETWORK_CODE]", "[SITE]").toString();
   Site response = siteServiceClient.getSite(name);
 }
 
Parameter
Name Description
name String

Required. The resource name of the Site. Format: networks/{network_code}/sites/{site_id}

Returns
Type Description
Site

getSiteCallable()

public final UnaryCallable<GetSiteRequest,Site> getSiteCallable()

API to retrieve a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   GetSiteRequest request =
       GetSiteRequest.newBuilder()
           .setName(SiteName.of("[NETWORK_CODE]", "[SITE]").toString())
           .build();
   ApiFuture<Site> future = siteServiceClient.getSiteCallable().futureCall(request);
   // Do something.
   Site response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetSiteRequest,Site>

getStub()

public SiteServiceStub getStub()
Returns
Type Description
SiteServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listSites(ListSitesRequest request)

public final SiteServiceClient.ListSitesPagedResponse listSites(ListSitesRequest request)

API to retrieve a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   ListSitesRequest request =
       ListSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   for (Site element : siteServiceClient.listSites(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListSitesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
SiteServiceClient.ListSitesPagedResponse

listSites(NetworkName parent)

public final SiteServiceClient.ListSitesPagedResponse listSites(NetworkName parent)

API to retrieve a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   NetworkName parent = NetworkName.of("[NETWORK_CODE]");
   for (Site element : siteServiceClient.listSites(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent NetworkName

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

Returns
Type Description
SiteServiceClient.ListSitesPagedResponse

listSites(String parent)

public final SiteServiceClient.ListSitesPagedResponse listSites(String parent)

API to retrieve a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   String parent = NetworkName.of("[NETWORK_CODE]").toString();
   for (Site element : siteServiceClient.listSites(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

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

Returns
Type Description
SiteServiceClient.ListSitesPagedResponse

listSitesCallable()

public final UnaryCallable<ListSitesRequest,ListSitesResponse> listSitesCallable()

API to retrieve a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   ListSitesRequest request =
       ListSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   while (true) {
     ListSitesResponse response = siteServiceClient.listSitesCallable().call(request);
     for (Site element : response.getSitesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListSitesRequest,ListSitesResponse>

listSitesPagedCallable()

public final UnaryCallable<ListSitesRequest,SiteServiceClient.ListSitesPagedResponse> listSitesPagedCallable()

API to retrieve a list of Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   ListSitesRequest request =
       ListSitesRequest.newBuilder()
           .setParent(NetworkName.of("[NETWORK_CODE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .setOrderBy("orderBy-1207110587")
           .setSkip(3532159)
           .build();
   ApiFuture<Site> future = siteServiceClient.listSitesPagedCallable().futureCall(request);
   // Do something.
   for (Site element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListSitesRequest,ListSitesPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateSite(Site site, FieldMask updateMask)

public final Site updateSite(Site site, FieldMask updateMask)

API to update a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   Site site = Site.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Site response = siteServiceClient.updateSite(site, updateMask);
 }
 
Parameters
Name Description
site Site

Required. The Site to update.

The Site's name is used to identify the Site to update.

updateMask FieldMask

Required. The list of fields to update.

Returns
Type Description
Site

updateSite(UpdateSiteRequest request)

public final Site updateSite(UpdateSiteRequest request)

API to update a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   UpdateSiteRequest request =
       UpdateSiteRequest.newBuilder()
           .setSite(Site.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Site response = siteServiceClient.updateSite(request);
 }
 
Parameter
Name Description
request UpdateSiteRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Site

updateSiteCallable()

public final UnaryCallable<UpdateSiteRequest,Site> updateSiteCallable()

API to update a Site 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 (SiteServiceClient siteServiceClient = SiteServiceClient.create()) {
   UpdateSiteRequest request =
       UpdateSiteRequest.newBuilder()
           .setSite(Site.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Site> future = siteServiceClient.updateSiteCallable().futureCall(request);
   // Do something.
   Site response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateSiteRequest,Site>