Skip to content

Commit 3add2ef

Browse files
committed
chore(showcase): add baseline ResumableUploadService definitions and client
1 parent c910ed3 commit 3add2ef

42 files changed

Lines changed: 6534 additions & 3 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

java-showcase/gapic-showcase/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</parent>
1818

1919
<properties>
20-
<gapic-showcase.version>0.41.0</gapic-showcase.version>
20+
<gapic-showcase.version>0.43.1</gapic-showcase.version>
2121
<!-- This is the last version supporting slf4j 1.x, do not upgrade -->
2222
<slf4j1-logback.version>1.2.13</slf4j1-logback.version>
2323
<slf4j2-logback.version>1.5.25</slf4j2-logback.version>

java-showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/ResumableUploadServiceClient.java

Lines changed: 796 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
/*
2+
* Copyright 2026 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.showcase.v1beta1;
18+
19+
import static com.google.showcase.v1beta1.ResumableUploadServiceClient.ListLocationsPagedResponse;
20+
21+
import com.google.api.core.ApiFunction;
22+
import com.google.api.core.BetaApi;
23+
import com.google.api.gax.core.GoogleCredentialsProvider;
24+
import com.google.api.gax.core.InstantiatingExecutorProvider;
25+
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
26+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
27+
import com.google.api.gax.rpc.ApiClientHeaderProvider;
28+
import com.google.api.gax.rpc.ClientContext;
29+
import com.google.api.gax.rpc.ClientSettings;
30+
import com.google.api.gax.rpc.PagedCallSettings;
31+
import com.google.api.gax.rpc.TransportChannelProvider;
32+
import com.google.api.gax.rpc.UnaryCallSettings;
33+
import com.google.cloud.location.GetLocationRequest;
34+
import com.google.cloud.location.ListLocationsRequest;
35+
import com.google.cloud.location.ListLocationsResponse;
36+
import com.google.cloud.location.Location;
37+
import com.google.iam.v1.GetIamPolicyRequest;
38+
import com.google.iam.v1.Policy;
39+
import com.google.iam.v1.SetIamPolicyRequest;
40+
import com.google.iam.v1.TestIamPermissionsRequest;
41+
import com.google.iam.v1.TestIamPermissionsResponse;
42+
import com.google.showcase.v1beta1.stub.ResumableUploadServiceStubSettings;
43+
import java.io.IOException;
44+
import java.util.List;
45+
import javax.annotation.Generated;
46+
import org.jspecify.annotations.NullMarked;
47+
import org.jspecify.annotations.Nullable;
48+
49+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
50+
/**
51+
* Settings class to configure an instance of {@link ResumableUploadServiceClient}.
52+
*
53+
* <p>The default instance has everything set to sensible defaults:
54+
*
55+
* <ul>
56+
* <li>The default service address (localhost) and default port (7469) are used.
57+
* <li>Credentials are acquired automatically through Application Default Credentials.
58+
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
59+
* </ul>
60+
*
61+
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
62+
* build() is called, the tree of builders is called to create the complete settings object.
63+
*
64+
* <p>For example, to set the
65+
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
66+
* of uploadMedia:
67+
*
68+
* <pre>{@code
69+
* // This snippet has been automatically generated and should be regarded as a code template only.
70+
* // It will require modifications to work:
71+
* // - It may require correct/in-range values for request initialization.
72+
* // - It may require specifying regional endpoints when creating the service client as shown in
73+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
74+
* ResumableUploadServiceSettings.Builder resumableUploadServiceSettingsBuilder =
75+
* ResumableUploadServiceSettings.newBuilder();
76+
* resumableUploadServiceSettingsBuilder
77+
* .uploadMediaSettings()
78+
* .setRetrySettings(
79+
* resumableUploadServiceSettingsBuilder
80+
* .uploadMediaSettings()
81+
* .getRetrySettings()
82+
* .toBuilder()
83+
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
84+
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
85+
* .setMaxAttempts(5)
86+
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
87+
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
88+
* .setRetryDelayMultiplier(1.3)
89+
* .setRpcTimeoutMultiplier(1.5)
90+
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
91+
* .build());
92+
* ResumableUploadServiceSettings resumableUploadServiceSettings =
93+
* resumableUploadServiceSettingsBuilder.build();
94+
* }</pre>
95+
*
96+
* Please refer to the [Client Side Retry
97+
* Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting
98+
* retries.
99+
*/
100+
@NullMarked
101+
@BetaApi
102+
@Generated("by gapic-generator-java")
103+
public class ResumableUploadServiceSettings extends ClientSettings<ResumableUploadServiceSettings> {
104+
105+
/** Returns the object with the settings used for calls to uploadMedia. */
106+
public UnaryCallSettings<UploadMediaRequest, UploadMediaResponse> uploadMediaSettings() {
107+
return ((ResumableUploadServiceStubSettings) getStubSettings()).uploadMediaSettings();
108+
}
109+
110+
/** Returns the object with the settings used for calls to listLocations. */
111+
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
112+
listLocationsSettings() {
113+
return ((ResumableUploadServiceStubSettings) getStubSettings()).listLocationsSettings();
114+
}
115+
116+
/** Returns the object with the settings used for calls to getLocation. */
117+
public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
118+
return ((ResumableUploadServiceStubSettings) getStubSettings()).getLocationSettings();
119+
}
120+
121+
/** Returns the object with the settings used for calls to setIamPolicy. */
122+
public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() {
123+
return ((ResumableUploadServiceStubSettings) getStubSettings()).setIamPolicySettings();
124+
}
125+
126+
/** Returns the object with the settings used for calls to getIamPolicy. */
127+
public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() {
128+
return ((ResumableUploadServiceStubSettings) getStubSettings()).getIamPolicySettings();
129+
}
130+
131+
/** Returns the object with the settings used for calls to testIamPermissions. */
132+
public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse>
133+
testIamPermissionsSettings() {
134+
return ((ResumableUploadServiceStubSettings) getStubSettings()).testIamPermissionsSettings();
135+
}
136+
137+
public static final ResumableUploadServiceSettings create(ResumableUploadServiceStubSettings stub)
138+
throws IOException {
139+
return new ResumableUploadServiceSettings.Builder(stub.toBuilder()).build();
140+
}
141+
142+
/** Returns a builder for the default ExecutorProvider for this service. */
143+
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
144+
return ResumableUploadServiceStubSettings.defaultExecutorProviderBuilder();
145+
}
146+
147+
/** Returns the default service endpoint. */
148+
public static String getDefaultEndpoint() {
149+
return ResumableUploadServiceStubSettings.getDefaultEndpoint();
150+
}
151+
152+
/** Returns the default service scopes. */
153+
public static List<String> getDefaultServiceScopes() {
154+
return ResumableUploadServiceStubSettings.getDefaultServiceScopes();
155+
}
156+
157+
/** Returns a builder for the default credentials for this service. */
158+
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
159+
return ResumableUploadServiceStubSettings.defaultCredentialsProviderBuilder();
160+
}
161+
162+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
163+
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
164+
return ResumableUploadServiceStubSettings.defaultGrpcTransportProviderBuilder();
165+
}
166+
167+
/** Returns a builder for the default REST ChannelProvider for this service. */
168+
@BetaApi
169+
public static InstantiatingHttpJsonChannelProvider.Builder
170+
defaultHttpJsonTransportProviderBuilder() {
171+
return ResumableUploadServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
172+
}
173+
174+
public static TransportChannelProvider defaultTransportChannelProvider() {
175+
return ResumableUploadServiceStubSettings.defaultTransportChannelProvider();
176+
}
177+
178+
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
179+
return ResumableUploadServiceStubSettings.defaultApiClientHeaderProviderBuilder();
180+
}
181+
182+
/** Returns a new gRPC builder for this class. */
183+
public static Builder newBuilder() {
184+
return Builder.createDefault();
185+
}
186+
187+
/** Returns a new REST builder for this class. */
188+
public static Builder newHttpJsonBuilder() {
189+
return Builder.createHttpJsonDefault();
190+
}
191+
192+
/** Returns a new builder for this class. */
193+
public static Builder newBuilder(@Nullable ClientContext clientContext) {
194+
return new Builder(clientContext);
195+
}
196+
197+
/** Returns a builder containing all the values of this settings class. */
198+
public Builder toBuilder() {
199+
return new Builder(this);
200+
}
201+
202+
protected ResumableUploadServiceSettings(Builder settingsBuilder) throws IOException {
203+
super(settingsBuilder);
204+
}
205+
206+
/** Builder for ResumableUploadServiceSettings. */
207+
public static class Builder
208+
extends ClientSettings.Builder<ResumableUploadServiceSettings, Builder> {
209+
210+
protected Builder() throws IOException {
211+
this(((ClientContext) null));
212+
}
213+
214+
protected Builder(@Nullable ClientContext clientContext) {
215+
super(ResumableUploadServiceStubSettings.newBuilder(clientContext));
216+
}
217+
218+
protected Builder(ResumableUploadServiceSettings settings) {
219+
super(settings.getStubSettings().toBuilder());
220+
}
221+
222+
protected Builder(ResumableUploadServiceStubSettings.Builder stubSettings) {
223+
super(stubSettings);
224+
}
225+
226+
private static Builder createDefault() {
227+
return new Builder(ResumableUploadServiceStubSettings.newBuilder());
228+
}
229+
230+
private static Builder createHttpJsonDefault() {
231+
return new Builder(ResumableUploadServiceStubSettings.newHttpJsonBuilder());
232+
}
233+
234+
public ResumableUploadServiceStubSettings.Builder getStubSettingsBuilder() {
235+
return ((ResumableUploadServiceStubSettings.Builder) getStubSettings());
236+
}
237+
238+
/**
239+
* Applies the given settings updater function to all of the unary API methods in this service.
240+
*
241+
* <p>Note: This method does not support applying settings to streaming methods.
242+
*/
243+
public Builder applyToAllUnaryMethods(
244+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
245+
super.applyToAllUnaryMethods(
246+
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
247+
return this;
248+
}
249+
250+
/** Returns the builder for the settings used for calls to uploadMedia. */
251+
public UnaryCallSettings.Builder<UploadMediaRequest, UploadMediaResponse>
252+
uploadMediaSettings() {
253+
return getStubSettingsBuilder().uploadMediaSettings();
254+
}
255+
256+
/** Returns the builder for the settings used for calls to listLocations. */
257+
public PagedCallSettings.Builder<
258+
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
259+
listLocationsSettings() {
260+
return getStubSettingsBuilder().listLocationsSettings();
261+
}
262+
263+
/** Returns the builder for the settings used for calls to getLocation. */
264+
public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
265+
return getStubSettingsBuilder().getLocationSettings();
266+
}
267+
268+
/** Returns the builder for the settings used for calls to setIamPolicy. */
269+
public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() {
270+
return getStubSettingsBuilder().setIamPolicySettings();
271+
}
272+
273+
/** Returns the builder for the settings used for calls to getIamPolicy. */
274+
public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() {
275+
return getStubSettingsBuilder().getIamPolicySettings();
276+
}
277+
278+
/** Returns the builder for the settings used for calls to testIamPermissions. */
279+
public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse>
280+
testIamPermissionsSettings() {
281+
return getStubSettingsBuilder().testIamPermissionsSettings();
282+
}
283+
284+
@Override
285+
public ResumableUploadServiceSettings build() throws IOException {
286+
return new ResumableUploadServiceSettings(this);
287+
}
288+
}
289+
}

