Skip to content

Commit

Permalink
feat: [servicecontrol] include api_key_uid in service control check r…
Browse files Browse the repository at this point in the history
…esponse (#10410)

* feat: include api_key_uid in service control check response

PiperOrigin-RevId: 608766712

Source-Link: googleapis/googleapis@7ac2785

Source-Link: googleapis/googleapis-gen@3864b57
Copy-Tag: eyJwIjoiamF2YS1zZXJ2aWNlLWNvbnRyb2wvLk93bEJvdC55YW1sIiwiaCI6IjM4NjRiNTc1OGI5ZDEwMjI3OTQ1YWI5NzNmM2M2OThhNTM2ZDJmNzgifQ==

* 🦉 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 Feb 29, 2024
1 parent 391f4f0 commit 4ed5b45
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 40 deletions.
2 changes: 1 addition & 1 deletion java-service-control/README.md
Original file line number Diff line number Diff line change
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-service-control.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-service-control/1.35.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-service-control/1.36.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,35 @@ public interface CheckInfoOrBuilder
* <code>.google.api.servicecontrol.v1.CheckResponse.ConsumerInfo consumer_info = 2;</code>
*/
com.google.api.servicecontrol.v1.CheckResponse.ConsumerInfoOrBuilder getConsumerInfoOrBuilder();

/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @return The apiKeyUid.
*/
java.lang.String getApiKeyUid();
/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @return The bytes for apiKeyUid.
*/
com.google.protobuf.ByteString getApiKeyUidBytes();
}
/**
*
Expand All @@ -186,6 +215,7 @@ private CheckInfo(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {

private CheckInfo() {
unusedArguments_ = com.google.protobuf.LazyStringArrayList.emptyList();
apiKeyUid_ = "";
}

@java.lang.Override
Expand Down Expand Up @@ -333,6 +363,61 @@ public com.google.api.servicecontrol.v1.CheckResponse.ConsumerInfo getConsumerIn
: consumerInfo_;
}

public static final int API_KEY_UID_FIELD_NUMBER = 5;

@SuppressWarnings("serial")
private volatile java.lang.Object apiKeyUid_ = "";
/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @return The apiKeyUid.
*/
@java.lang.Override
public java.lang.String getApiKeyUid() {
java.lang.Object ref = apiKeyUid_;
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();
apiKeyUid_ = s;
return s;
}
}
/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @return The bytes for apiKeyUid.
*/
@java.lang.Override
public com.google.protobuf.ByteString getApiKeyUidBytes() {
java.lang.Object ref = apiKeyUid_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
apiKeyUid_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
Expand All @@ -353,6 +438,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (((bitField0_ & 0x00000001) != 0)) {
output.writeMessage(2, getConsumerInfo());
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(apiKeyUid_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 5, apiKeyUid_);
}
getUnknownFields().writeTo(output);
}

Expand All @@ -373,6 +461,9 @@ public int getSerializedSize() {
if (((bitField0_ & 0x00000001) != 0)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getConsumerInfo());
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(apiKeyUid_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, apiKeyUid_);
}
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
Expand All @@ -394,6 +485,7 @@ public boolean equals(final java.lang.Object obj) {
if (hasConsumerInfo()) {
if (!getConsumerInfo().equals(other.getConsumerInfo())) return false;
}
if (!getApiKeyUid().equals(other.getApiKeyUid())) return false;
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
Expand All @@ -413,6 +505,8 @@ public int hashCode() {
hash = (37 * hash) + CONSUMER_INFO_FIELD_NUMBER;
hash = (53 * hash) + getConsumerInfo().hashCode();
}
hash = (37 * hash) + API_KEY_UID_FIELD_NUMBER;
hash = (53 * hash) + getApiKeyUid().hashCode();
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
Expand Down Expand Up @@ -570,6 +664,7 @@ public Builder clear() {
consumerInfoBuilder_.dispose();
consumerInfoBuilder_ = null;
}
apiKeyUid_ = "";
return this;
}

Expand Down Expand Up @@ -616,6 +711,9 @@ private void buildPartial0(com.google.api.servicecontrol.v1.CheckResponse.CheckI
consumerInfoBuilder_ == null ? consumerInfo_ : consumerInfoBuilder_.build();
to_bitField0_ |= 0x00000001;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.apiKeyUid_ = apiKeyUid_;
}
result.bitField0_ |= to_bitField0_;
}

Expand Down Expand Up @@ -680,6 +778,11 @@ public Builder mergeFrom(com.google.api.servicecontrol.v1.CheckResponse.CheckInf
if (other.hasConsumerInfo()) {
mergeConsumerInfo(other.getConsumerInfo());
}
if (!other.getApiKeyUid().isEmpty()) {
apiKeyUid_ = other.apiKeyUid_;
bitField0_ |= 0x00000004;
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
Expand Down Expand Up @@ -719,6 +822,12 @@ public Builder mergeFrom(
bitField0_ |= 0x00000002;
break;
} // case 18
case 42:
{
apiKeyUid_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000004;
break;
} // case 42
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
Expand Down Expand Up @@ -1122,6 +1231,122 @@ public Builder clearConsumerInfo() {
return consumerInfoBuilder_;
}

private java.lang.Object apiKeyUid_ = "";
/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @return The apiKeyUid.
*/
public java.lang.String getApiKeyUid() {
java.lang.Object ref = apiKeyUid_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
apiKeyUid_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @return The bytes for apiKeyUid.
*/
public com.google.protobuf.ByteString getApiKeyUidBytes() {
java.lang.Object ref = apiKeyUid_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
apiKeyUid_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @param value The apiKeyUid to set.
* @return This builder for chaining.
*/
public Builder setApiKeyUid(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
apiKeyUid_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @return This builder for chaining.
*/
public Builder clearApiKeyUid() {
apiKeyUid_ = getDefaultInstance().getApiKeyUid();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
/**
*
*
* <pre>
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
* This field will be populated when the consumer passed to Service Control
* is an API key and all the API key related validations are successful.
* </pre>
*
* <code>string api_key_uid = 5;</code>
*
* @param value The bytes for apiKeyUid to set.
* @return This builder for chaining.
*/
public Builder setApiKeyUidBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
apiKeyUid_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}

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

0 comments on commit 4ed5b45

Please sign in to comment.