Class ProjectServiceClient (2.55.0)

GitHub RepositoryProduct Reference

Service Description: Service for settings at Project level.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   RetailProjectName name = RetailProjectName.of("[PROJECT]");
   Project response = projectServiceClient.getProject(name);
 }
 

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

GetProject

Gets the project.

Throws NOT_FOUND if the project wasn't initialized for the Retail API service.

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

  • getProject(GetProjectRequest request)

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

  • getProject(RetailProjectName name)

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

  • getProjectCallable()

AcceptTerms

Accepts service terms for this project. By making requests to this API, you agree to the terms of service linked below. https://cloud.google.com/retail/data-use-terms

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

  • acceptTerms(AcceptTermsRequest request)

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

  • acceptTerms(RetailProjectName project)

  • acceptTerms(String project)

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

  • acceptTermsCallable()

EnrollSolution

The method enrolls a solution of type Retail Search into a project.

The Recommendations AI solution type is enrolled by default when your project enables Retail API, so you don't need to call the enrollSolution method for recommendations.

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

  • enrollSolutionAsync(EnrollSolutionRequest request)

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

  • enrollSolutionOperationCallable()

  • enrollSolutionCallable()

ListEnrolledSolutions

Lists all the retail API solutions the project has enrolled.

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

  • listEnrolledSolutions(ListEnrolledSolutionsRequest request)

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

  • listEnrolledSolutions(ProjectName parent)

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

  • listEnrolledSolutionsCallable()

GetLoggingConfig

Gets the LoggingConfig of the requested project.

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

  • getLoggingConfig(GetLoggingConfigRequest request)

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

  • getLoggingConfig(LoggingConfigName name)

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

  • getLoggingConfigCallable()

UpdateLoggingConfig

Updates the LoggingConfig of the requested project.

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

  • updateLoggingConfig(UpdateLoggingConfigRequest request)

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

  • updateLoggingConfig(LoggingConfig loggingConfig, 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.

  • updateLoggingConfigCallable()

GetAlertConfig

Get the AlertConfig of the requested project.

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

  • getAlertConfig(GetAlertConfigRequest request)

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

  • getAlertConfig(AlertConfigName name)

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

  • getAlertConfigCallable()

UpdateAlertConfig

Update the alert config of the requested project.

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

  • updateAlertConfig(UpdateAlertConfigRequest request)

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

  • updateAlertConfig(AlertConfig alertConfig, 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.

  • updateAlertConfigCallable()

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 ProjectServiceSettings 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
 ProjectServiceSettings projectServiceSettings =
     ProjectServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ProjectServiceClient projectServiceClient = ProjectServiceClient.create(projectServiceSettings);
 

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
 ProjectServiceSettings projectServiceSettings =
     ProjectServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 ProjectServiceClient projectServiceClient = ProjectServiceClient.create(projectServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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
 ProjectServiceSettings projectServiceSettings =
     ProjectServiceSettings.newHttpJsonBuilder().build();
 ProjectServiceClient projectServiceClient = ProjectServiceClient.create(projectServiceSettings);
 

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

Inheritance

java.lang.Object > ProjectServiceClient

Static Methods

create()

public static final ProjectServiceClient create()

Constructs an instance of ProjectServiceClient with default settings.

Returns
Type Description
ProjectServiceClient
Exceptions
Type Description
IOException

create(ProjectServiceSettings settings)

public static final ProjectServiceClient create(ProjectServiceSettings settings)

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

create(ProjectServiceStub stub)

public static final ProjectServiceClient create(ProjectServiceStub stub)

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

Parameter
Name Description
stub ProjectServiceStub
Returns
Type Description
ProjectServiceClient

Constructors

ProjectServiceClient(ProjectServiceSettings settings)

protected ProjectServiceClient(ProjectServiceSettings settings)

Constructs an instance of ProjectServiceClient, 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 ProjectServiceSettings

ProjectServiceClient(ProjectServiceStub stub)

protected ProjectServiceClient(ProjectServiceStub stub)
Parameter
Name Description
stub ProjectServiceStub

Methods

acceptTerms(AcceptTermsRequest request)

public final Project acceptTerms(AcceptTermsRequest request)

Accepts service terms for this project. By making requests to this API, you agree to the terms of service linked below. https://cloud.google.com/retail/data-use-terms

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   AcceptTermsRequest request =
       AcceptTermsRequest.newBuilder()
           .setProject(RetailProjectName.of("[PROJECT]").toString())
           .build();
   Project response = projectServiceClient.acceptTerms(request);
 }
 
Parameter
Name Description
request AcceptTermsRequest

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

Returns
Type Description
Project

acceptTerms(RetailProjectName project)

public final Project acceptTerms(RetailProjectName project)

Accepts service terms for this project. By making requests to this API, you agree to the terms of service linked below. https://cloud.google.com/retail/data-use-terms

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   RetailProjectName project = RetailProjectName.of("[PROJECT]");
   Project response = projectServiceClient.acceptTerms(project);
 }
 
Parameter
Name Description
project RetailProjectName

Required. Full resource name of the project. Format: projects/{project_number_or_id}/retailProject

Returns
Type Description
Project

acceptTerms(String project)

public final Project acceptTerms(String project)

Accepts service terms for this project. By making requests to this API, you agree to the terms of service linked below. https://cloud.google.com/retail/data-use-terms

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   String project = RetailProjectName.of("[PROJECT]").toString();
   Project response = projectServiceClient.acceptTerms(project);
 }
 
