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