Class RecommenderClient
- java.lang.Object
-
- com.google.cloud.recommender.v1.RecommenderClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class RecommenderClient extends Object implements com.google.api.gax.core.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:
// 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 (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:
// 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 RecommenderSettings recommenderSettings = RecommenderSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); RecommenderClient recommenderClient = RecommenderClient.create(recommenderSettings);
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 RecommenderSettings recommenderSettings = RecommenderSettings.newBuilder().setEndpoint(myEndpoint).build(); RecommenderClient recommenderClient = RecommenderClient.create(recommenderSettings);
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 RecommenderSettings recommenderSettings = RecommenderSettings.newHttpJsonBuilder().build(); RecommenderClient recommenderClient = RecommenderClient.create(recommenderSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RecommenderClient.ListInsightsFixedSizeCollection
static class
RecommenderClient.ListInsightsPage
static class
RecommenderClient.ListInsightsPagedResponse
static class
RecommenderClient.ListRecommendationsFixedSizeCollection
static class
RecommenderClient.ListRecommendationsPage
static class
RecommenderClient.ListRecommendationsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
RecommenderClient(RecommenderSettings settings)
Constructs an instance of RecommenderClient, using the given settings.protected
RecommenderClient(RecommenderStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static RecommenderClient
create()
Constructs an instance of RecommenderClient with default settings.static RecommenderClient
create(RecommenderSettings settings)
Constructs an instance of RecommenderClient, using the given settings.static RecommenderClient
create(RecommenderStub stub)
Constructs an instance of RecommenderClient, using the given stub for making calls.Insight
getInsight(GetInsightRequest request)
Gets the requested insight.Insight
getInsight(InsightName name)
Gets the requested insight.Insight
getInsight(String name)
Gets the requested insight.com.google.api.gax.rpc.UnaryCallable<GetInsightRequest,Insight>
getInsightCallable()
Gets the requested insight.InsightTypeConfig
getInsightTypeConfig(GetInsightTypeConfigRequest request)
Gets the requested InsightTypeConfig.InsightTypeConfig
getInsightTypeConfig(InsightTypeConfigName name)
Gets the requested InsightTypeConfig.InsightTypeConfig
getInsightTypeConfig(String name)
Gets the requested InsightTypeConfig.com.google.api.gax.rpc.UnaryCallable<GetInsightTypeConfigRequest,InsightTypeConfig>
getInsightTypeConfigCallable()
Gets the requested InsightTypeConfig.Recommendation
getRecommendation(GetRecommendationRequest request)
Gets the requested recommendation.Recommendation
getRecommendation(RecommendationName name)
Gets the requested recommendation.Recommendation
getRecommendation(String name)
Gets the requested recommendation.com.google.api.gax.rpc.UnaryCallable<GetRecommendationRequest,Recommendation>
getRecommendationCallable()
Gets the requested recommendation.RecommenderConfig
getRecommenderConfig(GetRecommenderConfigRequest request)
Gets the requested Recommender Config.RecommenderConfig
getRecommenderConfig(RecommenderConfigName name)
Gets the requested Recommender Config.RecommenderConfig
getRecommenderConfig(String name)
Gets the requested Recommender Config.com.google.api.gax.rpc.UnaryCallable<GetRecommenderConfigRequest,RecommenderConfig>
getRecommenderConfigCallable()
Gets the requested Recommender Config.RecommenderSettings
getSettings()
RecommenderStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
RecommenderClient.ListInsightsPagedResponse
listInsights(InsightTypeName parent)
Lists insights for the specified Cloud Resource.RecommenderClient.ListInsightsPagedResponse
listInsights(ListInsightsRequest request)
Lists insights for the specified Cloud Resource.RecommenderClient.ListInsightsPagedResponse
listInsights(String parent)
Lists insights for the specified Cloud Resource.com.google.api.gax.rpc.UnaryCallable<ListInsightsRequest,ListInsightsResponse>
listInsightsCallable()
Lists insights for the specified Cloud Resource.com.google.api.gax.rpc.UnaryCallable<ListInsightsRequest,RecommenderClient.ListInsightsPagedResponse>
listInsightsPagedCallable()
Lists insights for the specified Cloud Resource.RecommenderClient.ListRecommendationsPagedResponse
listRecommendations(ListRecommendationsRequest request)
Lists recommendations for the specified Cloud Resource.RecommenderClient.ListRecommendationsPagedResponse
listRecommendations(RecommenderName parent)
Lists recommendations for the specified Cloud Resource.RecommenderClient.ListRecommendationsPagedResponse
listRecommendations(RecommenderName parent, String filter)
Lists recommendations for the specified Cloud Resource.RecommenderClient.ListRecommendationsPagedResponse
listRecommendations(String parent)
Lists recommendations for the specified Cloud Resource.RecommenderClient.ListRecommendationsPagedResponse
listRecommendations(String parent, String filter)
Lists recommendations for the specified Cloud Resource.com.google.api.gax.rpc.UnaryCallable<ListRecommendationsRequest,ListRecommendationsResponse>
listRecommendationsCallable()
Lists recommendations for the specified Cloud Resource.com.google.api.gax.rpc.UnaryCallable<ListRecommendationsRequest,RecommenderClient.ListRecommendationsPagedResponse>
listRecommendationsPagedCallable()
Lists recommendations for the specified Cloud Resource.Insight
markInsightAccepted(InsightName name, Map<String,String> stateMetadata, String etag)
Marks the Insight State as Accepted.Insight
markInsightAccepted(MarkInsightAcceptedRequest request)
Marks the Insight State as Accepted.Insight
markInsightAccepted(String name, Map<String,String> stateMetadata, String etag)
Marks the Insight State as Accepted.com.google.api.gax.rpc.UnaryCallable<MarkInsightAcceptedRequest,Insight>
markInsightAcceptedCallable()
Marks the Insight State as Accepted.Recommendation
markRecommendationClaimed(MarkRecommendationClaimedRequest request)
Marks the Recommendation State as Claimed.Recommendation
markRecommendationClaimed(RecommendationName name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Claimed.Recommendation
markRecommendationClaimed(String name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Claimed.com.google.api.gax.rpc.UnaryCallable<MarkRecommendationClaimedRequest,Recommendation>
markRecommendationClaimedCallable()
Marks the Recommendation State as Claimed.Recommendation
markRecommendationDismissed(MarkRecommendationDismissedRequest request)
Mark the Recommendation State as Dismissed.com.google.api.gax.rpc.UnaryCallable<MarkRecommendationDismissedRequest,Recommendation>
markRecommendationDismissedCallable()
Mark the Recommendation State as Dismissed.Recommendation
markRecommendationFailed(MarkRecommendationFailedRequest request)
Marks the Recommendation State as Failed.Recommendation
markRecommendationFailed(RecommendationName name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Failed.Recommendation
markRecommendationFailed(String name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Failed.com.google.api.gax.rpc.UnaryCallable<MarkRecommendationFailedRequest,Recommendation>
markRecommendationFailedCallable()
Marks the Recommendation State as Failed.Recommendation
markRecommendationSucceeded(MarkRecommendationSucceededRequest request)
Marks the Recommendation State as Succeeded.Recommendation
markRecommendationSucceeded(RecommendationName name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Succeeded.Recommendation
markRecommendationSucceeded(String name, Map<String,String> stateMetadata, String etag)
Marks the Recommendation State as Succeeded.com.google.api.gax.rpc.UnaryCallable<MarkRecommendationSucceededRequest,Recommendation>
markRecommendationSucceededCallable()
Marks the Recommendation State as Succeeded.void
shutdown()
void
shutdownNow()
InsightTypeConfig
updateInsightTypeConfig(InsightTypeConfig insightTypeConfig, com.google.protobuf.FieldMask updateMask)
Updates an InsightTypeConfig change.InsightTypeConfig
updateInsightTypeConfig(UpdateInsightTypeConfigRequest request)
Updates an InsightTypeConfig change.com.google.api.gax.rpc.UnaryCallable<UpdateInsightTypeConfigRequest,InsightTypeConfig>
updateInsightTypeConfigCallable()
Updates an InsightTypeConfig change.RecommenderConfig
updateRecommenderConfig(RecommenderConfig recommenderConfig, com.google.protobuf.FieldMask updateMask)
Updates a Recommender Config.RecommenderConfig
updateRecommenderConfig(UpdateRecommenderConfigRequest request)
Updates a Recommender Config.com.google.api.gax.rpc.UnaryCallable<UpdateRecommenderConfigRequest,RecommenderConfig>
updateRecommenderConfigCallable()
Updates a Recommender Config.
-
-
-
Constructor Detail
-
RecommenderClient
protected RecommenderClient(RecommenderSettings settings) throws IOException
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.- Throws:
IOException
-
RecommenderClient
protected RecommenderClient(RecommenderStub stub)
-
-
Method Detail
-
create
public static final RecommenderClient create() throws IOException
Constructs an instance of RecommenderClient with default settings.- Throws:
IOException
-
create
public static final RecommenderClient create(RecommenderSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final RecommenderSettings getSettings()
-
getStub
public RecommenderStub getStub()
-
listInsights
public final RecommenderClient.ListInsightsPagedResponse listInsights(InsightTypeName parent)
Lists insights for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified insight type.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { InsightTypeName parent = InsightTypeName.ofProjectLocationInsightTypeName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]"); for (Insight element : recommenderClient.listInsights(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The container resource on which to execute the request. Acceptable formats:- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
- `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
- `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
- `organizations/[ORGANIZATION_ID]/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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listInsights
public final RecommenderClient.ListInsightsPagedResponse listInsights(String parent)
Lists insights for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified insight type.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String parent = InsightTypeName.ofProjectLocationInsightTypeName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]") .toString(); for (Insight element : recommenderClient.listInsights(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The container resource on which to execute the request. Acceptable formats:- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
- `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
- `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
- `organizations/[ORGANIZATION_ID]/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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listInsights
public final RecommenderClient.ListInsightsPagedResponse listInsights(ListInsightsRequest request)
Lists insights for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified insight type.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 (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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listInsightsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListInsightsRequest,RecommenderClient.ListInsightsPagedResponse> listInsightsPagedCallable()
Lists insights for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified insight type.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 (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); } }
-
listInsightsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListInsightsRequest,ListInsightsResponse> listInsightsCallable()
Lists insights for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified insight type.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 (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.getInsightsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getInsight
public final Insight getInsight(InsightName name)
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { InsightName name = InsightName.ofProjectLocationInsightTypeInsightName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]"); Insight response = recommenderClient.getInsight(name); }
- Parameters:
name
- Required. Name of the insight.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInsight
public final Insight getInsight(String name)
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String name = InsightName.ofProjectLocationInsightTypeInsightName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]") .toString(); Insight response = recommenderClient.getInsight(name); }
- Parameters:
name
- Required. Name of the insight.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInsight
public final Insight getInsight(GetInsightRequest request)
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { GetInsightRequest request = GetInsightRequest.newBuilder() .setName( InsightName.ofProjectLocationInsightTypeInsightName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]") .toString()) .build(); Insight response = recommenderClient.getInsight(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInsightCallable
public final com.google.api.gax.rpc.UnaryCallable<GetInsightRequest,Insight> getInsightCallable()
Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.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 (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(); }
-
markInsightAccepted
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { InsightName name = InsightName.ofProjectLocationInsightTypeInsightName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]"); Map<String, String> stateMetadata = new HashMap<>(); String etag = "etag3123477"; Insight response = recommenderClient.markInsightAccepted(name, stateMetadata, etag); }
- Parameters:
name
- Required. Name of the insight.stateMetadata
- Optional. State properties user wish to include with this state. Full replace of the current state_metadata.etag
- Required. Fingerprint of the Insight. Provides optimistic locking.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markInsightAccepted
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String name = InsightName.ofProjectLocationInsightTypeInsightName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]") .toString(); Map<String, String> stateMetadata = new HashMap<>(); String etag = "etag3123477"; Insight response = recommenderClient.markInsightAccepted(name, stateMetadata, etag); }
- Parameters:
name
- Required. Name of the insight.stateMetadata
- Optional. State properties user wish to include with this state. Full replace of the current state_metadata.etag
- Required. Fingerprint of the Insight. Provides optimistic locking.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markInsightAccepted
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkInsightAcceptedRequest request = MarkInsightAcceptedRequest.newBuilder() .setName( InsightName.ofProjectLocationInsightTypeInsightName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]") .toString()) .putAllStateMetadata(new HashMap<String, String>()) .setEtag("etag3123477") .build(); Insight response = recommenderClient.markInsightAccepted(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markInsightAcceptedCallable
public final com.google.api.gax.rpc.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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkInsightAcceptedRequest request = MarkInsightAcceptedRequest.newBuilder() .setName( InsightName.ofProjectLocationInsightTypeInsightName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]") .toString()) .putAllStateMetadata(new HashMap<String, String>()) .setEtag("etag3123477") .build(); ApiFuture<Insight> future = recommenderClient.markInsightAcceptedCallable().futureCall(request); // Do something. Insight response = future.get(); }
-
listRecommendations
public final RecommenderClient.ListRecommendationsPagedResponse listRecommendations(RecommenderName parent)
Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { RecommenderName parent = RecommenderName.ofProjectLocationRecommenderName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]"); for (Recommendation element : recommenderClient.listRecommendations(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The container resource on which to execute the request. Acceptable formats:- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `organizations/[ORGANIZATION_ID]/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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listRecommendations
public final RecommenderClient.ListRecommendationsPagedResponse listRecommendations(String parent)
Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String parent = RecommenderName.ofProjectLocationRecommenderName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]") .toString(); for (Recommendation element : recommenderClient.listRecommendations(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The container resource on which to execute the request. Acceptable formats:- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `organizations/[ORGANIZATION_ID]/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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listRecommendations
public final RecommenderClient.ListRecommendationsPagedResponse listRecommendations(RecommenderName parent, String filter)
Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.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 (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); } }
- Parameters:
parent
- Required. The container resource on which to execute the request. Acceptable formats:- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `organizations/[ORGANIZATION_ID]/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
- Filter expression to restrict the recommendations returned. Supported filter fields:- `state_info.state`
- `recommenderSubtype`
- `priority`
Examples:
- `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED`
- `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE`
- `priority = P1 OR priority = P2`
- `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)`
(These expressions are based on the filter language described at https://google.aip.dev/160)
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listRecommendations
public final RecommenderClient.ListRecommendationsPagedResponse listRecommendations(String parent, String filter)
Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.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 (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); } }
- Parameters:
parent
- Required. The container resource on which to execute the request. Acceptable formats:- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
- `organizations/[ORGANIZATION_ID]/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
- Filter expression to restrict the recommendations returned. Supported filter fields:- `state_info.state`
- `recommenderSubtype`
- `priority`
Examples:
- `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED`
- `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE`
- `priority = P1 OR priority = P2`
- `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)`
(These expressions are based on the filter language described at https://google.aip.dev/160)
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listRecommendations
public final RecommenderClient.ListRecommendationsPagedResponse listRecommendations(ListRecommendationsRequest request)
Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.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 (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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listRecommendationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListRecommendationsRequest,RecommenderClient.ListRecommendationsPagedResponse> listRecommendationsPagedCallable()
Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.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 (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); } }
-
listRecommendationsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListRecommendationsRequest,ListRecommendationsResponse> listRecommendationsCallable()
Lists recommendations for the specified Cloud Resource. Requires the recommender.*.list IAM permission for the specified recommender.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 (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.getRecommendationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getRecommendation
public final Recommendation getRecommendation(RecommendationName name)
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { RecommendationName name = RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]"); Recommendation response = recommenderClient.getRecommendation(name); }
- Parameters:
name
- Required. Name of the recommendation.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRecommendation
public final Recommendation getRecommendation(String name)
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String name = RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString(); Recommendation response = recommenderClient.getRecommendation(name); }
- Parameters:
name
- Required. Name of the recommendation.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRecommendation
public final Recommendation getRecommendation(GetRecommendationRequest request)
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { GetRecommendationRequest request = GetRecommendationRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .build(); Recommendation response = recommenderClient.getRecommendation(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRecommendationCallable
public final com.google.api.gax.rpc.UnaryCallable<GetRecommendationRequest,Recommendation> getRecommendationCallable()
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.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 (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(); }
-
markRecommendationDismissed
public final Recommendation markRecommendationDismissed(MarkRecommendationDismissedRequest request)
Mark the Recommendation State as Dismissed. Users can use this method to indicate to the Recommender API that an ACTIVE recommendation has to be marked back as DISMISSED.MarkRecommendationDismissed can be applied to recommendations in ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkRecommendationDismissedRequest request = MarkRecommendationDismissedRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .setEtag("etag3123477") .build(); Recommendation response = recommenderClient.markRecommendationDismissed(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationDismissedCallable
public final com.google.api.gax.rpc.UnaryCallable<MarkRecommendationDismissedRequest,Recommendation> markRecommendationDismissedCallable()
Mark the Recommendation State as Dismissed. Users can use this method to indicate to the Recommender API that an ACTIVE recommendation has to be marked back as DISMISSED.MarkRecommendationDismissed can be applied to recommendations in ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkRecommendationDismissedRequest request = MarkRecommendationDismissedRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .setEtag("etag3123477") .build(); ApiFuture<Recommendation> future = recommenderClient.markRecommendationDismissedCallable().futureCall(request); // Do something. Recommendation response = future.get(); }
-
markRecommendationClaimed
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, SUCCEEDED, FAILED, or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
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 (RecommenderClient recommenderClient = RecommenderClient.create()) { RecommendationName name = RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]"); Map<String, String> stateMetadata = new HashMap<>(); String etag = "etag3123477"; Recommendation response = recommenderClient.markRecommendationClaimed(name, stateMetadata, etag); }
- Parameters:
name
- Required. Name of the recommendation.stateMetadata
- State properties to include with this state. Overwrites any existing `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.etag
- Required. Fingerprint of the Recommendation. Provides optimistic locking.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationClaimed
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, SUCCEEDED, FAILED, or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String name = RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString(); Map<String, String> stateMetadata = new HashMap<>(); String etag = "etag3123477"; Recommendation response = recommenderClient.markRecommendationClaimed(name, stateMetadata, etag); }
- Parameters:
name
- Required. Name of the recommendation.stateMetadata
- State properties to include with this state. Overwrites any existing `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.etag
- Required. Fingerprint of the Recommendation. Provides optimistic locking.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationClaimed
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, SUCCEEDED, FAILED, or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkRecommendationClaimedRequest request = MarkRecommendationClaimedRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .putAllStateMetadata(new HashMap<String, String>()) .setEtag("etag3123477") .build(); Recommendation response = recommenderClient.markRecommendationClaimed(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationClaimedCallable
public final com.google.api.gax.rpc.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, SUCCEEDED, FAILED, or ACTIVE state.
Requires the recommender.*.update IAM permission for the specified recommender.
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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkRecommendationClaimedRequest request = MarkRecommendationClaimedRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .putAllStateMetadata(new HashMap<String, String>()) .setEtag("etag3123477") .build(); ApiFuture<Recommendation> future = recommenderClient.markRecommendationClaimedCallable().futureCall(request); // Do something. Recommendation response = future.get(); }
-
markRecommendationSucceeded
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { RecommendationName name = RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]"); Map<String, String> stateMetadata = new HashMap<>(); String etag = "etag3123477"; Recommendation response = recommenderClient.markRecommendationSucceeded(name, stateMetadata, etag); }
- Parameters:
name
- Required. Name of the recommendation.stateMetadata
- State properties to include with this state. Overwrites any existing `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.etag
- Required. Fingerprint of the Recommendation. Provides optimistic locking.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationSucceeded
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String name = RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString(); Map<String, String> stateMetadata = new HashMap<>(); String etag = "etag3123477"; Recommendation response = recommenderClient.markRecommendationSucceeded(name, stateMetadata, etag); }
- Parameters:
name
- Required. Name of the recommendation.stateMetadata
- State properties to include with this state. Overwrites any existing `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.etag
- Required. Fingerprint of the Recommendation. Provides optimistic locking.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationSucceeded
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkRecommendationSucceededRequest request = MarkRecommendationSucceededRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .putAllStateMetadata(new HashMap<String, String>()) .setEtag("etag3123477") .build(); Recommendation response = recommenderClient.markRecommendationSucceeded(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationSucceededCallable
public final com.google.api.gax.rpc.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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkRecommendationSucceededRequest request = MarkRecommendationSucceededRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .putAllStateMetadata(new HashMap<String, String>()) .setEtag("etag3123477") .build(); ApiFuture<Recommendation> future = recommenderClient.markRecommendationSucceededCallable().futureCall(request); // Do something. Recommendation response = future.get(); }
-
markRecommendationFailed
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { RecommendationName name = RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]"); Map<String, String> stateMetadata = new HashMap<>(); String etag = "etag3123477"; Recommendation response = recommenderClient.markRecommendationFailed(name, stateMetadata, etag); }
- Parameters:
name
- Required. Name of the recommendation.stateMetadata
- State properties to include with this state. Overwrites any existing `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.etag
- Required. Fingerprint of the Recommendation. Provides optimistic locking.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationFailed
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String name = RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString(); Map<String, String> stateMetadata = new HashMap<>(); String etag = "etag3123477"; Recommendation response = recommenderClient.markRecommendationFailed(name, stateMetadata, etag); }
- Parameters:
name
- Required. Name of the recommendation.stateMetadata
- State properties to include with this state. Overwrites any existing `state_metadata`. Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`. Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.etag
- Required. Fingerprint of the Recommendation. Provides optimistic locking.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationFailed
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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkRecommendationFailedRequest request = MarkRecommendationFailedRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .putAllStateMetadata(new HashMap<String, String>()) .setEtag("etag3123477") .build(); Recommendation response = recommenderClient.markRecommendationFailed(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
markRecommendationFailedCallable
public final com.google.api.gax.rpc.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:
// 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 (RecommenderClient recommenderClient = RecommenderClient.create()) { MarkRecommendationFailedRequest request = MarkRecommendationFailedRequest.newBuilder() .setName( RecommendationName.ofProjectLocationRecommenderRecommendationName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") .toString()) .putAllStateMetadata(new HashMap<String, String>()) .setEtag("etag3123477") .build(); ApiFuture<Recommendation> future = recommenderClient.markRecommendationFailedCallable().futureCall(request); // Do something. Recommendation response = future.get(); }
-
getRecommenderConfig
public final RecommenderConfig getRecommenderConfig(RecommenderConfigName name)
Gets the requested Recommender Config. There is only one instance of the config for each Recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { RecommenderConfigName name = RecommenderConfigName.ofProjectLocationRecommenderName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]"); RecommenderConfig response = recommenderClient.getRecommenderConfig(name); }
- Parameters:
name
- Required. Name of the Recommendation Config to get.Acceptable formats:
- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
- `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
- `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRecommenderConfig
public final RecommenderConfig getRecommenderConfig(String name)
Gets the requested Recommender Config. There is only one instance of the config for each Recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String name = RecommenderConfigName.ofProjectLocationRecommenderName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]") .toString(); RecommenderConfig response = recommenderClient.getRecommenderConfig(name); }
- Parameters:
name
- Required. Name of the Recommendation Config to get.Acceptable formats:
- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
- `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
- `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRecommenderConfig
public final RecommenderConfig getRecommenderConfig(GetRecommenderConfigRequest request)
Gets the requested Recommender Config. There is only one instance of the config for each Recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { GetRecommenderConfigRequest request = GetRecommenderConfigRequest.newBuilder() .setName( RecommenderConfigName.ofProjectLocationRecommenderName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]") .toString()) .build(); RecommenderConfig response = recommenderClient.getRecommenderConfig(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getRecommenderConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<GetRecommenderConfigRequest,RecommenderConfig> getRecommenderConfigCallable()
Gets the requested Recommender Config. There is only one instance of the config for each Recommender.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { GetRecommenderConfigRequest request = GetRecommenderConfigRequest.newBuilder() .setName( RecommenderConfigName.ofProjectLocationRecommenderName( "[PROJECT]", "[LOCATION]", "[RECOMMENDER]") .toString()) .build(); ApiFuture<RecommenderConfig> future = recommenderClient.getRecommenderConfigCallable().futureCall(request); // Do something. RecommenderConfig response = future.get(); }
-
updateRecommenderConfig
public final RecommenderConfig updateRecommenderConfig(RecommenderConfig recommenderConfig, com.google.protobuf.FieldMask updateMask)
Updates a Recommender Config. This will create a new revision of the config.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { RecommenderConfig recommenderConfig = RecommenderConfig.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); RecommenderConfig response = recommenderClient.updateRecommenderConfig(recommenderConfig, updateMask); }
- Parameters:
recommenderConfig
- Required. The RecommenderConfig to update.updateMask
- The list of fields to be updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateRecommenderConfig
public final RecommenderConfig updateRecommenderConfig(UpdateRecommenderConfigRequest request)
Updates a Recommender Config. This will create a new revision of the config.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { UpdateRecommenderConfigRequest request = UpdateRecommenderConfigRequest.newBuilder() .setRecommenderConfig(RecommenderConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setValidateOnly(true) .build(); RecommenderConfig response = recommenderClient.updateRecommenderConfig(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateRecommenderConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateRecommenderConfigRequest,RecommenderConfig> updateRecommenderConfigCallable()
Updates a Recommender Config. This will create a new revision of the config.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { UpdateRecommenderConfigRequest request = UpdateRecommenderConfigRequest.newBuilder() .setRecommenderConfig(RecommenderConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setValidateOnly(true) .build(); ApiFuture<RecommenderConfig> future = recommenderClient.updateRecommenderConfigCallable().futureCall(request); // Do something. RecommenderConfig response = future.get(); }
-
getInsightTypeConfig
public final InsightTypeConfig getInsightTypeConfig(InsightTypeConfigName name)
Gets the requested InsightTypeConfig. There is only one instance of the config for each InsightType.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { InsightTypeConfigName name = InsightTypeConfigName.ofProjectLocationInsightTypeName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]"); InsightTypeConfig response = recommenderClient.getInsightTypeConfig(name); }
- Parameters:
name
- Required. Name of the InsightTypeConfig to get.Acceptable formats:
- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
- `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
- `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInsightTypeConfig
public final InsightTypeConfig getInsightTypeConfig(String name)
Gets the requested InsightTypeConfig. There is only one instance of the config for each InsightType.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { String name = InsightTypeConfigName.ofProjectLocationInsightTypeName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]") .toString(); InsightTypeConfig response = recommenderClient.getInsightTypeConfig(name); }
- Parameters:
name
- Required. Name of the InsightTypeConfig to get.Acceptable formats:
- `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
- `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
- `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
- `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInsightTypeConfig
public final InsightTypeConfig getInsightTypeConfig(GetInsightTypeConfigRequest request)
Gets the requested InsightTypeConfig. There is only one instance of the config for each InsightType.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { GetInsightTypeConfigRequest request = GetInsightTypeConfigRequest.newBuilder() .setName( InsightTypeConfigName.ofProjectLocationInsightTypeName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]") .toString()) .build(); InsightTypeConfig response = recommenderClient.getInsightTypeConfig(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInsightTypeConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<GetInsightTypeConfigRequest,InsightTypeConfig> getInsightTypeConfigCallable()
Gets the requested InsightTypeConfig. There is only one instance of the config for each InsightType.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { GetInsightTypeConfigRequest request = GetInsightTypeConfigRequest.newBuilder() .setName( InsightTypeConfigName.ofProjectLocationInsightTypeName( "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]") .toString()) .build(); ApiFuture<InsightTypeConfig> future = recommenderClient.getInsightTypeConfigCallable().futureCall(request); // Do something. InsightTypeConfig response = future.get(); }
-
updateInsightTypeConfig
public final InsightTypeConfig updateInsightTypeConfig(InsightTypeConfig insightTypeConfig, com.google.protobuf.FieldMask updateMask)
Updates an InsightTypeConfig change. This will create a new revision of the config.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { InsightTypeConfig insightTypeConfig = InsightTypeConfig.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); InsightTypeConfig response = recommenderClient.updateInsightTypeConfig(insightTypeConfig, updateMask); }
- Parameters:
insightTypeConfig
- Required. The InsightTypeConfig to update.updateMask
- The list of fields to be updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateInsightTypeConfig
public final InsightTypeConfig updateInsightTypeConfig(UpdateInsightTypeConfigRequest request)
Updates an InsightTypeConfig change. This will create a new revision of the config.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { UpdateInsightTypeConfigRequest request = UpdateInsightTypeConfigRequest.newBuilder() .setInsightTypeConfig(InsightTypeConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setValidateOnly(true) .build(); InsightTypeConfig response = recommenderClient.updateInsightTypeConfig(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateInsightTypeConfigCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateInsightTypeConfigRequest,InsightTypeConfig> updateInsightTypeConfigCallable()
Updates an InsightTypeConfig change. This will create a new revision of the config.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 (RecommenderClient recommenderClient = RecommenderClient.create()) { UpdateInsightTypeConfigRequest request = UpdateInsightTypeConfigRequest.newBuilder() .setInsightTypeConfig(InsightTypeConfig.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setValidateOnly(true) .build(); ApiFuture<InsightTypeConfig> future = recommenderClient.updateInsightTypeConfigCallable().futureCall(request); // Do something. InsightTypeConfig response = future.get(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-