Skip to content

Commit 4ed5b45

Browse files
feat: [servicecontrol] include api_key_uid in service control check response (#10410)
* feat: include api_key_uid in service control check response PiperOrigin-RevId: 608766712 Source-Link: googleapis/googleapis@7ac2785 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3864b5758b9d10227945ab973f3c698a536d2f78 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>
1 parent 391f4f0 commit 4ed5b45

4 files changed

Lines changed: 271 additions & 40 deletions

File tree

‎java-service-control/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
195195
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
196196
[stability-image]: https://img.shields.io/badge/stability-stable-green
197197
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-service-control.svg
198-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-service-control/1.35.0
198+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-service-control/1.36.0
199199
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
200200
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
201201
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

‎java-service-control/proto-google-cloud-service-control-v1/src/main/java/com/google/api/servicecontrol/v1/CheckResponse.java‎

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,35 @@ public interface CheckInfoOrBuilder
164164
* <code>.google.api.servicecontrol.v1.CheckResponse.ConsumerInfo consumer_info = 2;</code>
165165
*/
166166
com.google.api.servicecontrol.v1.CheckResponse.ConsumerInfoOrBuilder getConsumerInfoOrBuilder();
167+
168+
/**
169+
*
170+
*
171+
* <pre>
172+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
173+
* This field will be populated when the consumer passed to Service Control
174+
* is an API key and all the API key related validations are successful.
175+
* </pre>
176+
*
177+
* <code>string api_key_uid = 5;</code>
178+
*
179+
* @return The apiKeyUid.
180+
*/
181+
java.lang.String getApiKeyUid();
182+
/**
183+
*
184+
*
185+
* <pre>
186+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
187+
* This field will be populated when the consumer passed to Service Control
188+
* is an API key and all the API key related validations are successful.
189+
* </pre>
190+
*
191+
* <code>string api_key_uid = 5;</code>
192+
*
193+
* @return The bytes for apiKeyUid.
194+
*/
195+
com.google.protobuf.ByteString getApiKeyUidBytes();
167196
}
168197
/**
169198
*
@@ -186,6 +215,7 @@ private CheckInfo(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
186215

187216
private CheckInfo() {
188217
unusedArguments_ = com.google.protobuf.LazyStringArrayList.emptyList();
218+
apiKeyUid_ = "";
189219
}
190220

191221
@java.lang.Override
@@ -333,6 +363,61 @@ public com.google.api.servicecontrol.v1.CheckResponse.ConsumerInfo getConsumerIn
333363
: consumerInfo_;
334364
}
335365

366+
public static final int API_KEY_UID_FIELD_NUMBER = 5;
367+
368+
@SuppressWarnings("serial")
369+
private volatile java.lang.Object apiKeyUid_ = "";
370+
/**
371+
*
372+
*
373+
* <pre>
374+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
375+
* This field will be populated when the consumer passed to Service Control
376+
* is an API key and all the API key related validations are successful.
377+
* </pre>
378+
*
379+
* <code>string api_key_uid = 5;</code>
380+
*
381+
* @return The apiKeyUid.
382+
*/
383+
@java.lang.Override
384+
public java.lang.String getApiKeyUid() {
385+
java.lang.Object ref = apiKeyUid_;
386+
if (ref instanceof java.lang.String) {
387+
return (java.lang.String) ref;
388+
} else {
389+
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
390+
java.lang.String s = bs.toStringUtf8();
391+
apiKeyUid_ = s;
392+
return s;
393+
}
394+
}
395+
/**
396+
*
397+
*
398+
* <pre>
399+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
400+
* This field will be populated when the consumer passed to Service Control
401+
* is an API key and all the API key related validations are successful.
402+
* </pre>
403+
*
404+
* <code>string api_key_uid = 5;</code>
405+
*
406+
* @return The bytes for apiKeyUid.
407+
*/
408+
@java.lang.Override
409+
public com.google.protobuf.ByteString getApiKeyUidBytes() {
410+
java.lang.Object ref = apiKeyUid_;
411+
if (ref instanceof java.lang.String) {
412+
com.google.protobuf.ByteString b =
413+
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
414+
apiKeyUid_ = b;
415+
return b;
416+
} else {
417+
return (com.google.protobuf.ByteString) ref;
418+
}
419+
}
420+
336421
private byte memoizedIsInitialized = -1;
337422

