• 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.RegionBackendServicesClient.ListPagedResponse;
20 
21 import com.google.api.core.ApiFunction;
22 import com.google.api.core.BetaApi;
23 import com.google.api.gax.core.GoogleCredentialsProvider;
24 import com.google.api.gax.core.InstantiatingExecutorProvider;
25 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
26 import com.google.api.gax.rpc.ApiClientHeaderProvider;
27 import com.google.api.gax.rpc.ClientContext;
28 import com.google.api.gax.rpc.ClientSettings;
29 import com.google.api.gax.rpc.OperationCallSettings;
30 import com.google.api.gax.rpc.PagedCallSettings;
31 import com.google.api.gax.rpc.TransportChannelProvider;
32 import com.google.api.gax.rpc.UnaryCallSettings;
33 import com.google.cloud.compute.v1.stub.RegionBackendServicesStubSettings;
34 import java.io.IOException;
35 import java.util.List;
36 import javax.annotation.Generated;
37 
38 // AUTO-GENERATED DOCUMENTATION AND CLASS.
39 /**
40  * Settings class to configure an instance of {@link RegionBackendServicesClient}.
41  *
42  * <p>The default instance has everything set to sensible defaults:
43  *
44  * <ul>
45  *   <li>The default service address (compute.googleapis.com) and default port (443) are used.
46  *   <li>Credentials are acquired automatically through Application Default Credentials.
47  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
48  * </ul>
49  *
50  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
51  * build() is called, the tree of builders is called to create the complete settings object.
52  *
53  * <p>For example, to set the total timeout of get to 30 seconds:
54  *
55  * <pre>{@code
56  * // This snippet has been automatically generated and should be regarded as a code template only.
57  * // It will require modifications to work:
58  * // - It may require correct/in-range values for request initialization.
59  * // - It may require specifying regional endpoints when creating the service client as shown in
60  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
61  * RegionBackendServicesSettings.Builder regionBackendServicesSettingsBuilder =
62  *     RegionBackendServicesSettings.newBuilder();
63  * regionBackendServicesSettingsBuilder
64  *     .getSettings()
65  *     .setRetrySettings(
66  *         regionBackendServicesSettingsBuilder
67  *             .getSettings()
68  *             .getRetrySettings()
69  *             .toBuilder()
70  *             .setTotalTimeout(Duration.ofSeconds(30))
71  *             .build());
72  * RegionBackendServicesSettings regionBackendServicesSettings =
73  *     regionBackendServicesSettingsBuilder.build();
74  * }</pre>
75  */
76 @Generated("by gapic-generator-java")
77 public class RegionBackendServicesSettings extends ClientSettings<RegionBackendServicesSettings> {
78 
79   /** Returns the object with the settings used for calls to delete. */
deleteSettings()80   public UnaryCallSettings<DeleteRegionBackendServiceRequest, Operation> deleteSettings() {
81     return ((RegionBackendServicesStubSettings) getStubSettings()).deleteSettings();
82   }
83 
84   /** Returns the object with the settings used for calls to delete. */
85   public OperationCallSettings<DeleteRegionBackendServiceRequest, Operation, Operation>
deleteOperationSettings()86       deleteOperationSettings() {
87     return ((RegionBackendServicesStubSettings) getStubSettings()).deleteOperationSettings();
88   }
89 
90   /** Returns the object with the settings used for calls to get. */
getSettings()91   public UnaryCallSettings<GetRegionBackendServiceRequest, BackendService> getSettings() {
92     return ((RegionBackendServicesStubSettings) getStubSettings()).getSettings();
93   }
94 
95   /** Returns the object with the settings used for calls to getHealth. */
96   public UnaryCallSettings<GetHealthRegionBackendServiceRequest, BackendServiceGroupHealth>
getHealthSettings()97       getHealthSettings() {
98     return ((RegionBackendServicesStubSettings) getStubSettings()).getHealthSettings();
99   }
100 
101   /** Returns the object with the settings used for calls to getIamPolicy. */
getIamPolicySettings()102   public UnaryCallSettings<GetIamPolicyRegionBackendServiceRequest, Policy> getIamPolicySettings() {
103     return ((RegionBackendServicesStubSettings) getStubSettings()).getIamPolicySettings();
104   }
105 
106   /** Returns the object with the settings used for calls to insert. */
insertSettings()107   public UnaryCallSettings<InsertRegionBackendServiceRequest, Operation> insertSettings() {
108     return ((RegionBackendServicesStubSettings) getStubSettings()).insertSettings();
109   }
110 
111   /** Returns the object with the settings used for calls to insert. */
112   public OperationCallSettings<InsertRegionBackendServiceRequest, Operation, Operation>
insertOperationSettings()113       insertOperationSettings() {
114     return ((RegionBackendServicesStubSettings) getStubSettings()).insertOperationSettings();
115   }
116 
117   /** Returns the object with the settings used for calls to list. */
118   public PagedCallSettings<ListRegionBackendServicesRequest, BackendServiceList, ListPagedResponse>
listSettings()119       listSettings() {
120     return ((RegionBackendServicesStubSettings) getStubSettings()).listSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to patch. */
patchSettings()124   public UnaryCallSettings<PatchRegionBackendServiceRequest, Operation> patchSettings() {
125     return ((RegionBackendServicesStubSettings) getStubSettings()).patchSettings();
126   }
127 
128   /** Returns the object with the settings used for calls to patch. */
129   public OperationCallSettings<PatchRegionBackendServiceRequest, Operation, Operation>
patchOperationSettings()130       patchOperationSettings() {
131     return ((RegionBackendServicesStubSettings) getStubSettings()).patchOperationSettings();
132   }
133 
134   /** Returns the object with the settings used for calls to setIamPolicy. */
setIamPolicySettings()135   public UnaryCallSettings<SetIamPolicyRegionBackendServiceRequest, Policy> setIamPolicySettings() {
136     return ((RegionBackendServicesStubSettings) getStubSettings()).setIamPolicySettings();
137   }
138 
139   /** Returns the object with the settings used for calls to update. */
updateSettings()140   public UnaryCallSettings<UpdateRegionBackendServiceRequest, Operation> updateSettings() {
141     return ((RegionBackendServicesStubSettings) getStubSettings()).updateSettings();
142   }
143 
144   /** Returns the object with the settings used for calls to update. */
145   public OperationCallSettings<UpdateRegionBackendServiceRequest, Operation, Operation>
updateOperationSettings()146       updateOperationSettings() {
147     return ((RegionBackendServicesStubSettings) getStubSettings()).updateOperationSettings();
148   }
149 
create(RegionBackendServicesStubSettings stub)150   public static final RegionBackendServicesSettings create(RegionBackendServicesStubSettings stub)
151       throws IOException {
152     return new RegionBackendServicesSettings.Builder(stub.toBuilder()).build();
153   }
154 
155   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()156   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
157     return RegionBackendServicesStubSettings.defaultExecutorProviderBuilder();
158   }
159 
160   /** Returns the default service endpoint. */
getDefaultEndpoint()161   public static String getDefaultEndpoint() {
162     return RegionBackendServicesStubSettings.getDefaultEndpoint();
163   }
164 
165   /** Returns the default service scopes. */
getDefaultServiceScopes()166   public static List<String> getDefaultServiceScopes() {
167     return RegionBackendServicesStubSettings.getDefaultServiceScopes();
168   }
169 
170   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()171   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
172     return RegionBackendServicesStubSettings.defaultCredentialsProviderBuilder();
173   }
174 
175   /** Returns a builder for the default ChannelProvider for this service. */
176   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()177       defaultHttpJsonTransportProviderBuilder() {
178     return RegionBackendServicesStubSettings.defaultHttpJsonTransportProviderBuilder();
179   }
180 
defaultTransportChannelProvider()181   public static TransportChannelProvider defaultTransportChannelProvider() {
182     return RegionBackendServicesStubSettings.defaultTransportChannelProvider();
183   }
184 
185   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()186   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
187     return RegionBackendServicesStubSettings.defaultApiClientHeaderProviderBuilder();
188   }
189 
190   /** Returns a new builder for this class. */
newBuilder()191   public static Builder newBuilder() {
192     return Builder.createDefault();
193   }
194 
195   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)196   public static Builder newBuilder(ClientContext clientContext) {
197     return new Builder(clientContext);
198   }
199 
200   /** Returns a builder containing all the values of this settings class. */
toBuilder()201   public Builder toBuilder() {
202     return new Builder(this);
203   }
204 
RegionBackendServicesSettings(Builder settingsBuilder)205   protected RegionBackendServicesSettings(Builder settingsBuilder) throws IOException {
206     super(settingsBuilder);
207   }
208 
209   /** Builder for RegionBackendServicesSettings. */
210   public static class Builder
211       extends ClientSettings.Builder<RegionBackendServicesSettings, Builder> {
212 
Builder()213     protected Builder() throws IOException {
214       this(((ClientContext) null));
215     }
216 
Builder(ClientContext clientContext)217     protected Builder(ClientContext clientContext) {
218       super(RegionBackendServicesStubSettings.newBuilder(clientContext));
219     }
220 
Builder(RegionBackendServicesSettings settings)221     protected Builder(RegionBackendServicesSettings settings) {
222       super(settings.getStubSettings().toBuilder());
223     }
224 
Builder(RegionBackendServicesStubSettings.Builder stubSettings)225     protected Builder(RegionBackendServicesStubSettings.Builder stubSettings) {
226       super(stubSettings);
227     }
228 
createDefault()229     private static Builder createDefault() {
230       return new Builder(RegionBackendServicesStubSettings.newBuilder());
231     }
232 
getStubSettingsBuilder()233     public RegionBackendServicesStubSettings.Builder getStubSettingsBuilder() {
234       return ((RegionBackendServicesStubSettings.Builder) getStubSettings());
235     }
236 
237     /**
238      * Applies the given settings updater function to all of the unary API methods in this service.
239      *
240      * <p>Note: This method does not support applying settings to streaming methods.
241      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)242     public Builder applyToAllUnaryMethods(
243         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
244       super.applyToAllUnaryMethods(
245           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
246       return this;
247     }
248 
249     /** Returns the builder for the settings used for calls to delete. */
250     public UnaryCallSettings.Builder<DeleteRegionBackendServiceRequest, Operation>
deleteSettings()251         deleteSettings() {
252       return getStubSettingsBuilder().deleteSettings();
253     }
254 
255     /** Returns the builder for the settings used for calls to delete. */
256     public OperationCallSettings.Builder<DeleteRegionBackendServiceRequest, Operation, Operation>
deleteOperationSettings()257         deleteOperationSettings() {
258       return getStubSettingsBuilder().deleteOperationSettings();
259     }
260 
261     /** Returns the builder for the settings used for calls to get. */
getSettings()262     public UnaryCallSettings.Builder<GetRegionBackendServiceRequest, BackendService> getSettings() {
263       return getStubSettingsBuilder().getSettings();
264     }
265 
266     /** Returns the builder for the settings used for calls to getHealth. */
267     public UnaryCallSettings.Builder<
268             GetHealthRegionBackendServiceRequest, BackendServiceGroupHealth>
getHealthSettings()269         getHealthSettings() {
270       return getStubSettingsBuilder().getHealthSettings();
271     }
272 
273     /** Returns the builder for the settings used for calls to getIamPolicy. */
274     public UnaryCallSettings.Builder<GetIamPolicyRegionBackendServiceRequest, Policy>
getIamPolicySettings()275         getIamPolicySettings() {
276       return getStubSettingsBuilder().getIamPolicySettings();
277     }
278 
279     /** Returns the builder for the settings used for calls to insert. */
280     public UnaryCallSettings.Builder<InsertRegionBackendServiceRequest, Operation>
insertSettings()281         insertSettings() {
282       return getStubSettingsBuilder().insertSettings();
283     }
284 
285     /** Returns the builder for the settings used for calls to insert. */
286     public OperationCallSettings.Builder<InsertRegionBackendServiceRequest, Operation, Operation>
insertOperationSettings()287         insertOperationSettings() {
288       return getStubSettingsBuilder().insertOperationSettings();
289     }
290 
291     /** Returns the builder for the settings used for calls to list. */
292     public PagedCallSettings.Builder<
293             ListRegionBackendServicesRequest, BackendServiceList, ListPagedResponse>
listSettings()294         listSettings() {
295       return getStubSettingsBuilder().listSettings();
296     }
297 
298     /** Returns the builder for the settings used for calls to patch. */
patchSettings()299     public UnaryCallSettings.Builder<PatchRegionBackendServiceRequest, Operation> patchSettings() {
300       return getStubSettingsBuilder().patchSettings();
301     }
302 
303     /** Returns the builder for the settings used for calls to patch. */
304     public OperationCallSettings.Builder<PatchRegionBackendServiceRequest, Operation, Operation>
patchOperationSettings()305         patchOperationSettings() {
306       return getStubSettingsBuilder().patchOperationSettings();
307     }
308 
309     /** Returns the builder for the settings used for calls to setIamPolicy. */
310     public UnaryCallSettings.Builder<SetIamPolicyRegionBackendServiceRequest, Policy>
setIamPolicySettings()311         setIamPolicySettings() {
312       return getStubSettingsBuilder().setIamPolicySettings();
313     }
314 
315     /** Returns the builder for the settings used for calls to update. */
316     public UnaryCallSettings.Builder<UpdateRegionBackendServiceRequest, Operation>
updateSettings()317         updateSettings() {
318       return getStubSettingsBuilder().updateSettings();
319     }
320 
321     /** Returns the builder for the settings used for calls to update. */
322     public OperationCallSettings.Builder<UpdateRegionBackendServiceRequest, Operation, Operation>
updateOperationSettings()323         updateOperationSettings() {
324       return getStubSettingsBuilder().updateOperationSettings();
325     }
326 
327     @Override
build()328     public RegionBackendServicesSettings build() throws IOException {
329       return new RegionBackendServicesSettings(this);
330     }
331   }
332 }
333