Parameter
Name Description
project String

Required. Full resource name of the project. Format: projects/{project_number_or_id}/retailProject

Returns
Type Description
Project

acceptTermsCallable()

public final UnaryCallable<AcceptTermsRequest,Project> acceptTermsCallable()

Accepts service terms for this project. By making requests to this API, you agree to the terms of service linked below. https://cloud.google.com/retail/data-use-terms

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   AcceptTermsRequest request =
       AcceptTermsRequest.newBuilder()
           .setProject(RetailProjectName.of("[PROJECT]").toString())
           .build();
   ApiFuture<Project> future = projectServiceClient.acceptTermsCallable().futureCall(request);
   // Do something.
   Project response = future.get();
 }
 
Returns
Type Description
UnaryCallable<AcceptTermsRequest,Project>

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

close()

public final void close()

enrollSolutionAsync(EnrollSolutionRequest request)

public final OperationFuture<EnrollSolutionResponse,EnrollSolutionMetadata> enrollSolutionAsync(EnrollSolutionRequest request)

The method enrolls a solution of type Retail Search into a project.

The Recommendations AI solution type is enrolled by default when your project enables Retail API, so you don't need to call the enrollSolution method for recommendations.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   EnrollSolutionRequest request =
       EnrollSolutionRequest.newBuilder()
           .setProject(ProjectName.of("[PROJECT]").toString())
           .setSolution(SolutionType.forNumber(0))
           .build();
   EnrollSolutionResponse response = projectServiceClient.enrollSolutionAsync(request).get();
 }
 
Parameter
Name Description
request EnrollSolutionRequest

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

Returns
Type Description
OperationFuture<EnrollSolutionResponse,EnrollSolutionMetadata>

enrollSolutionCallable()

public final UnaryCallable<EnrollSolutionRequest,Operation> enrollSolutionCallable()

The method enrolls a solution of type Retail Search into a project.

The Recommendations AI solution type is enrolled by default when your project enables Retail API, so you don't need to call the enrollSolution method for recommendations.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   EnrollSolutionRequest request =
       EnrollSolutionRequest.newBuilder()
           .setProject(ProjectName.of("[PROJECT]").toString())
           .setSolution(SolutionType.forNumber(0))
           .build();
   ApiFuture<Operation> future =
       projectServiceClient.enrollSolutionCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<EnrollSolutionRequest,Operation>

enrollSolutionOperationCallable()

public final OperationCallable<EnrollSolutionRequest,EnrollSolutionResponse,EnrollSolutionMetadata> enrollSolutionOperationCallable()

The method enrolls a solution of type Retail Search into a project.

