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