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