The Recommendations AI solution type is enrolled by default when your project enables Retail API, so you don't need to call the enrollSolution method for recommendations.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   EnrollSolutionRequest request =
       EnrollSolutionRequest.newBuilder()
           .setProject(ProjectName.of("[PROJECT]").toString())
           .setSolution(SolutionType.forNumber(0))
           .build();
   OperationFuture<EnrollSolutionResponse, EnrollSolutionMetadata> future =
       projectServiceClient.enrollSolutionOperationCallable().futureCall(request);
   // Do something.
   EnrollSolutionResponse response = future.get();
 }
 
Returns
Type Description
OperationCallable<EnrollSolutionRequest,EnrollSolutionResponse,EnrollSolutionMetadata>

getAlertConfig(AlertConfigName name)

public final AlertConfig getAlertConfig(AlertConfigName name)

Get the AlertConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   AlertConfigName name = AlertConfigName.of("[PROJECT]");
   AlertConfig response = projectServiceClient.getAlertConfig(name);
 }
 
Parameter
Name Description
name AlertConfigName

Required. Full AlertConfig resource name. Format: projects/{project_number}/alertConfig

Returns
Type Description
AlertConfig

getAlertConfig(GetAlertConfigRequest request)

public final AlertConfig getAlertConfig(GetAlertConfigRequest request)

Get the AlertConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   GetAlertConfigRequest request =
       GetAlertConfigRequest.newBuilder()
           .setName(AlertConfigName.of("[PROJECT]").toString())
           .build();
   AlertConfig response = projectServiceClient.getAlertConfig(request);
 }
 
Parameter
Name Description
request GetAlertConfigRequest

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

Returns
Type Description
AlertConfig

getAlertConfig(String name)

public final AlertConfig getAlertConfig(String name)

Get the AlertConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   String name = AlertConfigName.of("[PROJECT]").toString();
   AlertConfig response = projectServiceClient.getAlertConfig(name);
 }
 
Parameter
Name Description
name String

Required. Full AlertConfig resource name. Format: projects/{project_number}/alertConfig

Returns
Type Description
AlertConfig

getAlertConfigCallable()

public final UnaryCallable<GetAlertConfigRequest,AlertConfig> getAlertConfigCallable()

Get the AlertConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   GetAlertConfigRequest request =
       GetAlertConfigRequest.newBuilder()
           .setName(AlertConfigName.of("[PROJECT]").toString())
           .build();
   ApiFuture<AlertConfig> future =
       projectServiceClient.getAlertConfigCallable().futureCall(request);
   // Do something.
   AlertConfig response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetAlertConfigRequest,AlertConfig>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getLoggingConfig(GetLoggingConfigRequest request)

public final LoggingConfig getLoggingConfig(GetLoggingConfigRequest request)

Gets the LoggingConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   GetLoggingConfigRequest request =
       GetLoggingConfigRequest.newBuilder()
           .setName(LoggingConfigName.of("[PROJECT]").toString())
           .build();
   LoggingConfig response = projectServiceClient.getLoggingConfig(request);
 }
 
Parameter
Name Description
request GetLoggingConfigRequest

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

Returns
Type Description
LoggingConfig

getLoggingConfig(LoggingConfigName name)

public final LoggingConfig getLoggingConfig(LoggingConfigName name)

Gets the LoggingConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   LoggingConfigName name = LoggingConfigName.of("[PROJECT]");
   LoggingConfig response = projectServiceClient.getLoggingConfig(name);
 }
 
Parameter
Name Description
name LoggingConfigName

Required. Full LoggingConfig resource name. Format: projects/{project_number}/loggingConfig

Returns
Type Description
LoggingConfig

getLoggingConfig(String name)

public final LoggingConfig getLoggingConfig(String name)

Gets the LoggingConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   String name = LoggingConfigName.of("[PROJECT]").toString();
   LoggingConfig response = projectServiceClient.getLoggingConfig(name);
 }
 
Parameter
Name Description
name String

Required. Full LoggingConfig resource name. Format: projects/{project_number}/loggingConfig

Returns
Type Description
LoggingConfig

getLoggingConfigCallable()

public final UnaryCallable<GetLoggingConfigRequest,LoggingConfig> getLoggingConfigCallable()

Gets the LoggingConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   GetLoggingConfigRequest request =
       GetLoggingConfigRequest.newBuilder()
           .setName(LoggingConfigName.of("[PROJECT]").toString())
           .build();
   ApiFuture<LoggingConfig> future =
       projectServiceClient.getLoggingConfigCallable().futureCall(request);
   // Do something.
   LoggingConfig response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetLoggingConfigRequest,LoggingConfig>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getProject(GetProjectRequest request)