java-showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/gapic_metadata.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,33 @@
222222
}
223223
}
224224
},
225+
"ResumableUploadService": {
226+
"clients": {
227+
"grpc": {
228+
"libraryClient": "ResumableUploadServiceClient",
229+
"rpcs": {
230+
"GetIamPolicy": {
231+
"methods": ["getIamPolicy", "getIamPolicyCallable"]
232+
},
233+
"GetLocation": {
234+
"methods": ["getLocation", "getLocationCallable"]
235+
},
236+
"ListLocations": {
237+
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
238+
},
239+
"SetIamPolicy": {
240+
"methods": ["setIamPolicy", "setIamPolicyCallable"]
241+
},
242+
"TestIamPermissions": {
243+
"methods": ["testIamPermissions", "testIamPermissionsCallable"]
244+
},
245+
"UploadMedia": {
246+
"methods": ["uploadMedia", "uploadMediaCallable"]
247+
}
248+
}
249+
}
250+
}
251+
},
225252
"SequenceService": {
226253
"clients": {
227254
"grpc": {

java-showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/package-info.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,25 @@
123123
* }
124124
* }</pre>
125125
*
126+
* <p>======================= ResumableUploadServiceClient =======================
127+
*
128+
* <p>Service Description: A service showcasing universal resumable upload protocol support.
129+
*
130+
* <p>Sample for ResumableUploadServiceClient:
131+
*
132+
* <pre>{@code
133+
* // This snippet has been automatically generated and should be regarded as a code template only.
134+
* // It will require modifications to work:
135+
* // - It may require correct/in-range values for request initialization.
136+
* // - It may require specifying regional endpoints when creating the service client as shown in
137+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
138+
* try (ResumableUploadServiceClient resumableUploadServiceClient =
139+
* ResumableUploadServiceClient.create()) {
140+
* UploadMediaRequest request = UploadMediaRequest.newBuilder().setName("name3373707").build();
141+
* UploadMediaResponse response = resumableUploadServiceClient.uploadMedia(request);
142+
* }
143+
* }</pre>
144+
*
126145
* <p>======================= SequenceServiceClient =======================
127146
*
128147
* <p>Service Description: A service that enables testing of unary and server streaming calls by

0 commit comments

Comments
 (0)