• 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.osconfig.v1;
18 
19 import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchDeploymentsPagedResponse;
20 import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse;
21 import static com.google.cloud.osconfig.v1.OsConfigServiceClient.ListPatchJobsPagedResponse;
22 
23 import com.google.api.core.ApiFunction;
24 import com.google.api.core.BetaApi;
25 import com.google.api.gax.core.GoogleCredentialsProvider;
26 import com.google.api.gax.core.InstantiatingExecutorProvider;
27 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
28 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
29 import com.google.api.gax.rpc.ApiClientHeaderProvider;
30 import com.google.api.gax.rpc.ClientContext;
31 import com.google.api.gax.rpc.ClientSettings;
32 import com.google.api.gax.rpc.PagedCallSettings;
33 import com.google.api.gax.rpc.TransportChannelProvider;
34 import com.google.api.gax.rpc.UnaryCallSettings;
35 import com.google.cloud.osconfig.v1.stub.OsConfigServiceStubSettings;
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 OsConfigServiceClient}.
44  *
45  * <p>The default instance has everything set to sensible defaults:
46  *
47  * <ul>
48  *   <li>The default service address (osconfig.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 executePatchJob 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  * OsConfigServiceSettings.Builder osConfigServiceSettingsBuilder =
65  *     OsConfigServiceSettings.newBuilder();
66  * osConfigServiceSettingsBuilder
67  *     .executePatchJobSettings()
68  *     .setRetrySettings(
69  *         osConfigServiceSettingsBuilder
70  *             .executePatchJobSettings()
71  *             .getRetrySettings()
72  *             .toBuilder()
73  *             .setTotalTimeout(Duration.ofSeconds(30))
74  *             .build());
75  * OsConfigServiceSettings osConfigServiceSettings = osConfigServiceSettingsBuilder.build();
76  * }</pre>
77  */
78 @Generated("by gapic-generator-java")
79 public class OsConfigServiceSettings extends ClientSettings<OsConfigServiceSettings> {
80 
81   /** Returns the object with the settings used for calls to executePatchJob. */
82   public UnaryCallSettings<PatchJobs.ExecutePatchJobRequest, PatchJobs.PatchJob>
executePatchJobSettings()83       executePatchJobSettings() {
84     return ((OsConfigServiceStubSettings) getStubSettings()).executePatchJobSettings();
85   }
86 
87   /** Returns the object with the settings used for calls to getPatchJob. */
getPatchJobSettings()88   public UnaryCallSettings<PatchJobs.GetPatchJobRequest, PatchJobs.PatchJob> getPatchJobSettings() {
89     return ((OsConfigServiceStubSettings) getStubSettings()).getPatchJobSettings();
90   }
91 
92   /** Returns the object with the settings used for calls to cancelPatchJob. */
93   public UnaryCallSettings<PatchJobs.CancelPatchJobRequest, PatchJobs.PatchJob>
cancelPatchJobSettings()94       cancelPatchJobSettings() {
95     return ((OsConfigServiceStubSettings) getStubSettings()).cancelPatchJobSettings();
96   }
97 
98   /** Returns the object with the settings used for calls to listPatchJobs. */
99   public PagedCallSettings<
100           PatchJobs.ListPatchJobsRequest,
101           PatchJobs.ListPatchJobsResponse,
102           ListPatchJobsPagedResponse>
listPatchJobsSettings()103       listPatchJobsSettings() {
104     return ((OsConfigServiceStubSettings) getStubSettings()).listPatchJobsSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to listPatchJobInstanceDetails. */
108   public PagedCallSettings<
109           PatchJobs.ListPatchJobInstanceDetailsRequest,
110           PatchJobs.ListPatchJobInstanceDetailsResponse,
111           ListPatchJobInstanceDetailsPagedResponse>
listPatchJobInstanceDetailsSettings()112       listPatchJobInstanceDetailsSettings() {
113     return ((OsConfigServiceStubSettings) getStubSettings()).listPatchJobInstanceDetailsSettings();
114   }
115 
116   /** Returns the object with the settings used for calls to createPatchDeployment. */
117   public UnaryCallSettings<
118           PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
createPatchDeploymentSettings()119       createPatchDeploymentSettings() {
120     return ((OsConfigServiceStubSettings) getStubSettings()).createPatchDeploymentSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to getPatchDeployment. */
124   public UnaryCallSettings<
125           PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment>
getPatchDeploymentSettings()126       getPatchDeploymentSettings() {
127     return ((OsConfigServiceStubSettings) getStubSettings()).getPatchDeploymentSettings();
128   }
129 
130   /** Returns the object with the settings used for calls to listPatchDeployments. */
131   public PagedCallSettings<
132           PatchDeployments.ListPatchDeploymentsRequest,
133           PatchDeployments.ListPatchDeploymentsResponse,
134           ListPatchDeploymentsPagedResponse>
listPatchDeploymentsSettings()135       listPatchDeploymentsSettings() {
136     return ((OsConfigServiceStubSettings) getStubSettings()).listPatchDeploymentsSettings();
137   }
138 
139   /** Returns the object with the settings used for calls to deletePatchDeployment. */
140   public UnaryCallSettings<PatchDeployments.DeletePatchDeploymentRequest, Empty>
deletePatchDeploymentSettings()141       deletePatchDeploymentSettings() {
142     return ((OsConfigServiceStubSettings) getStubSettings()).deletePatchDeploymentSettings();
143   }
144 
145   /** Returns the object with the settings used for calls to updatePatchDeployment. */
146   public UnaryCallSettings<
147           PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
updatePatchDeploymentSettings()148       updatePatchDeploymentSettings() {
149     return ((OsConfigServiceStubSettings) getStubSettings()).updatePatchDeploymentSettings();
150   }
151 
152   /** Returns the object with the settings used for calls to pausePatchDeployment. */
153   public UnaryCallSettings<
154           PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment>
pausePatchDeploymentSettings()155       pausePatchDeploymentSettings() {
156     return ((OsConfigServiceStubSettings) getStubSettings()).pausePatchDeploymentSettings();
157   }
158 
159   /** Returns the object with the settings used for calls to resumePatchDeployment. */
160   public UnaryCallSettings<
161           PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment>
resumePatchDeploymentSettings()162       resumePatchDeploymentSettings() {
163     return ((OsConfigServiceStubSettings) getStubSettings()).resumePatchDeploymentSettings();
164   }
165 
create(OsConfigServiceStubSettings stub)166   public static final OsConfigServiceSettings create(OsConfigServiceStubSettings stub)
167       throws IOException {
168     return new OsConfigServiceSettings.Builder(stub.toBuilder()).build();
169   }
170 
171   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()172   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
173     return OsConfigServiceStubSettings.defaultExecutorProviderBuilder();
174   }
175 
176   /** Returns the default service endpoint. */
getDefaultEndpoint()177   public static String getDefaultEndpoint() {
178     return OsConfigServiceStubSettings.getDefaultEndpoint();
179   }
180 
181   /** Returns the default service scopes. */
getDefaultServiceScopes()182   public static List<String> getDefaultServiceScopes() {
183     return OsConfigServiceStubSettings.getDefaultServiceScopes();
184   }
185 
186   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()187   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
188     return OsConfigServiceStubSettings.defaultCredentialsProviderBuilder();
189   }
190 
191   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()192   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
193     return OsConfigServiceStubSettings.defaultGrpcTransportProviderBuilder();
194   }
195 
196   /** Returns a builder for the default REST ChannelProvider for this service. */
197   @BetaApi
198   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()199       defaultHttpJsonTransportProviderBuilder() {
200     return OsConfigServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
201   }
202 
defaultTransportChannelProvider()203   public static TransportChannelProvider defaultTransportChannelProvider() {
204     return OsConfigServiceStubSettings.defaultTransportChannelProvider();
205   }
206 
207   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()208   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
209     return OsConfigServiceStubSettings.defaultApiClientHeaderProviderBuilder();
210   }
211 
212   /** Returns a new gRPC builder for this class. */
newBuilder()213   public static Builder newBuilder() {
214     return Builder.createDefault();
215   }
216 
217   /** Returns a new REST builder for this class. */
218   @BetaApi
newHttpJsonBuilder()219   public static Builder newHttpJsonBuilder() {
220     return Builder.createHttpJsonDefault();
221   }
222 
223   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)224   public static Builder newBuilder(ClientContext clientContext) {
225     return new Builder(clientContext);
226   }
227 
228   /** Returns a builder containing all the values of this settings class. */
toBuilder()229   public Builder toBuilder() {
230     return new Builder(this);
231   }
232 
OsConfigServiceSettings(Builder settingsBuilder)233   protected OsConfigServiceSettings(Builder settingsBuilder) throws IOException {
234     super(settingsBuilder);
235   }
236 
237   /** Builder for OsConfigServiceSettings. */
238   public static class Builder extends ClientSettings.Builder<OsConfigServiceSettings, Builder> {
239 
Builder()240     protected Builder() throws IOException {
241       this(((ClientContext) null));
242     }
243 
Builder(ClientContext clientContext)244     protected Builder(ClientContext clientContext) {
245       super(OsConfigServiceStubSettings.newBuilder(clientContext));
246     }
247 
Builder(OsConfigServiceSettings settings)248     protected Builder(OsConfigServiceSettings settings) {
249       super(settings.getStubSettings().toBuilder());
250     }
251 
Builder(OsConfigServiceStubSettings.Builder stubSettings)252     protected Builder(OsConfigServiceStubSettings.Builder stubSettings) {
253       super(stubSettings);
254     }
255 
createDefault()256     private static Builder createDefault() {
257       return new Builder(OsConfigServiceStubSettings.newBuilder());
258     }
259 
260     @BetaApi
createHttpJsonDefault()261     private static Builder createHttpJsonDefault() {
262       return new Builder(OsConfigServiceStubSettings.newHttpJsonBuilder());
263     }
264 
getStubSettingsBuilder()265     public OsConfigServiceStubSettings.Builder getStubSettingsBuilder() {
266       return ((OsConfigServiceStubSettings.Builder) getStubSettings());
267     }
268 
269     /**
270      * Applies the given settings updater function to all of the unary API methods in this service.
271      *
272      * <p>Note: This method does not support applying settings to streaming methods.
273      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)274     public Builder applyToAllUnaryMethods(
275         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
276       super.applyToAllUnaryMethods(
277           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
278       return this;
279     }
280 
281     /** Returns the builder for the settings used for calls to executePatchJob. */
282     public UnaryCallSettings.Builder<PatchJobs.ExecutePatchJobRequest, PatchJobs.PatchJob>
executePatchJobSettings()283         executePatchJobSettings() {
284       return getStubSettingsBuilder().executePatchJobSettings();
285     }
286 
287     /** Returns the builder for the settings used for calls to getPatchJob. */
288     public UnaryCallSettings.Builder<PatchJobs.GetPatchJobRequest, PatchJobs.PatchJob>
getPatchJobSettings()289         getPatchJobSettings() {
290       return getStubSettingsBuilder().getPatchJobSettings();
291     }
292 
293     /** Returns the builder for the settings used for calls to cancelPatchJob. */
294     public UnaryCallSettings.Builder<PatchJobs.CancelPatchJobRequest, PatchJobs.PatchJob>
cancelPatchJobSettings()295         cancelPatchJobSettings() {
296       return getStubSettingsBuilder().cancelPatchJobSettings();
297     }
298 
299     /** Returns the builder for the settings used for calls to listPatchJobs. */
300     public PagedCallSettings.Builder<
301             PatchJobs.ListPatchJobsRequest,
302             PatchJobs.ListPatchJobsResponse,
303             ListPatchJobsPagedResponse>
listPatchJobsSettings()304         listPatchJobsSettings() {
305       return getStubSettingsBuilder().listPatchJobsSettings();
306     }
307 
308     /** Returns the builder for the settings used for calls to listPatchJobInstanceDetails. */
309     public PagedCallSettings.Builder<
310             PatchJobs.ListPatchJobInstanceDetailsRequest,
311             PatchJobs.ListPatchJobInstanceDetailsResponse,
312             ListPatchJobInstanceDetailsPagedResponse>
listPatchJobInstanceDetailsSettings()313         listPatchJobInstanceDetailsSettings() {
314       return getStubSettingsBuilder().listPatchJobInstanceDetailsSettings();
315     }
316 
317     /** Returns the builder for the settings used for calls to createPatchDeployment. */
318     public UnaryCallSettings.Builder<
319             PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
createPatchDeploymentSettings()320         createPatchDeploymentSettings() {
321       return getStubSettingsBuilder().createPatchDeploymentSettings();
322     }
323 
324     /** Returns the builder for the settings used for calls to getPatchDeployment. */
325     public UnaryCallSettings.Builder<
326             PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment>
getPatchDeploymentSettings()327         getPatchDeploymentSettings() {
328       return getStubSettingsBuilder().getPatchDeploymentSettings();
329     }
330 
331     /** Returns the builder for the settings used for calls to listPatchDeployments. */
332     public PagedCallSettings.Builder<
333             PatchDeployments.ListPatchDeploymentsRequest,
334             PatchDeployments.ListPatchDeploymentsResponse,
335             ListPatchDeploymentsPagedResponse>
listPatchDeploymentsSettings()336         listPatchDeploymentsSettings() {
337       return getStubSettingsBuilder().listPatchDeploymentsSettings();
338     }
339 
340     /** Returns the builder for the settings used for calls to deletePatchDeployment. */
341     public UnaryCallSettings.Builder<PatchDeployments.DeletePatchDeploymentRequest, Empty>
deletePatchDeploymentSettings()342         deletePatchDeploymentSettings() {
343       return getStubSettingsBuilder().deletePatchDeploymentSettings();
344     }
345 
346     /** Returns the builder for the settings used for calls to updatePatchDeployment. */
347     public UnaryCallSettings.Builder<
348             PatchDeployments.UpdatePatchDeploymentRequest, PatchDeployments.PatchDeployment>
updatePatchDeploymentSettings()349         updatePatchDeploymentSettings() {
350       return getStubSettingsBuilder().updatePatchDeploymentSettings();
351     }
352 
353     /** Returns the builder for the settings used for calls to pausePatchDeployment. */
354     public UnaryCallSettings.Builder<
355             PatchDeployments.PausePatchDeploymentRequest, PatchDeployments.PatchDeployment>
pausePatchDeploymentSettings()356         pausePatchDeploymentSettings() {
357       return getStubSettingsBuilder().pausePatchDeploymentSettings();
358     }
359 
360     /** Returns the builder for the settings used for calls to resumePatchDeployment. */
361     public UnaryCallSettings.Builder<
362             PatchDeployments.ResumePatchDeploymentRequest, PatchDeployments.PatchDeployment>
resumePatchDeploymentSettings()363         resumePatchDeploymentSettings() {
364       return getStubSettingsBuilder().resumePatchDeploymentSettings();
365     }
366 
367     @Override
build()368     public OsConfigServiceSettings build() throws IOException {
369       return new OsConfigServiceSettings(this);
370     }
371   }
372 }
373