public final Project getProject(GetProjectRequest request)

Gets the project.

Throws NOT_FOUND if the project wasn't initialized for the Retail API service.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   GetProjectRequest request =
       GetProjectRequest.newBuilder()
           .setName(RetailProjectName.of("[PROJECT]").toString())
           .build();
   Project response = projectServiceClient.getProject(request);
 }
 
Parameter
Name Description
request GetProjectRequest

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

Returns
Type Description
Project

getProject(RetailProjectName name)

public final Project getProject(RetailProjectName name)

Gets the project.

Throws NOT_FOUND if the project wasn't initialized for the Retail API service.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   RetailProjectName name = RetailProjectName.of("[PROJECT]");
   Project response = projectServiceClient.getProject(name);
 }
 
Parameter
Name Description
name RetailProjectName

Required. Full resource name of the project. Format: projects/{project_number_or_id}/retailProject

Returns
Type Description
Project

getProject(String name)

public final Project getProject(String name)

Gets the project.

Throws NOT_FOUND if the project wasn't initialized for the Retail API service.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   String name = RetailProjectName.of("[PROJECT]").toString();
   Project response = projectServiceClient.getProject(name);
 }
 
Parameter
Name Description
name String

Required. Full resource name of the project. Format: projects/{project_number_or_id}/retailProject

Returns
Type Description
Project

getProjectCallable()

public final UnaryCallable<GetProjectRequest,Project> getProjectCallable()

Gets the project.

Throws NOT_FOUND if the project wasn't initialized for the Retail API service.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   GetProjectRequest request =
       GetProjectRequest.newBuilder()
           .setName(RetailProjectName.of("[PROJECT]").toString())
           .build();
   ApiFuture<Project> future = projectServiceClient.getProjectCallable().futureCall(request);
   // Do something.
   Project response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetProjectRequest,Project>

getSettings()

public final ProjectServiceSettings getSettings()
Returns
Type Description
ProjectServiceSettings

getStub()

public ProjectServiceStub getStub()
Returns
Type Description
ProjectServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listEnrolledSolutions(ListEnrolledSolutionsRequest request)

public final ListEnrolledSolutionsResponse listEnrolledSolutions(ListEnrolledSolutionsRequest request)

Lists all the retail API solutions the project has enrolled.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   ListEnrolledSolutionsRequest request =
       ListEnrolledSolutionsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .build();
   ListEnrolledSolutionsResponse response = projectServiceClient.listEnrolledSolutions(request);
 }
 
Parameter
Name Description
request ListEnrolledSolutionsRequest

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

Returns
Type Description
ListEnrolledSolutionsResponse

listEnrolledSolutions(ProjectName parent)

public final ListEnrolledSolutionsResponse listEnrolledSolutions(ProjectName parent)

Lists all the retail API solutions the project has enrolled.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   ListEnrolledSolutionsResponse response = projectServiceClient.listEnrolledSolutions(parent);
 }
 
Parameter
Name Description
parent ProjectName

Required. Full resource name of parent. Format: projects/{project_number_or_id}

Returns
Type Description
ListEnrolledSolutionsResponse

listEnrolledSolutions(String parent)

public final ListEnrolledSolutionsResponse listEnrolledSolutions(String parent)

Lists all the retail API solutions the project has enrolled.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   ListEnrolledSolutionsResponse response = projectServiceClient.listEnrolledSolutions(parent);
 }
 
Parameter
Name Description
parent String

Required. Full resource name of parent. Format: projects/{project_number_or_id}

Returns
Type Description
ListEnrolledSolutionsResponse

listEnrolledSolutionsCallable()

public final UnaryCallable<ListEnrolledSolutionsRequest,ListEnrolledSolutionsResponse> listEnrolledSolutionsCallable()

Lists all the retail API solutions the project has enrolled.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   ListEnrolledSolutionsRequest request =
       ListEnrolledSolutionsRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .build();
   ApiFuture<ListEnrolledSolutionsResponse> future =
       projectServiceClient.listEnrolledSolutionsCallable().futureCall(request);
   // Do something.
   ListEnrolledSolutionsResponse response = future.get();
 }
 
