Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

feat: Enable REST transport for most of Java and Go clients #670

Merged
merged 4 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: Enable REST transport for most of Java and Go clients
PiperOrigin-RevId: 456641589

Source-Link: googleapis/googleapis@8a251f5

Source-Link: googleapis/googleapis-gen@4ca52a5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Jun 23, 2022
commit 29711f8cb8db3e7caa20d3956c41557bb1b77d07

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
* methods:
*
* <ol>
* <li>A "flattened" method. With this type of method, the fields of the request type have been
* <li> A "flattened" method. With this type of method, the fields of the request type have been
* converted into function parameters. It may be the case that not all fields are available as
* parameters, and not every API method will have a flattened method entry point.
* <li>A "request object" method. This type of method only takes one parameter, a request object,
* <li> A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
* <li> A "callable" method. This type of method takes no parameters and returns an immutable API
* callable object, which can be used to initiate calls to the service.
* </ol>
*
Expand Down Expand Up @@ -102,6 +102,20 @@
* CloudBillingClient cloudBillingClient = CloudBillingClient.create(cloudBillingSettings);
* }</pre>
*
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* CloudBillingSettings cloudBillingSettings =
* CloudBillingSettings.newBuilder()
* .setTransportChannelProvider(
* CloudBillingSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* CloudBillingClient cloudBillingClient = CloudBillingClient.create(cloudBillingSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
Expand Down Expand Up @@ -875,7 +889,7 @@ public final ProjectBillingInfo getProjectBillingInfo(GetProjectBillingInfoReque
* the name of an
*
* <ul>
* <li>open&#42; billing account.
* <li> open&#42; billing account.
* </ul>
*
* <p>Sample code:
Expand Down Expand Up @@ -936,7 +950,7 @@ public final ProjectBillingInfo updateProjectBillingInfo(
* the name of an
*
* <ul>
* <li>open&#42; billing account.
* <li> open&#42; billing account.
* </ul>
*
* <p>Sample code:
Expand Down Expand Up @@ -991,7 +1005,7 @@ public final ProjectBillingInfo updateProjectBillingInfo(
* the name of an
*
* <ul>
* <li>open&#42; billing account.
* <li> open&#42; billing account.
* </ul>
*
* <p>Sample code:
Expand Down Expand Up @@ -1414,11 +1428,8 @@ public boolean awaitTermination(long duration, TimeUnit unit) throws Interrupted

public static class ListBillingAccountsPagedResponse
extends AbstractPagedListResponse<
ListBillingAccountsRequest,
ListBillingAccountsResponse,
BillingAccount,
ListBillingAccountsPage,
ListBillingAccountsFixedSizeCollection> {
ListBillingAccountsRequest, ListBillingAccountsResponse, BillingAccount,
ListBillingAccountsPage, ListBillingAccountsFixedSizeCollection> {

public static ApiFuture<ListBillingAccountsPagedResponse> createAsync(
PageContext<ListBillingAccountsRequest, ListBillingAccountsResponse, BillingAccount>
Expand All @@ -1439,9 +1450,7 @@ private ListBillingAccountsPagedResponse(ListBillingAccountsPage page) {

public static class ListBillingAccountsPage
extends AbstractPage<
ListBillingAccountsRequest,
ListBillingAccountsResponse,
BillingAccount,
ListBillingAccountsRequest, ListBillingAccountsResponse, BillingAccount,
ListBillingAccountsPage> {

private ListBillingAccountsPage(
Expand Down Expand Up @@ -1474,11 +1483,8 @@ public ApiFuture<ListBillingAccountsPage> createPageAsync(

public static class ListBillingAccountsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListBillingAccountsRequest,
ListBillingAccountsResponse,
BillingAccount,
ListBillingAccountsPage,
ListBillingAccountsFixedSizeCollection> {
ListBillingAccountsRequest, ListBillingAccountsResponse, BillingAccount,
ListBillingAccountsPage, ListBillingAccountsFixedSizeCollection> {

private ListBillingAccountsFixedSizeCollection(
List<ListBillingAccountsPage> pages, int collectionSize) {
Expand All @@ -1498,11 +1504,8 @@ protected ListBillingAccountsFixedSizeCollection createCollection(

public static class ListProjectBillingInfoPagedResponse
extends AbstractPagedListResponse<
ListProjectBillingInfoRequest,
ListProjectBillingInfoResponse,
ProjectBillingInfo,
ListProjectBillingInfoPage,
ListProjectBillingInfoFixedSizeCollection> {
ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo,
ListProjectBillingInfoPage, ListProjectBillingInfoFixedSizeCollection> {

public static ApiFuture<ListProjectBillingInfoPagedResponse> createAsync(
PageContext<
Expand All @@ -1524,9 +1527,7 @@ private ListProjectBillingInfoPagedResponse(ListProjectBillingInfoPage page) {

public static class ListProjectBillingInfoPage
extends AbstractPage<
ListProjectBillingInfoRequest,
ListProjectBillingInfoResponse,
ProjectBillingInfo,
ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo,
ListProjectBillingInfoPage> {

private ListProjectBillingInfoPage(
Expand Down Expand Up @@ -1562,11 +1563,8 @@ public ApiFuture<ListProjectBillingInfoPage> createPageAsync(

public static class ListProjectBillingInfoFixedSizeCollection
extends AbstractFixedSizeCollection<
ListProjectBillingInfoRequest,
ListProjectBillingInfoResponse,
ProjectBillingInfo,
ListProjectBillingInfoPage,
ListProjectBillingInfoFixedSizeCollection> {
ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo,
ListProjectBillingInfoPage, ListProjectBillingInfoFixedSizeCollection> {

private ListProjectBillingInfoFixedSizeCollection(
List<ListProjectBillingInfoPage> pages, int collectionSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.billing.v1.stub.CloudBillingStubSettings;
Expand All @@ -47,9 +49,9 @@
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (cloudbilling.googleapis.com) and default port (443) are used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* <li> The default service address (cloudbilling.googleapis.com) and default port (443) are used.
* <li> Credentials are acquired automatically through Application Default Credentials.
* <li> Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
Expand Down Expand Up @@ -102,8 +104,7 @@ public UnaryCallSettings<GetBillingAccountRequest, BillingAccount> getBillingAcc

/** Returns the object with the settings used for calls to listProjectBillingInfo. */
public PagedCallSettings<
ListProjectBillingInfoRequest,
ListProjectBillingInfoResponse,
ListProjectBillingInfoRequest, ListProjectBillingInfoResponse,
ListProjectBillingInfoPagedResponse>
listProjectBillingInfoSettings() {
return ((CloudBillingStubSettings) getStubSettings()).listProjectBillingInfoSettings();
Expand Down Expand Up @@ -162,11 +163,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return CloudBillingStubSettings.defaultCredentialsProviderBuilder();
}

/** Returns a builder for the default ChannelProvider for this service. */
/** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return CloudBillingStubSettings.defaultGrpcTransportProviderBuilder();
}

/** Returns a builder for the default REST ChannelProvider for this service. */
@BetaApi
public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder() {
return CloudBillingStubSettings.defaultHttpJsonTransportProviderBuilder();
}

public static TransportChannelProvider defaultTransportChannelProvider() {
return CloudBillingStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -176,11 +184,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return CloudBillingStubSettings.defaultApiClientHeaderProviderBuilder();
}

/** Returns a new builder for this class. */
/** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}

/** Returns a new REST builder for this class. */
@BetaApi
public static Builder newHttpJsonBuilder() {
return Builder.createHttpJsonDefault();
}

/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
Expand Down Expand Up @@ -218,6 +232,11 @@ private static Builder createDefault() {
return new Builder(CloudBillingStubSettings.newBuilder());
}

@BetaApi
private static Builder createHttpJsonDefault() {
return new Builder(CloudBillingStubSettings.newHttpJsonBuilder());
}

public CloudBillingStubSettings.Builder getStubSettingsBuilder() {
return ((CloudBillingStubSettings.Builder) getStubSettings());
}
Expand All @@ -242,8 +261,7 @@ public Builder applyToAllUnaryMethods(

/** Returns the builder for the settings used for calls to listBillingAccounts. */
public PagedCallSettings.Builder<
ListBillingAccountsRequest,
ListBillingAccountsResponse,
ListBillingAccountsRequest, ListBillingAccountsResponse,
ListBillingAccountsPagedResponse>
listBillingAccountsSettings() {
return getStubSettingsBuilder().listBillingAccountsSettings();
Expand All @@ -263,8 +281,7 @@ public Builder applyToAllUnaryMethods(

/** Returns the builder for the settings used for calls to listProjectBillingInfo. */
public PagedCallSettings.Builder<
ListProjectBillingInfoRequest,
ListProjectBillingInfoResponse,
ListProjectBillingInfoRequest, ListProjectBillingInfoResponse,
ListProjectBillingInfoPagedResponse>
listProjectBillingInfoSettings() {
return getStubSettingsBuilder().listProjectBillingInfoSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
* methods:
*
* <ol>
* <li>A "flattened" method. With this type of method, the fields of the request type have been
* <li> A "flattened" method. With this type of method, the fields of the request type have been
* converted into function parameters. It may be the case that not all fields are available as
* parameters, and not every API method will have a flattened method entry point.
* <li>A "request object" method. This type of method only takes one parameter, a request object,
* <li> A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
* <li> A "callable" method. This type of method takes no parameters and returns an immutable API
* callable object, which can be used to initiate calls to the service.
* </ol>
*
Expand Down Expand Up @@ -98,6 +98,20 @@
* CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create(cloudCatalogSettings);
* }</pre>
*
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* CloudCatalogSettings cloudCatalogSettings =
* CloudCatalogSettings.newBuilder()
* .setTransportChannelProvider(
* CloudCatalogSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create(cloudCatalogSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
Expand Down Expand Up @@ -448,10 +462,7 @@ public boolean awaitTermination(long duration, TimeUnit unit) throws Interrupted

public static class ListServicesPagedResponse
extends AbstractPagedListResponse<
ListServicesRequest,
ListServicesResponse,
Service,
ListServicesPage,
ListServicesRequest, ListServicesResponse, Service, ListServicesPage,
ListServicesFixedSizeCollection> {

public static ApiFuture<ListServicesPagedResponse> createAsync(
Expand Down Expand Up @@ -500,10 +511,7 @@ public ApiFuture<ListServicesPage> createPageAsync(

public static class ListServicesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListServicesRequest,
ListServicesResponse,
Service,
ListServicesPage,
ListServicesRequest, ListServicesResponse, Service, ListServicesPage,
ListServicesFixedSizeCollection> {

private ListServicesFixedSizeCollection(List<ListServicesPage> pages, int collectionSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.billing.v1.stub.CloudCatalogStubSettings;
Expand All @@ -42,9 +44,9 @@
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (cloudbilling.googleapis.com) and default port (443) are used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* <li> The default service address (cloudbilling.googleapis.com) and default port (443) are used.
* <li> Credentials are acquired automatically through Application Default Credentials.
* <li> Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
Expand Down Expand Up @@ -108,11 +110,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return CloudCatalogStubSettings.defaultCredentialsProviderBuilder();
}

/** Returns a builder for the default ChannelProvider for this service. */
/** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return CloudCatalogStubSettings.defaultGrpcTransportProviderBuilder();
}

/** Returns a builder for the default REST ChannelProvider for this service. */
@BetaApi
public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder() {
return CloudCatalogStubSettings.defaultHttpJsonTransportProviderBuilder();
}

public static TransportChannelProvider defaultTransportChannelProvider() {
return CloudCatalogStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -122,11 +131,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return CloudCatalogStubSettings.defaultApiClientHeaderProviderBuilder();
}

/** Returns a new builder for this class. */
/** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}

/** Returns a new REST builder for this class. */
@BetaApi
public static Builder newHttpJsonBuilder() {
return Builder.createHttpJsonDefault();
}

/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
Expand Down Expand Up @@ -164,6 +179,11 @@ private static Builder createDefault() {
return new Builder(CloudCatalogStubSettings.newBuilder());
}

@BetaApi
private static Builder createHttpJsonDefault() {
return new Builder(CloudCatalogStubSettings.newHttpJsonBuilder());
}

public CloudCatalogStubSettings.Builder getStubSettingsBuilder() {
return ((CloudCatalogStubSettings.Builder) getStubSettings());
}
Expand Down
Loading