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