Returns
Type Description
UnaryCallable<ListEnrolledSolutionsRequest,ListEnrolledSolutionsResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateAlertConfig(AlertConfig alertConfig, FieldMask updateMask)

public final AlertConfig updateAlertConfig(AlertConfig alertConfig, FieldMask updateMask)

Update the alert config of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   AlertConfig alertConfig = AlertConfig.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   AlertConfig response = projectServiceClient.updateAlertConfig(alertConfig, updateMask);
 }
 
Parameters
Name Description
alertConfig AlertConfig

Required. The AlertConfig to update.

If the caller does not have permission to update the AlertConfig, then a PERMISSION_DENIED error is returned.

If the AlertConfig to update does not exist, a NOT_FOUND error is returned.

updateMask FieldMask

Indicates which fields in the provided AlertConfig to update. If not set, all supported fields are updated.

Returns
Type Description
AlertConfig

updateAlertConfig(UpdateAlertConfigRequest request)

public final AlertConfig updateAlertConfig(UpdateAlertConfigRequest request)

Update the alert config of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   UpdateAlertConfigRequest request =
       UpdateAlertConfigRequest.newBuilder()
           .setAlertConfig(AlertConfig.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   AlertConfig response = projectServiceClient.updateAlertConfig(request);
 }
 
Parameter
Name Description
request UpdateAlertConfigRequest

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

Returns
Type Description
AlertConfig

updateAlertConfigCallable()

public final UnaryCallable<UpdateAlertConfigRequest,AlertConfig> updateAlertConfigCallable()

Update the alert config of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   UpdateAlertConfigRequest request =
       UpdateAlertConfigRequest.newBuilder()
           .setAlertConfig(AlertConfig.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<AlertConfig> future =
       projectServiceClient.updateAlertConfigCallable().futureCall(request);
   // Do something.
   AlertConfig response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateAlertConfigRequest,AlertConfig>

updateLoggingConfig(LoggingConfig loggingConfig, FieldMask updateMask)

public final LoggingConfig updateLoggingConfig(LoggingConfig loggingConfig, FieldMask updateMask)

Updates the LoggingConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   LoggingConfig loggingConfig = LoggingConfig.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   LoggingConfig response = projectServiceClient.updateLoggingConfig(loggingConfig, updateMask);
 }
 
Parameters
Name Description
loggingConfig LoggingConfig

Required. The LoggingConfig to update.

If the caller does not have permission to update the LoggingConfig, then a PERMISSION_DENIED error is returned.

If the LoggingConfig to update does not exist, a NOT_FOUND error is returned.

updateMask FieldMask

Indicates which fields in the provided LoggingConfig to update. The following are the only supported fields:

  • LoggingConfig.default_log_generation_rule
  • LoggingConfig.service_log_generation_rules

If not set, all supported fields are updated.

Returns
Type Description
LoggingConfig

updateLoggingConfig(UpdateLoggingConfigRequest request)

public final LoggingConfig updateLoggingConfig(UpdateLoggingConfigRequest request)

Updates the LoggingConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   UpdateLoggingConfigRequest request =
       UpdateLoggingConfigRequest.newBuilder()
           .setLoggingConfig(LoggingConfig.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   LoggingConfig response = projectServiceClient.updateLoggingConfig(request);
 }
 
Parameter
Name Description
request UpdateLoggingConfigRequest

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

Returns
Type Description
LoggingConfig

updateLoggingConfigCallable()

public final UnaryCallable<UpdateLoggingConfigRequest,LoggingConfig> updateLoggingConfigCallable()

Updates the LoggingConfig of the requested project.

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 (ProjectServiceClient projectServiceClient = ProjectServiceClient.create()) {
   UpdateLoggingConfigRequest request =
       UpdateLoggingConfigRequest.newBuilder()
           .setLoggingConfig(LoggingConfig.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<LoggingConfig> future =
       projectServiceClient.updateLoggingConfigCallable().futureCall(request);
   // Do something.
   LoggingConfig response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateLoggingConfigRequest,LoggingConfig>