Skip to content

Commit f857175

Browse files
feat: [run] Adds Cloud Run Jobs v2 API client libraries (#8723)
1 parent 2b616d4 commit f857175

177 files changed

Lines changed: 63984 additions & 68 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-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsClient.java

Lines changed: 737 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
/*
2+
* Copyright 2022 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.cloud.run.v2;
18+
19+
import static com.google.cloud.run.v2.ExecutionsClient.ListExecutionsPagedResponse;
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.OperationCallSettings;
31+
import com.google.api.gax.rpc.PagedCallSettings;
32+
import com.google.api.gax.rpc.TransportChannelProvider;
33+
import com.google.api.gax.rpc.UnaryCallSettings;
34+
import com.google.cloud.run.v2.stub.ExecutionsStubSettings;
35+
import com.google.longrunning.Operation;
36+
import java.io.IOException;
37+
import java.util.List;
38+
import javax.annotation.Generated;
39+
40+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
41+
/**
42+
* Settings class to configure an instance of {@link ExecutionsClient}.
43+
*
44+
* <p>The default instance has everything set to sensible defaults:
45+
*
46+
* <ul>
47+
* <li>The default service address (run.googleapis.com) and default port (443) are used.
48+
* <li>Credentials are acquired automatically through Application Default Credentials.
49+
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
50+
* </ul>
51+
*
52+
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
53+
* build() is called, the tree of builders is called to create the complete settings object.
54+
*
55+
* <p>For example, to set the total timeout of getExecution to 30 seconds:
56+
*
57+
* <pre>{@code
58+
* // This snippet has been automatically generated and should be regarded as a code template only.
59+
* // It will require modifications to work:
60+
* // - It may require correct/in-range values for request initialization.
61+
* // - It may require specifying regional endpoints when creating the service client as shown in
62+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
63+
* ExecutionsSettings.Builder executionsSettingsBuilder = ExecutionsSettings.newBuilder();
64+
* executionsSettingsBuilder
65+
* .getExecutionSettings()
66+
* .setRetrySettings(
67+
* executionsSettingsBuilder.getExecutionSettings().getRetrySettings().toBuilder()
68+
* .setTotalTimeout(Duration.ofSeconds(30))
69+
* .build());
70+
* ExecutionsSettings executionsSettings = executionsSettingsBuilder.build();
71+
* }</pre>
72+
*/
73+
@Generated("by gapic-generator-java")
74+
public class ExecutionsSettings extends ClientSettings<ExecutionsSettings> {
75+
76+
/** Returns the object with the settings used for calls to getExecution. */
77+
public UnaryCallSettings<GetExecutionRequest, Execution> getExecutionSettings() {
78+
return ((ExecutionsStubSettings) getStubSettings()).getExecutionSettings();
79+
}
80+
81+
/** Returns the object with the settings used for calls to listExecutions. */
82+
public PagedCallSettings<
83+
ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse>
84+
listExecutionsSettings() {
85+
return ((ExecutionsStubSettings) getStubSettings()).listExecutionsSettings();
86+
}
87+
88+
/** Returns the object with the settings used for calls to deleteExecution. */
89+
public UnaryCallSettings<DeleteExecutionRequest, Operation> deleteExecutionSettings() {
90+
return ((ExecutionsStubSettings) getStubSettings()).deleteExecutionSettings();
91+
}
92+
93+
/** Returns the object with the settings used for calls to deleteExecution. */
94+
public OperationCallSettings<DeleteExecutionRequest, Execution, Execution>
95+
deleteExecutionOperationSettings() {
96+
return ((ExecutionsStubSettings) getStubSettings()).deleteExecutionOperationSettings();
97+
}
98+
99+
public static final ExecutionsSettings create(ExecutionsStubSettings stub) throws IOException {
100+
return new ExecutionsSettings.Builder(stub.toBuilder()).build();
101+
}
102+
103+
/** Returns a builder for the default ExecutorProvider for this service. */
104+
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
105+
return ExecutionsStubSettings.defaultExecutorProviderBuilder();
106+
}
107+
108+
/** Returns the default service endpoint. */
109+
public static String getDefaultEndpoint() {
110+
return ExecutionsStubSettings.getDefaultEndpoint();
111+
}
112+
113+
/** Returns the default service scopes. */
114+
public static List<String> getDefaultServiceScopes() {
115+
return ExecutionsStubSettings.getDefaultServiceScopes();
116+
}
117+
118+
/** Returns a builder for the default credentials for this service. */
119+
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
120+
return ExecutionsStubSettings.defaultCredentialsProviderBuilder();
121+
}
122+
123+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
124+
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
125+
return ExecutionsStubSettings.defaultGrpcTransportProviderBuilder();
126+
}
127+
128+
/** Returns a builder for the default REST ChannelProvider for this service. */
129+
@BetaApi
130+
public static InstantiatingHttpJsonChannelProvider.Builder
131+
defaultHttpJsonTransportProviderBuilder() {
132+
return ExecutionsStubSettings.defaultHttpJsonTransportProviderBuilder();
133+
}
134+
135+
public static TransportChannelProvider defaultTransportChannelProvider() {
136+
return ExecutionsStubSettings.defaultTransportChannelProvider();
137+
}
138+
139+
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
140+
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
141+
return ExecutionsStubSettings.defaultApiClientHeaderProviderBuilder();
142+
}
143+
144+
/** Returns a new gRPC builder for this class. */
145+
public static Builder newBuilder() {
146+
return Builder.createDefault();
147+
}
148+
149+
/** Returns a new REST builder for this class. */
150+
@BetaApi
151+
public static Builder newHttpJsonBuilder() {
152+
return Builder.createHttpJsonDefault();
153+
}
154+
155+
/** Returns a new builder for this class. */
156+
public static Builder newBuilder(ClientContext clientContext) {
157+
return new Builder(clientContext);
158+
}
159+
160+
/** Returns a builder containing all the values of this settings class. */
161+
public Builder toBuilder() {
162+
return new Builder(this);
163+
}
164+
165+
protected ExecutionsSettings(Builder settingsBuilder) throws IOException {
166+
super(settingsBuilder);
167+
}
168+
169+
/** Builder for ExecutionsSettings. */
170+
public static class Builder extends ClientSettings.Builder<ExecutionsSettings, Builder> {
171+
172+
protected Builder() throws IOException {
173+
this(((ClientContext) null));
174+
}
175+
176+
protected Builder(ClientContext clientContext) {
177+
super(ExecutionsStubSettings.newBuilder(clientContext));
178+
}
179+
180+
protected Builder(ExecutionsSettings settings) {
181+
super(settings.getStubSettings().toBuilder());
182+
}
183+
184+
protected Builder(ExecutionsStubSettings.Builder stubSettings) {
185+
super(stubSettings);
186+
}
187+
188+
private static Builder createDefault() {
189+
return new Builder(ExecutionsStubSettings.newBuilder());
190+
}
191+
192+
@BetaApi
193+
private static Builder createHttpJsonDefault() {
194+
return new Builder(ExecutionsStubSettings.newHttpJsonBuilder());
195+
}
196+
197+
public ExecutionsStubSettings.Builder getStubSettingsBuilder() {
198+
return ((ExecutionsStubSettings.Builder) getStubSettings());
199+
}
200+
201+
/**
202+
* Applies the given settings updater function to all of the unary API methods in this service.
203+
*
204+
* <p>Note: This method does not support applying settings to streaming methods.
205+
*/
206+
public Builder applyToAllUnaryMethods(
207+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
208+
super.applyToAllUnaryMethods(
209+
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
210+
return this;
211+
}
212+
213+
/** Returns the builder for the settings used for calls to getExecution. */
214+
public UnaryCallSettings.Builder<GetExecutionRequest, Execution> getExecutionSettings() {
215+
return getStubSettingsBuilder().getExecutionSettings();
216+
}
217+
218+
/** Returns the builder for the settings used for calls to listExecutions. */
219+
public PagedCallSettings.Builder<
220+
ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse>
221+
listExecutionsSettings() {
222+
return getStubSettingsBuilder().listExecutionsSettings();
223+
}
224+
225+
/** Returns the builder for the settings used for calls to deleteExecution. */
226+
public UnaryCallSettings.Builder<DeleteExecutionRequest, Operation> deleteExecutionSettings() {
227+
return getStubSettingsBuilder().deleteExecutionSettings();
228+
}
229+
230+
/** Returns the builder for the settings used for calls to deleteExecution. */
231+
public OperationCallSettings.Builder<DeleteExecutionRequest, Execution, Execution>
232+
deleteExecutionOperationSettings() {
233+
return getStubSettingsBuilder().deleteExecutionOperationSettings();
234+
}
235+
236+
@Override
237+
public ExecutionsSettings build() throws IOException {
238+
return new ExecutionsSettings(this);
239+
}
240+
}
241+
}

0 commit comments

Comments
 (0)