diff --git a/java-recommender/README.md b/java-recommender/README.md index 59fd3e3f265a..da11c8723dc5 100644 --- a/java-recommender/README.md +++ b/java-recommender/README.md @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.19.0 + 26.22.0 pom import @@ -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 diff --git a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderClient.java b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderClient.java index 82378d851762..4f6a24dab630 100644 --- a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderClient.java +++ b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderClient.java @@ -1200,6 +1200,82 @@ public final UnaryCallable 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. + * + *

MarkRecommendationDismissed can be applied to recommendations in ACTIVE state. + * + *

Requires the recommender.*.update IAM permission for the specified recommender. + * + *

Sample code: + * + *

{@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);
+   * }
+   * }
+ * + * @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. + * + *

MarkRecommendationDismissed can be applied to recommendations in ACTIVE state. + * + *

Requires the recommender.*.update IAM permission for the specified recommender. + * + *

Sample code: + * + *

{@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 future =
+   *       recommenderClient.markRecommendationDismissedCallable().futureCall(request);
+   *   // Do something.
+   *   Recommendation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + markRecommendationDismissedCallable() { + return stub.markRecommendationDismissedCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Marks the Recommendation State as Claimed. Users can use this method to indicate to the @@ -1779,6 +1855,9 @@ public final Recommendation markRecommendationFailed(MarkRecommendationFailedReq * + * * * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1823,6 +1902,9 @@ public final RecommenderConfig getRecommenderConfig(RecommenderConfigName name) * + * * * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -2016,13 +2098,16 @@ public final RecommenderConfig updateRecommenderConfig(UpdateRecommenderConfigRe * @param name Required. Name of the InsightTypeConfig to get. *

Acceptable formats: *

* * + * * * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2060,13 +2145,16 @@ public final InsightTypeConfig getInsightTypeConfig(InsightTypeConfigName name) * @param name Required. Name of the InsightTypeConfig to get. *

Acceptable formats: *

+ * * * * * @throws com.google.api.gax.rpc.ApiException if the remote call fails diff --git a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderSettings.java b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderSettings.java index f96908e60c95..67167e305ede 100644 --- a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderSettings.java +++ b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/RecommenderSettings.java @@ -103,6 +103,12 @@ public UnaryCallSettings getRecommenda return ((RecommenderStubSettings) getStubSettings()).getRecommendationSettings(); } + /** Returns the object with the settings used for calls to markRecommendationDismissed. */ + public UnaryCallSettings + markRecommendationDismissedSettings() { + return ((RecommenderStubSettings) getStubSettings()).markRecommendationDismissedSettings(); + } + /** Returns the object with the settings used for calls to markRecommendationClaimed. */ public UnaryCallSettings markRecommendationClaimedSettings() { @@ -292,6 +298,12 @@ public UnaryCallSettings.Builder getInsightSettings( return getStubSettingsBuilder().getRecommendationSettings(); } + /** Returns the builder for the settings used for calls to markRecommendationDismissed. */ + public UnaryCallSettings.Builder + markRecommendationDismissedSettings() { + return getStubSettingsBuilder().markRecommendationDismissedSettings(); + } + /** Returns the builder for the settings used for calls to markRecommendationClaimed. */ public UnaryCallSettings.Builder markRecommendationClaimedSettings() { diff --git a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/gapic_metadata.json b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/gapic_metadata.json index d78bbfbf9e00..552907a12fbb 100644 --- a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/gapic_metadata.json +++ b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/gapic_metadata.json @@ -34,6 +34,9 @@ "MarkRecommendationClaimed": { "methods": ["markRecommendationClaimed", "markRecommendationClaimed", "markRecommendationClaimed", "markRecommendationClaimedCallable"] }, + "MarkRecommendationDismissed": { + "methods": ["markRecommendationDismissed", "markRecommendationDismissedCallable"] + }, "MarkRecommendationFailed": { "methods": ["markRecommendationFailed", "markRecommendationFailed", "markRecommendationFailed", "markRecommendationFailedCallable"] }, diff --git a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/GrpcRecommenderStub.java b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/GrpcRecommenderStub.java index 40a8457e46e4..df8c458ee4f7 100644 --- a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/GrpcRecommenderStub.java +++ b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/GrpcRecommenderStub.java @@ -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; @@ -108,6 +109,17 @@ public class GrpcRecommenderStub extends RecommenderStub { .setResponseMarshaller(ProtoUtils.marshaller(Recommendation.getDefaultInstance())) .build(); + private static final MethodDescriptor + markRecommendationDismissedMethodDescriptor = + MethodDescriptor.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 markRecommendationClaimedMethodDescriptor = MethodDescriptor.newBuilder() @@ -190,6 +202,8 @@ public class GrpcRecommenderStub extends RecommenderStub { private final UnaryCallable listRecommendationsPagedCallable; private final UnaryCallable getRecommendationCallable; + private final UnaryCallable + markRecommendationDismissedCallable; private final UnaryCallable markRecommendationClaimedCallable; private final UnaryCallable @@ -298,6 +312,17 @@ protected GrpcRecommenderStub( return builder.build(); }) .build(); + GrpcCallSettings + markRecommendationDismissedTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(markRecommendationDismissedMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); GrpcCallSettings markRecommendationClaimedTransportSettings = GrpcCallSettings.newBuilder() @@ -409,6 +434,11 @@ protected GrpcRecommenderStub( getRecommendationTransportSettings, settings.getRecommendationSettings(), clientContext); + this.markRecommendationDismissedCallable = + callableFactory.createUnaryCallable( + markRecommendationDismissedTransportSettings, + settings.markRecommendationDismissedSettings(), + clientContext); this.markRecommendationClaimedCallable = callableFactory.createUnaryCallable( markRecommendationClaimedTransportSettings, @@ -490,6 +520,12 @@ public UnaryCallable getRecommendation return getRecommendationCallable; } + @Override + public UnaryCallable + markRecommendationDismissedCallable() { + return markRecommendationDismissedCallable; + } + @Override public UnaryCallable markRecommendationClaimedCallable() { diff --git a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/HttpJsonRecommenderStub.java b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/HttpJsonRecommenderStub.java index 2e40fe869034..a0271a7378e8 100644 --- a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/HttpJsonRecommenderStub.java +++ b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/HttpJsonRecommenderStub.java @@ -44,6 +44,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; @@ -268,6 +269,48 @@ public class HttpJsonRecommenderStub extends RecommenderStub { .build()) .build(); + private static final ApiMethodDescriptor + markRecommendationDismissedMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.recommender.v1.Recommender/MarkRecommendationDismissed") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markDismissed", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setAdditionalPaths( + "/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markDismissed", + "/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markDismissed", + "/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markDismissed") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Recommendation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private static final ApiMethodDescriptor markRecommendationClaimedMethodDescriptor = ApiMethodDescriptor.newBuilder() @@ -411,7 +454,8 @@ public class HttpJsonRecommenderStub extends RecommenderStub { return fields; }) .setAdditionalPaths( - "/v1/{name=organizations/*/locations/*/recommenders/*/config}") + "/v1/{name=organizations/*/locations/*/recommenders/*/config}", + "/v1/{name=billingAccounts/*/locations/*/recommenders/*/config}") .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); @@ -450,7 +494,8 @@ public class HttpJsonRecommenderStub extends RecommenderStub { return fields; }) .setAdditionalPaths( - "/v1/{recommenderConfig.name=organizations/*/locations/*/recommenders/*/config}") + "/v1/{recommenderConfig.name=organizations/*/locations/*/recommenders/*/config}", + "/v1/{recommenderConfig.name=billingAccounts/*/locations/*/recommenders/*/config}") .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); @@ -493,7 +538,8 @@ public class HttpJsonRecommenderStub extends RecommenderStub { return fields; }) .setAdditionalPaths( - "/v1/{name=organizations/*/locations/*/insightTypes/*/config}") + "/v1/{name=organizations/*/locations/*/insightTypes/*/config}", + "/v1/{name=billingAccounts/*/locations/*/insightTypes/*/config}") .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); @@ -532,7 +578,8 @@ public class HttpJsonRecommenderStub extends RecommenderStub { return fields; }) .setAdditionalPaths( - "/v1/{insightTypeConfig.name=organizations/*/locations/*/insightTypes/*/config}") + "/v1/{insightTypeConfig.name=organizations/*/locations/*/insightTypes/*/config}", + "/v1/{insightTypeConfig.name=billingAccounts/*/locations/*/insightTypes/*/config}") .setQueryParamsExtractor( request -> { Map> fields = new HashMap<>(); @@ -567,6 +614,8 @@ public class HttpJsonRecommenderStub extends RecommenderStub { private final UnaryCallable listRecommendationsPagedCallable; private final UnaryCallable getRecommendationCallable; + private final UnaryCallable + markRecommendationDismissedCallable; private final UnaryCallable markRecommendationClaimedCallable; private final UnaryCallable @@ -682,6 +731,18 @@ protected HttpJsonRecommenderStub( return builder.build(); }) .build(); + HttpJsonCallSettings + markRecommendationDismissedTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(markRecommendationDismissedMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); HttpJsonCallSettings markRecommendationClaimedTransportSettings = HttpJsonCallSettings.newBuilder() @@ -800,6 +861,11 @@ protected HttpJsonRecommenderStub( getRecommendationTransportSettings, settings.getRecommendationSettings(), clientContext); + this.markRecommendationDismissedCallable = + callableFactory.createUnaryCallable( + markRecommendationDismissedTransportSettings, + settings.markRecommendationDismissedSettings(), + clientContext); this.markRecommendationClaimedCallable = callableFactory.createUnaryCallable( markRecommendationClaimedTransportSettings, @@ -848,6 +914,7 @@ public static List getMethodDescriptors() { methodDescriptors.add(markInsightAcceptedMethodDescriptor); methodDescriptors.add(listRecommendationsMethodDescriptor); methodDescriptors.add(getRecommendationMethodDescriptor); + methodDescriptors.add(markRecommendationDismissedMethodDescriptor); methodDescriptors.add(markRecommendationClaimedMethodDescriptor); methodDescriptors.add(markRecommendationSucceededMethodDescriptor); methodDescriptors.add(markRecommendationFailedMethodDescriptor); @@ -895,6 +962,12 @@ public UnaryCallable getRecommendation return getRecommendationCallable; } + @Override + public UnaryCallable + markRecommendationDismissedCallable() { + return markRecommendationDismissedCallable; + } + @Override public UnaryCallable markRecommendationClaimedCallable() { diff --git a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/RecommenderStub.java b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/RecommenderStub.java index d3365007a9ab..3916d8341fc0 100644 --- a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/RecommenderStub.java +++ b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/RecommenderStub.java @@ -33,6 +33,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; @@ -80,6 +81,12 @@ public UnaryCallable getRecommendation throw new UnsupportedOperationException("Not implemented: getRecommendationCallable()"); } + public UnaryCallable + markRecommendationDismissedCallable() { + throw new UnsupportedOperationException( + "Not implemented: markRecommendationDismissedCallable()"); + } + public UnaryCallable markRecommendationClaimedCallable() { throw new UnsupportedOperationException("Not implemented: markRecommendationClaimedCallable()"); diff --git a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/RecommenderStubSettings.java b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/RecommenderStubSettings.java index adf061d24bb1..1311a531eec2 100644 --- a/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/RecommenderStubSettings.java +++ b/java-recommender/google-cloud-recommender/src/main/java/com/google/cloud/recommender/v1/stub/RecommenderStubSettings.java @@ -56,6 +56,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; @@ -124,6 +125,8 @@ public class RecommenderStubSettings extends StubSettings getRecommendationSettings; + private final UnaryCallSettings + markRecommendationDismissedSettings; private final UnaryCallSettings markRecommendationClaimedSettings; private final UnaryCallSettings @@ -281,6 +284,12 @@ public UnaryCallSettings getRecommenda return getRecommendationSettings; } + /** Returns the object with the settings used for calls to markRecommendationDismissed. */ + public UnaryCallSettings + markRecommendationDismissedSettings() { + return markRecommendationDismissedSettings; + } + /** Returns the object with the settings used for calls to markRecommendationClaimed. */ public UnaryCallSettings markRecommendationClaimedSettings() { @@ -434,6 +443,8 @@ protected RecommenderStubSettings(Builder settingsBuilder) throws IOException { markInsightAcceptedSettings = settingsBuilder.markInsightAcceptedSettings().build(); listRecommendationsSettings = settingsBuilder.listRecommendationsSettings().build(); getRecommendationSettings = settingsBuilder.getRecommendationSettings().build(); + markRecommendationDismissedSettings = + settingsBuilder.markRecommendationDismissedSettings().build(); markRecommendationClaimedSettings = settingsBuilder.markRecommendationClaimedSettings().build(); markRecommendationSucceededSettings = settingsBuilder.markRecommendationSucceededSettings().build(); @@ -460,6 +471,8 @@ public static class Builder extends StubSettings.Builder getRecommendationSettings; + private final UnaryCallSettings.Builder + markRecommendationDismissedSettings; private final UnaryCallSettings.Builder markRecommendationClaimedSettings; private final UnaryCallSettings.Builder @@ -533,6 +546,7 @@ protected Builder(ClientContext clientContext) { listRecommendationsSettings = PagedCallSettings.newBuilder(LIST_RECOMMENDATIONS_PAGE_STR_FACT); getRecommendationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + markRecommendationDismissedSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); markRecommendationClaimedSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); markRecommendationSucceededSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); markRecommendationFailedSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -548,6 +562,7 @@ protected Builder(ClientContext clientContext) { markInsightAcceptedSettings, listRecommendationsSettings, getRecommendationSettings, + markRecommendationDismissedSettings, markRecommendationClaimedSettings, markRecommendationSucceededSettings, markRecommendationFailedSettings, @@ -566,6 +581,8 @@ protected Builder(RecommenderStubSettings settings) { markInsightAcceptedSettings = settings.markInsightAcceptedSettings.toBuilder(); listRecommendationsSettings = settings.listRecommendationsSettings.toBuilder(); getRecommendationSettings = settings.getRecommendationSettings.toBuilder(); + markRecommendationDismissedSettings = + settings.markRecommendationDismissedSettings.toBuilder(); markRecommendationClaimedSettings = settings.markRecommendationClaimedSettings.toBuilder(); markRecommendationSucceededSettings = settings.markRecommendationSucceededSettings.toBuilder(); @@ -582,6 +599,7 @@ protected Builder(RecommenderStubSettings settings) { markInsightAcceptedSettings, listRecommendationsSettings, getRecommendationSettings, + markRecommendationDismissedSettings, markRecommendationClaimedSettings, markRecommendationSucceededSettings, markRecommendationFailedSettings, @@ -643,6 +661,11 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .markRecommendationDismissedSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder .markRecommendationClaimedSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) @@ -729,6 +752,12 @@ public UnaryCallSettings.Builder getInsightSettings( return getRecommendationSettings; } + /** Returns the builder for the settings used for calls to markRecommendationDismissed. */ + public UnaryCallSettings.Builder + markRecommendationDismissedSettings() { + return markRecommendationDismissedSettings; + } + /** Returns the builder for the settings used for calls to markRecommendationClaimed. */ public UnaryCallSettings.Builder markRecommendationClaimedSettings() { diff --git a/java-recommender/google-cloud-recommender/src/main/resources/META-INF/native-image/com.google.cloud.recommender.v1/reflect-config.json b/java-recommender/google-cloud-recommender/src/main/resources/META-INF/native-image/com.google.cloud.recommender.v1/reflect-config.json index 02178807ecde..0e187813d59f 100644 --- a/java-recommender/google-cloud-recommender/src/main/resources/META-INF/native-image/com.google.cloud.recommender.v1/reflect-config.json +++ b/java-recommender/google-cloud-recommender/src/main/resources/META-INF/native-image/com.google.cloud.recommender.v1/reflect-config.json @@ -719,6 +719,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.recommender.v1.MarkRecommendationFailedRequest", "queryAllDeclaredConstructors": true, @@ -917,6 +935,33 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.recommender.v1.ReliabilityProjection", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.recommender.v1.ReliabilityProjection$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.recommender.v1.ReliabilityProjection$RiskType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.recommender.v1.SecurityProjection", "queryAllDeclaredConstructors": true, @@ -935,6 +980,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.recommender.v1.SustainabilityProjection", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.recommender.v1.SustainabilityProjection$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.recommender.v1.UpdateInsightTypeConfigRequest", "queryAllDeclaredConstructors": true, diff --git a/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/MockRecommenderImpl.java b/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/MockRecommenderImpl.java index 3c5eaf85dfad..edafc4050985 100644 --- a/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/MockRecommenderImpl.java +++ b/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/MockRecommenderImpl.java @@ -163,6 +163,27 @@ public void getRecommendation( } } + @Override + public void markRecommendationDismissed( + MarkRecommendationDismissedRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Recommendation) { + requests.add(request); + responseObserver.onNext(((Recommendation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method MarkRecommendationDismissed, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Recommendation.class.getName(), + Exception.class.getName()))); + } + } + @Override public void markRecommendationClaimed( MarkRecommendationClaimedRequest request, StreamObserver responseObserver) { diff --git a/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/RecommenderClientHttpJsonTest.java b/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/RecommenderClientHttpJsonTest.java index 21fe2b2b54be..47dd05f6ad7c 100644 --- a/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/RecommenderClientHttpJsonTest.java +++ b/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/RecommenderClientHttpJsonTest.java @@ -763,6 +763,77 @@ public void getRecommendationExceptionTest2() throws Exception { } } + @Test + public void markRecommendationDismissedTest() throws Exception { + Recommendation expectedResponse = + Recommendation.newBuilder() + .setName( + RecommendationName.ofProjectLocationRecommenderRecommendationName( + "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") + .toString()) + .setDescription("description-1724546052") + .setRecommenderSubtype("recommenderSubtype1811451601") + .setLastRefreshTime(Timestamp.newBuilder().build()) + .setPrimaryImpact(Impact.newBuilder().build()) + .addAllAdditionalImpact(new ArrayList()) + .setContent(RecommendationContent.newBuilder().build()) + .setStateInfo(RecommendationStateInfo.newBuilder().build()) + .setEtag("etag3123477") + .addAllAssociatedInsights(new ArrayList()) + .setXorGroupId("xorGroupId-2095769825") + .build(); + mockService.addResponse(expectedResponse); + + MarkRecommendationDismissedRequest request = + MarkRecommendationDismissedRequest.newBuilder() + .setName( + RecommendationName.ofProjectLocationRecommenderRecommendationName( + "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") + .toString()) + .setEtag("etag3123477") + .build(); + + Recommendation actualResponse = client.markRecommendationDismissed(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void markRecommendationDismissedExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + MarkRecommendationDismissedRequest request = + MarkRecommendationDismissedRequest.newBuilder() + .setName( + RecommendationName.ofProjectLocationRecommenderRecommendationName( + "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") + .toString()) + .setEtag("etag3123477") + .build(); + client.markRecommendationDismissed(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test public void markRecommendationClaimedTest() throws Exception { Recommendation expectedResponse = diff --git a/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/RecommenderClientTest.java b/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/RecommenderClientTest.java index 7a5fce726947..acef793a6dfa 100644 --- a/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/RecommenderClientTest.java +++ b/java-recommender/google-cloud-recommender/src/test/java/com/google/cloud/recommender/v1/RecommenderClientTest.java @@ -694,6 +694,73 @@ public void getRecommendationExceptionTest2() throws Exception { } } + @Test + public void markRecommendationDismissedTest() throws Exception { + Recommendation expectedResponse = + Recommendation.newBuilder() + .setName( + RecommendationName.ofProjectLocationRecommenderRecommendationName( + "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") + .toString()) + .setDescription("description-1724546052") + .setRecommenderSubtype("recommenderSubtype1811451601") + .setLastRefreshTime(Timestamp.newBuilder().build()) + .setPrimaryImpact(Impact.newBuilder().build()) + .addAllAdditionalImpact(new ArrayList()) + .setContent(RecommendationContent.newBuilder().build()) + .setStateInfo(RecommendationStateInfo.newBuilder().build()) + .setEtag("etag3123477") + .addAllAssociatedInsights(new ArrayList()) + .setXorGroupId("xorGroupId-2095769825") + .build(); + mockRecommender.addResponse(expectedResponse); + + MarkRecommendationDismissedRequest request = + MarkRecommendationDismissedRequest.newBuilder() + .setName( + RecommendationName.ofProjectLocationRecommenderRecommendationName( + "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") + .toString()) + .setEtag("etag3123477") + .build(); + + Recommendation actualResponse = client.markRecommendationDismissed(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockRecommender.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + MarkRecommendationDismissedRequest actualRequest = + ((MarkRecommendationDismissedRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getEtag(), actualRequest.getEtag()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void markRecommendationDismissedExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockRecommender.addException(exception); + + try { + MarkRecommendationDismissedRequest request = + MarkRecommendationDismissedRequest.newBuilder() + .setName( + RecommendationName.ofProjectLocationRecommenderRecommendationName( + "[PROJECT]", "[LOCATION]", "[RECOMMENDER]", "[RECOMMENDATION]") + .toString()) + .setEtag("etag3123477") + .build(); + client.markRecommendationDismissed(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test public void markRecommendationClaimedTest() throws Exception { Recommendation expectedResponse = diff --git a/java-recommender/grpc-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderGrpc.java b/java-recommender/grpc-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderGrpc.java index 3b95a181acab..d2b35cc1f11d 100644 --- a/java-recommender/grpc-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderGrpc.java +++ b/java-recommender/grpc-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderGrpc.java @@ -270,6 +270,57 @@ private RecommenderGrpc() {} return getGetRecommendationMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest, + com.google.cloud.recommender.v1.Recommendation> + getMarkRecommendationDismissedMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "MarkRecommendationDismissed", + requestType = com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest.class, + responseType = com.google.cloud.recommender.v1.Recommendation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest, + com.google.cloud.recommender.v1.Recommendation> + getMarkRecommendationDismissedMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest, + com.google.cloud.recommender.v1.Recommendation> + getMarkRecommendationDismissedMethod; + if ((getMarkRecommendationDismissedMethod = + RecommenderGrpc.getMarkRecommendationDismissedMethod) + == null) { + synchronized (RecommenderGrpc.class) { + if ((getMarkRecommendationDismissedMethod = + RecommenderGrpc.getMarkRecommendationDismissedMethod) + == null) { + RecommenderGrpc.getMarkRecommendationDismissedMethod = + getMarkRecommendationDismissedMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "MarkRecommendationDismissed")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.recommender.v1.Recommendation.getDefaultInstance())) + .setSchemaDescriptor( + new RecommenderMethodDescriptorSupplier("MarkRecommendationDismissed")) + .build(); + } + } + } + return getMarkRecommendationDismissedMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.cloud.recommender.v1.MarkRecommendationClaimedRequest, com.google.cloud.recommender.v1.Recommendation> @@ -750,6 +801,27 @@ default void getRecommendation( getGetRecommendationMethod(), responseObserver); } + /** + * + * + *
+     * 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.
+     * 
+ */ + default void markRecommendationDismissed( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getMarkRecommendationDismissedMethod(), responseObserver); + } + /** * * @@ -1012,6 +1084,29 @@ public void getRecommendation( responseObserver); } + /** + * + * + *
+     * 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.
+     * 
+ */ + public void markRecommendationDismissed( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getMarkRecommendationDismissedMethod(), getCallOptions()), + request, + responseObserver); + } + /** * * @@ -1254,6 +1349,25 @@ public com.google.cloud.recommender.v1.Recommendation getRecommendation( getChannel(), getGetRecommendationMethod(), getCallOptions(), 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.
+     * 
+ */ + public com.google.cloud.recommender.v1.Recommendation markRecommendationDismissed( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getMarkRecommendationDismissedMethod(), getCallOptions(), request); + } + /** * * @@ -1473,6 +1587,27 @@ protected RecommenderFutureStub build( getChannel().newCall(getGetRecommendationMethod(), getCallOptions()), 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.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.recommender.v1.Recommendation> + markRecommendationDismissed( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getMarkRecommendationDismissedMethod(), getCallOptions()), request); + } + /** * * @@ -1609,13 +1744,14 @@ protected RecommenderFutureStub build( private static final int METHODID_MARK_INSIGHT_ACCEPTED = 2; private static final int METHODID_LIST_RECOMMENDATIONS = 3; private static final int METHODID_GET_RECOMMENDATION = 4; - private static final int METHODID_MARK_RECOMMENDATION_CLAIMED = 5; - private static final int METHODID_MARK_RECOMMENDATION_SUCCEEDED = 6; - private static final int METHODID_MARK_RECOMMENDATION_FAILED = 7; - private static final int METHODID_GET_RECOMMENDER_CONFIG = 8; - private static final int METHODID_UPDATE_RECOMMENDER_CONFIG = 9; - private static final int METHODID_GET_INSIGHT_TYPE_CONFIG = 10; - private static final int METHODID_UPDATE_INSIGHT_TYPE_CONFIG = 11; + private static final int METHODID_MARK_RECOMMENDATION_DISMISSED = 5; + private static final int METHODID_MARK_RECOMMENDATION_CLAIMED = 6; + private static final int METHODID_MARK_RECOMMENDATION_SUCCEEDED = 7; + private static final int METHODID_MARK_RECOMMENDATION_FAILED = 8; + private static final int METHODID_GET_RECOMMENDER_CONFIG = 9; + private static final int METHODID_UPDATE_RECOMMENDER_CONFIG = 10; + private static final int METHODID_GET_INSIGHT_TYPE_CONFIG = 11; + private static final int METHODID_UPDATE_INSIGHT_TYPE_CONFIG = 12; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -1665,6 +1801,12 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_MARK_RECOMMENDATION_DISMISSED: + serviceImpl.markRecommendationDismissed( + (com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; case METHODID_MARK_RECOMMENDATION_CLAIMED: serviceImpl.markRecommendationClaimed( (com.google.cloud.recommender.v1.MarkRecommendationClaimedRequest) request, @@ -1759,6 +1901,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser com.google.cloud.recommender.v1.GetRecommendationRequest, com.google.cloud.recommender.v1.Recommendation>( service, METHODID_GET_RECOMMENDATION))) + .addMethod( + getMarkRecommendationDismissedMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest, + com.google.cloud.recommender.v1.Recommendation>( + service, METHODID_MARK_RECOMMENDATION_DISMISSED))) .addMethod( getMarkRecommendationClaimedMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -1864,6 +2013,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getMarkInsightAcceptedMethod()) .addMethod(getListRecommendationsMethod()) .addMethod(getGetRecommendationMethod()) + .addMethod(getMarkRecommendationDismissedMethod()) .addMethod(getMarkRecommendationClaimedMethod()) .addMethod(getMarkRecommendationSucceededMethod()) .addMethod(getMarkRecommendationFailedMethod()) diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetInsightTypeConfigRequest.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetInsightTypeConfigRequest.java index 3a714c1fb3c5..e1f9aff5f046 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetInsightTypeConfigRequest.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetInsightTypeConfigRequest.java @@ -74,11 +74,13 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[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` * * * @@ -107,11 +109,13 @@ public java.lang.String getName() { * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * * * @@ -485,11 +489,13 @@ public Builder mergeFrom( * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[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` * * * @@ -517,11 +523,13 @@ public java.lang.String getName() { * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * * * @@ -549,11 +557,13 @@ public com.google.protobuf.ByteString getNameBytes() { * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[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` * * * @@ -580,11 +590,13 @@ public Builder setName(java.lang.String value) { * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * * * @@ -607,11 +619,13 @@ public Builder clearName() { * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * * * diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetInsightTypeConfigRequestOrBuilder.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetInsightTypeConfigRequestOrBuilder.java index b9f72b109747..4f9e4231982d 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetInsightTypeConfigRequestOrBuilder.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetInsightTypeConfigRequestOrBuilder.java @@ -31,11 +31,13 @@ public interface GetInsightTypeConfigRequestOrBuilder * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[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` * * * @@ -53,11 +55,13 @@ public interface GetInsightTypeConfigRequestOrBuilder * * Acceptable formats: * - * * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + * + * * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * - * * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` * * * diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetRecommenderConfigRequest.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetRecommenderConfigRequest.java index 413185763107..86cf3fd395a3 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetRecommenderConfigRequest.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetRecommenderConfigRequest.java @@ -79,6 +79,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * * `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` * * * @@ -112,6 +114,8 @@ public java.lang.String getName() { * * `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` * * * @@ -490,6 +494,8 @@ public Builder mergeFrom( * * `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` * * * @@ -522,6 +528,8 @@ public java.lang.String getName() { * * `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` * * * @@ -554,6 +562,8 @@ public com.google.protobuf.ByteString getNameBytes() { * * `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` * * * @@ -585,6 +595,8 @@ public Builder setName(java.lang.String value) { * * `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` * * * @@ -612,6 +624,8 @@ public Builder clearName() { * * `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` * * * diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetRecommenderConfigRequestOrBuilder.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetRecommenderConfigRequestOrBuilder.java index 39b695dbef15..340b765b8392 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetRecommenderConfigRequestOrBuilder.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/GetRecommenderConfigRequestOrBuilder.java @@ -36,6 +36,8 @@ public interface GetRecommenderConfigRequestOrBuilder * * `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` * * * @@ -58,6 +60,8 @@ public interface GetRecommenderConfigRequestOrBuilder * * `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` * * * diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/Impact.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/Impact.java index 1ea2141751e4..dc6493ffd71f 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/Impact.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/Impact.java @@ -122,6 +122,26 @@ public enum Category implements com.google.protobuf.ProtocolMessageEnum { * MANAGEABILITY = 4; */ MANAGEABILITY(4), + /** + * + * + *
+     * Indicates a potential increase or decrease in sustainability.
+     * 
+ * + * SUSTAINABILITY = 5; + */ + SUSTAINABILITY(5), + /** + * + * + *
+     * Indicates a potential increase or decrease in reliability.
+     * 
+ * + * RELIABILITY = 6; + */ + RELIABILITY(6), UNRECOGNIZED(-1), ; @@ -175,6 +195,26 @@ public enum Category implements com.google.protobuf.ProtocolMessageEnum { * MANAGEABILITY = 4; */ public static final int MANAGEABILITY_VALUE = 4; + /** + * + * + *
+     * Indicates a potential increase or decrease in sustainability.
+     * 
+ * + * SUSTAINABILITY = 5; + */ + public static final int SUSTAINABILITY_VALUE = 5; + /** + * + * + *
+     * Indicates a potential increase or decrease in reliability.
+     * 
+ * + * RELIABILITY = 6; + */ + public static final int RELIABILITY_VALUE = 6; public final int getNumber() { if (this == UNRECOGNIZED) { @@ -210,6 +250,10 @@ public static Category forNumber(int value) { return PERFORMANCE; case 4: return MANAGEABILITY; + case 5: + return SUSTAINABILITY; + case 6: + return RELIABILITY; default: return null; } @@ -274,6 +318,8 @@ public enum ProjectionCase com.google.protobuf.AbstractMessage.InternalOneOfEnum { COST_PROJECTION(100), SECURITY_PROJECTION(101), + SUSTAINABILITY_PROJECTION(102), + RELIABILITY_PROJECTION(103), PROJECTION_NOT_SET(0); private final int value; @@ -296,6 +342,10 @@ public static ProjectionCase forNumber(int value) { return COST_PROJECTION; case 101: return SECURITY_PROJECTION; + case 102: + return SUSTAINABILITY_PROJECTION; + case 103: + return RELIABILITY_PROJECTION; case 0: return PROJECTION_NOT_SET; default: @@ -450,6 +500,113 @@ public com.google.cloud.recommender.v1.SecurityProjection getSecurityProjection( return com.google.cloud.recommender.v1.SecurityProjection.getDefaultInstance(); } + public static final int SUSTAINABILITY_PROJECTION_FIELD_NUMBER = 102; + /** + * + * + *
+   * Use with CategoryType.SUSTAINABILITY
+   * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + * + * @return Whether the sustainabilityProjection field is set. + */ + @java.lang.Override + public boolean hasSustainabilityProjection() { + return projectionCase_ == 102; + } + /** + * + * + *
+   * Use with CategoryType.SUSTAINABILITY
+   * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + * + * @return The sustainabilityProjection. + */ + @java.lang.Override + public com.google.cloud.recommender.v1.SustainabilityProjection getSustainabilityProjection() { + if (projectionCase_ == 102) { + return (com.google.cloud.recommender.v1.SustainabilityProjection) projection_; + } + return com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance(); + } + /** + * + * + *
+   * Use with CategoryType.SUSTAINABILITY
+   * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + @java.lang.Override + public com.google.cloud.recommender.v1.SustainabilityProjectionOrBuilder + getSustainabilityProjectionOrBuilder() { + if (projectionCase_ == 102) { + return (com.google.cloud.recommender.v1.SustainabilityProjection) projection_; + } + return com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance(); + } + + public static final int RELIABILITY_PROJECTION_FIELD_NUMBER = 103; + /** + * + * + *
+   * Use with CategoryType.RELAIBILITY
+   * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + * + * @return Whether the reliabilityProjection field is set. + */ + @java.lang.Override + public boolean hasReliabilityProjection() { + return projectionCase_ == 103; + } + /** + * + * + *
+   * Use with CategoryType.RELAIBILITY
+   * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + * + * @return The reliabilityProjection. + */ + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjection getReliabilityProjection() { + if (projectionCase_ == 103) { + return (com.google.cloud.recommender.v1.ReliabilityProjection) projection_; + } + return com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance(); + } + /** + * + * + *
+   * Use with CategoryType.RELAIBILITY
+   * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjectionOrBuilder + getReliabilityProjectionOrBuilder() { + if (projectionCase_ == 103) { + return (com.google.cloud.recommender.v1.ReliabilityProjection) projection_; + } + return com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -474,6 +631,13 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (projectionCase_ == 101) { output.writeMessage(101, (com.google.cloud.recommender.v1.SecurityProjection) projection_); } + if (projectionCase_ == 102) { + output.writeMessage( + 102, (com.google.cloud.recommender.v1.SustainabilityProjection) projection_); + } + if (projectionCase_ == 103) { + output.writeMessage(103, (com.google.cloud.recommender.v1.ReliabilityProjection) projection_); + } getUnknownFields().writeTo(output); } @@ -497,6 +661,16 @@ public int getSerializedSize() { com.google.protobuf.CodedOutputStream.computeMessageSize( 101, (com.google.cloud.recommender.v1.SecurityProjection) projection_); } + if (projectionCase_ == 102) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 102, (com.google.cloud.recommender.v1.SustainabilityProjection) projection_); + } + if (projectionCase_ == 103) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 103, (com.google.cloud.recommender.v1.ReliabilityProjection) projection_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -521,6 +695,13 @@ public boolean equals(final java.lang.Object obj) { case 101: if (!getSecurityProjection().equals(other.getSecurityProjection())) return false; break; + case 102: + if (!getSustainabilityProjection().equals(other.getSustainabilityProjection())) + return false; + break; + case 103: + if (!getReliabilityProjection().equals(other.getReliabilityProjection())) return false; + break; case 0: default: } @@ -546,6 +727,14 @@ public int hashCode() { hash = (37 * hash) + SECURITY_PROJECTION_FIELD_NUMBER; hash = (53 * hash) + getSecurityProjection().hashCode(); break; + case 102: + hash = (37 * hash) + SUSTAINABILITY_PROJECTION_FIELD_NUMBER; + hash = (53 * hash) + getSustainabilityProjection().hashCode(); + break; + case 103: + hash = (37 * hash) + RELIABILITY_PROJECTION_FIELD_NUMBER; + hash = (53 * hash) + getReliabilityProjection().hashCode(); + break; case 0: default: } @@ -695,6 +884,12 @@ public Builder clear() { if (securityProjectionBuilder_ != null) { securityProjectionBuilder_.clear(); } + if (sustainabilityProjectionBuilder_ != null) { + sustainabilityProjectionBuilder_.clear(); + } + if (reliabilityProjectionBuilder_ != null) { + reliabilityProjectionBuilder_.clear(); + } projectionCase_ = 0; projection_ = null; return this; @@ -748,6 +943,12 @@ private void buildPartialOneofs(com.google.cloud.recommender.v1.Impact result) { if (projectionCase_ == 101 && securityProjectionBuilder_ != null) { result.projection_ = securityProjectionBuilder_.build(); } + if (projectionCase_ == 102 && sustainabilityProjectionBuilder_ != null) { + result.projection_ = sustainabilityProjectionBuilder_.build(); + } + if (projectionCase_ == 103 && reliabilityProjectionBuilder_ != null) { + result.projection_ = reliabilityProjectionBuilder_.build(); + } } @java.lang.Override @@ -809,6 +1010,16 @@ public Builder mergeFrom(com.google.cloud.recommender.v1.Impact other) { mergeSecurityProjection(other.getSecurityProjection()); break; } + case SUSTAINABILITY_PROJECTION: + { + mergeSustainabilityProjection(other.getSustainabilityProjection()); + break; + } + case RELIABILITY_PROJECTION: + { + mergeReliabilityProjection(other.getReliabilityProjection()); + break; + } case PROJECTION_NOT_SET: { break; @@ -859,6 +1070,20 @@ public Builder mergeFrom( projectionCase_ = 101; break; } // case 810 + case 818: + { + input.readMessage( + getSustainabilityProjectionFieldBuilder().getBuilder(), extensionRegistry); + projectionCase_ = 102; + break; + } // case 818 + case 826: + { + input.readMessage( + getReliabilityProjectionFieldBuilder().getBuilder(), extensionRegistry); + projectionCase_ = 103; + break; + } // case 826 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1404,6 +1629,444 @@ public Builder clearSecurityProjection() { return securityProjectionBuilder_; } + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.recommender.v1.SustainabilityProjection, + com.google.cloud.recommender.v1.SustainabilityProjection.Builder, + com.google.cloud.recommender.v1.SustainabilityProjectionOrBuilder> + sustainabilityProjectionBuilder_; + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + * + * @return Whether the sustainabilityProjection field is set. + */ + @java.lang.Override + public boolean hasSustainabilityProjection() { + return projectionCase_ == 102; + } + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + * + * @return The sustainabilityProjection. + */ + @java.lang.Override + public com.google.cloud.recommender.v1.SustainabilityProjection getSustainabilityProjection() { + if (sustainabilityProjectionBuilder_ == null) { + if (projectionCase_ == 102) { + return (com.google.cloud.recommender.v1.SustainabilityProjection) projection_; + } + return com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance(); + } else { + if (projectionCase_ == 102) { + return sustainabilityProjectionBuilder_.getMessage(); + } + return com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance(); + } + } + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + public Builder setSustainabilityProjection( + com.google.cloud.recommender.v1.SustainabilityProjection value) { + if (sustainabilityProjectionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + projection_ = value; + onChanged(); + } else { + sustainabilityProjectionBuilder_.setMessage(value); + } + projectionCase_ = 102; + return this; + } + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + public Builder setSustainabilityProjection( + com.google.cloud.recommender.v1.SustainabilityProjection.Builder builderForValue) { + if (sustainabilityProjectionBuilder_ == null) { + projection_ = builderForValue.build(); + onChanged(); + } else { + sustainabilityProjectionBuilder_.setMessage(builderForValue.build()); + } + projectionCase_ = 102; + return this; + } + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + public Builder mergeSustainabilityProjection( + com.google.cloud.recommender.v1.SustainabilityProjection value) { + if (sustainabilityProjectionBuilder_ == null) { + if (projectionCase_ == 102 + && projection_ + != com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance()) { + projection_ = + com.google.cloud.recommender.v1.SustainabilityProjection.newBuilder( + (com.google.cloud.recommender.v1.SustainabilityProjection) projection_) + .mergeFrom(value) + .buildPartial(); + } else { + projection_ = value; + } + onChanged(); + } else { + if (projectionCase_ == 102) { + sustainabilityProjectionBuilder_.mergeFrom(value); + } else { + sustainabilityProjectionBuilder_.setMessage(value); + } + } + projectionCase_ = 102; + return this; + } + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + public Builder clearSustainabilityProjection() { + if (sustainabilityProjectionBuilder_ == null) { + if (projectionCase_ == 102) { + projectionCase_ = 0; + projection_ = null; + onChanged(); + } + } else { + if (projectionCase_ == 102) { + projectionCase_ = 0; + projection_ = null; + } + sustainabilityProjectionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + public com.google.cloud.recommender.v1.SustainabilityProjection.Builder + getSustainabilityProjectionBuilder() { + return getSustainabilityProjectionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + @java.lang.Override + public com.google.cloud.recommender.v1.SustainabilityProjectionOrBuilder + getSustainabilityProjectionOrBuilder() { + if ((projectionCase_ == 102) && (sustainabilityProjectionBuilder_ != null)) { + return sustainabilityProjectionBuilder_.getMessageOrBuilder(); + } else { + if (projectionCase_ == 102) { + return (com.google.cloud.recommender.v1.SustainabilityProjection) projection_; + } + return com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance(); + } + } + /** + * + * + *
+     * Use with CategoryType.SUSTAINABILITY
+     * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.recommender.v1.SustainabilityProjection, + com.google.cloud.recommender.v1.SustainabilityProjection.Builder, + com.google.cloud.recommender.v1.SustainabilityProjectionOrBuilder> + getSustainabilityProjectionFieldBuilder() { + if (sustainabilityProjectionBuilder_ == null) { + if (!(projectionCase_ == 102)) { + projection_ = + com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance(); + } + sustainabilityProjectionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.recommender.v1.SustainabilityProjection, + com.google.cloud.recommender.v1.SustainabilityProjection.Builder, + com.google.cloud.recommender.v1.SustainabilityProjectionOrBuilder>( + (com.google.cloud.recommender.v1.SustainabilityProjection) projection_, + getParentForChildren(), + isClean()); + projection_ = null; + } + projectionCase_ = 102; + onChanged(); + return sustainabilityProjectionBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.recommender.v1.ReliabilityProjection, + com.google.cloud.recommender.v1.ReliabilityProjection.Builder, + com.google.cloud.recommender.v1.ReliabilityProjectionOrBuilder> + reliabilityProjectionBuilder_; + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + * + * @return Whether the reliabilityProjection field is set. + */ + @java.lang.Override + public boolean hasReliabilityProjection() { + return projectionCase_ == 103; + } + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + * + * @return The reliabilityProjection. + */ + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjection getReliabilityProjection() { + if (reliabilityProjectionBuilder_ == null) { + if (projectionCase_ == 103) { + return (com.google.cloud.recommender.v1.ReliabilityProjection) projection_; + } + return com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance(); + } else { + if (projectionCase_ == 103) { + return reliabilityProjectionBuilder_.getMessage(); + } + return com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance(); + } + } + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + public Builder setReliabilityProjection( + com.google.cloud.recommender.v1.ReliabilityProjection value) { + if (reliabilityProjectionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + projection_ = value; + onChanged(); + } else { + reliabilityProjectionBuilder_.setMessage(value); + } + projectionCase_ = 103; + return this; + } + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + public Builder setReliabilityProjection( + com.google.cloud.recommender.v1.ReliabilityProjection.Builder builderForValue) { + if (reliabilityProjectionBuilder_ == null) { + projection_ = builderForValue.build(); + onChanged(); + } else { + reliabilityProjectionBuilder_.setMessage(builderForValue.build()); + } + projectionCase_ = 103; + return this; + } + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + public Builder mergeReliabilityProjection( + com.google.cloud.recommender.v1.ReliabilityProjection value) { + if (reliabilityProjectionBuilder_ == null) { + if (projectionCase_ == 103 + && projection_ + != com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance()) { + projection_ = + com.google.cloud.recommender.v1.ReliabilityProjection.newBuilder( + (com.google.cloud.recommender.v1.ReliabilityProjection) projection_) + .mergeFrom(value) + .buildPartial(); + } else { + projection_ = value; + } + onChanged(); + } else { + if (projectionCase_ == 103) { + reliabilityProjectionBuilder_.mergeFrom(value); + } else { + reliabilityProjectionBuilder_.setMessage(value); + } + } + projectionCase_ = 103; + return this; + } + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + public Builder clearReliabilityProjection() { + if (reliabilityProjectionBuilder_ == null) { + if (projectionCase_ == 103) { + projectionCase_ = 0; + projection_ = null; + onChanged(); + } + } else { + if (projectionCase_ == 103) { + projectionCase_ = 0; + projection_ = null; + } + reliabilityProjectionBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + public com.google.cloud.recommender.v1.ReliabilityProjection.Builder + getReliabilityProjectionBuilder() { + return getReliabilityProjectionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjectionOrBuilder + getReliabilityProjectionOrBuilder() { + if ((projectionCase_ == 103) && (reliabilityProjectionBuilder_ != null)) { + return reliabilityProjectionBuilder_.getMessageOrBuilder(); + } else { + if (projectionCase_ == 103) { + return (com.google.cloud.recommender.v1.ReliabilityProjection) projection_; + } + return com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance(); + } + } + /** + * + * + *
+     * Use with CategoryType.RELAIBILITY
+     * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.recommender.v1.ReliabilityProjection, + com.google.cloud.recommender.v1.ReliabilityProjection.Builder, + com.google.cloud.recommender.v1.ReliabilityProjectionOrBuilder> + getReliabilityProjectionFieldBuilder() { + if (reliabilityProjectionBuilder_ == null) { + if (!(projectionCase_ == 103)) { + projection_ = com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance(); + } + reliabilityProjectionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.recommender.v1.ReliabilityProjection, + com.google.cloud.recommender.v1.ReliabilityProjection.Builder, + com.google.cloud.recommender.v1.ReliabilityProjectionOrBuilder>( + (com.google.cloud.recommender.v1.ReliabilityProjection) projection_, + getParentForChildren(), + isClean()); + projection_ = null; + } + projectionCase_ = 103; + onChanged(); + return reliabilityProjectionBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ImpactOrBuilder.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ImpactOrBuilder.java index abe7a5fcafbe..b7d46e592f3b 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ImpactOrBuilder.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ImpactOrBuilder.java @@ -118,5 +118,80 @@ public interface ImpactOrBuilder */ com.google.cloud.recommender.v1.SecurityProjectionOrBuilder getSecurityProjectionOrBuilder(); + /** + * + * + *
+   * Use with CategoryType.SUSTAINABILITY
+   * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + * + * @return Whether the sustainabilityProjection field is set. + */ + boolean hasSustainabilityProjection(); + /** + * + * + *
+   * Use with CategoryType.SUSTAINABILITY
+   * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + * + * @return The sustainabilityProjection. + */ + com.google.cloud.recommender.v1.SustainabilityProjection getSustainabilityProjection(); + /** + * + * + *
+   * Use with CategoryType.SUSTAINABILITY
+   * 
+ * + * .google.cloud.recommender.v1.SustainabilityProjection sustainability_projection = 102; + * + */ + com.google.cloud.recommender.v1.SustainabilityProjectionOrBuilder + getSustainabilityProjectionOrBuilder(); + + /** + * + * + *
+   * Use with CategoryType.RELAIBILITY
+   * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + * + * @return Whether the reliabilityProjection field is set. + */ + boolean hasReliabilityProjection(); + /** + * + * + *
+   * Use with CategoryType.RELAIBILITY
+   * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + * + * @return The reliabilityProjection. + */ + com.google.cloud.recommender.v1.ReliabilityProjection getReliabilityProjection(); + /** + * + * + *
+   * Use with CategoryType.RELAIBILITY
+   * 
+ * + * .google.cloud.recommender.v1.ReliabilityProjection reliability_projection = 103; + */ + com.google.cloud.recommender.v1.ReliabilityProjectionOrBuilder + getReliabilityProjectionOrBuilder(); + com.google.cloud.recommender.v1.Impact.ProjectionCase getProjectionCase(); } diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/Insight.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/Insight.java index 8fc5f403cb98..273df064210f 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/Insight.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/Insight.java @@ -23,7 +23,7 @@ * *
  * An insight along with the information used to derive the insight. The insight
- * may have associated recomendations as well.
+ * may have associated recommendations as well.
  * 
* * Protobuf type {@code google.cloud.recommender.v1.Insight} @@ -130,6 +130,26 @@ public enum Category implements com.google.protobuf.ProtocolMessageEnum { * MANAGEABILITY = 4; */ MANAGEABILITY(4), + /** + * + * + *
+     * The insight is related to sustainability.
+     * 
+ * + * SUSTAINABILITY = 5; + */ + SUSTAINABILITY(5), + /** + * + * + *
+     * This insight is related to reliability.
+     * 
+ * + * RELIABILITY = 6; + */ + RELIABILITY(6), UNRECOGNIZED(-1), ; @@ -183,6 +203,26 @@ public enum Category implements com.google.protobuf.ProtocolMessageEnum { * MANAGEABILITY = 4; */ public static final int MANAGEABILITY_VALUE = 4; + /** + * + * + *
+     * The insight is related to sustainability.
+     * 
+ * + * SUSTAINABILITY = 5; + */ + public static final int SUSTAINABILITY_VALUE = 5; + /** + * + * + *
+     * This insight is related to reliability.
+     * 
+ * + * RELIABILITY = 6; + */ + public static final int RELIABILITY_VALUE = 6; public final int getNumber() { if (this == UNRECOGNIZED) { @@ -218,6 +258,10 @@ public static Category forNumber(int value) { return PERFORMANCE; case 4: return MANAGEABILITY; + case 5: + return SUSTAINABILITY; + case 6: + return RELIABILITY; default: return null; } @@ -2063,7 +2107,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * *
    * An insight along with the information used to derive the insight. The insight
-   * may have associated recomendations as well.
+   * may have associated recommendations as well.
    * 
* * Protobuf type {@code google.cloud.recommender.v1.Insight} diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightProto.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightProto.java index f05564b1abc9..698aaed01615 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightProto.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightProto.java @@ -56,7 +56,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "oto\022\033google.cloud.recommender.v1\032\031google" + "/api/resource.proto\032\036google/protobuf/dur" + "ation.proto\032\034google/protobuf/struct.prot" - + "o\032\037google/protobuf/timestamp.proto\"\266\t\n\007I" + + "o\032\037google/protobuf/timestamp.proto\"\334\t\n\007I" + "nsight\022\014\n\004name\030\001 \001(\t\022\023\n\013description\030\002 \001(" + "\t\022\030\n\020target_resources\030\t \003(\t\022\027\n\017insight_s" + "ubtype\030\n \001(\t\022(\n\007content\030\003 \001(\0132\027.google.p" @@ -72,42 +72,43 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "tions\030\010 \003(\0132<.google.cloud.recommender.v" + "1.Insight.RecommendationReference\0321\n\027Rec" + "ommendationReference\022\026\n\016recommendation\030\001" - + " \001(\t\"`\n\010Category\022\030\n\024CATEGORY_UNSPECIFIED" - + "\020\000\022\010\n\004COST\020\001\022\014\n\010SECURITY\020\002\022\017\n\013PERFORMANC" - + "E\020\003\022\021\n\rMANAGEABILITY\020\004\"Q\n\010Severity\022\030\n\024SE" - + "VERITY_UNSPECIFIED\020\000\022\007\n\003LOW\020\001\022\n\n\006MEDIUM\020" - + "\002\022\010\n\004HIGH\020\003\022\014\n\010CRITICAL\020\004:\237\003\352A\233\003\n\"recomm" - + "ender.googleapis.com/Insight\022Vprojects/{" - + "project}/locations/{location}/insightTyp" - + "es/{insight_type}/insights/{insight}\022ebi" - + "llingAccounts/{billing_account}/location" - + "s/{location}/insightTypes/{insight_type}" - + "/insights/{insight}\022Tfolders/{folder}/lo" + + " \001(\t\"\205\001\n\010Category\022\030\n\024CATEGORY_UNSPECIFIE" + + "D\020\000\022\010\n\004COST\020\001\022\014\n\010SECURITY\020\002\022\017\n\013PERFORMAN" + + "CE\020\003\022\021\n\rMANAGEABILITY\020\004\022\022\n\016SUSTAINABILIT" + + "Y\020\005\022\017\n\013RELIABILITY\020\006\"Q\n\010Severity\022\030\n\024SEVE" + + "RITY_UNSPECIFIED\020\000\022\007\n\003LOW\020\001\022\n\n\006MEDIUM\020\002\022" + + "\010\n\004HIGH\020\003\022\014\n\010CRITICAL\020\004:\237\003\352A\233\003\n\"recommen" + + "der.googleapis.com/Insight\022Vprojects/{pr" + + "oject}/locations/{location}/insightTypes" + + "/{insight_type}/insights/{insight}\022ebill" + + "ingAccounts/{billing_account}/locations/" + + "{location}/insightTypes/{insight_type}/i" + + "nsights/{insight}\022Tfolders/{folder}/loca" + + "tions/{location}/insightTypes/{insight_t" + + "ype}/insights/{insight}\022`organizations/{" + + "organization}/locations/{location}/insig" + + "htTypes/{insight_type}/insights/{insight" + + "}\"\257\002\n\020InsightStateInfo\022B\n\005state\030\001 \001(\01623." + + "google.cloud.recommender.v1.InsightState" + + "Info.State\022X\n\016state_metadata\030\002 \003(\0132@.goo" + + "gle.cloud.recommender.v1.InsightStateInf" + + "o.StateMetadataEntry\0324\n\022StateMetadataEnt" + + "ry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"G\n\005St" + + "ate\022\025\n\021STATE_UNSPECIFIED\020\000\022\n\n\006ACTIVE\020\001\022\014" + + "\n\010ACCEPTED\020\002\022\r\n\tDISMISSED\020\003B\360\003\n\037com.goog" + + "le.cloud.recommender.v1B\014InsightProtoP\001Z" + + "Acloud.google.com/go/recommender/apiv1/r" + + "ecommenderpb;recommenderpb\242\002\004CREC\252\002\033Goog" + + "le.Cloud.Recommender.V1\352A\323\002\n&recommender" + + ".googleapis.com/InsightType\022Cprojects/{p" + + "roject}/locations/{location}/insightType" + + "s/{insight_type}\022RbillingAccounts/{billi" + + "ng_account}/locations/{location}/insight" + + "Types/{insight_type}\022Afolders/{folder}/l" + + "ocations/{location}/insightTypes/{insigh" + + "t_type}\022Morganizations/{organization}/lo" + "cations/{location}/insightTypes/{insight" - + "_type}/insights/{insight}\022`organizations" - + "/{organization}/locations/{location}/ins" - + "ightTypes/{insight_type}/insights/{insig" - + "ht}\"\257\002\n\020InsightStateInfo\022B\n\005state\030\001 \001(\0162" - + "3.google.cloud.recommender.v1.InsightSta" - + "teInfo.State\022X\n\016state_metadata\030\002 \003(\0132@.g" - + "oogle.cloud.recommender.v1.InsightStateI" - + "nfo.StateMetadataEntry\0324\n\022StateMetadataE" - + "ntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"G\n\005" - + "State\022\025\n\021STATE_UNSPECIFIED\020\000\022\n\n\006ACTIVE\020\001" - + "\022\014\n\010ACCEPTED\020\002\022\r\n\tDISMISSED\020\003B\360\003\n\037com.go" - + "ogle.cloud.recommender.v1B\014InsightProtoP" - + "\001ZAcloud.google.com/go/recommender/apiv1" - + "/recommenderpb;recommenderpb\242\002\004CREC\252\002\033Go" - + "ogle.Cloud.Recommender.V1\352A\323\002\n&recommend" - + "er.googleapis.com/InsightType\022Cprojects/" - + "{project}/locations/{location}/insightTy" - + "pes/{insight_type}\022RbillingAccounts/{bil" - + "ling_account}/locations/{location}/insig" - + "htTypes/{insight_type}\022Afolders/{folder}" - + "/locations/{location}/insightTypes/{insi" - + "ght_type}\022Morganizations/{organization}/" - + "locations/{location}/insightTypes/{insig" - + "ht_type}b\006proto3" + + "_type}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightTypeConfigName.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightTypeConfigName.java index c0b819942aac..1c4a08e15a4e 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightTypeConfigName.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightTypeConfigName.java @@ -37,6 +37,9 @@ public class InsightTypeConfigName implements ResourceName { private static final PathTemplate ORGANIZATION_LOCATION_INSIGHT_TYPE = PathTemplate.createWithoutUrlEncoding( "organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config"); + private static final PathTemplate BILLING_ACCOUNT_LOCATION_INSIGHT_TYPE = + PathTemplate.createWithoutUrlEncoding( + "billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/config"); private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; @@ -44,6 +47,7 @@ public class InsightTypeConfigName implements ResourceName { private final String location; private final String insightType; private final String organization; + private final String billingAccount; @Deprecated protected InsightTypeConfigName() { @@ -51,6 +55,7 @@ protected InsightTypeConfigName() { location = null; insightType = null; organization = null; + billingAccount = null; } private InsightTypeConfigName(Builder builder) { @@ -58,6 +63,7 @@ private InsightTypeConfigName(Builder builder) { location = Preconditions.checkNotNull(builder.getLocation()); insightType = Preconditions.checkNotNull(builder.getInsightType()); organization = null; + billingAccount = null; pathTemplate = PROJECT_LOCATION_INSIGHT_TYPE; } @@ -66,9 +72,19 @@ private InsightTypeConfigName(OrganizationLocationInsightTypeBuilder builder) { location = Preconditions.checkNotNull(builder.getLocation()); insightType = Preconditions.checkNotNull(builder.getInsightType()); project = null; + billingAccount = null; pathTemplate = ORGANIZATION_LOCATION_INSIGHT_TYPE; } + private InsightTypeConfigName(BillingAccountLocationInsightTypeBuilder builder) { + billingAccount = Preconditions.checkNotNull(builder.getBillingAccount()); + location = Preconditions.checkNotNull(builder.getLocation()); + insightType = Preconditions.checkNotNull(builder.getInsightType()); + project = null; + organization = null; + pathTemplate = BILLING_ACCOUNT_LOCATION_INSIGHT_TYPE; + } + public String getProject() { return project; } @@ -85,6 +101,10 @@ public String getOrganization() { return organization; } + public String getBillingAccount() { + return billingAccount; + } + public static Builder newBuilder() { return new Builder(); } @@ -99,6 +119,12 @@ public static OrganizationLocationInsightTypeBuilder newOrganizationLocationInsi return new OrganizationLocationInsightTypeBuilder(); } + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static BillingAccountLocationInsightTypeBuilder + newBillingAccountLocationInsightTypeBuilder() { + return new BillingAccountLocationInsightTypeBuilder(); + } + public Builder toBuilder() { return new Builder(this); } @@ -131,6 +157,16 @@ public static InsightTypeConfigName ofOrganizationLocationInsightTypeName( .build(); } + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static InsightTypeConfigName ofBillingAccountLocationInsightTypeName( + String billingAccount, String location, String insightType) { + return newBillingAccountLocationInsightTypeBuilder() + .setBillingAccount(billingAccount) + .setLocation(location) + .setInsightType(insightType) + .build(); + } + public static String format(String project, String location, String insightType) { return newBuilder() .setProject(project) @@ -162,6 +198,17 @@ public static String formatOrganizationLocationInsightTypeName( .toString(); } + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatBillingAccountLocationInsightTypeName( + String billingAccount, String location, String insightType) { + return newBillingAccountLocationInsightTypeBuilder() + .setBillingAccount(billingAccount) + .setLocation(location) + .setInsightType(insightType) + .build() + .toString(); + } + public static InsightTypeConfigName parse(String formattedString) { if (formattedString.isEmpty()) { return null; @@ -174,6 +221,10 @@ public static InsightTypeConfigName parse(String formattedString) { Map matchMap = ORGANIZATION_LOCATION_INSIGHT_TYPE.match(formattedString); return ofOrganizationLocationInsightTypeName( matchMap.get("organization"), matchMap.get("location"), matchMap.get("insight_type")); + } else if (BILLING_ACCOUNT_LOCATION_INSIGHT_TYPE.matches(formattedString)) { + Map matchMap = BILLING_ACCOUNT_LOCATION_INSIGHT_TYPE.match(formattedString); + return ofBillingAccountLocationInsightTypeName( + matchMap.get("billing_account"), matchMap.get("location"), matchMap.get("insight_type")); } throw new ValidationException( "InsightTypeConfigName.parse: formattedString not in valid format"); @@ -201,7 +252,8 @@ public static List toStringList(List values) { public static boolean isParsableFrom(String formattedString) { return PROJECT_LOCATION_INSIGHT_TYPE.matches(formattedString) - || ORGANIZATION_LOCATION_INSIGHT_TYPE.matches(formattedString); + || ORGANIZATION_LOCATION_INSIGHT_TYPE.matches(formattedString) + || BILLING_ACCOUNT_LOCATION_INSIGHT_TYPE.matches(formattedString); } @Override @@ -222,6 +274,9 @@ public Map getFieldValuesMap() { if (organization != null) { fieldMapBuilder.put("organization", organization); } + if (billingAccount != null) { + fieldMapBuilder.put("billing_account", billingAccount); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -248,7 +303,8 @@ public boolean equals(Object o) { return Objects.equals(this.project, that.project) && Objects.equals(this.location, that.location) && Objects.equals(this.insightType, that.insightType) - && Objects.equals(this.organization, that.organization); + && Objects.equals(this.organization, that.organization) + && Objects.equals(this.billingAccount, that.billingAccount); } return false; } @@ -266,6 +322,8 @@ public int hashCode() { h ^= Objects.hashCode(insightType); h *= 1000003; h ^= Objects.hashCode(organization); + h *= 1000003; + h ^= Objects.hashCode(billingAccount); return h; } @@ -361,4 +419,48 @@ public InsightTypeConfigName build() { return new InsightTypeConfigName(this); } } + + /** + * Builder for + * billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/config. + */ + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static class BillingAccountLocationInsightTypeBuilder { + private String billingAccount; + private String location; + private String insightType; + + protected BillingAccountLocationInsightTypeBuilder() {} + + public String getBillingAccount() { + return billingAccount; + } + + public String getLocation() { + return location; + } + + public String getInsightType() { + return insightType; + } + + public BillingAccountLocationInsightTypeBuilder setBillingAccount(String billingAccount) { + this.billingAccount = billingAccount; + return this; + } + + public BillingAccountLocationInsightTypeBuilder setLocation(String location) { + this.location = location; + return this; + } + + public BillingAccountLocationInsightTypeBuilder setInsightType(String insightType) { + this.insightType = insightType; + return this; + } + + public InsightTypeConfigName build() { + return new InsightTypeConfigName(this); + } + } } diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightTypeConfigProto.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightTypeConfigProto.java index 1db1f4ff1fd5..335231fc5946 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightTypeConfigProto.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/InsightTypeConfigProto.java @@ -53,7 +53,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "r.v1\032\037google/api/field_behavior.proto\032\031g" + "oogle/api/resource.proto\032\034google/protobu" + "f/struct.proto\032\037google/protobuf/timestam" - + "p.proto\"\325\004\n\021InsightTypeConfig\022\014\n\004name\030\001 " + + "p.proto\"\260\005\n\021InsightTypeConfig\022\014\n\004name\030\001 " + "\001(\t\022`\n\036insight_type_generation_config\030\002 " + "\001(\01328.google.cloud.recommender.v1.Insigh" + "tTypeGenerationConfig\022\014\n\004etag\030\003 \001(\t\022/\n\013u" @@ -62,19 +62,21 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "tations\030\006 \003(\0132?.google.cloud.recommender" + ".v1.InsightTypeConfig.AnnotationsEntry\022\024" + "\n\014display_name\030\007 \001(\t\0322\n\020AnnotationsEntry" - + "\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:\324\001\352A\320\001\n" + + "\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:\257\002\352A\253\002\n" + ",recommender.googleapis.com/InsightTypeC" + "onfig\022Jprojects/{project}/locations/{loc" + "ation}/insightTypes/{insight_type}/confi" + "g\022Torganizations/{organization}/location" + "s/{location}/insightTypes/{insight_type}" - + "/config\"F\n\033InsightTypeGenerationConfig\022\'" - + "\n\006params\030\001 \001(\0132\027.google.protobuf.StructB" - + "\243\001\n\037com.google.cloud.recommender.v1B\026Ins" - + "ightTypeConfigProtoP\001ZAcloud.google.com/" - + "go/recommender/apiv1/recommenderpb;recom" - + "menderpb\242\002\004CREC\252\002\033Google.Cloud.Recommend" - + "er.V1b\006proto3" + + "/config\022YbillingAccounts/{billing_accoun" + + "t}/locations/{location}/insightTypes/{in" + + "sight_type}/config\"F\n\033InsightTypeGenerat" + + "ionConfig\022\'\n\006params\030\001 \001(\0132\027.google.proto" + + "buf.StructB\243\001\n\037com.google.cloud.recommen" + + "der.v1B\026InsightTypeConfigProtoP\001ZAcloud." + + "google.com/go/recommender/apiv1/recommen" + + "derpb;recommenderpb\242\002\004CREC\252\002\033Google.Clou" + + "d.Recommender.V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/MarkRecommendationDismissedRequest.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/MarkRecommendationDismissedRequest.java new file mode 100644 index 000000000000..2d97f70cadc5 --- /dev/null +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/MarkRecommendationDismissedRequest.java @@ -0,0 +1,833 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/recommender/v1/recommender_service.proto + +package com.google.cloud.recommender.v1; + +/** + * + * + *
+ * Request for the `MarkRecommendationDismissed` Method.
+ * 
+ * + * Protobuf type {@code google.cloud.recommender.v1.MarkRecommendationDismissedRequest} + */ +public final class MarkRecommendationDismissedRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.recommender.v1.MarkRecommendationDismissedRequest) + MarkRecommendationDismissedRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use MarkRecommendationDismissedRequest.newBuilder() to construct. + private MarkRecommendationDismissedRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private MarkRecommendationDismissedRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new MarkRecommendationDismissedRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.recommender.v1.RecommenderProto + .internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.recommender.v1.RecommenderProto + .internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest.class, + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Name of the recommendation.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Name of the recommendation.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ETAG_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object etag_ = ""; + /** + * + * + *
+   * Fingerprint of the Recommendation. Provides optimistic locking.
+   * 
+ * + * string etag = 2; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Fingerprint of the Recommendation. Provides optimistic locking.
+   * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest)) { + return super.equals(obj); + } + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest other = + (com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for the `MarkRecommendationDismissed` Method.
+   * 
+ * + * Protobuf type {@code google.cloud.recommender.v1.MarkRecommendationDismissedRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.recommender.v1.MarkRecommendationDismissedRequest) + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.recommender.v1.RecommenderProto + .internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.recommender.v1.RecommenderProto + .internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest.class, + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest.Builder.class); + } + + // Construct using + // com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + etag_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.recommender.v1.RecommenderProto + .internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + getDefaultInstanceForType() { + return com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest build() { + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest buildPartial() { + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest result = + new com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.etag_ = etag_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest) { + return mergeFrom( + (com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest other) { + if (other + == com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + .getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + etag_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Name of the recommendation.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Name of the recommendation.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Name of the recommendation.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Name of the recommendation.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Name of the recommendation.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Fingerprint of the Recommendation. Provides optimistic locking.
+     * 
+ * + * string etag = 2; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Fingerprint of the Recommendation. Provides optimistic locking.
+     * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Fingerprint of the Recommendation. Provides optimistic locking.
+     * 
+ * + * string etag = 2; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + etag_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Fingerprint of the Recommendation. Provides optimistic locking.
+     * 
+ * + * string etag = 2; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + etag_ = getDefaultInstance().getEtag(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Fingerprint of the Recommendation. Provides optimistic locking.
+     * 
+ * + * string etag = 2; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + etag_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.recommender.v1.MarkRecommendationDismissedRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.recommender.v1.MarkRecommendationDismissedRequest) + private static final com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest(); + } + + public static com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MarkRecommendationDismissedRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/MarkRecommendationDismissedRequestOrBuilder.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/MarkRecommendationDismissedRequestOrBuilder.java new file mode 100644 index 000000000000..6c06bedf6022 --- /dev/null +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/MarkRecommendationDismissedRequestOrBuilder.java @@ -0,0 +1,79 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/recommender/v1/recommender_service.proto + +package com.google.cloud.recommender.v1; + +public interface MarkRecommendationDismissedRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.recommender.v1.MarkRecommendationDismissedRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Name of the recommendation.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Name of the recommendation.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Fingerprint of the Recommendation. Provides optimistic locking.
+   * 
+ * + * string etag = 2; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Fingerprint of the Recommendation. Provides optimistic locking.
+   * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommendationOuterClass.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommendationOuterClass.java index edbf58792d76..04d43bc0e8b9 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommendationOuterClass.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommendationOuterClass.java @@ -67,6 +67,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_recommender_v1_SecurityProjection_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_recommender_v1_SecurityProjection_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_recommender_v1_SustainabilityProjection_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_recommender_v1_SustainabilityProjection_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_recommender_v1_ReliabilityProjection_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_recommender_v1_ReliabilityProjection_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_recommender_v1_Impact_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -149,36 +157,50 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "t\030\001 \001(\0132\022.google.type.Money\022+\n\010duration\030" + "\002 \001(\0132\031.google.protobuf.Duration\">\n\022Secu" + "rityProjection\022(\n\007details\030\002 \001(\0132\027.google" - + ".protobuf.Struct\"\320\002\n\006Impact\022>\n\010category\030" - + "\001 \001(\0162,.google.cloud.recommender.v1.Impa" - + "ct.Category\022F\n\017cost_projection\030d \001(\0132+.g" - + "oogle.cloud.recommender.v1.CostProjectio" - + "nH\000\022N\n\023security_projection\030e \001(\0132/.googl" - + "e.cloud.recommender.v1.SecurityProjectio" - + "nH\000\"`\n\010Category\022\030\n\024CATEGORY_UNSPECIFIED\020" - + "\000\022\010\n\004COST\020\001\022\014\n\010SECURITY\020\002\022\017\n\013PERFORMANCE" - + "\020\003\022\021\n\rMANAGEABILITY\020\004B\014\n\nprojection\"\336\002\n\027" - + "RecommendationStateInfo\022I\n\005state\030\001 \001(\0162:" - + ".google.cloud.recommender.v1.Recommendat" - + "ionStateInfo.State\022_\n\016state_metadata\030\002 \003" - + "(\0132G.google.cloud.recommender.v1.Recomme" - + "ndationStateInfo.StateMetadataEntry\0324\n\022S" - + "tateMetadataEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030" - + "\002 \001(\t:\0028\001\"a\n\005State\022\025\n\021STATE_UNSPECIFIED\020" - + "\000\022\n\n\006ACTIVE\020\001\022\013\n\007CLAIMED\020\006\022\r\n\tSUCCEEDED\020" - + "\003\022\n\n\006FAILED\020\004\022\r\n\tDISMISSED\020\005B\336\003\n\037com.goo" - + "gle.cloud.recommender.v1P\001ZAcloud.google" - + ".com/go/recommender/apiv1/recommenderpb;" - + "recommenderpb\242\002\004CREC\252\002\033Google.Cloud.Reco" - + "mmender.V1\352A\317\002\n&recommender.googleapis.c" - + "om/Recommender\022Bprojects/{project}/locat" - + "ions/{location}/recommenders/{recommende" - + "r}\022QbillingAccounts/{billing_account}/lo" - + "cations/{location}/recommenders/{recomme" - + "nder}\022@folders/{folder}/locations/{locat" - + "ion}/recommenders/{recommender}\022Lorganiz" - + "ations/{organization}/locations/{locatio" - + "n}/recommenders/{recommender}b\006proto3" + + ".protobuf.Struct\"Y\n\030SustainabilityProjec" + + "tion\022\020\n\010kg_c_o2e\030\001 \001(\001\022+\n\010duration\030\002 \001(\013" + + "2\031.google.protobuf.Duration\"\354\001\n\025Reliabil" + + "ityProjection\022J\n\005risks\030\001 \003(\0162;.google.cl" + + "oud.recommender.v1.ReliabilityProjection" + + ".RiskType\022(\n\007details\030\002 \001(\0132\027.google.prot" + + "obuf.Struct\"]\n\010RiskType\022\031\n\025RISK_TYPE_UNS" + + "PECIFIED\020\000\022\026\n\022SERVICE_DISRUPTION\020\001\022\r\n\tDA" + + "TA_LOSS\020\002\022\017\n\013ACCESS_DENY\020\003\"\250\004\n\006Impact\022>\n" + + "\010category\030\001 \001(\0162,.google.cloud.recommend" + + "er.v1.Impact.Category\022F\n\017cost_projection" + + "\030d \001(\0132+.google.cloud.recommender.v1.Cos" + + "tProjectionH\000\022N\n\023security_projection\030e \001" + + "(\0132/.google.cloud.recommender.v1.Securit" + + "yProjectionH\000\022Z\n\031sustainability_projecti" + + "on\030f \001(\01325.google.cloud.recommender.v1.S" + + "ustainabilityProjectionH\000\022T\n\026reliability" + + "_projection\030g \001(\01322.google.cloud.recomme" + + "nder.v1.ReliabilityProjectionH\000\"\205\001\n\010Cate" + + "gory\022\030\n\024CATEGORY_UNSPECIFIED\020\000\022\010\n\004COST\020\001" + + "\022\014\n\010SECURITY\020\002\022\017\n\013PERFORMANCE\020\003\022\021\n\rMANAG" + + "EABILITY\020\004\022\022\n\016SUSTAINABILITY\020\005\022\017\n\013RELIAB" + + "ILITY\020\006B\014\n\nprojection\"\336\002\n\027Recommendation" + + "StateInfo\022I\n\005state\030\001 \001(\0162:.google.cloud." + + "recommender.v1.RecommendationStateInfo.S" + + "tate\022_\n\016state_metadata\030\002 \003(\0132G.google.cl" + + "oud.recommender.v1.RecommendationStateIn" + + "fo.StateMetadataEntry\0324\n\022StateMetadataEn" + + "try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"a\n\005S" + + "tate\022\025\n\021STATE_UNSPECIFIED\020\000\022\n\n\006ACTIVE\020\001\022" + + "\013\n\007CLAIMED\020\006\022\r\n\tSUCCEEDED\020\003\022\n\n\006FAILED\020\004\022" + + "\r\n\tDISMISSED\020\005B\336\003\n\037com.google.cloud.reco" + + "mmender.v1P\001ZAcloud.google.com/go/recomm" + + "ender/apiv1/recommenderpb;recommenderpb\242" + + "\002\004CREC\252\002\033Google.Cloud.Recommender.V1\352A\317\002" + + "\n&recommender.googleapis.com/Recommender" + + "\022Bprojects/{project}/locations/{location" + + "}/recommenders/{recommender}\022QbillingAcc" + + "ounts/{billing_account}/locations/{locat" + + "ion}/recommenders/{recommender}\022@folders" + + "/{folder}/locations/{location}/recommend" + + "ers/{recommender}\022Lorganizations/{organi" + + "zation}/locations/{location}/recommender" + + "s/{recommender}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -293,16 +315,37 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Details", }); - internal_static_google_cloud_recommender_v1_Impact_descriptor = + internal_static_google_cloud_recommender_v1_SustainabilityProjection_descriptor = getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_recommender_v1_SustainabilityProjection_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_recommender_v1_SustainabilityProjection_descriptor, + new java.lang.String[] { + "KgCO2E", "Duration", + }); + internal_static_google_cloud_recommender_v1_ReliabilityProjection_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_recommender_v1_ReliabilityProjection_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_recommender_v1_ReliabilityProjection_descriptor, + new java.lang.String[] { + "Risks", "Details", + }); + internal_static_google_cloud_recommender_v1_Impact_descriptor = + getDescriptor().getMessageTypes().get(9); internal_static_google_cloud_recommender_v1_Impact_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_Impact_descriptor, new java.lang.String[] { - "Category", "CostProjection", "SecurityProjection", "Projection", + "Category", + "CostProjection", + "SecurityProjection", + "SustainabilityProjection", + "ReliabilityProjection", + "Projection", }); internal_static_google_cloud_recommender_v1_RecommendationStateInfo_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageTypes().get(10); internal_static_google_cloud_recommender_v1_RecommendationStateInfo_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_RecommendationStateInfo_descriptor, diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderConfigName.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderConfigName.java index 994b15d7a17a..e0e56137e9da 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderConfigName.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderConfigName.java @@ -37,6 +37,9 @@ public class RecommenderConfigName implements ResourceName { private static final PathTemplate ORGANIZATION_LOCATION_RECOMMENDER = PathTemplate.createWithoutUrlEncoding( "organizations/{organization}/locations/{location}/recommenders/{recommender}/config"); + private static final PathTemplate BILLING_ACCOUNT_LOCATION_RECOMMENDER = + PathTemplate.createWithoutUrlEncoding( + "billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/config"); private volatile Map fieldValuesMap; private PathTemplate pathTemplate; private String fixedValue; @@ -44,6 +47,7 @@ public class RecommenderConfigName implements ResourceName { private final String location; private final String recommender; private final String organization; + private final String billingAccount; @Deprecated protected RecommenderConfigName() { @@ -51,6 +55,7 @@ protected RecommenderConfigName() { location = null; recommender = null; organization = null; + billingAccount = null; } private RecommenderConfigName(Builder builder) { @@ -58,6 +63,7 @@ private RecommenderConfigName(Builder builder) { location = Preconditions.checkNotNull(builder.getLocation()); recommender = Preconditions.checkNotNull(builder.getRecommender()); organization = null; + billingAccount = null; pathTemplate = PROJECT_LOCATION_RECOMMENDER; } @@ -66,9 +72,19 @@ private RecommenderConfigName(OrganizationLocationRecommenderBuilder builder) { location = Preconditions.checkNotNull(builder.getLocation()); recommender = Preconditions.checkNotNull(builder.getRecommender()); project = null; + billingAccount = null; pathTemplate = ORGANIZATION_LOCATION_RECOMMENDER; } + private RecommenderConfigName(BillingAccountLocationRecommenderBuilder builder) { + billingAccount = Preconditions.checkNotNull(builder.getBillingAccount()); + location = Preconditions.checkNotNull(builder.getLocation()); + recommender = Preconditions.checkNotNull(builder.getRecommender()); + project = null; + organization = null; + pathTemplate = BILLING_ACCOUNT_LOCATION_RECOMMENDER; + } + public String getProject() { return project; } @@ -85,6 +101,10 @@ public String getOrganization() { return organization; } + public String getBillingAccount() { + return billingAccount; + } + public static Builder newBuilder() { return new Builder(); } @@ -99,6 +119,12 @@ public static OrganizationLocationRecommenderBuilder newOrganizationLocationReco return new OrganizationLocationRecommenderBuilder(); } + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static BillingAccountLocationRecommenderBuilder + newBillingAccountLocationRecommenderBuilder() { + return new BillingAccountLocationRecommenderBuilder(); + } + public Builder toBuilder() { return new Builder(this); } @@ -131,6 +157,16 @@ public static RecommenderConfigName ofOrganizationLocationRecommenderName( .build(); } + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static RecommenderConfigName ofBillingAccountLocationRecommenderName( + String billingAccount, String location, String recommender) { + return newBillingAccountLocationRecommenderBuilder() + .setBillingAccount(billingAccount) + .setLocation(location) + .setRecommender(recommender) + .build(); + } + public static String format(String project, String location, String recommender) { return newBuilder() .setProject(project) @@ -162,6 +198,17 @@ public static String formatOrganizationLocationRecommenderName( .toString(); } + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatBillingAccountLocationRecommenderName( + String billingAccount, String location, String recommender) { + return newBillingAccountLocationRecommenderBuilder() + .setBillingAccount(billingAccount) + .setLocation(location) + .setRecommender(recommender) + .build() + .toString(); + } + public static RecommenderConfigName parse(String formattedString) { if (formattedString.isEmpty()) { return null; @@ -174,6 +221,10 @@ public static RecommenderConfigName parse(String formattedString) { Map matchMap = ORGANIZATION_LOCATION_RECOMMENDER.match(formattedString); return ofOrganizationLocationRecommenderName( matchMap.get("organization"), matchMap.get("location"), matchMap.get("recommender")); + } else if (BILLING_ACCOUNT_LOCATION_RECOMMENDER.matches(formattedString)) { + Map matchMap = BILLING_ACCOUNT_LOCATION_RECOMMENDER.match(formattedString); + return ofBillingAccountLocationRecommenderName( + matchMap.get("billing_account"), matchMap.get("location"), matchMap.get("recommender")); } throw new ValidationException( "RecommenderConfigName.parse: formattedString not in valid format"); @@ -201,7 +252,8 @@ public static List toStringList(List values) { public static boolean isParsableFrom(String formattedString) { return PROJECT_LOCATION_RECOMMENDER.matches(formattedString) - || ORGANIZATION_LOCATION_RECOMMENDER.matches(formattedString); + || ORGANIZATION_LOCATION_RECOMMENDER.matches(formattedString) + || BILLING_ACCOUNT_LOCATION_RECOMMENDER.matches(formattedString); } @Override @@ -222,6 +274,9 @@ public Map getFieldValuesMap() { if (organization != null) { fieldMapBuilder.put("organization", organization); } + if (billingAccount != null) { + fieldMapBuilder.put("billing_account", billingAccount); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -248,7 +303,8 @@ public boolean equals(Object o) { return Objects.equals(this.project, that.project) && Objects.equals(this.location, that.location) && Objects.equals(this.recommender, that.recommender) - && Objects.equals(this.organization, that.organization); + && Objects.equals(this.organization, that.organization) + && Objects.equals(this.billingAccount, that.billingAccount); } return false; } @@ -266,6 +322,8 @@ public int hashCode() { h ^= Objects.hashCode(recommender); h *= 1000003; h ^= Objects.hashCode(organization); + h *= 1000003; + h ^= Objects.hashCode(billingAccount); return h; } @@ -361,4 +419,48 @@ public RecommenderConfigName build() { return new RecommenderConfigName(this); } } + + /** + * Builder for + * billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/config. + */ + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static class BillingAccountLocationRecommenderBuilder { + private String billingAccount; + private String location; + private String recommender; + + protected BillingAccountLocationRecommenderBuilder() {} + + public String getBillingAccount() { + return billingAccount; + } + + public String getLocation() { + return location; + } + + public String getRecommender() { + return recommender; + } + + public BillingAccountLocationRecommenderBuilder setBillingAccount(String billingAccount) { + this.billingAccount = billingAccount; + return this; + } + + public BillingAccountLocationRecommenderBuilder setLocation(String location) { + this.location = location; + return this; + } + + public BillingAccountLocationRecommenderBuilder setRecommender(String recommender) { + this.recommender = recommender; + return this; + } + + public RecommenderConfigName build() { + return new RecommenderConfigName(this); + } + } } diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderConfigProto.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderConfigProto.java index 1789c77af315..3fb7411f102b 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderConfigProto.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderConfigProto.java @@ -53,7 +53,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + ".v1\032\037google/api/field_behavior.proto\032\031go" + "ogle/api/resource.proto\032\034google/protobuf" + "/struct.proto\032\037google/protobuf/timestamp" - + ".proto\"\322\004\n\021RecommenderConfig\022\014\n\004name\030\001 \001" + + ".proto\"\254\005\n\021RecommenderConfig\022\014\n\004name\030\001 \001" + "(\t\022_\n\035recommender_generation_config\030\002 \001(" + "\01328.google.cloud.recommender.v1.Recommen" + "derGenerationConfig\022\014\n\004etag\030\003 \001(\t\022/\n\013upd" @@ -62,19 +62,21 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "tions\030\006 \003(\0132?.google.cloud.recommender.v" + "1.RecommenderConfig.AnnotationsEntry\022\024\n\014" + "display_name\030\007 \001(\t\0322\n\020AnnotationsEntry\022\013" - + "\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:\322\001\352A\316\001\n,r" + + "\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:\254\002\352A\250\002\n,r" + "ecommender.googleapis.com/RecommenderCon" + "fig\022Iprojects/{project}/locations/{locat" + "ion}/recommenders/{recommender}/config\022S" + "organizations/{organization}/locations/{" + "location}/recommenders/{recommender}/con" - + "fig\"F\n\033RecommenderGenerationConfig\022\'\n\006pa" - + "rams\030\001 \001(\0132\027.google.protobuf.StructB\243\001\n\037" - + "com.google.cloud.recommender.v1B\026Recomme" - + "nderConfigProtoP\001ZAcloud.google.com/go/r" - + "ecommender/apiv1/recommenderpb;recommend" - + "erpb\242\002\004CREC\252\002\033Google.Cloud.Recommender.V" - + "1b\006proto3" + + "fig\022XbillingAccounts/{billing_account}/l" + + "ocations/{location}/recommenders/{recomm" + + "ender}/config\"F\n\033RecommenderGenerationCo" + + "nfig\022\'\n\006params\030\001 \001(\0132\027.google.protobuf.S" + + "tructB\243\001\n\037com.google.cloud.recommender.v" + + "1B\026RecommenderConfigProtoP\001ZAcloud.googl" + + "e.com/go/recommender/apiv1/recommenderpb" + + ";recommenderpb\242\002\004CREC\252\002\033Google.Cloud.Rec" + + "ommender.V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderProto.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderProto.java index 69a588082540..406dada4e259 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderProto.java +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/RecommenderProto.java @@ -59,6 +59,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_recommender_v1_GetRecommendationRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_recommender_v1_GetRecommendationRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_recommender_v1_MarkRecommendationClaimedRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -143,175 +147,200 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + ".cloud.recommender.v1.Recommendation\022\027\n\017" + "next_page_token\030\002 \001(\t\"\\\n\030GetRecommendati" + "onRequest\022@\n\004name\030\001 \001(\tB2\342A\001\002\372A+\n)recomm" - + "ender.googleapis.com/Recommendation\"\230\002\n " - + "MarkRecommendationClaimedRequest\022@\n\004name" - + "\030\001 \001(\tB2\342A\001\002\372A+\n)recommender.googleapis." - + "com/Recommendation\022h\n\016state_metadata\030\002 \003" - + "(\0132P.google.cloud.recommender.v1.MarkRec" - + "ommendationClaimedRequest.StateMetadataE" - + "ntry\022\022\n\004etag\030\003 \001(\tB\004\342A\001\002\0324\n\022StateMetadat" - + "aEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\234" - + "\002\n\"MarkRecommendationSucceededRequest\022@\n" - + "\004name\030\001 \001(\tB2\342A\001\002\372A+\n)recommender.google" - + "apis.com/Recommendation\022j\n\016state_metadat" - + "a\030\002 \003(\0132R.google.cloud.recommender.v1.Ma" - + "rkRecommendationSucceededRequest.StateMe" - + "tadataEntry\022\022\n\004etag\030\003 \001(\tB\004\342A\001\002\0324\n\022State" - + "MetadataEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(" - + "\t:\0028\001\"\226\002\n\037MarkRecommendationFailedReques" - + "t\022@\n\004name\030\001 \001(\tB2\342A\001\002\372A+\n)recommender.go" - + "ogleapis.com/Recommendation\022g\n\016state_met" - + "adata\030\002 \003(\0132O.google.cloud.recommender.v" - + "1.MarkRecommendationFailedRequest.StateM" - + "etadataEntry\022\022\n\004etag\030\003 \001(\tB\004\342A\001\002\0324\n\022Stat" - + "eMetadataEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001" - + "(\t:\0028\001\"b\n\033GetRecommenderConfigRequest\022C\n" - + "\004name\030\001 \001(\tB5\342A\001\002\372A.\n,recommender.google" - + "apis.com/RecommenderConfig\"\272\001\n\036UpdateRec" - + "ommenderConfigRequest\022P\n\022recommender_con" - + "fig\030\001 \001(\0132..google.cloud.recommender.v1." - + "RecommenderConfigB\004\342A\001\002\022/\n\013update_mask\030\002" - + " \001(\0132\032.google.protobuf.FieldMask\022\025\n\rvali" - + "date_only\030\003 \001(\010\"b\n\033GetInsightTypeConfigR" - + "equest\022C\n\004name\030\001 \001(\tB5\342A\001\002\372A.\n,recommend" - + "er.googleapis.com/InsightTypeConfig\"\273\001\n\036" - + "UpdateInsightTypeConfigRequest\022Q\n\023insigh" - + "t_type_config\030\001 \001(\0132..google.cloud.recom" - + "mender.v1.InsightTypeConfigB\004\342A\001\002\022/\n\013upd" - + "ate_mask\030\002 \001(\0132\032.google.protobuf.FieldMa" - + "sk\022\025\n\rvalidate_only\030\003 \001(\0102\377\'\n\013Recommende" - + "r\022\213\003\n\014ListInsights\0220.google.cloud.recomm" - + "ender.v1.ListInsightsRequest\0321.google.cl" - + "oud.recommender.v1.ListInsightsResponse\"" - + "\225\002\332A\006parent\202\323\344\223\002\205\002\022;/v1/{parent=projects" - + "/*/locations/*/insightTypes/*}/insightsZ" - + "D\022B/v1/{parent=billingAccounts/*/locatio" - + "ns/*/insightTypes/*}/insightsZ<\022:/v1/{pa" - + "rent=folders/*/locations/*/insightTypes/" - + "*}/insightsZB\022@/v1/{parent=organizations" - + "/*/locations/*/insightTypes/*}/insights\022" - + "\370\002\n\nGetInsight\022..google.cloud.recommende" - + "r.v1.GetInsightRequest\032$.google.cloud.re" - + "commender.v1.Insight\"\223\002\332A\004name\202\323\344\223\002\205\002\022;/" - + "v1/{name=projects/*/locations/*/insightT" - + "ypes/*/insights/*}ZD\022B/v1/{name=billingA" - + "ccounts/*/locations/*/insightTypes/*/ins" - + "ights/*}Z<\022:/v1/{name=folders/*/location" - + "s/*/insightTypes/*/insights/*}ZB\022@/v1/{n" - + "ame=organizations/*/locations/*/insightT" - + "ypes/*/insights/*}\022\336\003\n\023MarkInsightAccept" - + "ed\0227.google.cloud.recommender.v1.MarkIns" - + "ightAcceptedRequest\032$.google.cloud.recom" - + "mender.v1.Insight\"\347\002\332A\030name,state_metada" - + "ta,etag\202\323\344\223\002\305\002\"H/v1/{name=projects/*/loc" - + "ations/*/insightTypes/*/insights/*}:mark" - + "Accepted:\001*ZT\"O/v1/{name=billingAccounts" - + "/*/locations/*/insightTypes/*/insights/*" - + "}:markAccepted:\001*ZL\"G/v1/{name=folders/*" + + "ender.googleapis.com/Recommendation\"t\n\"M" + + "arkRecommendationDismissedRequest\022@\n\004nam" + + "e\030\001 \001(\tB2\342A\001\002\372A+\n)recommender.googleapis" + + ".com/Recommendation\022\014\n\004etag\030\002 \001(\t\"\230\002\n Ma" + + "rkRecommendationClaimedRequest\022@\n\004name\030\001" + + " \001(\tB2\342A\001\002\372A+\n)recommender.googleapis.co" + + "m/Recommendation\022h\n\016state_metadata\030\002 \003(\013" + + "2P.google.cloud.recommender.v1.MarkRecom" + + "mendationClaimedRequest.StateMetadataEnt" + + "ry\022\022\n\004etag\030\003 \001(\tB\004\342A\001\002\0324\n\022StateMetadataE" + + "ntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\234\002\n" + + "\"MarkRecommendationSucceededRequest\022@\n\004n" + + "ame\030\001 \001(\tB2\342A\001\002\372A+\n)recommender.googleap" + + "is.com/Recommendation\022j\n\016state_metadata\030" + + "\002 \003(\0132R.google.cloud.recommender.v1.Mark" + + "RecommendationSucceededRequest.StateMeta" + + "dataEntry\022\022\n\004etag\030\003 \001(\tB\004\342A\001\002\0324\n\022StateMe" + + "tadataEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:" + + "\0028\001\"\226\002\n\037MarkRecommendationFailedRequest\022" + + "@\n\004name\030\001 \001(\tB2\342A\001\002\372A+\n)recommender.goog" + + "leapis.com/Recommendation\022g\n\016state_metad" + + "ata\030\002 \003(\0132O.google.cloud.recommender.v1." + + "MarkRecommendationFailedRequest.StateMet" + + "adataEntry\022\022\n\004etag\030\003 \001(\tB\004\342A\001\002\0324\n\022StateM" + + "etadataEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t" + + ":\0028\001\"b\n\033GetRecommenderConfigRequest\022C\n\004n" + + "ame\030\001 \001(\tB5\342A\001\002\372A.\n,recommender.googleap" + + "is.com/RecommenderConfig\"\272\001\n\036UpdateRecom" + + "menderConfigRequest\022P\n\022recommender_confi" + + "g\030\001 \001(\0132..google.cloud.recommender.v1.Re" + + "commenderConfigB\004\342A\001\002\022/\n\013update_mask\030\002 \001" + + "(\0132\032.google.protobuf.FieldMask\022\025\n\rvalida" + + "te_only\030\003 \001(\010\"b\n\033GetInsightTypeConfigReq" + + "uest\022C\n\004name\030\001 \001(\tB5\342A\001\002\372A.\n,recommender" + + ".googleapis.com/InsightTypeConfig\"\273\001\n\036Up" + + "dateInsightTypeConfigRequest\022Q\n\023insight_" + + "type_config\030\001 \001(\0132..google.cloud.recomme" + + "nder.v1.InsightTypeConfigB\004\342A\001\002\022/\n\013updat" + + "e_mask\030\002 \001(\0132\032.google.protobuf.FieldMask" + + "\022\025\n\rvalidate_only\030\003 \001(\0102\326.\n\013Recommender\022" + + "\213\003\n\014ListInsights\0220.google.cloud.recommen" + + "der.v1.ListInsightsRequest\0321.google.clou" + + "d.recommender.v1.ListInsightsResponse\"\225\002" + + "\332A\006parent\202\323\344\223\002\205\002\022;/v1/{parent=projects/*" + + "/locations/*/insightTypes/*}/insightsZD\022" + + "B/v1/{parent=billingAccounts/*/locations" + + "/*/insightTypes/*}/insightsZ<\022:/v1/{pare" + + "nt=folders/*/locations/*/insightTypes/*}" + + "/insightsZB\022@/v1/{parent=organizations/*" + + "/locations/*/insightTypes/*}/insights\022\370\002" + + "\n\nGetInsight\022..google.cloud.recommender." + + "v1.GetInsightRequest\032$.google.cloud.reco" + + "mmender.v1.Insight\"\223\002\332A\004name\202\323\344\223\002\205\002\022;/v1" + + "/{name=projects/*/locations/*/insightTyp" + + "es/*/insights/*}ZD\022B/v1/{name=billingAcc" + + "ounts/*/locations/*/insightTypes/*/insig" + + "hts/*}Z<\022:/v1/{name=folders/*/locations/" + + "*/insightTypes/*/insights/*}ZB\022@/v1/{nam" + + "e=organizations/*/locations/*/insightTyp" + + "es/*/insights/*}\022\336\003\n\023MarkInsightAccepted" + + "\0227.google.cloud.recommender.v1.MarkInsig" + + "htAcceptedRequest\032$.google.cloud.recomme" + + "nder.v1.Insight\"\347\002\332A\030name,state_metadata" + + ",etag\202\323\344\223\002\305\002\"H/v1/{name=projects/*/locat" + + "ions/*/insightTypes/*/insights/*}:markAc" + + "cepted:\001*ZT\"O/v1/{name=billingAccounts/*" + "/locations/*/insightTypes/*/insights/*}:" - + "markAccepted:\001*ZR\"M/v1/{name=organizatio" - + "ns/*/locations/*/insightTypes/*/insights" - + "/*}:markAccepted:\001*\022\314\003\n\023ListRecommendati" - + "ons\0227.google.cloud.recommender.v1.ListRe" - + "commendationsRequest\0328.google.cloud.reco" - + "mmender.v1.ListRecommendationsResponse\"\301" - + "\002\332A\006parent\332A\rparent,filter\202\323\344\223\002\241\002\022B/v1/{" - + "parent=projects/*/locations/*/recommende" - + "rs/*}/recommendationsZK\022I/v1/{parent=bil" - + "lingAccounts/*/locations/*/recommenders/" - + "*}/recommendationsZC\022A/v1/{parent=folder" - + "s/*/locations/*/recommenders/*}/recommen" - + "dationsZI\022G/v1/{parent=organizations/*/l" - + "ocations/*/recommenders/*}/recommendatio" - + "ns\022\251\003\n\021GetRecommendation\0225.google.cloud." - + "recommender.v1.GetRecommendationRequest\032" - + "+.google.cloud.recommender.v1.Recommenda" - + "tion\"\257\002\332A\004name\202\323\344\223\002\241\002\022B/v1/{name=project" - + "s/*/locations/*/recommenders/*/recommend" - + "ations/*}ZK\022I/v1/{name=billingAccounts/*" + + "markAccepted:\001*ZL\"G/v1/{name=folders/*/l" + + "ocations/*/insightTypes/*/insights/*}:ma" + + "rkAccepted:\001*ZR\"M/v1/{name=organizations" + + "/*/locations/*/insightTypes/*/insights/*" + + "}:markAccepted:\001*\022\314\003\n\023ListRecommendation" + + "s\0227.google.cloud.recommender.v1.ListReco" + + "mmendationsRequest\0328.google.cloud.recomm" + + "ender.v1.ListRecommendationsResponse\"\301\002\332" + + "A\006parent\332A\rparent,filter\202\323\344\223\002\241\002\022B/v1/{pa" + + "rent=projects/*/locations/*/recommenders" + + "/*}/recommendationsZK\022I/v1/{parent=billi" + + "ngAccounts/*/locations/*/recommenders/*}" + + "/recommendationsZC\022A/v1/{parent=folders/" + + "*/locations/*/recommenders/*}/recommenda" + + "tionsZI\022G/v1/{parent=organizations/*/loc" + + "ations/*/recommenders/*}/recommendations" + + "\022\251\003\n\021GetRecommendation\0225.google.cloud.re" + + "commender.v1.GetRecommendationRequest\032+." + + "google.cloud.recommender.v1.Recommendati" + + "on\"\257\002\332A\004name\202\323\344\223\002\241\002\022B/v1/{name=projects/" + + "*/locations/*/recommenders/*/recommendat" + + "ions/*}ZK\022I/v1/{name=billingAccounts/*/l" + + "ocations/*/recommenders/*/recommendation" + + "s/*}ZC\022A/v1/{name=folders/*/locations/*/" + + "recommenders/*/recommendations/*}ZI\022G/v1" + + "/{name=organizations/*/locations/*/recom" + + "menders/*/recommendations/*}\022\372\003\n\033MarkRec" + + "ommendationDismissed\022?.google.cloud.reco" + + "mmender.v1.MarkRecommendationDismissedRe" + + "quest\032+.google.cloud.recommender.v1.Reco" + + "mmendation\"\354\002\202\323\344\223\002\345\002\"P/v1/{name=projects" + + "/*/locations/*/recommenders/*/recommenda" + + "tions/*}:markDismissed:\001*Z\\\"W/v1/{name=b" + + "illingAccounts/*/locations/*/recommender" + + "s/*/recommendations/*}:markDismissed:\001*Z" + + "T\"O/v1/{name=folders/*/locations/*/recom" + + "menders/*/recommendations/*}:markDismiss" + + "ed:\001*ZZ\"U/v1/{name=organizations/*/locat" + + "ions/*/recommenders/*/recommendations/*}" + + ":markDismissed:\001*\022\211\004\n\031MarkRecommendation" + + "Claimed\022=.google.cloud.recommender.v1.Ma" + + "rkRecommendationClaimedRequest\032+.google." + + "cloud.recommender.v1.Recommendation\"\377\002\332A" + + "\030name,state_metadata,etag\202\323\344\223\002\335\002\"N/v1/{n" + + "ame=projects/*/locations/*/recommenders/" + + "*/recommendations/*}:markClaimed:\001*ZZ\"U/" + + "v1/{name=billingAccounts/*/locations/*/r" + + "ecommenders/*/recommendations/*}:markCla" + + "imed:\001*ZR\"M/v1/{name=folders/*/locations" + + "/*/recommenders/*/recommendations/*}:mar" + + "kClaimed:\001*ZX\"S/v1/{name=organizations/*" + "/locations/*/recommenders/*/recommendati" - + "ons/*}ZC\022A/v1/{name=folders/*/locations/" - + "*/recommenders/*/recommendations/*}ZI\022G/" - + "v1/{name=organizations/*/locations/*/rec" - + "ommenders/*/recommendations/*}\022\211\004\n\031MarkR" - + "ecommendationClaimed\022=.google.cloud.reco" - + "mmender.v1.MarkRecommendationClaimedRequ" - + "est\032+.google.cloud.recommender.v1.Recomm" - + "endation\"\377\002\332A\030name,state_metadata,etag\202\323" - + "\344\223\002\335\002\"N/v1/{name=projects/*/locations/*/" - + "recommenders/*/recommendations/*}:markCl" - + "aimed:\001*ZZ\"U/v1/{name=billingAccounts/*/" - + "locations/*/recommenders/*/recommendatio" - + "ns/*}:markClaimed:\001*ZR\"M/v1/{name=folder" + + "ons/*}:markClaimed:\001*\022\225\004\n\033MarkRecommenda" + + "tionSucceeded\022?.google.cloud.recommender" + + ".v1.MarkRecommendationSucceededRequest\032+" + + ".google.cloud.recommender.v1.Recommendat" + + "ion\"\207\003\332A\030name,state_metadata,etag\202\323\344\223\002\345\002" + + "\"P/v1/{name=projects/*/locations/*/recom" + + "menders/*/recommendations/*}:markSucceed" + + "ed:\001*Z\\\"W/v1/{name=billingAccounts/*/loc" + + "ations/*/recommenders/*/recommendations/" + + "*}:markSucceeded:\001*ZT\"O/v1/{name=folders" + + "/*/locations/*/recommenders/*/recommenda" + + "tions/*}:markSucceeded:\001*ZZ\"U/v1/{name=o" + + "rganizations/*/locations/*/recommenders/" + + "*/recommendations/*}:markSucceeded:\001*\022\203\004" + + "\n\030MarkRecommendationFailed\022<.google.clou" + + "d.recommender.v1.MarkRecommendationFaile" + + "dRequest\032+.google.cloud.recommender.v1.R" + + "ecommendation\"\373\002\332A\030name,state_metadata,e" + + "tag\202\323\344\223\002\331\002\"M/v1/{name=projects/*/locatio" + + "ns/*/recommenders/*/recommendations/*}:m" + + "arkFailed:\001*ZY\"T/v1/{name=billingAccount" + "s/*/locations/*/recommenders/*/recommend" - + "ations/*}:markClaimed:\001*ZX\"S/v1/{name=or" - + "ganizations/*/locations/*/recommenders/*" - + "/recommendations/*}:markClaimed:\001*\022\225\004\n\033M" - + "arkRecommendationSucceeded\022?.google.clou" - + "d.recommender.v1.MarkRecommendationSucce" - + "ededRequest\032+.google.cloud.recommender.v" - + "1.Recommendation\"\207\003\332A\030name,state_metadat" - + "a,etag\202\323\344\223\002\345\002\"P/v1/{name=projects/*/loca" - + "tions/*/recommenders/*/recommendations/*" - + "}:markSucceeded:\001*Z\\\"W/v1/{name=billingA" - + "ccounts/*/locations/*/recommenders/*/rec" - + "ommendations/*}:markSucceeded:\001*ZT\"O/v1/" - + "{name=folders/*/locations/*/recommenders" - + "/*/recommendations/*}:markSucceeded:\001*ZZ" - + "\"U/v1/{name=organizations/*/locations/*/" - + "recommenders/*/recommendations/*}:markSu" - + "cceeded:\001*\022\203\004\n\030MarkRecommendationFailed\022" - + "<.google.cloud.recommender.v1.MarkRecomm" - + "endationFailedRequest\032+.google.cloud.rec" - + "ommender.v1.Recommendation\"\373\002\332A\030name,sta" - + "te_metadata,etag\202\323\344\223\002\331\002\"M/v1/{name=proje" - + "cts/*/locations/*/recommenders/*/recomme" - + "ndations/*}:markFailed:\001*ZY\"T/v1/{name=b" - + "illingAccounts/*/locations/*/recommender" - + "s/*/recommendations/*}:markFailed:\001*ZQ\"L" - + "/v1/{name=folders/*/locations/*/recommen" - + "ders/*/recommendations/*}:markFailed:\001*Z" - + "W\"R/v1/{name=organizations/*/locations/*" - + "/recommenders/*/recommendations/*}:markF" - + "ailed:\001*\022\211\002\n\024GetRecommenderConfig\0228.goog" - + "le.cloud.recommender.v1.GetRecommenderCo" - + "nfigRequest\032..google.cloud.recommender.v" - + "1.RecommenderConfig\"\206\001\332A\004name\202\323\344\223\002y\0227/v1" - + "/{name=projects/*/locations/*/recommende" - + "rs/*/config}Z>\022\022/v1/{name=bi" + + "llingAccounts/*/locations/*/recommenders" + + "/*/config}\022\341\003\n\027UpdateRecommenderConfig\022;" + + ".google.cloud.recommender.v1.UpdateRecom" + + "menderConfigRequest\032..google.cloud.recom" + + "mender.v1.RecommenderConfig\"\330\002\332A\036recomme" + + "nder_config,update_mask\202\323\344\223\002\260\0022J/v1/{rec" + + "ommender_config.name=projects/*/location" + + "s/*/recommenders/*/config}:\022recommender_" + + "configZe2O/v1/{recommender_config.name=o" + + "rganizations/*/locations/*/recommenders/" + + "*/config}:\022recommender_configZg2Q/v1/{re" + + "commender_config.name=billingAccounts/*/" + + "locations/*/recommenders/*/config}:\022reco" + + "mmender_config\022\314\002\n\024GetInsightTypeConfig\022" + + "8.google.cloud.recommender.v1.GetInsight" + + "TypeConfigRequest\032..google.cloud.recomme" + + "nder.v1.InsightTypeConfig\"\311\001\332A\004name\202\323\344\223\002" + + "\273\001\0227/v1/{name=projects/*/locations/*/ins" + "ightTypes/*/config}Z>\022/v1/{name=billingAccounts/*/locat" + + "ions/*/insightTypes/*/config}\022\350\003\n\027Update" + + "InsightTypeConfig\022;.google.cloud.recomme" + + "nder.v1.UpdateInsightTypeConfigRequest\032." + + ".google.cloud.recommender.v1.InsightType" + + "Config\"\337\002\332A\037insight_type_config,update_m" + + "ask\202\323\344\223\002\266\0022K/v1/{insight_type_config.nam" + + "e=projects/*/locations/*/insightTypes/*/" + + "config}:\023insight_type_configZg2P/v1/{ins" + + "ight_type_config.name=organizations/*/lo" + + "cations/*/insightTypes/*/config}:\023insigh" + + "t_type_configZi2R/v1/{insight_type_confi" + + "g.name=billingAccounts/*/locations/*/ins" + + "ightTypes/*/config}:\023insight_type_config" + + "\032N\312A\032recommender.googleapis.com\322A.https:" + + "//www.googleapis.com/auth/cloud-platform" + + "B\235\001\n\037com.google.cloud.recommender.v1B\020Re" + + "commenderProtoP\001ZAcloud.google.com/go/re" + + "commender/apiv1/recommenderpb;recommende" + + "rpb\242\002\004CREC\252\002\033Google.Cloud.Recommender.V1" + + "b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -393,8 +422,16 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Name", }); - internal_static_google_cloud_recommender_v1_MarkRecommendationClaimedRequest_descriptor = + internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_descriptor = getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_recommender_v1_MarkRecommendationDismissedRequest_descriptor, + new java.lang.String[] { + "Name", "Etag", + }); + internal_static_google_cloud_recommender_v1_MarkRecommendationClaimedRequest_descriptor = + getDescriptor().getMessageTypes().get(8); internal_static_google_cloud_recommender_v1_MarkRecommendationClaimedRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_MarkRecommendationClaimedRequest_descriptor, @@ -412,7 +449,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_recommender_v1_MarkRecommendationSucceededRequest_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageTypes().get(9); internal_static_google_cloud_recommender_v1_MarkRecommendationSucceededRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_MarkRecommendationSucceededRequest_descriptor, @@ -430,7 +467,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_recommender_v1_MarkRecommendationFailedRequest_descriptor = - getDescriptor().getMessageTypes().get(9); + getDescriptor().getMessageTypes().get(10); internal_static_google_cloud_recommender_v1_MarkRecommendationFailedRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_MarkRecommendationFailedRequest_descriptor, @@ -448,7 +485,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_recommender_v1_GetRecommenderConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(10); + getDescriptor().getMessageTypes().get(11); internal_static_google_cloud_recommender_v1_GetRecommenderConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_GetRecommenderConfigRequest_descriptor, @@ -456,7 +493,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", }); internal_static_google_cloud_recommender_v1_UpdateRecommenderConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(11); + getDescriptor().getMessageTypes().get(12); internal_static_google_cloud_recommender_v1_UpdateRecommenderConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_UpdateRecommenderConfigRequest_descriptor, @@ -464,7 +501,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "RecommenderConfig", "UpdateMask", "ValidateOnly", }); internal_static_google_cloud_recommender_v1_GetInsightTypeConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(12); + getDescriptor().getMessageTypes().get(13); internal_static_google_cloud_recommender_v1_GetInsightTypeConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_GetInsightTypeConfigRequest_descriptor, @@ -472,7 +509,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", }); internal_static_google_cloud_recommender_v1_UpdateInsightTypeConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(13); + getDescriptor().getMessageTypes().get(14); internal_static_google_cloud_recommender_v1_UpdateInsightTypeConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_recommender_v1_UpdateInsightTypeConfigRequest_descriptor, diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ReliabilityProjection.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ReliabilityProjection.java new file mode 100644 index 000000000000..eeab3de82159 --- /dev/null +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ReliabilityProjection.java @@ -0,0 +1,1275 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/recommender/v1/recommendation.proto + +package com.google.cloud.recommender.v1; + +/** + * + * + *
+ * Contains information on the impact of a reliability recommendation.
+ * 
+ * + * Protobuf type {@code google.cloud.recommender.v1.ReliabilityProjection} + */ +public final class ReliabilityProjection extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.recommender.v1.ReliabilityProjection) + ReliabilityProjectionOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReliabilityProjection.newBuilder() to construct. + private ReliabilityProjection(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReliabilityProjection() { + risks_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReliabilityProjection(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_ReliabilityProjection_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_ReliabilityProjection_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.recommender.v1.ReliabilityProjection.class, + com.google.cloud.recommender.v1.ReliabilityProjection.Builder.class); + } + + /** + * + * + *
+   * The risk associated with the reliability issue.
+   * 
+ * + * Protobuf enum {@code google.cloud.recommender.v1.ReliabilityProjection.RiskType} + */ + public enum RiskType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default unspecified risk. Don't use directly.
+     * 
+ * + * RISK_TYPE_UNSPECIFIED = 0; + */ + RISK_TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * Potential service downtime.
+     * 
+ * + * SERVICE_DISRUPTION = 1; + */ + SERVICE_DISRUPTION(1), + /** + * + * + *
+     * Potential data loss.
+     * 
+ * + * DATA_LOSS = 2; + */ + DATA_LOSS(2), + /** + * + * + *
+     * Potential access denial. The service is still up but some or all clients
+     * can't access it.
+     * 
+ * + * ACCESS_DENY = 3; + */ + ACCESS_DENY(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default unspecified risk. Don't use directly.
+     * 
+ * + * RISK_TYPE_UNSPECIFIED = 0; + */ + public static final int RISK_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Potential service downtime.
+     * 
+ * + * SERVICE_DISRUPTION = 1; + */ + public static final int SERVICE_DISRUPTION_VALUE = 1; + /** + * + * + *
+     * Potential data loss.
+     * 
+ * + * DATA_LOSS = 2; + */ + public static final int DATA_LOSS_VALUE = 2; + /** + * + * + *
+     * Potential access denial. The service is still up but some or all clients
+     * can't access it.
+     * 
+ * + * ACCESS_DENY = 3; + */ + public static final int ACCESS_DENY_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RiskType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static RiskType forNumber(int value) { + switch (value) { + case 0: + return RISK_TYPE_UNSPECIFIED; + case 1: + return SERVICE_DISRUPTION; + case 2: + return DATA_LOSS; + case 3: + return ACCESS_DENY; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public RiskType findValueByNumber(int number) { + return RiskType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.recommender.v1.ReliabilityProjection.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final RiskType[] VALUES = values(); + + public static RiskType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private RiskType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.recommender.v1.ReliabilityProjection.RiskType) + } + + public static final int RISKS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List risks_; + + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.recommender.v1.ReliabilityProjection.RiskType> + risks_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.recommender.v1.ReliabilityProjection.RiskType>() { + public com.google.cloud.recommender.v1.ReliabilityProjection.RiskType convert( + java.lang.Integer from) { + com.google.cloud.recommender.v1.ReliabilityProjection.RiskType result = + com.google.cloud.recommender.v1.ReliabilityProjection.RiskType.forNumber(from); + return result == null + ? com.google.cloud.recommender.v1.ReliabilityProjection.RiskType.UNRECOGNIZED + : result; + } + }; + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return A list containing the risks. + */ + @java.lang.Override + public java.util.List + getRisksList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.recommender.v1.ReliabilityProjection.RiskType>( + risks_, risks_converter_); + } + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return The count of risks. + */ + @java.lang.Override + public int getRisksCount() { + return risks_.size(); + } + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param index The index of the element to return. + * @return The risks at the given index. + */ + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjection.RiskType getRisks(int index) { + return risks_converter_.convert(risks_.get(index)); + } + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return A list containing the enum numeric values on the wire for risks. + */ + @java.lang.Override + public java.util.List getRisksValueList() { + return risks_; + } + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of risks at the given index. + */ + @java.lang.Override + public int getRisksValue(int index) { + return risks_.get(index); + } + + private int risksMemoizedSerializedSize; + + public static final int DETAILS_FIELD_NUMBER = 2; + private com.google.protobuf.Struct details_; + /** + * + * + *
+   * Per-recommender projection.
+   * 
+ * + * .google.protobuf.Struct details = 2; + * + * @return Whether the details field is set. + */ + @java.lang.Override + public boolean hasDetails() { + return details_ != null; + } + /** + * + * + *
+   * Per-recommender projection.
+   * 
+ * + * .google.protobuf.Struct details = 2; + * + * @return The details. + */ + @java.lang.Override + public com.google.protobuf.Struct getDetails() { + return details_ == null ? com.google.protobuf.Struct.getDefaultInstance() : details_; + } + /** + * + * + *
+   * Per-recommender projection.
+   * 
+ * + * .google.protobuf.Struct details = 2; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getDetailsOrBuilder() { + return details_ == null ? com.google.protobuf.Struct.getDefaultInstance() : details_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + getSerializedSize(); + if (getRisksList().size() > 0) { + output.writeUInt32NoTag(10); + output.writeUInt32NoTag(risksMemoizedSerializedSize); + } + for (int i = 0; i < risks_.size(); i++) { + output.writeEnumNoTag(risks_.get(i)); + } + if (details_ != null) { + output.writeMessage(2, getDetails()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < risks_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(risks_.get(i)); + } + size += dataSize; + if (!getRisksList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + risksMemoizedSerializedSize = dataSize; + } + if (details_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDetails()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.recommender.v1.ReliabilityProjection)) { + return super.equals(obj); + } + com.google.cloud.recommender.v1.ReliabilityProjection other = + (com.google.cloud.recommender.v1.ReliabilityProjection) obj; + + if (!risks_.equals(other.risks_)) return false; + if (hasDetails() != other.hasDetails()) return false; + if (hasDetails()) { + if (!getDetails().equals(other.getDetails())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getRisksCount() > 0) { + hash = (37 * hash) + RISKS_FIELD_NUMBER; + hash = (53 * hash) + risks_.hashCode(); + } + if (hasDetails()) { + hash = (37 * hash) + DETAILS_FIELD_NUMBER; + hash = (53 * hash) + getDetails().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.recommender.v1.ReliabilityProjection prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Contains information on the impact of a reliability recommendation.
+   * 
+ * + * Protobuf type {@code google.cloud.recommender.v1.ReliabilityProjection} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.recommender.v1.ReliabilityProjection) + com.google.cloud.recommender.v1.ReliabilityProjectionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_ReliabilityProjection_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_ReliabilityProjection_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.recommender.v1.ReliabilityProjection.class, + com.google.cloud.recommender.v1.ReliabilityProjection.Builder.class); + } + + // Construct using com.google.cloud.recommender.v1.ReliabilityProjection.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + risks_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + details_ = null; + if (detailsBuilder_ != null) { + detailsBuilder_.dispose(); + detailsBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_ReliabilityProjection_descriptor; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjection getDefaultInstanceForType() { + return com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjection build() { + com.google.cloud.recommender.v1.ReliabilityProjection result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjection buildPartial() { + com.google.cloud.recommender.v1.ReliabilityProjection result = + new com.google.cloud.recommender.v1.ReliabilityProjection(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.recommender.v1.ReliabilityProjection result) { + if (((bitField0_ & 0x00000001) != 0)) { + risks_ = java.util.Collections.unmodifiableList(risks_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.risks_ = risks_; + } + + private void buildPartial0(com.google.cloud.recommender.v1.ReliabilityProjection result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.details_ = detailsBuilder_ == null ? details_ : detailsBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.recommender.v1.ReliabilityProjection) { + return mergeFrom((com.google.cloud.recommender.v1.ReliabilityProjection) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.recommender.v1.ReliabilityProjection other) { + if (other == com.google.cloud.recommender.v1.ReliabilityProjection.getDefaultInstance()) + return this; + if (!other.risks_.isEmpty()) { + if (risks_.isEmpty()) { + risks_ = other.risks_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureRisksIsMutable(); + risks_.addAll(other.risks_); + } + onChanged(); + } + if (other.hasDetails()) { + mergeDetails(other.getDetails()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int tmpRaw = input.readEnum(); + ensureRisksIsMutable(); + risks_.add(tmpRaw); + break; + } // case 8 + case 10: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int tmpRaw = input.readEnum(); + ensureRisksIsMutable(); + risks_.add(tmpRaw); + } + input.popLimit(oldLimit); + break; + } // case 10 + case 18: + { + input.readMessage(getDetailsFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List risks_ = java.util.Collections.emptyList(); + + private void ensureRisksIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + risks_ = new java.util.ArrayList(risks_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return A list containing the risks. + */ + public java.util.List + getRisksList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.recommender.v1.ReliabilityProjection.RiskType>( + risks_, risks_converter_); + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return The count of risks. + */ + public int getRisksCount() { + return risks_.size(); + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param index The index of the element to return. + * @return The risks at the given index. + */ + public com.google.cloud.recommender.v1.ReliabilityProjection.RiskType getRisks(int index) { + return risks_converter_.convert(risks_.get(index)); + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param index The index to set the value at. + * @param value The risks to set. + * @return This builder for chaining. + */ + public Builder setRisks( + int index, com.google.cloud.recommender.v1.ReliabilityProjection.RiskType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRisksIsMutable(); + risks_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param value The risks to add. + * @return This builder for chaining. + */ + public Builder addRisks(com.google.cloud.recommender.v1.ReliabilityProjection.RiskType value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRisksIsMutable(); + risks_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param values The risks to add. + * @return This builder for chaining. + */ + public Builder addAllRisks( + java.lang.Iterable + values) { + ensureRisksIsMutable(); + for (com.google.cloud.recommender.v1.ReliabilityProjection.RiskType value : values) { + risks_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return This builder for chaining. + */ + public Builder clearRisks() { + risks_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return A list containing the enum numeric values on the wire for risks. + */ + public java.util.List getRisksValueList() { + return java.util.Collections.unmodifiableList(risks_); + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of risks at the given index. + */ + public int getRisksValue(int index) { + return risks_.get(index); + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param index The index to set the value at. + * @param value The enum numeric value on the wire for risks to set. + * @return This builder for chaining. + */ + public Builder setRisksValue(int index, int value) { + ensureRisksIsMutable(); + risks_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param value The enum numeric value on the wire for risks to add. + * @return This builder for chaining. + */ + public Builder addRisksValue(int value) { + ensureRisksIsMutable(); + risks_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Reliability risks mitigated by this recommendation.
+     * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param values The enum numeric values on the wire for risks to add. + * @return This builder for chaining. + */ + public Builder addAllRisksValue(java.lang.Iterable values) { + ensureRisksIsMutable(); + for (int value : values) { + risks_.add(value); + } + onChanged(); + return this; + } + + private com.google.protobuf.Struct details_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder> + detailsBuilder_; + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + * + * @return Whether the details field is set. + */ + public boolean hasDetails() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + * + * @return The details. + */ + public com.google.protobuf.Struct getDetails() { + if (detailsBuilder_ == null) { + return details_ == null ? com.google.protobuf.Struct.getDefaultInstance() : details_; + } else { + return detailsBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + */ + public Builder setDetails(com.google.protobuf.Struct value) { + if (detailsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + details_ = value; + } else { + detailsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + */ + public Builder setDetails(com.google.protobuf.Struct.Builder builderForValue) { + if (detailsBuilder_ == null) { + details_ = builderForValue.build(); + } else { + detailsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + */ + public Builder mergeDetails(com.google.protobuf.Struct value) { + if (detailsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && details_ != null + && details_ != com.google.protobuf.Struct.getDefaultInstance()) { + getDetailsBuilder().mergeFrom(value); + } else { + details_ = value; + } + } else { + detailsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + */ + public Builder clearDetails() { + bitField0_ = (bitField0_ & ~0x00000002); + details_ = null; + if (detailsBuilder_ != null) { + detailsBuilder_.dispose(); + detailsBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + */ + public com.google.protobuf.Struct.Builder getDetailsBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getDetailsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + */ + public com.google.protobuf.StructOrBuilder getDetailsOrBuilder() { + if (detailsBuilder_ != null) { + return detailsBuilder_.getMessageOrBuilder(); + } else { + return details_ == null ? com.google.protobuf.Struct.getDefaultInstance() : details_; + } + } + /** + * + * + *
+     * Per-recommender projection.
+     * 
+ * + * .google.protobuf.Struct details = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder> + getDetailsFieldBuilder() { + if (detailsBuilder_ == null) { + detailsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Struct, + com.google.protobuf.Struct.Builder, + com.google.protobuf.StructOrBuilder>( + getDetails(), getParentForChildren(), isClean()); + details_ = null; + } + return detailsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.recommender.v1.ReliabilityProjection) + } + + // @@protoc_insertion_point(class_scope:google.cloud.recommender.v1.ReliabilityProjection) + private static final com.google.cloud.recommender.v1.ReliabilityProjection DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.recommender.v1.ReliabilityProjection(); + } + + public static com.google.cloud.recommender.v1.ReliabilityProjection getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReliabilityProjection parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.ReliabilityProjection getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ReliabilityProjectionOrBuilder.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ReliabilityProjectionOrBuilder.java new file mode 100644 index 000000000000..7679ac1ba971 --- /dev/null +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/ReliabilityProjectionOrBuilder.java @@ -0,0 +1,123 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/recommender/v1/recommendation.proto + +package com.google.cloud.recommender.v1; + +public interface ReliabilityProjectionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.recommender.v1.ReliabilityProjection) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return A list containing the risks. + */ + java.util.List getRisksList(); + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return The count of risks. + */ + int getRisksCount(); + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param index The index of the element to return. + * @return The risks at the given index. + */ + com.google.cloud.recommender.v1.ReliabilityProjection.RiskType getRisks(int index); + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @return A list containing the enum numeric values on the wire for risks. + */ + java.util.List getRisksValueList(); + /** + * + * + *
+   * Reliability risks mitigated by this recommendation.
+   * 
+ * + * repeated .google.cloud.recommender.v1.ReliabilityProjection.RiskType risks = 1; + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of risks at the given index. + */ + int getRisksValue(int index); + + /** + * + * + *
+   * Per-recommender projection.
+   * 
+ * + * .google.protobuf.Struct details = 2; + * + * @return Whether the details field is set. + */ + boolean hasDetails(); + /** + * + * + *
+   * Per-recommender projection.
+   * 
+ * + * .google.protobuf.Struct details = 2; + * + * @return The details. + */ + com.google.protobuf.Struct getDetails(); + /** + * + * + *
+   * Per-recommender projection.
+   * 
+ * + * .google.protobuf.Struct details = 2; + */ + com.google.protobuf.StructOrBuilder getDetailsOrBuilder(); +} diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/SustainabilityProjection.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/SustainabilityProjection.java new file mode 100644 index 000000000000..84f0120e95aa --- /dev/null +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/SustainabilityProjection.java @@ -0,0 +1,800 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/recommender/v1/recommendation.proto + +package com.google.cloud.recommender.v1; + +/** + * + * + *
+ * Contains metadata about how much sustainability a recommendation can save or
+ * incur.
+ * 
+ * + * Protobuf type {@code google.cloud.recommender.v1.SustainabilityProjection} + */ +public final class SustainabilityProjection extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.recommender.v1.SustainabilityProjection) + SustainabilityProjectionOrBuilder { + private static final long serialVersionUID = 0L; + // Use SustainabilityProjection.newBuilder() to construct. + private SustainabilityProjection(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SustainabilityProjection() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SustainabilityProjection(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_SustainabilityProjection_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_SustainabilityProjection_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.recommender.v1.SustainabilityProjection.class, + com.google.cloud.recommender.v1.SustainabilityProjection.Builder.class); + } + + public static final int KG_C_O2E_FIELD_NUMBER = 1; + private double kgCO2E_ = 0D; + /** + * + * + *
+   * Carbon Footprint generated in kg of CO2 equivalent.
+   * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e).
+   * 
+ * + * double kg_c_o2e = 1; + * + * @return The kgCO2e. + */ + @java.lang.Override + public double getKgCO2E() { + return kgCO2E_; + } + + public static final int DURATION_FIELD_NUMBER = 2; + private com.google.protobuf.Duration duration_; + /** + * + * + *
+   * Duration for which this sustainability applies.
+   * 
+ * + * .google.protobuf.Duration duration = 2; + * + * @return Whether the duration field is set. + */ + @java.lang.Override + public boolean hasDuration() { + return duration_ != null; + } + /** + * + * + *
+   * Duration for which this sustainability applies.
+   * 
+ * + * .google.protobuf.Duration duration = 2; + * + * @return The duration. + */ + @java.lang.Override + public com.google.protobuf.Duration getDuration() { + return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_; + } + /** + * + * + *
+   * Duration for which this sustainability applies.
+   * 
+ * + * .google.protobuf.Duration duration = 2; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() { + return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (java.lang.Double.doubleToRawLongBits(kgCO2E_) != 0) { + output.writeDouble(1, kgCO2E_); + } + if (duration_ != null) { + output.writeMessage(2, getDuration()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (java.lang.Double.doubleToRawLongBits(kgCO2E_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(1, kgCO2E_); + } + if (duration_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDuration()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.recommender.v1.SustainabilityProjection)) { + return super.equals(obj); + } + com.google.cloud.recommender.v1.SustainabilityProjection other = + (com.google.cloud.recommender.v1.SustainabilityProjection) obj; + + if (java.lang.Double.doubleToLongBits(getKgCO2E()) + != java.lang.Double.doubleToLongBits(other.getKgCO2E())) return false; + if (hasDuration() != other.hasDuration()) return false; + if (hasDuration()) { + if (!getDuration().equals(other.getDuration())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KG_C_O2E_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong(java.lang.Double.doubleToLongBits(getKgCO2E())); + if (hasDuration()) { + hash = (37 * hash) + DURATION_FIELD_NUMBER; + hash = (53 * hash) + getDuration().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.recommender.v1.SustainabilityProjection prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Contains metadata about how much sustainability a recommendation can save or
+   * incur.
+   * 
+ * + * Protobuf type {@code google.cloud.recommender.v1.SustainabilityProjection} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.recommender.v1.SustainabilityProjection) + com.google.cloud.recommender.v1.SustainabilityProjectionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_SustainabilityProjection_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_SustainabilityProjection_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.recommender.v1.SustainabilityProjection.class, + com.google.cloud.recommender.v1.SustainabilityProjection.Builder.class); + } + + // Construct using com.google.cloud.recommender.v1.SustainabilityProjection.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + kgCO2E_ = 0D; + duration_ = null; + if (durationBuilder_ != null) { + durationBuilder_.dispose(); + durationBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.recommender.v1.RecommendationOuterClass + .internal_static_google_cloud_recommender_v1_SustainabilityProjection_descriptor; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.SustainabilityProjection getDefaultInstanceForType() { + return com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.recommender.v1.SustainabilityProjection build() { + com.google.cloud.recommender.v1.SustainabilityProjection result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.SustainabilityProjection buildPartial() { + com.google.cloud.recommender.v1.SustainabilityProjection result = + new com.google.cloud.recommender.v1.SustainabilityProjection(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.recommender.v1.SustainabilityProjection result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.kgCO2E_ = kgCO2E_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.duration_ = durationBuilder_ == null ? duration_ : durationBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.recommender.v1.SustainabilityProjection) { + return mergeFrom((com.google.cloud.recommender.v1.SustainabilityProjection) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.recommender.v1.SustainabilityProjection other) { + if (other == com.google.cloud.recommender.v1.SustainabilityProjection.getDefaultInstance()) + return this; + if (other.getKgCO2E() != 0D) { + setKgCO2E(other.getKgCO2E()); + } + if (other.hasDuration()) { + mergeDuration(other.getDuration()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 9: + { + kgCO2E_ = input.readDouble(); + bitField0_ |= 0x00000001; + break; + } // case 9 + case 18: + { + input.readMessage(getDurationFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private double kgCO2E_; + /** + * + * + *
+     * Carbon Footprint generated in kg of CO2 equivalent.
+     * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e).
+     * 
+ * + * double kg_c_o2e = 1; + * + * @return The kgCO2e. + */ + @java.lang.Override + public double getKgCO2E() { + return kgCO2E_; + } + /** + * + * + *
+     * Carbon Footprint generated in kg of CO2 equivalent.
+     * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e).
+     * 
+ * + * double kg_c_o2e = 1; + * + * @param value The kgCO2e to set. + * @return This builder for chaining. + */ + public Builder setKgCO2E(double value) { + + kgCO2E_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Carbon Footprint generated in kg of CO2 equivalent.
+     * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e).
+     * 
+ * + * double kg_c_o2e = 1; + * + * @return This builder for chaining. + */ + public Builder clearKgCO2E() { + bitField0_ = (bitField0_ & ~0x00000001); + kgCO2E_ = 0D; + onChanged(); + return this; + } + + private com.google.protobuf.Duration duration_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + durationBuilder_; + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + * + * @return Whether the duration field is set. + */ + public boolean hasDuration() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + * + * @return The duration. + */ + public com.google.protobuf.Duration getDuration() { + if (durationBuilder_ == null) { + return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_; + } else { + return durationBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + */ + public Builder setDuration(com.google.protobuf.Duration value) { + if (durationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + duration_ = value; + } else { + durationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + */ + public Builder setDuration(com.google.protobuf.Duration.Builder builderForValue) { + if (durationBuilder_ == null) { + duration_ = builderForValue.build(); + } else { + durationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + */ + public Builder mergeDuration(com.google.protobuf.Duration value) { + if (durationBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && duration_ != null + && duration_ != com.google.protobuf.Duration.getDefaultInstance()) { + getDurationBuilder().mergeFrom(value); + } else { + duration_ = value; + } + } else { + durationBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + */ + public Builder clearDuration() { + bitField0_ = (bitField0_ & ~0x00000002); + duration_ = null; + if (durationBuilder_ != null) { + durationBuilder_.dispose(); + durationBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + */ + public com.google.protobuf.Duration.Builder getDurationBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getDurationFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + */ + public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() { + if (durationBuilder_ != null) { + return durationBuilder_.getMessageOrBuilder(); + } else { + return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_; + } + } + /** + * + * + *
+     * Duration for which this sustainability applies.
+     * 
+ * + * .google.protobuf.Duration duration = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getDurationFieldBuilder() { + if (durationBuilder_ == null) { + durationBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getDuration(), getParentForChildren(), isClean()); + duration_ = null; + } + return durationBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.recommender.v1.SustainabilityProjection) + } + + // @@protoc_insertion_point(class_scope:google.cloud.recommender.v1.SustainabilityProjection) + private static final com.google.cloud.recommender.v1.SustainabilityProjection DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.recommender.v1.SustainabilityProjection(); + } + + public static com.google.cloud.recommender.v1.SustainabilityProjection getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SustainabilityProjection parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.recommender.v1.SustainabilityProjection getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/SustainabilityProjectionOrBuilder.java b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/SustainabilityProjectionOrBuilder.java new file mode 100644 index 000000000000..d43fe0ef9fd8 --- /dev/null +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/java/com/google/cloud/recommender/v1/SustainabilityProjectionOrBuilder.java @@ -0,0 +1,74 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/recommender/v1/recommendation.proto + +package com.google.cloud.recommender.v1; + +public interface SustainabilityProjectionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.recommender.v1.SustainabilityProjection) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Carbon Footprint generated in kg of CO2 equivalent.
+   * Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e).
+   * 
+ * + * double kg_c_o2e = 1; + * + * @return The kgCO2e. + */ + double getKgCO2E(); + + /** + * + * + *
+   * Duration for which this sustainability applies.
+   * 
+ * + * .google.protobuf.Duration duration = 2; + * + * @return Whether the duration field is set. + */ + boolean hasDuration(); + /** + * + * + *
+   * Duration for which this sustainability applies.
+   * 
+ * + * .google.protobuf.Duration duration = 2; + * + * @return The duration. + */ + com.google.protobuf.Duration getDuration(); + /** + * + * + *
+   * Duration for which this sustainability applies.
+   * 
+ * + * .google.protobuf.Duration duration = 2; + */ + com.google.protobuf.DurationOrBuilder getDurationOrBuilder(); +} diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/insight.proto b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/insight.proto index 2d7c01339e33..8022297e971a 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/insight.proto +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/insight.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ option (google.api.resource_definition) = { }; // An insight along with the information used to derive the insight. The insight -// may have associated recomendations as well. +// may have associated recommendations as well. message Insight { option (google.api.resource) = { type: "recommender.googleapis.com/Insight" @@ -62,6 +62,12 @@ message Insight { // This insight is related to manageability. MANAGEABILITY = 4; + + // The insight is related to sustainability. + SUSTAINABILITY = 5; + + // This insight is related to reliability. + RELIABILITY = 6; } // Insight severity levels. diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/insight_type_config.proto b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/insight_type_config.proto index 742864bc75b3..457d6fbca4dd 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/insight_type_config.proto +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/insight_type_config.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ message InsightTypeConfig { type: "recommender.googleapis.com/InsightTypeConfig" pattern: "projects/{project}/locations/{location}/insightTypes/{insight_type}/config" pattern: "organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config" + pattern: "billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/config" }; // Name of insight type config. diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommendation.proto b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommendation.proto index fd1533456880..ec6932580d2b 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommendation.proto +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommendation.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -264,6 +264,42 @@ message SecurityProjection { google.protobuf.Struct details = 2; } +// Contains metadata about how much sustainability a recommendation can save or +// incur. +message SustainabilityProjection { + // Carbon Footprint generated in kg of CO2 equivalent. + // Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e). + double kg_c_o2e = 1; + + // Duration for which this sustainability applies. + google.protobuf.Duration duration = 2; +} + +// Contains information on the impact of a reliability recommendation. +message ReliabilityProjection { + // The risk associated with the reliability issue. + enum RiskType { + // Default unspecified risk. Don't use directly. + RISK_TYPE_UNSPECIFIED = 0; + + // Potential service downtime. + SERVICE_DISRUPTION = 1; + + // Potential data loss. + DATA_LOSS = 2; + + // Potential access denial. The service is still up but some or all clients + // can't access it. + ACCESS_DENY = 3; + } + + // Reliability risks mitigated by this recommendation. + repeated RiskType risks = 1; + + // Per-recommender projection. + google.protobuf.Struct details = 2; +} + // Contains the impact a recommendation can have for a given category. message Impact { // The category of the impact. @@ -282,6 +318,12 @@ message Impact { // Indicates a potential increase or decrease in manageability. MANAGEABILITY = 4; + + // Indicates a potential increase or decrease in sustainability. + SUSTAINABILITY = 5; + + // Indicates a potential increase or decrease in reliability. + RELIABILITY = 6; } // Category that is being targeted. @@ -294,6 +336,12 @@ message Impact { // Use with CategoryType.SECURITY SecurityProjection security_projection = 101; + + // Use with CategoryType.SUSTAINABILITY + SustainabilityProjection sustainability_projection = 102; + + // Use with CategoryType.RELAIBILITY + ReliabilityProjection reliability_projection = 103; } } diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommender_config.proto b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommender_config.proto index 0e0c613b9820..19daba2c197c 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommender_config.proto +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommender_config.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ message RecommenderConfig { type: "recommender.googleapis.com/RecommenderConfig" pattern: "projects/{project}/locations/{location}/recommenders/{recommender}/config" pattern: "organizations/{organization}/locations/{location}/recommenders/{recommender}/config" + pattern: "billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/config" }; // Name of recommender config. diff --git a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommender_service.proto b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommender_service.proto index 947687639d1a..991e3796ed19 100644 --- a/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommender_service.proto +++ b/java-recommender/proto-google-cloud-recommender-v1/src/main/proto/google/cloud/recommender/v1/recommender_service.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -142,6 +142,35 @@ service Recommender { option (google.api.method_signature) = "name"; } + // 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. + rpc MarkRecommendationDismissed(MarkRecommendationDismissedRequest) + returns (Recommendation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markDismissed" + body: "*" + additional_bindings { + post: "/v1/{name=billingAccounts/*/locations/*/recommenders/*/recommendations/*}:markDismissed" + body: "*" + } + additional_bindings { + post: "/v1/{name=folders/*/locations/*/recommenders/*/recommendations/*}:markDismissed" + body: "*" + } + additional_bindings { + post: "/v1/{name=organizations/*/locations/*/recommenders/*/recommendations/*}:markDismissed" + body: "*" + } + }; + } + // 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 @@ -246,6 +275,9 @@ service Recommender { additional_bindings { get: "/v1/{name=organizations/*/locations/*/recommenders/*/config}" } + additional_bindings { + get: "/v1/{name=billingAccounts/*/locations/*/recommenders/*/config}" + } }; option (google.api.method_signature) = "name"; } @@ -261,6 +293,10 @@ service Recommender { patch: "/v1/{recommender_config.name=organizations/*/locations/*/recommenders/*/config}" body: "recommender_config" } + additional_bindings { + patch: "/v1/{recommender_config.name=billingAccounts/*/locations/*/recommenders/*/config}" + body: "recommender_config" + } }; option (google.api.method_signature) = "recommender_config,update_mask"; } @@ -274,6 +310,9 @@ service Recommender { additional_bindings { get: "/v1/{name=organizations/*/locations/*/insightTypes/*/config}" } + additional_bindings { + get: "/v1/{name=billingAccounts/*/locations/*/insightTypes/*/config}" + } }; option (google.api.method_signature) = "name"; } @@ -289,6 +328,10 @@ service Recommender { patch: "/v1/{insight_type_config.name=organizations/*/locations/*/insightTypes/*/config}" body: "insight_type_config" } + additional_bindings { + patch: "/v1/{insight_type_config.name=billingAccounts/*/locations/*/insightTypes/*/config}" + body: "insight_type_config" + } }; option (google.api.method_signature) = "insight_type_config,update_mask"; } @@ -477,6 +520,20 @@ message GetRecommendationRequest { ]; } +// Request for the `MarkRecommendationDismissed` Method. +message MarkRecommendationDismissedRequest { + // Name of the recommendation. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "recommender.googleapis.com/Recommendation" + } + ]; + + // Fingerprint of the Recommendation. Provides optimistic locking. + string etag = 2; +} + // Request for the `MarkRecommendationClaimed` Method. message MarkRecommendationClaimedRequest { // Required. Name of the recommendation. @@ -548,6 +605,8 @@ message GetRecommenderConfigRequest { // * `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` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -576,11 +635,13 @@ message GetInsightTypeConfigRequest { // // Acceptable formats: // - // * `projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + // * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` + // + // * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` // - // * `projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` // - // * `organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config` + // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { diff --git a/java-recommender/samples/snippets/generated/com/google/cloud/recommender/v1/recommender/markrecommendationdismissed/AsyncMarkRecommendationDismissed.java b/java-recommender/samples/snippets/generated/com/google/cloud/recommender/v1/recommender/markrecommendationdismissed/AsyncMarkRecommendationDismissed.java new file mode 100644 index 000000000000..af3744fe5663 --- /dev/null +++ b/java-recommender/samples/snippets/generated/com/google/cloud/recommender/v1/recommender/markrecommendationdismissed/AsyncMarkRecommendationDismissed.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recommender.v1.samples; + +// [START recommender_v1_generated_Recommender_MarkRecommendationDismissed_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest; +import com.google.cloud.recommender.v1.Recommendation; +import com.google.cloud.recommender.v1.RecommendationName; +import com.google.cloud.recommender.v1.RecommenderClient; + +public class AsyncMarkRecommendationDismissed { + + public static void main(String[] args) throws Exception { + asyncMarkRecommendationDismissed(); + } + + public static void asyncMarkRecommendationDismissed() throws Exception { + // 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 future = + recommenderClient.markRecommendationDismissedCallable().futureCall(request); + // Do something. + Recommendation response = future.get(); + } + } +} +// [END recommender_v1_generated_Recommender_MarkRecommendationDismissed_async] diff --git a/java-recommender/samples/snippets/generated/com/google/cloud/recommender/v1/recommender/markrecommendationdismissed/SyncMarkRecommendationDismissed.java b/java-recommender/samples/snippets/generated/com/google/cloud/recommender/v1/recommender/markrecommendationdismissed/SyncMarkRecommendationDismissed.java new file mode 100644 index 000000000000..42b6a0932cd2 --- /dev/null +++ b/java-recommender/samples/snippets/generated/com/google/cloud/recommender/v1/recommender/markrecommendationdismissed/SyncMarkRecommendationDismissed.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recommender.v1.samples; + +// [START recommender_v1_generated_Recommender_MarkRecommendationDismissed_sync] +import com.google.cloud.recommender.v1.MarkRecommendationDismissedRequest; +import com.google.cloud.recommender.v1.Recommendation; +import com.google.cloud.recommender.v1.RecommendationName; +import com.google.cloud.recommender.v1.RecommenderClient; + +public class SyncMarkRecommendationDismissed { + + public static void main(String[] args) throws Exception { + syncMarkRecommendationDismissed(); + } + + public static void syncMarkRecommendationDismissed() throws Exception { + // 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); + } + } +} +// [END recommender_v1_generated_Recommender_MarkRecommendationDismissed_sync]