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