• 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.DisksClient.AggregatedListPagedResponse;
20 import static com.google.cloud.compute.v1.DisksClient.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.DisksStubSettings;
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 DisksClient}.
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  * DisksSettings.Builder disksSettingsBuilder = DisksSettings.newBuilder();
63  * disksSettingsBuilder
64  *     .getSettings()
65  *     .setRetrySettings(
66  *         disksSettingsBuilder
67  *             .getSettings()
68  *             .getRetrySettings()
69  *             .toBuilder()
70  *             .setTotalTimeout(Duration.ofSeconds(30))
71  *             .build());
72  * DisksSettings disksSettings = disksSettingsBuilder.build();
73  * }</pre>
74  */
75 @Generated("by gapic-generator-java")
76 public class DisksSettings extends ClientSettings<DisksSettings> {
77 
78   /** Returns the object with the settings used for calls to addResourcePolicies. */
79   public UnaryCallSettings<AddResourcePoliciesDiskRequest, Operation>
addResourcePoliciesSettings()80       addResourcePoliciesSettings() {
81     return ((DisksStubSettings) getStubSettings()).addResourcePoliciesSettings();
82   }
83 
84   /** Returns the object with the settings used for calls to addResourcePolicies. */
85   public OperationCallSettings<AddResourcePoliciesDiskRequest, Operation, Operation>
addResourcePoliciesOperationSettings()86       addResourcePoliciesOperationSettings() {
87     return ((DisksStubSettings) getStubSettings()).addResourcePoliciesOperationSettings();
88   }
89 
90   /** Returns the object with the settings used for calls to aggregatedList. */
91   public PagedCallSettings<
92           AggregatedListDisksRequest, DiskAggregatedList, AggregatedListPagedResponse>
aggregatedListSettings()93       aggregatedListSettings() {
94     return ((DisksStubSettings) getStubSettings()).aggregatedListSettings();
95   }
96 
97   /** Returns the object with the settings used for calls to createSnapshot. */
createSnapshotSettings()98   public UnaryCallSettings<CreateSnapshotDiskRequest, Operation> createSnapshotSettings() {
99     return ((DisksStubSettings) getStubSettings()).createSnapshotSettings();
100   }
101 
102   /** Returns the object with the settings used for calls to createSnapshot. */
103   public OperationCallSettings<CreateSnapshotDiskRequest, Operation, Operation>
createSnapshotOperationSettings()104       createSnapshotOperationSettings() {
105     return ((DisksStubSettings) getStubSettings()).createSnapshotOperationSettings();
106   }
107 
108   /** Returns the object with the settings used for calls to delete. */
deleteSettings()109   public UnaryCallSettings<DeleteDiskRequest, Operation> deleteSettings() {
110     return ((DisksStubSettings) getStubSettings()).deleteSettings();
111   }
112 
113   /** Returns the object with the settings used for calls to delete. */
deleteOperationSettings()114   public OperationCallSettings<DeleteDiskRequest, Operation, Operation> deleteOperationSettings() {
115     return ((DisksStubSettings) getStubSettings()).deleteOperationSettings();
116   }
117 
118   /** Returns the object with the settings used for calls to get. */
getSettings()119   public UnaryCallSettings<GetDiskRequest, Disk> getSettings() {
120     return ((DisksStubSettings) getStubSettings()).getSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to getIamPolicy. */
getIamPolicySettings()124   public UnaryCallSettings<GetIamPolicyDiskRequest, Policy> getIamPolicySettings() {
125     return ((DisksStubSettings) getStubSettings()).getIamPolicySettings();
126   }
127 
128   /** Returns the object with the settings used for calls to insert. */
insertSettings()129   public UnaryCallSettings<InsertDiskRequest, Operation> insertSettings() {
130     return ((DisksStubSettings) getStubSettings()).insertSettings();
131   }
132 
133   /** Returns the object with the settings used for calls to insert. */
insertOperationSettings()134   public OperationCallSettings<InsertDiskRequest, Operation, Operation> insertOperationSettings() {
135     return ((DisksStubSettings) getStubSettings()).insertOperationSettings();
136   }
137 
138   /** Returns the object with the settings used for calls to list. */
listSettings()139   public PagedCallSettings<ListDisksRequest, DiskList, ListPagedResponse> listSettings() {
140     return ((DisksStubSettings) getStubSettings()).listSettings();
141   }
142 
143   /** Returns the object with the settings used for calls to removeResourcePolicies. */
144   public UnaryCallSettings<RemoveResourcePoliciesDiskRequest, Operation>
removeResourcePoliciesSettings()145       removeResourcePoliciesSettings() {
146     return ((DisksStubSettings) getStubSettings()).removeResourcePoliciesSettings();
147   }
148 
149   /** Returns the object with the settings used for calls to removeResourcePolicies. */
150   public OperationCallSettings<RemoveResourcePoliciesDiskRequest, Operation, Operation>
removeResourcePoliciesOperationSettings()151       removeResourcePoliciesOperationSettings() {
152     return ((DisksStubSettings) getStubSettings()).removeResourcePoliciesOperationSettings();
153   }
154 
155   /** Returns the object with the settings used for calls to resize. */
resizeSettings()156   public UnaryCallSettings<ResizeDiskRequest, Operation> resizeSettings() {
157     return ((DisksStubSettings) getStubSettings()).resizeSettings();
158   }
159 
160   /** Returns the object with the settings used for calls to resize. */
resizeOperationSettings()161   public OperationCallSettings<ResizeDiskRequest, Operation, Operation> resizeOperationSettings() {
162     return ((DisksStubSettings) getStubSettings()).resizeOperationSettings();
163   }
164 
165   /** Returns the object with the settings used for calls to setIamPolicy. */
setIamPolicySettings()166   public UnaryCallSettings<SetIamPolicyDiskRequest, Policy> setIamPolicySettings() {
167     return ((DisksStubSettings) getStubSettings()).setIamPolicySettings();
168   }
169 
170   /** Returns the object with the settings used for calls to setLabels. */
setLabelsSettings()171   public UnaryCallSettings<SetLabelsDiskRequest, Operation> setLabelsSettings() {
172     return ((DisksStubSettings) getStubSettings()).setLabelsSettings();
173   }
174 
175   /** Returns the object with the settings used for calls to setLabels. */
176   public OperationCallSettings<SetLabelsDiskRequest, Operation, Operation>
setLabelsOperationSettings()177       setLabelsOperationSettings() {
178     return ((DisksStubSettings) getStubSettings()).setLabelsOperationSettings();
179   }
180 
181   /** Returns the object with the settings used for calls to testIamPermissions. */
182   public UnaryCallSettings<TestIamPermissionsDiskRequest, TestPermissionsResponse>
testIamPermissionsSettings()183       testIamPermissionsSettings() {
184     return ((DisksStubSettings) getStubSettings()).testIamPermissionsSettings();
185   }
186 
187   /** Returns the object with the settings used for calls to update. */
updateSettings()188   public UnaryCallSettings<UpdateDiskRequest, Operation> updateSettings() {
189     return ((DisksStubSettings) getStubSettings()).updateSettings();
190   }
191 
192   /** Returns the object with the settings used for calls to update. */
updateOperationSettings()193   public OperationCallSettings<UpdateDiskRequest, Operation, Operation> updateOperationSettings() {
194     return ((DisksStubSettings) getStubSettings()).updateOperationSettings();
195   }
196 
create(DisksStubSettings stub)197   public static final DisksSettings create(DisksStubSettings stub) throws IOException {
198     return new DisksSettings.Builder(stub.toBuilder()).build();
199   }
200 
201   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()202   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
203     return DisksStubSettings.defaultExecutorProviderBuilder();
204   }
205 
206   /** Returns the default service endpoint. */
getDefaultEndpoint()207   public static String getDefaultEndpoint() {
208     return DisksStubSettings.getDefaultEndpoint();
209   }
210 
211   /** Returns the default service scopes. */
getDefaultServiceScopes()212   public static List<String> getDefaultServiceScopes() {
213     return DisksStubSettings.getDefaultServiceScopes();
214   }
215 
216   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()217   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
218     return DisksStubSettings.defaultCredentialsProviderBuilder();
219   }
220 
221   /** Returns a builder for the default ChannelProvider for this service. */
222   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()223       defaultHttpJsonTransportProviderBuilder() {
224     return DisksStubSettings.defaultHttpJsonTransportProviderBuilder();
225   }
226 
defaultTransportChannelProvider()227   public static TransportChannelProvider defaultTransportChannelProvider() {
228     return DisksStubSettings.defaultTransportChannelProvider();
229   }
230 
231   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()232   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
233     return DisksStubSettings.defaultApiClientHeaderProviderBuilder();
234   }
235 
236   /** Returns a new builder for this class. */
newBuilder()237   public static Builder newBuilder() {
238     return Builder.createDefault();
239   }
240 
241   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)242   public static Builder newBuilder(ClientContext clientContext) {
243     return new Builder(clientContext);
244   }
245 
246   /** Returns a builder containing all the values of this settings class. */
toBuilder()247   public Builder toBuilder() {
248     return new Builder(this);
249   }
250 
DisksSettings(Builder settingsBuilder)251   protected DisksSettings(Builder settingsBuilder) throws IOException {
252     super(settingsBuilder);
253   }
254 
255   /** Builder for DisksSettings. */
256   public static class Builder extends ClientSettings.Builder<DisksSettings, Builder> {
257 
Builder()258     protected Builder() throws IOException {
259       this(((ClientContext) null));
260     }
261 
Builder(ClientContext clientContext)262     protected Builder(ClientContext clientContext) {
263       super(DisksStubSettings.newBuilder(clientContext));
264     }
265 
Builder(DisksSettings settings)266     protected Builder(DisksSettings settings) {
267       super(settings.getStubSettings().toBuilder());
268     }
269 
Builder(DisksStubSettings.Builder stubSettings)270     protected Builder(DisksStubSettings.Builder stubSettings) {
271       super(stubSettings);
272     }
273 
createDefault()274     private static Builder createDefault() {
275       return new Builder(DisksStubSettings.newBuilder());
276     }
277 
getStubSettingsBuilder()278     public DisksStubSettings.Builder getStubSettingsBuilder() {
279       return ((DisksStubSettings.Builder) getStubSettings());
280     }
281 
282     /**
283      * Applies the given settings updater function to all of the unary API methods in this service.
284      *
285      * <p>Note: This method does not support applying settings to streaming methods.
286      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)287     public Builder applyToAllUnaryMethods(
288         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
289       super.applyToAllUnaryMethods(
290           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
291       return this;
292     }
293 
294     /** Returns the builder for the settings used for calls to addResourcePolicies. */
295     public UnaryCallSettings.Builder<AddResourcePoliciesDiskRequest, Operation>
addResourcePoliciesSettings()296         addResourcePoliciesSettings() {
297       return getStubSettingsBuilder().addResourcePoliciesSettings();
298     }
299 
300     /** Returns the builder for the settings used for calls to addResourcePolicies. */
301     public OperationCallSettings.Builder<AddResourcePoliciesDiskRequest, Operation, Operation>
addResourcePoliciesOperationSettings()302         addResourcePoliciesOperationSettings() {
303       return getStubSettingsBuilder().addResourcePoliciesOperationSettings();
304     }
305 
306     /** Returns the builder for the settings used for calls to aggregatedList. */
307     public PagedCallSettings.Builder<
308             AggregatedListDisksRequest, DiskAggregatedList, AggregatedListPagedResponse>
aggregatedListSettings()309         aggregatedListSettings() {
310       return getStubSettingsBuilder().aggregatedListSettings();
311     }
312 
313     /** Returns the builder for the settings used for calls to createSnapshot. */
314     public UnaryCallSettings.Builder<CreateSnapshotDiskRequest, Operation>
createSnapshotSettings()315         createSnapshotSettings() {
316       return getStubSettingsBuilder().createSnapshotSettings();
317     }
318 
319     /** Returns the builder for the settings used for calls to createSnapshot. */
320     public OperationCallSettings.Builder<CreateSnapshotDiskRequest, Operation, Operation>
createSnapshotOperationSettings()321         createSnapshotOperationSettings() {
322       return getStubSettingsBuilder().createSnapshotOperationSettings();
323     }
324 
325     /** Returns the builder for the settings used for calls to delete. */
deleteSettings()326     public UnaryCallSettings.Builder<DeleteDiskRequest, Operation> deleteSettings() {
327       return getStubSettingsBuilder().deleteSettings();
328     }
329 
330     /** Returns the builder for the settings used for calls to delete. */
331     public OperationCallSettings.Builder<DeleteDiskRequest, Operation, Operation>
deleteOperationSettings()332         deleteOperationSettings() {
333       return getStubSettingsBuilder().deleteOperationSettings();
334     }
335 
336     /** Returns the builder for the settings used for calls to get. */
getSettings()337     public UnaryCallSettings.Builder<GetDiskRequest, Disk> getSettings() {
338       return getStubSettingsBuilder().getSettings();
339     }
340 
341     /** Returns the builder for the settings used for calls to getIamPolicy. */
getIamPolicySettings()342     public UnaryCallSettings.Builder<GetIamPolicyDiskRequest, Policy> getIamPolicySettings() {
343       return getStubSettingsBuilder().getIamPolicySettings();
344     }
345 
346     /** Returns the builder for the settings used for calls to insert. */
insertSettings()347     public UnaryCallSettings.Builder<InsertDiskRequest, Operation> insertSettings() {
348       return getStubSettingsBuilder().insertSettings();
349     }
350 
351     /** Returns the builder for the settings used for calls to insert. */
352     public OperationCallSettings.Builder<InsertDiskRequest, Operation, Operation>
insertOperationSettings()353         insertOperationSettings() {
354       return getStubSettingsBuilder().insertOperationSettings();
355     }
356 
357     /** Returns the builder for the settings used for calls to list. */
listSettings()358     public PagedCallSettings.Builder<ListDisksRequest, DiskList, ListPagedResponse> listSettings() {
359       return getStubSettingsBuilder().listSettings();
360     }
361 
362     /** Returns the builder for the settings used for calls to removeResourcePolicies. */
363     public UnaryCallSettings.Builder<RemoveResourcePoliciesDiskRequest, Operation>
removeResourcePoliciesSettings()364         removeResourcePoliciesSettings() {
365       return getStubSettingsBuilder().removeResourcePoliciesSettings();
366     }
367 
368     /** Returns the builder for the settings used for calls to removeResourcePolicies. */
369     public OperationCallSettings.Builder<RemoveResourcePoliciesDiskRequest, Operation, Operation>
removeResourcePoliciesOperationSettings()370         removeResourcePoliciesOperationSettings() {
371       return getStubSettingsBuilder().removeResourcePoliciesOperationSettings();
372     }
373 
374     /** Returns the builder for the settings used for calls to resize. */
resizeSettings()375     public UnaryCallSettings.Builder<ResizeDiskRequest, Operation> resizeSettings() {
376       return getStubSettingsBuilder().resizeSettings();
377     }
378 
379     /** Returns the builder for the settings used for calls to resize. */
380     public OperationCallSettings.Builder<ResizeDiskRequest, Operation, Operation>
resizeOperationSettings()381         resizeOperationSettings() {
382       return getStubSettingsBuilder().resizeOperationSettings();
383     }
384 
385     /** Returns the builder for the settings used for calls to setIamPolicy. */
setIamPolicySettings()386     public UnaryCallSettings.Builder<SetIamPolicyDiskRequest, Policy> setIamPolicySettings() {
387       return getStubSettingsBuilder().setIamPolicySettings();
388     }
389 
390     /** Returns the builder for the settings used for calls to setLabels. */
setLabelsSettings()391     public UnaryCallSettings.Builder<SetLabelsDiskRequest, Operation> setLabelsSettings() {
392       return getStubSettingsBuilder().setLabelsSettings();
393     }
394 
395     /** Returns the builder for the settings used for calls to setLabels. */
396     public OperationCallSettings.Builder<SetLabelsDiskRequest, Operation, Operation>
setLabelsOperationSettings()397         setLabelsOperationSettings() {
398       return getStubSettingsBuilder().setLabelsOperationSettings();
399     }
400 
401     /** Returns the builder for the settings used for calls to testIamPermissions. */
402     public UnaryCallSettings.Builder<TestIamPermissionsDiskRequest, TestPermissionsResponse>
testIamPermissionsSettings()403         testIamPermissionsSettings() {
404       return getStubSettingsBuilder().testIamPermissionsSettings();
405     }
406 
407     /** Returns the builder for the settings used for calls to update. */
updateSettings()408     public UnaryCallSettings.Builder<UpdateDiskRequest, Operation> updateSettings() {
409       return getStubSettingsBuilder().updateSettings();
410     }
411 
412     /** Returns the builder for the settings used for calls to update. */
413     public OperationCallSettings.Builder<UpdateDiskRequest, Operation, Operation>
updateOperationSettings()414         updateOperationSettings() {
415       return getStubSettingsBuilder().updateOperationSettings();
416     }
417 
418     @Override
build()419     public DisksSettings build() throws IOException {
420       return new DisksSettings(this);
421     }
422   }
423 }
424