338423
@java.lang.Override
@@ -353,6 +438,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
353438
if (((bitField0_ & 0x00000001) != 0)) {
354439
output.writeMessage(2, getConsumerInfo());
355440
}
441+
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(apiKeyUid_)) {
442+
com.google.protobuf.GeneratedMessageV3.writeString(output, 5, apiKeyUid_);
443+
}
356444
getUnknownFields().writeTo(output);
357445
}
358446

@@ -373,6 +461,9 @@ public int getSerializedSize() {
373461
if (((bitField0_ & 0x00000001) != 0)) {
374462
size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getConsumerInfo());
375463
}
464+
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(apiKeyUid_)) {
465+
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, apiKeyUid_);
466+
}
376467
size += getUnknownFields().getSerializedSize();
377468
memoizedSize = size;
378469
return size;
@@ -394,6 +485,7 @@ public boolean equals(final java.lang.Object obj) {
394485
if (hasConsumerInfo()) {
395486
if (!getConsumerInfo().equals(other.getConsumerInfo())) return false;
396487
}
488+
if (!getApiKeyUid().equals(other.getApiKeyUid())) return false;
397489
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
398490
return true;
399491
}
@@ -413,6 +505,8 @@ public int hashCode() {
413505
hash = (37 * hash) + CONSUMER_INFO_FIELD_NUMBER;
414506
hash = (53 * hash) + getConsumerInfo().hashCode();
415507
}
508+
hash = (37 * hash) + API_KEY_UID_FIELD_NUMBER;
509+
hash = (53 * hash) + getApiKeyUid().hashCode();
416510
hash = (29 * hash) + getUnknownFields().hashCode();
417511
memoizedHashCode = hash;
418512
return hash;
@@ -570,6 +664,7 @@ public Builder clear() {
570664
consumerInfoBuilder_.dispose();
571665
consumerInfoBuilder_ = null;
572666
}
667+
apiKeyUid_ = "";
573668
return this;
574669
}
575670

@@ -616,6 +711,9 @@ private void buildPartial0(com.google.api.servicecontrol.v1.CheckResponse.CheckI
616711
consumerInfoBuilder_ == null ? consumerInfo_ : consumerInfoBuilder_.build();
617712
to_bitField0_ |= 0x00000001;
618713
}
714+
if (((from_bitField0_ & 0x00000004) != 0)) {
715+
result.apiKeyUid_ = apiKeyUid_;
716+
}
619717
result.bitField0_ |= to_bitField0_;
620718
}
621719

