• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.dataproc.v1;
18 
19 import static com.google.cloud.dataproc.v1.JobControllerClient.ListJobsPagedResponse;
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.dataproc.v1.stub.JobControllerStubSettings;
35 import com.google.longrunning.Operation;
36 import com.google.protobuf.Empty;
37 import java.io.IOException;
38 import java.util.List;
39 import javax.annotation.Generated;
40 
41 // AUTO-GENERATED DOCUMENTATION AND CLASS.
42 /**
43  * Settings class to configure an instance of {@link JobControllerClient}.
44  *
45  * <p>The default instance has everything set to sensible defaults:
46  *
47  * <ul>
48  *   <li>The default service address (dataproc.googleapis.com) and default port (443) are used.
49  *   <li>Credentials are acquired automatically through Application Default Credentials.
50  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
51  * </ul>
52  *
53  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
54  * build() is called, the tree of builders is called to create the complete settings object.
55  *
56  * <p>For example, to set the total timeout of submitJob to 30 seconds:
57  *
58  * <pre>{@code
59  * // This snippet has been automatically generated and should be regarded as a code template only.
60  * // It will require modifications to work:
61  * // - It may require correct/in-range values for request initialization.
62  * // - It may require specifying regional endpoints when creating the service client as shown in
63  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
64  * JobControllerSettings.Builder jobControllerSettingsBuilder = JobControllerSettings.newBuilder();
65  * jobControllerSettingsBuilder
66  *     .submitJobSettings()
67  *     .setRetrySettings(
68  *         jobControllerSettingsBuilder
69  *             .submitJobSettings()
70  *             .getRetrySettings()
71  *             .toBuilder()
72  *             .setTotalTimeout(Duration.ofSeconds(30))
73  *             .build());
74  * JobControllerSettings jobControllerSettings = jobControllerSettingsBuilder.build();
75  * }</pre>
76  */
77 @Generated("by gapic-generator-java")
78 public class JobControllerSettings extends ClientSettings<JobControllerSettings> {
79 
80   /** Returns the object with the settings used for calls to submitJob. */
submitJobSettings()81   public UnaryCallSettings<SubmitJobRequest, Job> submitJobSettings() {
82     return ((JobControllerStubSettings) getStubSettings()).submitJobSettings();
83   }
84 
85   /** Returns the object with the settings used for calls to submitJobAs. */
submitJobAsOperationSettings()86   public UnaryCallSettings<SubmitJobRequest, Operation> submitJobAsOperationSettings() {
87     return ((JobControllerStubSettings) getStubSettings()).submitJobAsOperationSettings();
88   }
89 
90   /** Returns the object with the settings used for calls to submitJobAsOperation. */
91   public OperationCallSettings<SubmitJobRequest, Job, JobMetadata>
submitJobAsOperationOperationSettings()92       submitJobAsOperationOperationSettings() {
93     return ((JobControllerStubSettings) getStubSettings()).submitJobAsOperationOperationSettings();
94   }
95 
96   /** Returns the object with the settings used for calls to getJob. */
getJobSettings()97   public UnaryCallSettings<GetJobRequest, Job> getJobSettings() {
98     return ((JobControllerStubSettings) getStubSettings()).getJobSettings();
99   }
100 
101   /** Returns the object with the settings used for calls to listJobs. */
102   public PagedCallSettings<ListJobsRequest, ListJobsResponse, ListJobsPagedResponse>
listJobsSettings()103       listJobsSettings() {
104     return ((JobControllerStubSettings) getStubSettings()).listJobsSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to updateJob. */
updateJobSettings()108   public UnaryCallSettings<UpdateJobRequest, Job> updateJobSettings() {
109     return ((JobControllerStubSettings) getStubSettings()).updateJobSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to cancelJob. */
cancelJobSettings()113   public UnaryCallSettings<CancelJobRequest, Job> cancelJobSettings() {
114     return ((JobControllerStubSettings) getStubSettings()).cancelJobSettings();
115   }
116 
117   /** Returns the object with the settings used for calls to deleteJob. */
deleteJobSettings()118   public UnaryCallSettings<DeleteJobRequest, Empty> deleteJobSettings() {
119     return ((JobControllerStubSettings) getStubSettings()).deleteJobSettings();
120   }
121 
create(JobControllerStubSettings stub)122   public static final JobControllerSettings create(JobControllerStubSettings stub)
123       throws IOException {
124     return new JobControllerSettings.Builder(stub.toBuilder()).build();
125   }
126 
127   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()128   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
129     return JobControllerStubSettings.defaultExecutorProviderBuilder();
130   }
131 
132   /** Returns the default service endpoint. */
getDefaultEndpoint()133   public static String getDefaultEndpoint() {
134     return JobControllerStubSettings.getDefaultEndpoint();
135   }
136 
137   /** Returns the default service scopes. */
getDefaultServiceScopes()138   public static List<String> getDefaultServiceScopes() {
139     return JobControllerStubSettings.getDefaultServiceScopes();
140   }
141 
142   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()143   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
144     return JobControllerStubSettings.defaultCredentialsProviderBuilder();
145   }
146 
147   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()148   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
149     return JobControllerStubSettings.defaultGrpcTransportProviderBuilder();
150   }
151 
152   /** Returns a builder for the default REST ChannelProvider for this service. */
153   @BetaApi
154   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()155       defaultHttpJsonTransportProviderBuilder() {
156     return JobControllerStubSettings.defaultHttpJsonTransportProviderBuilder();
157   }
158 
defaultTransportChannelProvider()159   public static TransportChannelProvider defaultTransportChannelProvider() {
160     return JobControllerStubSettings.defaultTransportChannelProvider();
161   }
162 
163   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()164   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
165     return JobControllerStubSettings.defaultApiClientHeaderProviderBuilder();
166   }
167 
168   /** Returns a new gRPC builder for this class. */
newBuilder()169   public static Builder newBuilder() {
170     return Builder.createDefault();
171   }
172 
173   /** Returns a new REST builder for this class. */
174   @BetaApi
newHttpJsonBuilder()175   public static Builder newHttpJsonBuilder() {
176     return Builder.createHttpJsonDefault();
177   }
178 
179   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)180   public static Builder newBuilder(ClientContext clientContext) {
181     return new Builder(clientContext);
182   }
183 
184   /** Returns a builder containing all the values of this settings class. */
toBuilder()185   public Builder toBuilder() {
186     return new Builder(this);
187   }
188 
JobControllerSettings(Builder settingsBuilder)189   protected JobControllerSettings(Builder settingsBuilder) throws IOException {
190     super(settingsBuilder);
191   }
192 
193   /** Builder for JobControllerSettings. */
194   public static class Builder extends ClientSettings.Builder<JobControllerSettings, Builder> {
195 
Builder()196     protected Builder() throws IOException {
197       this(((ClientContext) null));
198     }
199 
Builder(ClientContext clientContext)200     protected Builder(ClientContext clientContext) {
201       super(JobControllerStubSettings.newBuilder(clientContext));
202     }
203 
Builder(JobControllerSettings settings)204     protected Builder(JobControllerSettings settings) {
205       super(settings.getStubSettings().toBuilder());
206     }
207 
Builder(JobControllerStubSettings.Builder stubSettings)208     protected Builder(JobControllerStubSettings.Builder stubSettings) {
209       super(stubSettings);
210     }
211 
createDefault()212     private static Builder createDefault() {
213       return new Builder(JobControllerStubSettings.newBuilder());
214     }
215 
216     @BetaApi
createHttpJsonDefault()217     private static Builder createHttpJsonDefault() {
218       return new Builder(JobControllerStubSettings.newHttpJsonBuilder());
219     }
220 
getStubSettingsBuilder()221     public JobControllerStubSettings.Builder getStubSettingsBuilder() {
222       return ((JobControllerStubSettings.Builder) getStubSettings());
223     }
224 
225     /**
226      * Applies the given settings updater function to all of the unary API methods in this service.
227      *
228      * <p>Note: This method does not support applying settings to streaming methods.
229      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)230     public Builder applyToAllUnaryMethods(
231         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
232       super.applyToAllUnaryMethods(
233           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
234       return this;
235     }
236 
237     /** Returns the builder for the settings used for calls to submitJob. */
submitJobSettings()238     public UnaryCallSettings.Builder<SubmitJobRequest, Job> submitJobSettings() {
239       return getStubSettingsBuilder().submitJobSettings();
240     }
241 
242     /** Returns the builder for the settings used for calls to submitJobAs. */
submitJobAsOperationSettings()243     public UnaryCallSettings.Builder<SubmitJobRequest, Operation> submitJobAsOperationSettings() {
244       return getStubSettingsBuilder().submitJobAsOperationSettings();
245     }
246 
247     /** Returns the builder for the settings used for calls to submitJobAsOperation. */
248     public OperationCallSettings.Builder<SubmitJobRequest, Job, JobMetadata>
submitJobAsOperationOperationSettings()249         submitJobAsOperationOperationSettings() {
250       return getStubSettingsBuilder().submitJobAsOperationOperationSettings();
251     }
252 
253     /** Returns the builder for the settings used for calls to getJob. */
getJobSettings()254     public UnaryCallSettings.Builder<GetJobRequest, Job> getJobSettings() {
255       return getStubSettingsBuilder().getJobSettings();
256     }
257 
258     /** Returns the builder for the settings used for calls to listJobs. */
259     public PagedCallSettings.Builder<ListJobsRequest, ListJobsResponse, ListJobsPagedResponse>
listJobsSettings()260         listJobsSettings() {
261       return getStubSettingsBuilder().listJobsSettings();
262     }
263 
264     /** Returns the builder for the settings used for calls to updateJob. */
updateJobSettings()265     public UnaryCallSettings.Builder<UpdateJobRequest, Job> updateJobSettings() {
266       return getStubSettingsBuilder().updateJobSettings();
267     }
268 
269     /** Returns the builder for the settings used for calls to cancelJob. */
cancelJobSettings()270     public UnaryCallSettings.Builder<CancelJobRequest, Job> cancelJobSettings() {
271       return getStubSettingsBuilder().cancelJobSettings();
272     }
273 
274     /** Returns the builder for the settings used for calls to deleteJob. */
deleteJobSettings()275     public UnaryCallSettings.Builder<DeleteJobRequest, Empty> deleteJobSettings() {
276       return getStubSettingsBuilder().deleteJobSettings();
277     }
278 
279     @Override
build()280     public JobControllerSettings build() throws IOException {
281       return new JobControllerSettings(this);
282     }
283   }
284 }
285