• 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.TargetHttpProxiesClient.AggregatedListPagedResponse;
20 import static com.google.cloud.compute.v1.TargetHttpProxiesClient.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.TargetHttpProxiesStubSettings;
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 TargetHttpProxiesClient}.
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  * TargetHttpProxiesSettings.Builder targetHttpProxiesSettingsBuilder =
63  *     TargetHttpProxiesSettings.newBuilder();
64  * targetHttpProxiesSettingsBuilder
65  *     .getSettings()
66  *     .setRetrySettings(
67  *         targetHttpProxiesSettingsBuilder
68  *             .getSettings()
69  *             .getRetrySettings()
70  *             .toBuilder()
71  *             .setTotalTimeout(Duration.ofSeconds(30))
72  *             .build());
73  * TargetHttpProxiesSettings targetHttpProxiesSettings = targetHttpProxiesSettingsBuilder.build();
74  * }</pre>
75  */
76 @Generated("by gapic-generator-java")
77 public class TargetHttpProxiesSettings extends ClientSettings<TargetHttpProxiesSettings> {
78 
79   /** Returns the object with the settings used for calls to aggregatedList. */
80   public PagedCallSettings<
81           AggregatedListTargetHttpProxiesRequest,
82           TargetHttpProxyAggregatedList,
83           AggregatedListPagedResponse>
aggregatedListSettings()84       aggregatedListSettings() {
85     return ((TargetHttpProxiesStubSettings) getStubSettings()).aggregatedListSettings();
86   }
87 
88   /** Returns the object with the settings used for calls to delete. */
deleteSettings()89   public UnaryCallSettings<DeleteTargetHttpProxyRequest, Operation> deleteSettings() {
90     return ((TargetHttpProxiesStubSettings) getStubSettings()).deleteSettings();
91   }
92 
93   /** Returns the object with the settings used for calls to delete. */
94   public OperationCallSettings<DeleteTargetHttpProxyRequest, Operation, Operation>
deleteOperationSettings()95       deleteOperationSettings() {
96     return ((TargetHttpProxiesStubSettings) getStubSettings()).deleteOperationSettings();
97   }
98 
99   /** Returns the object with the settings used for calls to get. */
getSettings()100   public UnaryCallSettings<GetTargetHttpProxyRequest, TargetHttpProxy> getSettings() {
101     return ((TargetHttpProxiesStubSettings) getStubSettings()).getSettings();
102   }
103 
104   /** Returns the object with the settings used for calls to insert. */
insertSettings()105   public UnaryCallSettings<InsertTargetHttpProxyRequest, Operation> insertSettings() {
106     return ((TargetHttpProxiesStubSettings) getStubSettings()).insertSettings();
107   }
108 
109   /** Returns the object with the settings used for calls to insert. */
110   public OperationCallSettings<InsertTargetHttpProxyRequest, Operation, Operation>
insertOperationSettings()111       insertOperationSettings() {
112     return ((TargetHttpProxiesStubSettings) getStubSettings()).insertOperationSettings();
113   }
114 
115   /** Returns the object with the settings used for calls to list. */
116   public PagedCallSettings<ListTargetHttpProxiesRequest, TargetHttpProxyList, ListPagedResponse>
listSettings()117       listSettings() {
118     return ((TargetHttpProxiesStubSettings) getStubSettings()).listSettings();
119   }
120 
121   /** Returns the object with the settings used for calls to patch. */
patchSettings()122   public UnaryCallSettings<PatchTargetHttpProxyRequest, Operation> patchSettings() {
123     return ((TargetHttpProxiesStubSettings) getStubSettings()).patchSettings();
124   }
125 
126   /** Returns the object with the settings used for calls to patch. */
127   public OperationCallSettings<PatchTargetHttpProxyRequest, Operation, Operation>
patchOperationSettings()128       patchOperationSettings() {
129     return ((TargetHttpProxiesStubSettings) getStubSettings()).patchOperationSettings();
130   }
131 
132   /** Returns the object with the settings used for calls to setUrlMap. */
setUrlMapSettings()133   public UnaryCallSettings<SetUrlMapTargetHttpProxyRequest, Operation> setUrlMapSettings() {
134     return ((TargetHttpProxiesStubSettings) getStubSettings()).setUrlMapSettings();
135   }
136 
137   /** Returns the object with the settings used for calls to setUrlMap. */
138   public OperationCallSettings<SetUrlMapTargetHttpProxyRequest, Operation, Operation>
setUrlMapOperationSettings()139       setUrlMapOperationSettings() {
140     return ((TargetHttpProxiesStubSettings) getStubSettings()).setUrlMapOperationSettings();
141   }
142 
create(TargetHttpProxiesStubSettings stub)143   public static final TargetHttpProxiesSettings create(TargetHttpProxiesStubSettings stub)
144       throws IOException {
145     return new TargetHttpProxiesSettings.Builder(stub.toBuilder()).build();
146   }
147 
148   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()149   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
150     return TargetHttpProxiesStubSettings.defaultExecutorProviderBuilder();
151   }
152 
153   /** Returns the default service endpoint. */
getDefaultEndpoint()154   public static String getDefaultEndpoint() {
155     return TargetHttpProxiesStubSettings.getDefaultEndpoint();
156   }
157 
158   /** Returns the default service scopes. */
getDefaultServiceScopes()159   public static List<String> getDefaultServiceScopes() {
160     return TargetHttpProxiesStubSettings.getDefaultServiceScopes();
161   }
162 
163   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()164   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
165     return TargetHttpProxiesStubSettings.defaultCredentialsProviderBuilder();
166   }
167 
168   /** Returns a builder for the default ChannelProvider for this service. */
169   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()170       defaultHttpJsonTransportProviderBuilder() {
171     return TargetHttpProxiesStubSettings.defaultHttpJsonTransportProviderBuilder();
172   }
173 
defaultTransportChannelProvider()174   public static TransportChannelProvider defaultTransportChannelProvider() {
175     return TargetHttpProxiesStubSettings.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 TargetHttpProxiesStubSettings.defaultApiClientHeaderProviderBuilder();
181   }
182 
183   /** Returns a new builder for this class. */
newBuilder()184   public static Builder newBuilder() {
185     return Builder.createDefault();
186   }
187 
188   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)189   public static Builder newBuilder(ClientContext clientContext) {
190     return new Builder(clientContext);
191   }
192 
193   /** Returns a builder containing all the values of this settings class. */
toBuilder()194   public Builder toBuilder() {
195     return new Builder(this);
196   }
197 
TargetHttpProxiesSettings(Builder settingsBuilder)198   protected TargetHttpProxiesSettings(Builder settingsBuilder) throws IOException {
199     super(settingsBuilder);
200   }
201 
202   /** Builder for TargetHttpProxiesSettings. */
203   public static class Builder extends ClientSettings.Builder<TargetHttpProxiesSettings, Builder> {
204 
Builder()205     protected Builder() throws IOException {
206       this(((ClientContext) null));
207     }
208 
Builder(ClientContext clientContext)209     protected Builder(ClientContext clientContext) {
210       super(TargetHttpProxiesStubSettings.newBuilder(clientContext));
211     }
212 
Builder(TargetHttpProxiesSettings settings)213     protected Builder(TargetHttpProxiesSettings settings) {
214       super(settings.getStubSettings().toBuilder());
215     }
216 
Builder(TargetHttpProxiesStubSettings.Builder stubSettings)217     protected Builder(TargetHttpProxiesStubSettings.Builder stubSettings) {
218       super(stubSettings);
219     }
220 
createDefault()221     private static Builder createDefault() {
222       return new Builder(TargetHttpProxiesStubSettings.newBuilder());
223     }
224 
getStubSettingsBuilder()225     public TargetHttpProxiesStubSettings.Builder getStubSettingsBuilder() {
226       return ((TargetHttpProxiesStubSettings.Builder) getStubSettings());
227     }
228 
229     /**
230      * Applies the given settings updater function to all of the unary API methods in this service.
231      *
232      * <p>Note: This method does not support applying settings to streaming methods.
233      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)234     public Builder applyToAllUnaryMethods(
235         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
236       super.applyToAllUnaryMethods(
237           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
238       return this;
239     }
240 
241     /** Returns the builder for the settings used for calls to aggregatedList. */
242     public PagedCallSettings.Builder<
243             AggregatedListTargetHttpProxiesRequest,
244             TargetHttpProxyAggregatedList,
245             AggregatedListPagedResponse>
aggregatedListSettings()246         aggregatedListSettings() {
247       return getStubSettingsBuilder().aggregatedListSettings();
248     }
249 
250     /** Returns the builder for the settings used for calls to delete. */
deleteSettings()251     public UnaryCallSettings.Builder<DeleteTargetHttpProxyRequest, Operation> deleteSettings() {
252       return getStubSettingsBuilder().deleteSettings();
253     }
254 
255     /** Returns the builder for the settings used for calls to delete. */
256     public OperationCallSettings.Builder<DeleteTargetHttpProxyRequest, Operation, Operation>
deleteOperationSettings()257         deleteOperationSettings() {
258       return getStubSettingsBuilder().deleteOperationSettings();
259     }
260 
261     /** Returns the builder for the settings used for calls to get. */
getSettings()262     public UnaryCallSettings.Builder<GetTargetHttpProxyRequest, TargetHttpProxy> getSettings() {
263       return getStubSettingsBuilder().getSettings();
264     }
265 
266     /** Returns the builder for the settings used for calls to insert. */
insertSettings()267     public UnaryCallSettings.Builder<InsertTargetHttpProxyRequest, Operation> insertSettings() {
268       return getStubSettingsBuilder().insertSettings();
269     }
270 
271     /** Returns the builder for the settings used for calls to insert. */
272     public OperationCallSettings.Builder<InsertTargetHttpProxyRequest, Operation, Operation>
insertOperationSettings()273         insertOperationSettings() {
274       return getStubSettingsBuilder().insertOperationSettings();
275     }
276 
277     /** Returns the builder for the settings used for calls to list. */
278     public PagedCallSettings.Builder<
279             ListTargetHttpProxiesRequest, TargetHttpProxyList, ListPagedResponse>
listSettings()280         listSettings() {
281       return getStubSettingsBuilder().listSettings();
282     }
283 
284     /** Returns the builder for the settings used for calls to patch. */
patchSettings()285     public UnaryCallSettings.Builder<PatchTargetHttpProxyRequest, Operation> patchSettings() {
286       return getStubSettingsBuilder().patchSettings();
287     }
288 
289     /** Returns the builder for the settings used for calls to patch. */
290     public OperationCallSettings.Builder<PatchTargetHttpProxyRequest, Operation, Operation>
patchOperationSettings()291         patchOperationSettings() {
292       return getStubSettingsBuilder().patchOperationSettings();
293     }
294 
295     /** Returns the builder for the settings used for calls to setUrlMap. */
296     public UnaryCallSettings.Builder<SetUrlMapTargetHttpProxyRequest, Operation>
setUrlMapSettings()297         setUrlMapSettings() {
298       return getStubSettingsBuilder().setUrlMapSettings();
299     }
300 
301     /** Returns the builder for the settings used for calls to setUrlMap. */
302     public OperationCallSettings.Builder<SetUrlMapTargetHttpProxyRequest, Operation, Operation>
setUrlMapOperationSettings()303         setUrlMapOperationSettings() {
304       return getStubSettingsBuilder().setUrlMapOperationSettings();
305     }
306 
307     @Override
build()308     public TargetHttpProxiesSettings build() throws IOException {
309       return new TargetHttpProxiesSettings(this);
310     }
311   }
312 }
313