@@ -680,6 +778,11 @@ public Builder mergeFrom(com.google.api.servicecontrol.v1.CheckResponse.CheckInf
680778
if (other.hasConsumerInfo()) {
681779
mergeConsumerInfo(other.getConsumerInfo());
682780
}
781+
if (!other.getApiKeyUid().isEmpty()) {
782+
apiKeyUid_ = other.apiKeyUid_;
783+
bitField0_ |= 0x00000004;
784+
onChanged();
785+
}
683786
this.mergeUnknownFields(other.getUnknownFields());
684787
onChanged();
685788
return this;
@@ -719,6 +822,12 @@ public Builder mergeFrom(
719822
bitField0_ |= 0x00000002;
720823
break;
721824
} // case 18
825+
case 42:
826+
{
827+
apiKeyUid_ = input.readStringRequireUtf8();
828+
bitField0_ |= 0x00000004;
829+
break;
830+
} // case 42
722831
default:
723832
{
724833
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
@@ -1122,6 +1231,122 @@ public Builder clearConsumerInfo() {
11221231
return consumerInfoBuilder_;
11231232
}
11241233

1234+
private java.lang.Object apiKeyUid_ = "";
1235+
/**
1236+
*
1237+
*
1238+
* <pre>
1239+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
1240+
* This field will be populated when the consumer passed to Service Control
1241+
* is an API key and all the API key related validations are successful.
1242+
* </pre>
1243+
*
1244+
* <code>string api_key_uid = 5;</code>
1245+
*
1246+
* @return The apiKeyUid.
1247+
*/
1248+
public java.lang.String getApiKeyUid() {
1249+
java.lang.Object ref = apiKeyUid_;
1250+
if (!(ref instanceof java.lang.String)) {
1251+
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
1252+
java.lang.String s = bs.toStringUtf8();
1253+
apiKeyUid_ = s;
1254+
return s;
1255+
} else {
1256+
return (java.lang.String) ref;
1257+
}
1258+
}
1259+
/**
1260+
*
1261+
*
1262+
* <pre>
1263+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
1264+
* This field will be populated when the consumer passed to Service Control
1265+
* is an API key and all the API key related validations are successful.
1266+
* </pre>
1267+
*
1268+
* <code>string api_key_uid = 5;</code>
1269+
*
1270+
* @return The bytes for apiKeyUid.
1271+
*/
1272+
public com.google.protobuf.ByteString getApiKeyUidBytes() {
1273+
java.lang.Object ref = apiKeyUid_;
1274+
if (ref instanceof String) {
1275+
com.google.protobuf.ByteString b =
1276+
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
1277+
apiKeyUid_ = b;
1278+
return b;
1279+
} else {
1280+
return (com.google.protobuf.ByteString) ref;
1281+
}
1282+
}
1283+
/**
1284+
*
1285+
*
1286+
* <pre>
1287+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
1288+
* This field will be populated when the consumer passed to Service Control
1289+
* is an API key and all the API key related validations are successful.
1290+
* </pre>
1291+
*
1292+
* <code>string api_key_uid = 5;</code>
1293+
*
1294+
* @param value The apiKeyUid to set.
1295+
* @return This builder for chaining.
1296+
*/
1297+
public Builder setApiKeyUid(java.lang.String value) {
1298+
if (value == null) {
1299+
throw new NullPointerException();
1300+
}
1301+
apiKeyUid_ = value;
1302+
bitField0_ |= 0x00000004;
1303+
onChanged();
1304+
return this;
1305+
}
1306+
/**
1307+
*
1308+
*
1309+
* <pre>
1310+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
1311+
* This field will be populated when the consumer passed to Service Control
1312+
* is an API key and all the API key related validations are successful.
1313+
* </pre>
1314+
*
1315+
* <code>string api_key_uid = 5;</code>
1316+
*
1317+
* @return This builder for chaining.
1318+
*/
1319+
public Builder clearApiKeyUid() {
1320+
apiKeyUid_ = getDefaultInstance().getApiKeyUid();
1321+
bitField0_ = (bitField0_ & ~0x00000004);
1322+
onChanged();
1323+
return this;
1324+
}
1325+
/**
1326+
*
1327+
*
1328+
* <pre>
1329+
* The unique id of the api key in the format of "apikey:&lt;UID&gt;".
1330+
* This field will be populated when the consumer passed to Service Control
1331+
* is an API key and all the API key related validations are successful.
1332+
* </pre>
1333+
*
1334+
* <code>string api_key_uid = 5;</code>
1335+
*
1336+
* @param value The bytes for apiKeyUid to set.
1337+
* @return This builder for chaining.
1338+
*/
1339+
public Builder setApiKeyUidBytes(com.google.protobuf.ByteString value) {
1340+
if (value == null) {
1341+
throw new NullPointerException();
1342+
}
1343+
checkByteStringIsUtf8(value);
1344+
apiKeyUid_ = value;
1345+
bitField0_ |= 0x00000004;
1346+
onChanged();
1347+
return this;
1348+
}
1349+
11251350
@java.lang.Override
11261351
public final Builder setUnknownFields(
11271352
final com.google.protobuf.UnknownFieldSet unknownFields) {

0 commit comments

Comments
 (0)