• 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.TargetPoolsClient.AggregatedListPagedResponse;
20 import static com.google.cloud.compute.v1.TargetPoolsClient.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.TargetPoolsStubSettings;
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 TargetPoolsClient}.
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  * TargetPoolsSettings.Builder targetPoolsSettingsBuilder = TargetPoolsSettings.newBuilder();
63  * targetPoolsSettingsBuilder
64  *     .getSettings()
65  *     .setRetrySettings(
66  *         targetPoolsSettingsBuilder
67  *             .getSettings()
68  *             .getRetrySettings()
69  *             .toBuilder()
70  *             .setTotalTimeout(Duration.ofSeconds(30))
71  *             .build());
72  * TargetPoolsSettings targetPoolsSettings = targetPoolsSettingsBuilder.build();
73  * }</pre>
74  */
75 @Generated("by gapic-generator-java")
76 public class TargetPoolsSettings extends ClientSettings<TargetPoolsSettings> {
77 
78   /** Returns the object with the settings used for calls to addHealthCheck. */
addHealthCheckSettings()79   public UnaryCallSettings<AddHealthCheckTargetPoolRequest, Operation> addHealthCheckSettings() {
80     return ((TargetPoolsStubSettings) getStubSettings()).addHealthCheckSettings();
81   }
82 
83   /** Returns the object with the settings used for calls to addHealthCheck. */
84   public OperationCallSettings<AddHealthCheckTargetPoolRequest, Operation, Operation>
addHealthCheckOperationSettings()85       addHealthCheckOperationSettings() {
86     return ((TargetPoolsStubSettings) getStubSettings()).addHealthCheckOperationSettings();
87   }
88 
89   /** Returns the object with the settings used for calls to addInstance. */
addInstanceSettings()90   public UnaryCallSettings<AddInstanceTargetPoolRequest, Operation> addInstanceSettings() {
91     return ((TargetPoolsStubSettings) getStubSettings()).addInstanceSettings();
92   }
93 
94   /** Returns the object with the settings used for calls to addInstance. */
95   public OperationCallSettings<AddInstanceTargetPoolRequest, Operation, Operation>
addInstanceOperationSettings()96       addInstanceOperationSettings() {
97     return ((TargetPoolsStubSettings) getStubSettings()).addInstanceOperationSettings();
98   }
99 
100   /** Returns the object with the settings used for calls to aggregatedList. */
101   public PagedCallSettings<
102           AggregatedListTargetPoolsRequest, TargetPoolAggregatedList, AggregatedListPagedResponse>
aggregatedListSettings()103       aggregatedListSettings() {
104     return ((TargetPoolsStubSettings) getStubSettings()).aggregatedListSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to delete. */
deleteSettings()108   public UnaryCallSettings<DeleteTargetPoolRequest, Operation> deleteSettings() {
109     return ((TargetPoolsStubSettings) getStubSettings()).deleteSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to delete. */
113   public OperationCallSettings<DeleteTargetPoolRequest, Operation, Operation>
deleteOperationSettings()114       deleteOperationSettings() {
115     return ((TargetPoolsStubSettings) getStubSettings()).deleteOperationSettings();
116   }
117 
118   /** Returns the object with the settings used for calls to get. */
getSettings()119   public UnaryCallSettings<GetTargetPoolRequest, TargetPool> getSettings() {
120     return ((TargetPoolsStubSettings) getStubSettings()).getSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to getHealth. */
124   public UnaryCallSettings<GetHealthTargetPoolRequest, TargetPoolInstanceHealth>
getHealthSettings()125       getHealthSettings() {
126     return ((TargetPoolsStubSettings) getStubSettings()).getHealthSettings();
127   }
128 
129   /** Returns the object with the settings used for calls to insert. */
insertSettings()130   public UnaryCallSettings<InsertTargetPoolRequest, Operation> insertSettings() {
131     return ((TargetPoolsStubSettings) getStubSettings()).insertSettings();
132   }
133 
134   /** Returns the object with the settings used for calls to insert. */
135   public OperationCallSettings<InsertTargetPoolRequest, Operation, Operation>
insertOperationSettings()136       insertOperationSettings() {
137     return ((TargetPoolsStubSettings) getStubSettings()).insertOperationSettings();
138   }
139 
140   /** Returns the object with the settings used for calls to list. */
141   public PagedCallSettings<ListTargetPoolsRequest, TargetPoolList, ListPagedResponse>
listSettings()142       listSettings() {
143     return ((TargetPoolsStubSettings) getStubSettings()).listSettings();
144   }
145 
146   /** Returns the object with the settings used for calls to removeHealthCheck. */
147   public UnaryCallSettings<RemoveHealthCheckTargetPoolRequest, Operation>
removeHealthCheckSettings()148       removeHealthCheckSettings() {
149     return ((TargetPoolsStubSettings) getStubSettings()).removeHealthCheckSettings();
150   }
151 
152   /** Returns the object with the settings used for calls to removeHealthCheck. */
153   public OperationCallSettings<RemoveHealthCheckTargetPoolRequest, Operation, Operation>
removeHealthCheckOperationSettings()154       removeHealthCheckOperationSettings() {
155     return ((TargetPoolsStubSettings) getStubSettings()).removeHealthCheckOperationSettings();
156   }
157 
158   /** Returns the object with the settings used for calls to removeInstance. */
removeInstanceSettings()159   public UnaryCallSettings<RemoveInstanceTargetPoolRequest, Operation> removeInstanceSettings() {
160     return ((TargetPoolsStubSettings) getStubSettings()).removeInstanceSettings();
161   }
162 
163   /** Returns the object with the settings used for calls to removeInstance. */
164   public OperationCallSettings<RemoveInstanceTargetPoolRequest, Operation, Operation>
removeInstanceOperationSettings()165       removeInstanceOperationSettings() {
166     return ((TargetPoolsStubSettings) getStubSettings()).removeInstanceOperationSettings();
167   }
168 
169   /** Returns the object with the settings used for calls to setBackup. */
setBackupSettings()170   public UnaryCallSettings<SetBackupTargetPoolRequest, Operation> setBackupSettings() {
171     return ((TargetPoolsStubSettings) getStubSettings()).setBackupSettings();
172   }
173 
174   /** Returns the object with the settings used for calls to setBackup. */
175   public OperationCallSettings<SetBackupTargetPoolRequest, Operation, Operation>
setBackupOperationSettings()176       setBackupOperationSettings() {
177     return ((TargetPoolsStubSettings) getStubSettings()).setBackupOperationSettings();
178   }
179 
create(TargetPoolsStubSettings stub)180   public static final TargetPoolsSettings create(TargetPoolsStubSettings stub) throws IOException {
181     return new TargetPoolsSettings.Builder(stub.toBuilder()).build();
182   }
183 
184   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()185   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
186     return TargetPoolsStubSettings.defaultExecutorProviderBuilder();
187   }
188 
189   /** Returns the default service endpoint. */
getDefaultEndpoint()190   public static String getDefaultEndpoint() {
191     return TargetPoolsStubSettings.getDefaultEndpoint();
192   }
193 
194   /** Returns the default service scopes. */
getDefaultServiceScopes()195   public static List<String> getDefaultServiceScopes() {
196     return TargetPoolsStubSettings.getDefaultServiceScopes();
197   }
198 
199   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()200   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
201     return TargetPoolsStubSettings.defaultCredentialsProviderBuilder();
202   }
203 
204   /** Returns a builder for the default ChannelProvider for this service. */
205   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()206       defaultHttpJsonTransportProviderBuilder() {
207     return TargetPoolsStubSettings.defaultHttpJsonTransportProviderBuilder();
208   }
209 
defaultTransportChannelProvider()210   public static TransportChannelProvider defaultTransportChannelProvider() {
211     return TargetPoolsStubSettings.defaultTransportChannelProvider();
212   }
213 
214   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()215   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
216     return TargetPoolsStubSettings.defaultApiClientHeaderProviderBuilder();
217   }
218 
219   /** Returns a new builder for this class. */
newBuilder()220   public static Builder newBuilder() {
221     return Builder.createDefault();
222   }
223 
224   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)225   public static Builder newBuilder(ClientContext clientContext) {
226     return new Builder(clientContext);
227   }
228 
229   /** Returns a builder containing all the values of this settings class. */
toBuilder()230   public Builder toBuilder() {
231     return new Builder(this);
232   }
233 
TargetPoolsSettings(Builder settingsBuilder)234   protected TargetPoolsSettings(Builder settingsBuilder) throws IOException {
235     super(settingsBuilder);
236   }
237 
238   /** Builder for TargetPoolsSettings. */
239   public static class Builder extends ClientSettings.Builder<TargetPoolsSettings, Builder> {
240 
Builder()241     protected Builder() throws IOException {
242       this(((ClientContext) null));
243     }
244 
Builder(ClientContext clientContext)245     protected Builder(ClientContext clientContext) {
246       super(TargetPoolsStubSettings.newBuilder(clientContext));
247     }
248 
Builder(TargetPoolsSettings settings)249     protected Builder(TargetPoolsSettings settings) {
250       super(settings.getStubSettings().toBuilder());
251     }
252 
Builder(TargetPoolsStubSettings.Builder stubSettings)253     protected Builder(TargetPoolsStubSettings.Builder stubSettings) {
254       super(stubSettings);
255     }
256 
createDefault()257     private static Builder createDefault() {
258       return new Builder(TargetPoolsStubSettings.newBuilder());
259     }
260 
getStubSettingsBuilder()261     public TargetPoolsStubSettings.Builder getStubSettingsBuilder() {
262       return ((TargetPoolsStubSettings.Builder) getStubSettings());
263     }
264 
265     /**
266      * Applies the given settings updater function to all of the unary API methods in this service.
267      *
268      * <p>Note: This method does not support applying settings to streaming methods.
269      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)270     public Builder applyToAllUnaryMethods(
271         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
272       super.applyToAllUnaryMethods(
273           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
274       return this;
275     }
276 
277     /** Returns the builder for the settings used for calls to addHealthCheck. */
278     public UnaryCallSettings.Builder<AddHealthCheckTargetPoolRequest, Operation>
addHealthCheckSettings()279         addHealthCheckSettings() {
280       return getStubSettingsBuilder().addHealthCheckSettings();
281     }
282 
283     /** Returns the builder for the settings used for calls to addHealthCheck. */
284     public OperationCallSettings.Builder<AddHealthCheckTargetPoolRequest, Operation, Operation>
addHealthCheckOperationSettings()285         addHealthCheckOperationSettings() {
286       return getStubSettingsBuilder().addHealthCheckOperationSettings();
287     }
288 
289     /** Returns the builder for the settings used for calls to addInstance. */
290     public UnaryCallSettings.Builder<AddInstanceTargetPoolRequest, Operation>
addInstanceSettings()291         addInstanceSettings() {
292       return getStubSettingsBuilder().addInstanceSettings();
293     }
294 
295     /** Returns the builder for the settings used for calls to addInstance. */
296     public OperationCallSettings.Builder<AddInstanceTargetPoolRequest, Operation, Operation>
addInstanceOperationSettings()297         addInstanceOperationSettings() {
298       return getStubSettingsBuilder().addInstanceOperationSettings();
299     }
300 
301     /** Returns the builder for the settings used for calls to aggregatedList. */
302     public PagedCallSettings.Builder<
303             AggregatedListTargetPoolsRequest, TargetPoolAggregatedList, AggregatedListPagedResponse>
aggregatedListSettings()304         aggregatedListSettings() {
305       return getStubSettingsBuilder().aggregatedListSettings();
306     }
307 
308     /** Returns the builder for the settings used for calls to delete. */
deleteSettings()309     public UnaryCallSettings.Builder<DeleteTargetPoolRequest, Operation> deleteSettings() {
310       return getStubSettingsBuilder().deleteSettings();
311     }
312 
313     /** Returns the builder for the settings used for calls to delete. */
314     public OperationCallSettings.Builder<DeleteTargetPoolRequest, Operation, Operation>
deleteOperationSettings()315         deleteOperationSettings() {
316       return getStubSettingsBuilder().deleteOperationSettings();
317     }
318 
319     /** Returns the builder for the settings used for calls to get. */
getSettings()320     public UnaryCallSettings.Builder<GetTargetPoolRequest, TargetPool> getSettings() {
321       return getStubSettingsBuilder().getSettings();
322     }
323 
324     /** Returns the builder for the settings used for calls to getHealth. */
325     public UnaryCallSettings.Builder<GetHealthTargetPoolRequest, TargetPoolInstanceHealth>
getHealthSettings()326         getHealthSettings() {
327       return getStubSettingsBuilder().getHealthSettings();
328     }
329 
330     /** Returns the builder for the settings used for calls to insert. */
insertSettings()331     public UnaryCallSettings.Builder<InsertTargetPoolRequest, Operation> insertSettings() {
332       return getStubSettingsBuilder().insertSettings();
333     }
334 
335     /** Returns the builder for the settings used for calls to insert. */
336     public OperationCallSettings.Builder<InsertTargetPoolRequest, Operation, Operation>
insertOperationSettings()337         insertOperationSettings() {
338       return getStubSettingsBuilder().insertOperationSettings();
339     }
340 
341     /** Returns the builder for the settings used for calls to list. */
342     public PagedCallSettings.Builder<ListTargetPoolsRequest, TargetPoolList, ListPagedResponse>
listSettings()343         listSettings() {
344       return getStubSettingsBuilder().listSettings();
345     }
346 
347     /** Returns the builder for the settings used for calls to removeHealthCheck. */
348     public UnaryCallSettings.Builder<RemoveHealthCheckTargetPoolRequest, Operation>
removeHealthCheckSettings()349         removeHealthCheckSettings() {
350       return getStubSettingsBuilder().removeHealthCheckSettings();
351     }
352 
353     /** Returns the builder for the settings used for calls to removeHealthCheck. */
354     public OperationCallSettings.Builder<RemoveHealthCheckTargetPoolRequest, Operation, Operation>
removeHealthCheckOperationSettings()355         removeHealthCheckOperationSettings() {
356       return getStubSettingsBuilder().removeHealthCheckOperationSettings();
357     }
358 
359     /** Returns the builder for the settings used for calls to removeInstance. */
360     public UnaryCallSettings.Builder<RemoveInstanceTargetPoolRequest, Operation>
removeInstanceSettings()361         removeInstanceSettings() {
362       return getStubSettingsBuilder().removeInstanceSettings();
363     }
364 
365     /** Returns the builder for the settings used for calls to removeInstance. */
366     public OperationCallSettings.Builder<RemoveInstanceTargetPoolRequest, Operation, Operation>
removeInstanceOperationSettings()367         removeInstanceOperationSettings() {
368       return getStubSettingsBuilder().removeInstanceOperationSettings();
369     }
370 
371     /** Returns the builder for the settings used for calls to setBackup. */
setBackupSettings()372     public UnaryCallSettings.Builder<SetBackupTargetPoolRequest, Operation> setBackupSettings() {
373       return getStubSettingsBuilder().setBackupSettings();
374     }
375 
376     /** Returns the builder for the settings used for calls to setBackup. */
377     public OperationCallSettings.Builder<SetBackupTargetPoolRequest, Operation, Operation>
setBackupOperationSettings()378         setBackupOperationSettings() {
379       return getStubSettingsBuilder().setBackupOperationSettings();
380     }
381 
382     @Override
build()383     public TargetPoolsSettings build() throws IOException {
384       return new TargetPoolsSettings(this);
385     }
386   }
387 }
388