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