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