- 2.57.0 (latest)
- 2.56.0
- 2.55.0
- 2.54.0
- 2.53.0
- 2.51.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.39.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.7
- 2.4.1
- 2.3.0
- 2.2.0
- 2.1.5
public class RecommenderClient implements BackgroundResource
Service Description: Provides insights and recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. Insights and recommendations are generated automatically based on analysis of user resources, configuration and monitoring metrics.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
InsightName name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
Insight response = recommenderClient.getInsight(name);
}
Note: close() needs to be called on the RecommenderClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of RecommenderSettings to create(). For example:
To customize credentials:
RecommenderSettings recommenderSettings =
RecommenderSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
RecommenderClient recommenderClient = RecommenderClient.create(recommenderSettings);
To customize the endpoint:
RecommenderSettings recommenderSettings =
RecommenderSettings.newBuilder().setEndpoint(myEndpoint).build();
RecommenderClient recommenderClient = RecommenderClient.create(recommenderSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceConstructors
RecommenderClient(RecommenderSettings settings)
protected RecommenderClient(RecommenderSettings settings)
Constructs an instance of RecommenderClient, 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.
Name | Description |
settings | RecommenderSettings |
RecommenderClient(RecommenderStub stub)
protected RecommenderClient(RecommenderStub stub)
Name | Description |
stub | RecommenderStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
close()
public final void close()
create()
public static final RecommenderClient create()
Constructs an instance of RecommenderClient with default settings.
Type | Description |
RecommenderClient |
Type | Description |
IOException |
create(RecommenderSettings settings)
public static final RecommenderClient create(RecommenderSettings settings)
Constructs an instance of RecommenderClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | RecommenderSettings |
Type | Description |
RecommenderClient |
Type | Description |
IOException |
create(RecommenderStub stub)
public static final RecommenderClient create(RecommenderStub stub)
Constructs an instance of RecommenderClient, using the given stub for making calls. This is for advanced usage - prefer using create(RecommenderSettings).
Name | Description |
stub | RecommenderStub |
Type | Description |
RecommenderClient |
getInsight(GetInsightRequest request)
public final Insight getInsight(GetInsightRequest request)
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
GetInsightRequest request =
GetInsightRequest.newBuilder()
.setName(
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString())
.build();
Insight response = recommenderClient.getInsight(request);
}
Name | Description |
request | GetInsightRequest The request object containing all of the parameters for the API call. |
Type | Description |
Insight |
getInsight(InsightName name)
public final Insight getInsight(InsightName name)
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
InsightName name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
Insight response = recommenderClient.getInsight(name);
}
Name | Description |
name | InsightName Required. Name of the insight. |
Type | Description |
Insight |
getInsight(String name)
public final Insight getInsight(String name)
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString();
Insight response = recommenderClient.getInsight(name);
}
Name | Description |
name | String Required. Name of the insight. |
Type | Description |
Insight |
getInsightCallable()
public final UnaryCallable<GetInsightRequest,Insight> getInsightCallable()
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
GetInsightRequest request =
GetInsightRequest.newBuilder()
.setName(
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString())
.build();
ApiFuture<Insight> future = recommenderClient.getInsightCallable().futureCall(request);
// Do something.
Insight response = future.get();
}
Type | Description |
UnaryCallable<GetInsightRequest,Insight> |
getRecommendation(GetRecommendationRequest request)
public final Recommendation getRecommendation(GetRecommendationRequest request)
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
GetRecommendationRequest request =
GetRecommendationRequest.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.build();
Recommendation response = recommenderClient.getRecommendation(request);
}
Name | Description |
request | GetRecommendationRequest The request object containing all of the parameters for the API call. |
Type | Description |
Recommendation |
getRecommendation(RecommendationName name)
public final Recommendation getRecommendation(RecommendationName name)
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Recommendation response = recommenderClient.getRecommendation(name);
}
Name | Description |
name | RecommendationName Required. Name of the recommendation. |
Type | Description |
Recommendation |
getRecommendation(String name)
public final Recommendation getRecommendation(String name)
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString();
Recommendation response = recommenderClient.getRecommendation(name);
}
Name | Description |
name | String Required. Name of the recommendation. |
Type | Description |
Recommendation |
getRecommendationCallable()
public final UnaryCallable<GetRecommendationRequest,Recommendation> getRecommendationCallable()
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
GetRecommendationRequest request =
GetRecommendationRequest.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.build();
ApiFuture<Recommendation> future =
recommenderClient.getRecommendationCallable().futureCall(request);
// Do something.
Recommendation response = future.get();
}
Type | Description |
UnaryCallable<GetRecommendationRequest,Recommendation> |
getSettings()
public final RecommenderSettings getSettings()
Type | Description |
RecommenderSettings |
getStub()
public RecommenderStub getStub()
Type | Description |
RecommenderStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listInsights(InsightTypeName parent)
public final RecommenderClient.ListInsightsPagedResponse listInsights(InsightTypeName parent)
Lists insights for a Cloud project. Requires the recommender.*.list IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
InsightTypeName parent =
InsightTypeName.ofProjectLocationInsightTypeName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]");
for (Insight element : recommenderClient.listInsights(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | InsightTypeName Required. The container resource on which to execute the request. Acceptable formats: 1. "projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]", LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/ INSIGHT_TYPE_ID refers to supported insight types: https://cloud.google.com/recommender/docs/insights/insight-types. |
Type | Description |
RecommenderClient.ListInsightsPagedResponse |
listInsights(ListInsightsRequest request)
public final RecommenderClient.ListInsightsPagedResponse listInsights(ListInsightsRequest request)
Lists insights for a Cloud project. Requires the recommender.*.list IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
ListInsightsRequest request =
ListInsightsRequest.newBuilder()
.setParent(
InsightTypeName.ofProjectLocationInsightTypeName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Insight element : recommenderClient.listInsights(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListInsightsRequest The request object containing all of the parameters for the API call. |
Type | Description |
RecommenderClient.ListInsightsPagedResponse |
listInsights(String parent)
public final RecommenderClient.ListInsightsPagedResponse listInsights(String parent)
Lists insights for a Cloud project. Requires the recommender.*.list IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String parent =
InsightTypeName.ofProjectLocationInsightTypeName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
.toString();
for (Insight element : recommenderClient.listInsights(parent).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The container resource on which to execute the request. Acceptable formats: 1. "projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]", LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/ INSIGHT_TYPE_ID refers to supported insight types: https://cloud.google.com/recommender/docs/insights/insight-types. |
Type | Description |
RecommenderClient.ListInsightsPagedResponse |
listInsightsCallable()
public final UnaryCallable<ListInsightsRequest,ListInsightsResponse> listInsightsCallable()
Lists insights for a Cloud project. Requires the recommender.*.list IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
ListInsightsRequest request =
ListInsightsRequest.newBuilder()
.setParent(
InsightTypeName.ofProjectLocationInsightTypeName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListInsightsResponse response = recommenderClient.listInsightsCallable().call(request);
for (Insight element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListInsightsRequest,ListInsightsResponse> |
listInsightsPagedCallable()
public final UnaryCallable<ListInsightsRequest,RecommenderClient.ListInsightsPagedResponse> listInsightsPagedCallable()
Lists insights for a Cloud project. Requires the recommender.*.list IAM permission for the specified insight type.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
ListInsightsRequest request =
ListInsightsRequest.newBuilder()
.setParent(
InsightTypeName.ofProjectLocationInsightTypeName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Insight> future = recommenderClient.listInsightsPagedCallable().futureCall(request);
// Do something.
for (Insight element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListInsightsRequest,ListInsightsPagedResponse> |
listRecommendations(ListRecommendationsRequest request)
public final RecommenderClient.ListRecommendationsPagedResponse listRecommendations(ListRecommendationsRequest request)
Lists recommendations for a Cloud project. Requires the recommender.*.list IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
ListRecommendationsRequest request =
ListRecommendationsRequest.newBuilder()
.setParent(
RecommenderName.ofProjectLocationRecommenderName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Recommendation element : recommenderClient.listRecommendations(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListRecommendationsRequest The request object containing all of the parameters for the API call. |
Type | Description |
RecommenderClient.ListRecommendationsPagedResponse |
listRecommendations(RecommenderName parent, String filter)
public final RecommenderClient.ListRecommendationsPagedResponse listRecommendations(RecommenderName parent, String filter)
Lists recommendations for a Cloud project. Requires the recommender.*.list IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
RecommenderName parent =
RecommenderName.ofProjectLocationRecommenderName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]");
String filter = "filter-1274492040";
for (Recommendation element :
recommenderClient.listRecommendations(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | RecommenderName Required. The container resource on which to execute the request. Acceptable formats: 1. "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]", LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/ RECOMMENDER_ID refers to supported recommenders: https://cloud.google.com/recommender/docs/recommenders. |
filter | String Filter expression to restrict the recommendations returned. Supported filter fields: state_info.state Eg: `state_info.state:"DISMISSED" or state_info.state:"FAILED" |
Type | Description |
RecommenderClient.ListRecommendationsPagedResponse |
listRecommendations(String parent, String filter)
public final RecommenderClient.ListRecommendationsPagedResponse listRecommendations(String parent, String filter)
Lists recommendations for a Cloud project. Requires the recommender.*.list IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String parent =
RecommenderName.ofProjectLocationRecommenderName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
.toString();
String filter = "filter-1274492040";
for (Recommendation element :
recommenderClient.listRecommendations(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The container resource on which to execute the request. Acceptable formats: 1. "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]", LOCATION here refers to GCP Locations: https://cloud.google.com/about/locations/ RECOMMENDER_ID refers to supported recommenders: https://cloud.google.com/recommender/docs/recommenders. |
filter | String Filter expression to restrict the recommendations returned. Supported filter fields: state_info.state Eg: `state_info.state:"DISMISSED" or state_info.state:"FAILED" |
Type | Description |
RecommenderClient.ListRecommendationsPagedResponse |
listRecommendationsCallable()
public final UnaryCallable<ListRecommendationsRequest,ListRecommendationsResponse> listRecommendationsCallable()
Lists recommendations for a Cloud project. Requires the recommender.*.list IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
ListRecommendationsRequest request =
ListRecommendationsRequest.newBuilder()
.setParent(
RecommenderName.ofProjectLocationRecommenderName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListRecommendationsResponse response =
recommenderClient.listRecommendationsCallable().call(request);
for (Recommendation element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListRecommendationsRequest,ListRecommendationsResponse> |
listRecommendationsPagedCallable()
public final UnaryCallable<ListRecommendationsRequest,RecommenderClient.ListRecommendationsPagedResponse> listRecommendationsPagedCallable()
Lists recommendations for a Cloud project. Requires the recommender.*.list IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
ListRecommendationsRequest request =
ListRecommendationsRequest.newBuilder()
.setParent(
RecommenderName.ofProjectLocationRecommenderName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Recommendation> future =
recommenderClient.listRecommendationsPagedCallable().futureCall(request);
// Do something.
for (Recommendation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListRecommendationsRequest,ListRecommendationsPagedResponse> |
markInsightAccepted(InsightName name, Map<String,String> stateMetadata, String etag)
public final Insight markInsightAccepted(InsightName name, Map<String,String> stateMetadata, String etag)
Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender API that they have applied some action based on the insight. This stops the insight content from being updated.
MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the recommender.*.update IAM permission for the specified insight.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
InsightName name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]");
Map
Name | Description |
name | InsightName Required. Name of the insight. |
stateMetadata | Map<String,String> Optional. State properties user wish to include with this state. Full replace of the current state_metadata. |
etag | String Required. Fingerprint of the Insight. Provides optimistic locking. |
Type | Description |
Insight |
markInsightAccepted(MarkInsightAcceptedRequest request)
public final Insight markInsightAccepted(MarkInsightAcceptedRequest request)
Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender API that they have applied some action based on the insight. This stops the insight content from being updated.
MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the recommender.*.update IAM permission for the specified insight.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
MarkInsightAcceptedRequest request =
MarkInsightAcceptedRequest.newBuilder()
.setName(
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString())
.putAllStateMetadata(new HashMap
Name | Description |
request | MarkInsightAcceptedRequest The request object containing all of the parameters for the API call. |
Type | Description |
Insight |
markInsightAccepted(String name, Map<String,String> stateMetadata, String etag)
public final Insight markInsightAccepted(String name, Map<String,String> stateMetadata, String etag)
Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender API that they have applied some action based on the insight. This stops the insight content from being updated.
MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the recommender.*.update IAM permission for the specified insight.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String name =
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString();
Map
Name | Description |
name | String Required. Name of the insight. |
stateMetadata | Map<String,String> Optional. State properties user wish to include with this state. Full replace of the current state_metadata. |
etag | String Required. Fingerprint of the Insight. Provides optimistic locking. |
Type | Description |
Insight |
markInsightAcceptedCallable()
public final UnaryCallable<MarkInsightAcceptedRequest,Insight> markInsightAcceptedCallable()
Marks the Insight State as Accepted. Users can use this method to indicate to the Recommender API that they have applied some action based on the insight. This stops the insight content from being updated.
MarkInsightAccepted can be applied to insights in ACTIVE state. Requires the recommender.*.update IAM permission for the specified insight.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
MarkInsightAcceptedRequest request =
MarkInsightAcceptedRequest.newBuilder()
.setName(
InsightName.ofProjectLocationInsightTypeInsightName(
"[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]")
.toString())
.putAllStateMetadata(new HashMap
Type | Description |
UnaryCallable<MarkInsightAcceptedRequest,Insight> |
markRecommendationClaimed(MarkRecommendationClaimedRequest request)
public final Recommendation markRecommendationClaimed(MarkRecommendationClaimedRequest request)
Marks the Recommendation State as Claimed. Users can use this method to indicate to the Recommender API that they are starting to apply the recommendation themselves. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
MarkRecommendationClaimedRequest request =
MarkRecommendationClaimedRequest.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.putAllStateMetadata(new HashMap
Name | Description |
request | MarkRecommendationClaimedRequest The request object containing all of the parameters for the API call. |
Type | Description |
Recommendation |
markRecommendationClaimed(RecommendationName name, Map<String,String> stateMetadata, String etag)
public final Recommendation markRecommendationClaimed(RecommendationName name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Claimed. Users can use this method to indicate to the Recommender API that they are starting to apply the recommendation themselves. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map
Name | Description |
name | RecommendationName Required. Name of the recommendation. |
stateMetadata | Map<String,String> State properties to include with this state. Overwrites any existing
|
etag | String Required. Fingerprint of the Recommendation. Provides optimistic locking. |
Type | Description |
Recommendation |
markRecommendationClaimed(String name, Map<String,String> stateMetadata, String etag)
public final Recommendation markRecommendationClaimed(String name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Claimed. Users can use this method to indicate to the Recommender API that they are starting to apply the recommendation themselves. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString();
Map
Name | Description |
name | String Required. Name of the recommendation. |
stateMetadata | Map<String,String> State properties to include with this state. Overwrites any existing
|
etag | String Required. Fingerprint of the Recommendation. Provides optimistic locking. |
Type | Description |
Recommendation |
markRecommendationClaimedCallable()
public final UnaryCallable<MarkRecommendationClaimedRequest,Recommendation> markRecommendationClaimedCallable()
Marks the Recommendation State as Claimed. Users can use this method to indicate to the Recommender API that they are starting to apply the recommendation themselves. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationClaimed can be applied to recommendations in CLAIMED or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
MarkRecommendationClaimedRequest request =
MarkRecommendationClaimedRequest.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.putAllStateMetadata(new HashMap
Type | Description |
UnaryCallable<MarkRecommendationClaimedRequest,Recommendation> |
markRecommendationFailed(MarkRecommendationFailedRequest request)
public final Recommendation markRecommendationFailed(MarkRecommendationFailedRequest request)
Marks the Recommendation State as Failed. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation failed. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
MarkRecommendationFailedRequest request =
MarkRecommendationFailedRequest.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.putAllStateMetadata(new HashMap
Name | Description |
request | MarkRecommendationFailedRequest The request object containing all of the parameters for the API call. |
Type | Description |
Recommendation |
markRecommendationFailed(RecommendationName name, Map<String,String> stateMetadata, String etag)
public final Recommendation markRecommendationFailed(RecommendationName name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Failed. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation failed. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map
Name | Description |
name | RecommendationName Required. Name of the recommendation. |
stateMetadata | Map<String,String> State properties to include with this state. Overwrites any existing
|
etag | String Required. Fingerprint of the Recommendation. Provides optimistic locking. |
Type | Description |
Recommendation |
markRecommendationFailed(String name, Map<String,String> stateMetadata, String etag)
public final Recommendation markRecommendationFailed(String name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Failed. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation failed. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString();
Map
Name | Description |
name | String Required. Name of the recommendation. |
stateMetadata | Map<String,String> State properties to include with this state. Overwrites any existing
|
etag | String Required. Fingerprint of the Recommendation. Provides optimistic locking. |
Type | Description |
Recommendation |
markRecommendationFailedCallable()
public final UnaryCallable<MarkRecommendationFailedRequest,Recommendation> markRecommendationFailedCallable()
Marks the Recommendation State as Failed. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation failed. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
MarkRecommendationFailedRequest request =
MarkRecommendationFailedRequest.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.putAllStateMetadata(new HashMap
Type | Description |
UnaryCallable<MarkRecommendationFailedRequest,Recommendation> |
markRecommendationSucceeded(MarkRecommendationSucceededRequest request)
public final Recommendation markRecommendationSucceeded(MarkRecommendationSucceededRequest request)
Marks the Recommendation State as Succeeded. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation was successful. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
MarkRecommendationSucceededRequest request =
MarkRecommendationSucceededRequest.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.putAllStateMetadata(new HashMap
Name | Description |
request | MarkRecommendationSucceededRequest The request object containing all of the parameters for the API call. |
Type | Description |
Recommendation |
markRecommendationSucceeded(RecommendationName name, Map<String,String> stateMetadata, String etag)
public final Recommendation markRecommendationSucceeded(RecommendationName name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Succeeded. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation was successful. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
RecommendationName name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]");
Map
Name | Description |
name | RecommendationName Required. Name of the recommendation. |
stateMetadata | Map<String,String> State properties to include with this state. Overwrites any existing
|
etag | String Required. Fingerprint of the Recommendation. Provides optimistic locking. |
Type | Description |
Recommendation |
markRecommendationSucceeded(String name, Map<String,String> stateMetadata, String etag)
public final Recommendation markRecommendationSucceeded(String name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Succeeded. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation was successful. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
String name =
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString();
Map
Name | Description |
name | String Required. Name of the recommendation. |
stateMetadata | Map<String,String> State properties to include with this state. Overwrites any existing
|
etag | String Required. Fingerprint of the Recommendation. Provides optimistic locking. |
Type | Description |
Recommendation |
markRecommendationSucceededCallable()
public final UnaryCallable<MarkRecommendationSucceededRequest,Recommendation> markRecommendationSucceededCallable()
Marks the Recommendation State as Succeeded. Users can use this method to indicate to the Recommender API that they have applied the recommendation themselves, and the operation was successful. This stops the recommendation content from being updated. Associated insights are frozen and placed in the ACCEPTED state.
MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state.
Requires the recommender.*.update IAM permission for the specified recommender.
Sample code:
try (RecommenderClient recommenderClient = RecommenderClient.create()) {
MarkRecommendationSucceededRequest request =
MarkRecommendationSucceededRequest.newBuilder()
.setName(
RecommendationName.ofProjectLocationRecommenderRecommendationName(
"[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]")
.toString())
.putAllStateMetadata(new HashMap
Type | Description |
UnaryCallable<MarkRecommendationSucceededRequest,Recommendation> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()