Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [servicemanagement] Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport #8785

Merged
merged 2 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions java-service-management/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-service-management</artifactId>
<version>3.3.0</version>
<version>3.4.0</version>
</dependency>
```

If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-service-management:3.3.0'
implementation 'com.google.cloud:google-cloud-service-management:3.4.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-service-management" % "3.3.0"
libraryDependencies += "com.google.cloud" % "google-cloud-service-management" % "3.4.0"
```

## Authentication
Expand Down Expand Up @@ -159,16 +159,16 @@ Java is a registered trademark of Oracle and/or its affiliates.

[product-docs]: https://cloud.google.com/service-infrastructure/docs/overview/
[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-service-management/latest/overview
[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java7.svg
[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java7.html
[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java8.svg
[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java8.html
[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java8-osx.svg
[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java8-osx.html
[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java8-win.svg
[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java8-win.html
[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java11.svg
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-service-management/java11.html
[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.svg
[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java7.html
[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.svg
[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8.html
[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.svg
[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-osx.html
[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.svg
[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java8-win.html
[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.svg
[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-management.svg
[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-service-management&core=gav
Expand All @@ -180,9 +180,9 @@ Java is a registered trademark of Oracle and/or its affiliates.
[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects
[cloud-sdk]: https://cloud.google.com/sdk/
[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting
[contributing]: https://github.com/googleapis/java-service-management/blob/main/CONTRIBUTING.md
[code-of-conduct]: https://github.com/googleapis/java-service-management/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct
[license]: https://github.com/googleapis/java-service-management/blob/main/LICENSE
[contributing]: https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md
[code-of-conduct]: https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct
[license]: https://github.com/googleapis/google-cloud-java/blob/main/LICENSE
[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing
[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=service-management.googleapis.com
[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(
fields, "producerProjectId", request.getProducerProjectId());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -148,6 +149,7 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<GetServiceRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -180,12 +182,13 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<CreateServiceRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("service", request.getService(), false))
.toBody("service", request.getService(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -220,6 +223,7 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<DeleteServiceRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -257,6 +261,7 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<UndeleteServiceRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -297,6 +302,7 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -334,6 +340,7 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
ProtoRestSerializer<GetServiceConfigRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "view", request.getViewValue());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -369,12 +376,13 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<CreateServiceConfigRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("serviceConfig", request.getServiceConfig(), false))
.toBody("serviceConfig", request.getServiceConfig(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Service>newBuilder()
Expand Down Expand Up @@ -407,13 +415,14 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<SubmitConfigSourceRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody(
"*", request.toBuilder().clearServiceName().build(), false))
"*", request.toBuilder().clearServiceName().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -452,6 +461,7 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
serializer.putQueryParam(fields, "filter", request.getFilter());
serializer.putQueryParam(fields, "pageSize", request.getPageSize());
serializer.putQueryParam(fields, "pageToken", request.getPageToken());
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -487,6 +497,7 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<GetServiceRolloutRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(request -> null)
Expand Down Expand Up @@ -522,12 +533,13 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<CreateServiceRolloutRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("rollout", request.getRollout(), false))
.toBody("rollout", request.getRollout(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<Operation>newBuilder()
Expand Down Expand Up @@ -563,12 +575,13 @@ public class HttpJsonServiceManagerStub extends ServiceManagerStub {
Map<String, List<String>> fields = new HashMap<>();
ProtoRestSerializer<GenerateConfigReportRequest> serializer =
ProtoRestSerializer.create();
serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
return fields;
})
.setRequestBodyExtractor(
request ->
ProtoRestSerializer.create()
.toBody("*", request.toBuilder().build(), false))
.toBody("*", request.toBuilder().build(), true))
.build())
.setResponseParser(
ProtoMessageResponseParser.<GenerateConfigReportResponse>newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.google.api.MetricDescriptor;
import com.google.api.MonitoredResourceDescriptor;
import com.google.api.Monitoring;
import com.google.api.Publishing;
import com.google.api.Quota;
import com.google.api.Service;
import com.google.api.SourceInfo;
Expand Down Expand Up @@ -437,6 +438,7 @@ public void getServiceConfigTest() throws Exception {
.setMonitoring(Monitoring.newBuilder().build())
.setSystemParameters(SystemParameters.newBuilder().build())
.setSourceInfo(SourceInfo.newBuilder().build())
.setPublishing(Publishing.newBuilder().build())
.setConfigVersion(UInt32Value.newBuilder().build())
.build();
mockService.addResponse(expectedResponse);
Expand Down Expand Up @@ -509,6 +511,7 @@ public void createServiceConfigTest() throws Exception {
.setMonitoring(Monitoring.newBuilder().build())
.setSystemParameters(SystemParameters.newBuilder().build())
.setSourceInfo(SourceInfo.newBuilder().build())
.setPublishing(Publishing.newBuilder().build())
.setConfigVersion(UInt32Value.newBuilder().build())
.build();
mockService.addResponse(expectedResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.google.api.MetricDescriptor;
import com.google.api.MonitoredResourceDescriptor;
import com.google.api.Monitoring;
import com.google.api.Publishing;
import com.google.api.Quota;
import com.google.api.Service;
import com.google.api.SourceInfo;
Expand Down Expand Up @@ -427,6 +428,7 @@ public void getServiceConfigTest() throws Exception {
.setMonitoring(Monitoring.newBuilder().build())
.setSystemParameters(SystemParameters.newBuilder().build())
.setSourceInfo(SourceInfo.newBuilder().build())
.setPublishing(Publishing.newBuilder().build())
.setConfigVersion(UInt32Value.newBuilder().build())
.build();
mockServiceManager.addResponse(expectedResponse);
Expand Down Expand Up @@ -495,6 +497,7 @@ public void createServiceConfigTest() throws Exception {
.setMonitoring(Monitoring.newBuilder().build())
.setSystemParameters(SystemParameters.newBuilder().build())
.setSourceInfo(SourceInfo.newBuilder().build())
.setPublishing(Publishing.newBuilder().build())
.setConfigVersion(UInt32Value.newBuilder().build())
.build();
mockServiceManager.addResponse(expectedResponse);
Expand Down