Skip to content

Commit

Permalink
feat: [recommender] Add MarkRecommendationDismissed method (#9791)
Browse files Browse the repository at this point in the history
* feat: Add MarkRecommendationDismissed method
feat: Billing account scoped Recommender/InsightType config
feat: Add Sustainability and Reliability impact

PiperOrigin-RevId: 561374659

Source-Link: googleapis/googleapis@fa66938

Source-Link: googleapis/googleapis-gen@aa0b3f3
Copy-Tag: eyJwIjoiamF2YS1yZWNvbW1lbmRlci8uT3dsQm90LnlhbWwiLCJoIjoiYWEwYjNmMzY3YmJhZWViOTFhNjkwM2FlYzg5YTMzOTljYzVhYzhjNSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Aug 31, 2023
1 parent a1b7cd8 commit b6c0df2
Show file tree
Hide file tree
Showing 40 changed files with 5,451 additions and 319 deletions.
4 changes: 2 additions & 2 deletions java-recommender/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.19.0</version>
<version>26.22.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-recommender.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-recommender/2.23.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-recommender/2.25.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,82 @@ public final UnaryCallable<GetRecommendationRequest, Recommendation> getRecommen
return stub.getRecommendationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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.
*
* <p>MarkRecommendationDismissed can be applied to recommendations in ACTIVE state.
*
* <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
*
* <p>Sample code:
*
* <pre>{@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);
* }
* }</pre>
*
* @param 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
*/
public final Recommendation markRecommendationDismissed(
MarkRecommendationDismissedRequest request) {
return markRecommendationDismissedCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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.
*
* <p>MarkRecommendationDismissed can be applied to recommendations in ACTIVE state.
*
* <p>Requires the recommender.&#42;.update IAM permission for the specified recommender.
*
* <p>Sample code:
*
* <pre>{@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();
* }
* }</pre>
*/
public final UnaryCallable<MarkRecommendationDismissedRequest, Recommendation>
markRecommendationDismissedCallable() {
return stub.markRecommendationDismissedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Marks the Recommendation State as Claimed. Users can use this method to indicate to the
Expand Down Expand Up @@ -1779,6 +1855,9 @@ public final Recommendation markRecommendationFailed(MarkRecommendationFailedReq
* <ul>
* <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
* </ul>
* <ul>
* <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
* </ul>
*
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand Down Expand Up @@ -1823,6 +1902,9 @@ public final RecommenderConfig getRecommenderConfig(RecommenderConfigName name)
* <ul>
* <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
* </ul>
* <ul>
* <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
* </ul>
*
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
Expand Down Expand Up @@ -2016,13 +2098,16 @@ public final RecommenderConfig updateRecommenderConfig(UpdateRecommenderConfigRe
* @param name Required. Name of the InsightTypeConfig to get.
* <p>Acceptable formats:
* <ul>
* <li>`projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
* <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
* </ul>
* <ul>
* <li>`projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
* <li>`projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
* </ul>
* <ul>
* <li>`organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
* <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
* </ul>
* <ul>
* <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
* </ul>
*
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand Down Expand Up @@ -2060,13 +2145,16 @@ public final InsightTypeConfig getInsightTypeConfig(InsightTypeConfigName name)
* @param name Required. Name of the InsightTypeConfig to get.
* <p>Acceptable formats:
* <ul>
* <li>`projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
* <li>`projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
* </ul>
* <ul>
* <li>`projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
* </ul>
* <ul>
* <li>`projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
* <li>`organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
* </ul>
* <ul>
* <li>`organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config`
* <li>`billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
* </ul>
*
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ public UnaryCallSettings<GetRecommendationRequest, Recommendation> getRecommenda
return ((RecommenderStubSettings) getStubSettings()).getRecommendationSettings();
}

/** Returns the object with the settings used for calls to markRecommendationDismissed. */
public UnaryCallSettings<MarkRecommendationDismissedRequest, Recommendation>
markRecommendationDismissedSettings() {
return ((RecommenderStubSettings) getStubSettings()).markRecommendationDismissedSettings();
}

/** Returns the object with the settings used for calls to markRecommendationClaimed. */
public UnaryCallSettings<MarkRecommendationClaimedRequest, Recommendation>
markRecommendationClaimedSettings() {
Expand Down Expand Up @@ -292,6 +298,12 @@ public UnaryCallSettings.Builder<GetInsightRequest, Insight> getInsightSettings(
return getStubSettingsBuilder().getRecommendationSettings();
}

/** Returns the builder for the settings used for calls to markRecommendationDismissed. */
public UnaryCallSettings.Builder<MarkRecommendationDismissedRequest, Recommendation>
markRecommendationDismissedSettings() {
return getStubSettingsBuilder().markRecommendationDismissedSettings();
}

/** Returns the builder for the settings used for calls to markRecommendationClaimed. */
public UnaryCallSettings.Builder<MarkRecommendationClaimedRequest, Recommendation>
markRecommendationClaimedSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"MarkRecommendationClaimed": {
"methods": ["markRecommendationClaimed", "markRecommendationClaimed", "markRecommendationClaimed", "markRecommendationClaimedCallable"]
},
"MarkRecommendationDismissed": {
"methods": ["markRecommendationDismissed", "markRecommendationDismissedCallable"]
},
"MarkRecommendationFailed": {
"methods": ["markRecommendationFailed", "markRecommendationFailed", "markRecommendationFailed", "markRecommendationFailedCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.google.cloud.recommender.v1.ListRecommendationsResponse;
import com.google.cloud.recommender.v1.MarkInsightAcceptedRequest;
import com.google.cloud.recommender.v1.MarkRecommendationClaimedRequest;
import com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest;
import com.google.cloud.recommender.v1.MarkRecommendationFailedRequest;
import com.google.cloud.recommender.v1.MarkRecommendationSucceededRequest;
import com.google.cloud.recommender.v1.Recommendation;
Expand Down Expand Up @@ -108,6 +109,17 @@ public class GrpcRecommenderStub extends RecommenderStub {
.setResponseMarshaller(ProtoUtils.marshaller(Recommendation.getDefaultInstance()))
.build();

private static final MethodDescriptor<MarkRecommendationDismissedRequest, Recommendation>
markRecommendationDismissedMethodDescriptor =
MethodDescriptor.<MarkRecommendationDismissedRequest, Recommendation>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.recommender.v1.Recommender/MarkRecommendationDismissed")
.setRequestMarshaller(
ProtoUtils.marshaller(MarkRecommendationDismissedRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Recommendation.getDefaultInstance()))
.build();

private static final MethodDescriptor<MarkRecommendationClaimedRequest, Recommendation>
markRecommendationClaimedMethodDescriptor =
MethodDescriptor.<MarkRecommendationClaimedRequest, Recommendation>newBuilder()
Expand Down Expand Up @@ -190,6 +202,8 @@ public class GrpcRecommenderStub extends RecommenderStub {
private final UnaryCallable<ListRecommendationsRequest, ListRecommendationsPagedResponse>
listRecommendationsPagedCallable;
private final UnaryCallable<GetRecommendationRequest, Recommendation> getRecommendationCallable;
private final UnaryCallable<MarkRecommendationDismissedRequest, Recommendation>
markRecommendationDismissedCallable;
private final UnaryCallable<MarkRecommendationClaimedRequest, Recommendation>
markRecommendationClaimedCallable;
private final UnaryCallable<MarkRecommendationSucceededRequest, Recommendation>
Expand Down Expand Up @@ -298,6 +312,17 @@ protected GrpcRecommenderStub(
return builder.build();
})
.build();
GrpcCallSettings<MarkRecommendationDismissedRequest, Recommendation>
markRecommendationDismissedTransportSettings =
GrpcCallSettings.<MarkRecommendationDismissedRequest, Recommendation>newBuilder()
.setMethodDescriptor(markRecommendationDismissedMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings<MarkRecommendationClaimedRequest, Recommendation>
markRecommendationClaimedTransportSettings =
GrpcCallSettings.<MarkRecommendationClaimedRequest, Recommendation>newBuilder()
Expand Down Expand Up @@ -409,6 +434,11 @@ protected GrpcRecommenderStub(
getRecommendationTransportSettings,
settings.getRecommendationSettings(),
clientContext);
this.markRecommendationDismissedCallable =
callableFactory.createUnaryCallable(
markRecommendationDismissedTransportSettings,
settings.markRecommendationDismissedSettings(),
clientContext);
this.markRecommendationClaimedCallable =
callableFactory.createUnaryCallable(
markRecommendationClaimedTransportSettings,
Expand Down Expand Up @@ -490,6 +520,12 @@ public UnaryCallable<GetRecommendationRequest, Recommendation> getRecommendation
return getRecommendationCallable;
}

@Override
public UnaryCallable<MarkRecommendationDismissedRequest, Recommendation>
markRecommendationDismissedCallable() {
return markRecommendationDismissedCallable;
}

@Override
public UnaryCallable<MarkRecommendationClaimedRequest, Recommendation>
markRecommendationClaimedCallable() {
Expand Down
Loading

0 comments on commit b6c0df2

Please sign in to comment.