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