Skip to content

Commit

Permalink
feat: [recommender] Support cost_in_local_currency field in the cost …
Browse files Browse the repository at this point in the history
…projection (#10140)

* feat: Support cost_in_local_currency field in the cost projection
docs: Fix typo for the comment of reliability_projection
docs: Add comment for targetResources

PiperOrigin-RevId: 589982370

Source-Link: googleapis/googleapis@b7abf5c

Source-Link: googleapis/googleapis-gen@1617d1e
Copy-Tag: eyJwIjoiamF2YS1yZWNvbW1lbmRlci8uT3dsQm90LnlhbWwiLCJoIjoiMTYxN2QxZWRlMmEwNWMxMzI4OWNmZWE0ODgzYmNkZjkxMTZmNTY0ZSJ9

* 🦉 Updates from OwlBot post-processor

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

* 🦉 Updates from OwlBot post-processor

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

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Jan 3, 2024
1 parent 3ef3b0a commit ab29b60
Show file tree
Hide file tree
Showing 15 changed files with 535 additions and 76 deletions.
2 changes: 1 addition & 1 deletion java-recommender/README.md
Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-recommender.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-recommender/2.32.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-recommender/2.34.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Expand Up @@ -846,6 +846,9 @@ public final ListRecommendationsPagedResponse listRecommendations(String parent)
* <ul>
* <li>`priority`
* </ul>
* <ul>
* <li>`targetResources`
* </ul>
* <p>Examples:
* <ul>
* <li>`stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED`
Expand All @@ -857,8 +860,13 @@ public final ListRecommendationsPagedResponse listRecommendations(String parent)
* <li>`priority = P1 OR priority = P2`
* </ul>
* <ul>
* <li>`targetResources :
* //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1`
* </ul>
* <ul>
* <li>`stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)`
* </ul>
* <p>The max allowed filter length is 500 characters.
* <p>(These expressions are based on the filter language described at
* https://google.aip.dev/160)
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand Down Expand Up @@ -930,6 +938,9 @@ public final ListRecommendationsPagedResponse listRecommendations(
* <ul>
* <li>`priority`
* </ul>
* <ul>
* <li>`targetResources`
* </ul>
* <p>Examples:
* <ul>
* <li>`stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED`
Expand All @@ -941,8 +952,13 @@ public final ListRecommendationsPagedResponse listRecommendations(
* <li>`priority = P1 OR priority = P2`
* </ul>
* <ul>
* <li>`targetResources :
* //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1`
* </ul>
* <ul>
* <li>`stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)`
* </ul>
* <p>The max allowed filter length is 500 characters.
* <p>(These expressions are based on the filter language described at
* https://google.aip.dev/160)
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand Down
Expand Up @@ -167,6 +167,56 @@ public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() {
return duration_ == null ? com.google.protobuf.Duration.getDefaultInstance() : duration_;
}

public static final int COST_IN_LOCAL_CURRENCY_FIELD_NUMBER = 3;
private com.google.type.Money costInLocalCurrency_;
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*
* @return Whether the costInLocalCurrency field is set.
*/
@java.lang.Override
public boolean hasCostInLocalCurrency() {
return costInLocalCurrency_ != null;
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*
* @return The costInLocalCurrency.
*/
@java.lang.Override
public com.google.type.Money getCostInLocalCurrency() {
return costInLocalCurrency_ == null
? com.google.type.Money.getDefaultInstance()
: costInLocalCurrency_;
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*/
@java.lang.Override
public com.google.type.MoneyOrBuilder getCostInLocalCurrencyOrBuilder() {
return costInLocalCurrency_ == null
? com.google.type.Money.getDefaultInstance()
: costInLocalCurrency_;
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
Expand All @@ -187,6 +237,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (duration_ != null) {
output.writeMessage(2, getDuration());
}
if (costInLocalCurrency_ != null) {
output.writeMessage(3, getCostInLocalCurrency());
}
getUnknownFields().writeTo(output);
}

Expand All @@ -202,6 +255,9 @@ public int getSerializedSize() {
if (duration_ != null) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDuration());
}
if (costInLocalCurrency_ != null) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCostInLocalCurrency());
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -226,6 +282,10 @@ public boolean equals(final java.lang.Object obj) {
if (hasDuration()) {
if (!getDuration().equals(other.getDuration())) return false;
}
if (hasCostInLocalCurrency() != other.hasCostInLocalCurrency()) return false;
if (hasCostInLocalCurrency()) {
if (!getCostInLocalCurrency().equals(other.getCostInLocalCurrency())) return false;
}
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
Expand All @@ -245,6 +305,10 @@ public int hashCode() {
hash = (37 * hash) + DURATION_FIELD_NUMBER;
hash = (53 * hash) + getDuration().hashCode();
}
if (hasCostInLocalCurrency()) {
hash = (37 * hash) + COST_IN_LOCAL_CURRENCY_FIELD_NUMBER;
hash = (53 * hash) + getCostInLocalCurrency().hashCode();
}
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -394,6 +458,11 @@ public Builder clear() {
durationBuilder_.dispose();
durationBuilder_ = null;
}
costInLocalCurrency_ = null;
if (costInLocalCurrencyBuilder_ != null) {
costInLocalCurrencyBuilder_.dispose();
costInLocalCurrencyBuilder_ = null;
}
return this;
}

Expand Down Expand Up @@ -436,6 +505,12 @@ private void buildPartial0(com.google.cloud.recommender.v1.CostProjection result
if (((from_bitField0_ & 0x00000002) != 0)) {
result.duration_ = durationBuilder_ == null ? duration_ : durationBuilder_.build();
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.costInLocalCurrency_ =
costInLocalCurrencyBuilder_ == null
? costInLocalCurrency_
: costInLocalCurrencyBuilder_.build();
}
}

@java.lang.Override
Expand Down Expand Up @@ -489,6 +564,9 @@ public Builder mergeFrom(com.google.cloud.recommender.v1.CostProjection other) {
if (other.hasDuration()) {
mergeDuration(other.getDuration());
}
if (other.hasCostInLocalCurrency()) {
mergeCostInLocalCurrency(other.getCostInLocalCurrency());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
Expand Down Expand Up @@ -527,6 +605,13 @@ public Builder mergeFrom(
bitField0_ |= 0x00000002;
break;
} // case 18
case 26:
{
input.readMessage(
getCostInLocalCurrencyFieldBuilder().getBuilder(), extensionRegistry);
bitField0_ |= 0x00000004;
break;
} // case 26
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
Expand Down Expand Up @@ -944,6 +1029,185 @@ public com.google.protobuf.DurationOrBuilder getDurationOrBuilder() {
return durationBuilder_;
}

private com.google.type.Money costInLocalCurrency_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder>
costInLocalCurrencyBuilder_;
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*
* @return Whether the costInLocalCurrency field is set.
*/
public boolean hasCostInLocalCurrency() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*
* @return The costInLocalCurrency.
*/
public com.google.type.Money getCostInLocalCurrency() {
if (costInLocalCurrencyBuilder_ == null) {
return costInLocalCurrency_ == null
? com.google.type.Money.getDefaultInstance()
: costInLocalCurrency_;
} else {
return costInLocalCurrencyBuilder_.getMessage();
}
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*/
public Builder setCostInLocalCurrency(com.google.type.Money value) {
if (costInLocalCurrencyBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
costInLocalCurrency_ = value;
} else {
costInLocalCurrencyBuilder_.setMessage(value);
}
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*/
public Builder setCostInLocalCurrency(com.google.type.Money.Builder builderForValue) {
if (costInLocalCurrencyBuilder_ == null) {
costInLocalCurrency_ = builderForValue.build();
} else {
costInLocalCurrencyBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*/
public Builder mergeCostInLocalCurrency(com.google.type.Money value) {
if (costInLocalCurrencyBuilder_ == null) {
if (((bitField0_ & 0x00000004) != 0)
&& costInLocalCurrency_ != null
&& costInLocalCurrency_ != com.google.type.Money.getDefaultInstance()) {
getCostInLocalCurrencyBuilder().mergeFrom(value);
} else {
costInLocalCurrency_ = value;
}
} else {
costInLocalCurrencyBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*/
public Builder clearCostInLocalCurrency() {
bitField0_ = (bitField0_ & ~0x00000004);
costInLocalCurrency_ = null;
if (costInLocalCurrencyBuilder_ != null) {
costInLocalCurrencyBuilder_.dispose();
costInLocalCurrencyBuilder_ = null;
}
onChanged();
return this;
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*/
public com.google.type.Money.Builder getCostInLocalCurrencyBuilder() {
bitField0_ |= 0x00000004;
onChanged();
return getCostInLocalCurrencyFieldBuilder().getBuilder();
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*/
public com.google.type.MoneyOrBuilder getCostInLocalCurrencyOrBuilder() {
if (costInLocalCurrencyBuilder_ != null) {
return costInLocalCurrencyBuilder_.getMessageOrBuilder();
} else {
return costInLocalCurrency_ == null
? com.google.type.Money.getDefaultInstance()
: costInLocalCurrency_;
}
}
/**
*
*
* <pre>
* The approximate cost savings in the billing account's local currency.
* </pre>
*
* <code>.google.type.Money cost_in_local_currency = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder>
getCostInLocalCurrencyFieldBuilder() {
if (costInLocalCurrencyBuilder_ == null) {
costInLocalCurrencyBuilder_ =
new com.google.protobuf.SingleFieldBuilderV3<
com.google.type.Money,
com.google.type.Money.Builder,
com.google.type.MoneyOrBuilder>(
getCostInLocalCurrency(), getParentForChildren(), isClean());
costInLocalCurrency_ = null;
}
return costInLocalCurrencyBuilder_;
}

@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
Expand Down

0 comments on commit ab29b60

Please sign in to comment.