• 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.memcache.v1beta2;
18 
19 import static com.google.cloud.memcache.v1beta2.CloudMemcacheClient.ListInstancesPagedResponse;
20 import static com.google.cloud.memcache.v1beta2.CloudMemcacheClient.ListLocationsPagedResponse;
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.grpc.InstantiatingGrpcChannelProvider;
27 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
28 import com.google.api.gax.rpc.ApiClientHeaderProvider;
29 import com.google.api.gax.rpc.ClientContext;
30 import com.google.api.gax.rpc.ClientSettings;
31 import com.google.api.gax.rpc.OperationCallSettings;
32 import com.google.api.gax.rpc.PagedCallSettings;
33 import com.google.api.gax.rpc.TransportChannelProvider;
34 import com.google.api.gax.rpc.UnaryCallSettings;
35 import com.google.cloud.location.GetLocationRequest;
36 import com.google.cloud.location.ListLocationsRequest;
37 import com.google.cloud.location.ListLocationsResponse;
38 import com.google.cloud.location.Location;
39 import com.google.cloud.memcache.v1beta2.stub.CloudMemcacheStubSettings;
40 import com.google.longrunning.Operation;
41 import com.google.protobuf.Empty;
42 import java.io.IOException;
43 import java.util.List;
44 import javax.annotation.Generated;
45 
46 // AUTO-GENERATED DOCUMENTATION AND CLASS.
47 /**
48  * Settings class to configure an instance of {@link CloudMemcacheClient}.
49  *
50  * <p>The default instance has everything set to sensible defaults:
51  *
52  * <ul>
53  *   <li>The default service address (memcache.googleapis.com) and default port (443) are used.
54  *   <li>Credentials are acquired automatically through Application Default Credentials.
55  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
56  * </ul>
57  *
58  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
59  * build() is called, the tree of builders is called to create the complete settings object.
60  *
61  * <p>For example, to set the total timeout of getInstance to 30 seconds:
62  *
63  * <pre>{@code
64  * // This snippet has been automatically generated and should be regarded as a code template only.
65  * // It will require modifications to work:
66  * // - It may require correct/in-range values for request initialization.
67  * // - It may require specifying regional endpoints when creating the service client as shown in
68  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
69  * CloudMemcacheSettings.Builder cloudMemcacheSettingsBuilder = CloudMemcacheSettings.newBuilder();
70  * cloudMemcacheSettingsBuilder
71  *     .getInstanceSettings()
72  *     .setRetrySettings(
73  *         cloudMemcacheSettingsBuilder
74  *             .getInstanceSettings()
75  *             .getRetrySettings()
76  *             .toBuilder()
77  *             .setTotalTimeout(Duration.ofSeconds(30))
78  *             .build());
79  * CloudMemcacheSettings cloudMemcacheSettings = cloudMemcacheSettingsBuilder.build();
80  * }</pre>
81  */
82 @BetaApi
83 @Generated("by gapic-generator-java")
84 public class CloudMemcacheSettings extends ClientSettings<CloudMemcacheSettings> {
85 
86   /** Returns the object with the settings used for calls to listInstances. */
87   public PagedCallSettings<ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse>
listInstancesSettings()88       listInstancesSettings() {
89     return ((CloudMemcacheStubSettings) getStubSettings()).listInstancesSettings();
90   }
91 
92   /** Returns the object with the settings used for calls to getInstance. */
getInstanceSettings()93   public UnaryCallSettings<GetInstanceRequest, Instance> getInstanceSettings() {
94     return ((CloudMemcacheStubSettings) getStubSettings()).getInstanceSettings();
95   }
96 
97   /** Returns the object with the settings used for calls to createInstance. */
createInstanceSettings()98   public UnaryCallSettings<CreateInstanceRequest, Operation> createInstanceSettings() {
99     return ((CloudMemcacheStubSettings) getStubSettings()).createInstanceSettings();
100   }
101 
102   /** Returns the object with the settings used for calls to createInstance. */
103   public OperationCallSettings<CreateInstanceRequest, Instance, OperationMetadata>
createInstanceOperationSettings()104       createInstanceOperationSettings() {
105     return ((CloudMemcacheStubSettings) getStubSettings()).createInstanceOperationSettings();
106   }
107 
108   /** Returns the object with the settings used for calls to updateInstance. */
updateInstanceSettings()109   public UnaryCallSettings<UpdateInstanceRequest, Operation> updateInstanceSettings() {
110     return ((CloudMemcacheStubSettings) getStubSettings()).updateInstanceSettings();
111   }
112 
113   /** Returns the object with the settings used for calls to updateInstance. */
114   public OperationCallSettings<UpdateInstanceRequest, Instance, OperationMetadata>
updateInstanceOperationSettings()115       updateInstanceOperationSettings() {
116     return ((CloudMemcacheStubSettings) getStubSettings()).updateInstanceOperationSettings();
117   }
118 
119   /** Returns the object with the settings used for calls to updateParameters. */
updateParametersSettings()120   public UnaryCallSettings<UpdateParametersRequest, Operation> updateParametersSettings() {
121     return ((CloudMemcacheStubSettings) getStubSettings()).updateParametersSettings();
122   }
123 
124   /** Returns the object with the settings used for calls to updateParameters. */
125   public OperationCallSettings<UpdateParametersRequest, Instance, OperationMetadata>
updateParametersOperationSettings()126       updateParametersOperationSettings() {
127     return ((CloudMemcacheStubSettings) getStubSettings()).updateParametersOperationSettings();
128   }
129 
130   /** Returns the object with the settings used for calls to deleteInstance. */
deleteInstanceSettings()131   public UnaryCallSettings<DeleteInstanceRequest, Operation> deleteInstanceSettings() {
132     return ((CloudMemcacheStubSettings) getStubSettings()).deleteInstanceSettings();
133   }
134 
135   /** Returns the object with the settings used for calls to deleteInstance. */
136   public OperationCallSettings<DeleteInstanceRequest, Empty, OperationMetadata>
deleteInstanceOperationSettings()137       deleteInstanceOperationSettings() {
138     return ((CloudMemcacheStubSettings) getStubSettings()).deleteInstanceOperationSettings();
139   }
140 
141   /** Returns the object with the settings used for calls to applyParameters. */
applyParametersSettings()142   public UnaryCallSettings<ApplyParametersRequest, Operation> applyParametersSettings() {
143     return ((CloudMemcacheStubSettings) getStubSettings()).applyParametersSettings();
144   }
145 
146   /** Returns the object with the settings used for calls to applyParameters. */
147   public OperationCallSettings<ApplyParametersRequest, Instance, OperationMetadata>
applyParametersOperationSettings()148       applyParametersOperationSettings() {
149     return ((CloudMemcacheStubSettings) getStubSettings()).applyParametersOperationSettings();
150   }
151 
152   /** Returns the object with the settings used for calls to applySoftwareUpdate. */
applySoftwareUpdateSettings()153   public UnaryCallSettings<ApplySoftwareUpdateRequest, Operation> applySoftwareUpdateSettings() {
154     return ((CloudMemcacheStubSettings) getStubSettings()).applySoftwareUpdateSettings();
155   }
156 
157   /** Returns the object with the settings used for calls to applySoftwareUpdate. */
158   public OperationCallSettings<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationSettings()159       applySoftwareUpdateOperationSettings() {
160     return ((CloudMemcacheStubSettings) getStubSettings()).applySoftwareUpdateOperationSettings();
161   }
162 
163   /** Returns the object with the settings used for calls to rescheduleMaintenance. */
164   public UnaryCallSettings<RescheduleMaintenanceRequest, Operation>
rescheduleMaintenanceSettings()165       rescheduleMaintenanceSettings() {
166     return ((CloudMemcacheStubSettings) getStubSettings()).rescheduleMaintenanceSettings();
167   }
168 
169   /** Returns the object with the settings used for calls to rescheduleMaintenance. */
170   public OperationCallSettings<RescheduleMaintenanceRequest, Instance, OperationMetadata>
rescheduleMaintenanceOperationSettings()171       rescheduleMaintenanceOperationSettings() {
172     return ((CloudMemcacheStubSettings) getStubSettings()).rescheduleMaintenanceOperationSettings();
173   }
174 
175   /** Returns the object with the settings used for calls to listLocations. */
176   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()177       listLocationsSettings() {
178     return ((CloudMemcacheStubSettings) getStubSettings()).listLocationsSettings();
179   }
180 
181   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()182   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
183     return ((CloudMemcacheStubSettings) getStubSettings()).getLocationSettings();
184   }
185 
create(CloudMemcacheStubSettings stub)186   public static final CloudMemcacheSettings create(CloudMemcacheStubSettings stub)
187       throws IOException {
188     return new CloudMemcacheSettings.Builder(stub.toBuilder()).build();
189   }
190 
191   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()192   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
193     return CloudMemcacheStubSettings.defaultExecutorProviderBuilder();
194   }
195 
196   /** Returns the default service endpoint. */
getDefaultEndpoint()197   public static String getDefaultEndpoint() {
198     return CloudMemcacheStubSettings.getDefaultEndpoint();
199   }
200 
201   /** Returns the default service scopes. */
getDefaultServiceScopes()202   public static List<String> getDefaultServiceScopes() {
203     return CloudMemcacheStubSettings.getDefaultServiceScopes();
204   }
205 
206   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()207   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
208     return CloudMemcacheStubSettings.defaultCredentialsProviderBuilder();
209   }
210 
211   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()212   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
213     return CloudMemcacheStubSettings.defaultGrpcTransportProviderBuilder();
214   }
215 
216   /** Returns a builder for the default REST ChannelProvider for this service. */
217   @BetaApi
218   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()219       defaultHttpJsonTransportProviderBuilder() {
220     return CloudMemcacheStubSettings.defaultHttpJsonTransportProviderBuilder();
221   }
222 
defaultTransportChannelProvider()223   public static TransportChannelProvider defaultTransportChannelProvider() {
224     return CloudMemcacheStubSettings.defaultTransportChannelProvider();
225   }
226 
227   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()228   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
229     return CloudMemcacheStubSettings.defaultApiClientHeaderProviderBuilder();
230   }
231 
232   /** Returns a new gRPC builder for this class. */
newBuilder()233   public static Builder newBuilder() {
234     return Builder.createDefault();
235   }
236 
237   /** Returns a new REST builder for this class. */
238   @BetaApi
newHttpJsonBuilder()239   public static Builder newHttpJsonBuilder() {
240     return Builder.createHttpJsonDefault();
241   }
242 
243   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)244   public static Builder newBuilder(ClientContext clientContext) {
245     return new Builder(clientContext);
246   }
247 
248   /** Returns a builder containing all the values of this settings class. */
toBuilder()249   public Builder toBuilder() {
250     return new Builder(this);
251   }
252 
CloudMemcacheSettings(Builder settingsBuilder)253   protected CloudMemcacheSettings(Builder settingsBuilder) throws IOException {
254     super(settingsBuilder);
255   }
256 
257   /** Builder for CloudMemcacheSettings. */
258   public static class Builder extends ClientSettings.Builder<CloudMemcacheSettings, Builder> {
259 
Builder()260     protected Builder() throws IOException {
261       this(((ClientContext) null));
262     }
263 
Builder(ClientContext clientContext)264     protected Builder(ClientContext clientContext) {
265       super(CloudMemcacheStubSettings.newBuilder(clientContext));
266     }
267 
Builder(CloudMemcacheSettings settings)268     protected Builder(CloudMemcacheSettings settings) {
269       super(settings.getStubSettings().toBuilder());
270     }
271 
Builder(CloudMemcacheStubSettings.Builder stubSettings)272     protected Builder(CloudMemcacheStubSettings.Builder stubSettings) {
273       super(stubSettings);
274     }
275 
createDefault()276     private static Builder createDefault() {
277       return new Builder(CloudMemcacheStubSettings.newBuilder());
278     }
279 
280     @BetaApi
createHttpJsonDefault()281     private static Builder createHttpJsonDefault() {
282       return new Builder(CloudMemcacheStubSettings.newHttpJsonBuilder());
283     }
284 
getStubSettingsBuilder()285     public CloudMemcacheStubSettings.Builder getStubSettingsBuilder() {
286       return ((CloudMemcacheStubSettings.Builder) getStubSettings());
287     }
288 
289     /**
290      * Applies the given settings updater function to all of the unary API methods in this service.
291      *
292      * <p>Note: This method does not support applying settings to streaming methods.
293      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)294     public Builder applyToAllUnaryMethods(
295         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
296       super.applyToAllUnaryMethods(
297           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
298       return this;
299     }
300 
301     /** Returns the builder for the settings used for calls to listInstances. */
302     public PagedCallSettings.Builder<
303             ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse>
listInstancesSettings()304         listInstancesSettings() {
305       return getStubSettingsBuilder().listInstancesSettings();
306     }
307 
308     /** Returns the builder for the settings used for calls to getInstance. */
getInstanceSettings()309     public UnaryCallSettings.Builder<GetInstanceRequest, Instance> getInstanceSettings() {
310       return getStubSettingsBuilder().getInstanceSettings();
311     }
312 
313     /** Returns the builder for the settings used for calls to createInstance. */
createInstanceSettings()314     public UnaryCallSettings.Builder<CreateInstanceRequest, Operation> createInstanceSettings() {
315       return getStubSettingsBuilder().createInstanceSettings();
316     }
317 
318     /** Returns the builder for the settings used for calls to createInstance. */
319     public OperationCallSettings.Builder<CreateInstanceRequest, Instance, OperationMetadata>
createInstanceOperationSettings()320         createInstanceOperationSettings() {
321       return getStubSettingsBuilder().createInstanceOperationSettings();
322     }
323 
324     /** Returns the builder for the settings used for calls to updateInstance. */
updateInstanceSettings()325     public UnaryCallSettings.Builder<UpdateInstanceRequest, Operation> updateInstanceSettings() {
326       return getStubSettingsBuilder().updateInstanceSettings();
327     }
328 
329     /** Returns the builder for the settings used for calls to updateInstance. */
330     public OperationCallSettings.Builder<UpdateInstanceRequest, Instance, OperationMetadata>
updateInstanceOperationSettings()331         updateInstanceOperationSettings() {
332       return getStubSettingsBuilder().updateInstanceOperationSettings();
333     }
334 
335     /** Returns the builder for the settings used for calls to updateParameters. */
336     public UnaryCallSettings.Builder<UpdateParametersRequest, Operation>
updateParametersSettings()337         updateParametersSettings() {
338       return getStubSettingsBuilder().updateParametersSettings();
339     }
340 
341     /** Returns the builder for the settings used for calls to updateParameters. */
342     public OperationCallSettings.Builder<UpdateParametersRequest, Instance, OperationMetadata>
updateParametersOperationSettings()343         updateParametersOperationSettings() {
344       return getStubSettingsBuilder().updateParametersOperationSettings();
345     }
346 
347     /** Returns the builder for the settings used for calls to deleteInstance. */
deleteInstanceSettings()348     public UnaryCallSettings.Builder<DeleteInstanceRequest, Operation> deleteInstanceSettings() {
349       return getStubSettingsBuilder().deleteInstanceSettings();
350     }
351 
352     /** Returns the builder for the settings used for calls to deleteInstance. */
353     public OperationCallSettings.Builder<DeleteInstanceRequest, Empty, OperationMetadata>
deleteInstanceOperationSettings()354         deleteInstanceOperationSettings() {
355       return getStubSettingsBuilder().deleteInstanceOperationSettings();
356     }
357 
358     /** Returns the builder for the settings used for calls to applyParameters. */
applyParametersSettings()359     public UnaryCallSettings.Builder<ApplyParametersRequest, Operation> applyParametersSettings() {
360       return getStubSettingsBuilder().applyParametersSettings();
361     }
362 
363     /** Returns the builder for the settings used for calls to applyParameters. */
364     public OperationCallSettings.Builder<ApplyParametersRequest, Instance, OperationMetadata>
applyParametersOperationSettings()365         applyParametersOperationSettings() {
366       return getStubSettingsBuilder().applyParametersOperationSettings();
367     }
368 
369     /** Returns the builder for the settings used for calls to applySoftwareUpdate. */
370     public UnaryCallSettings.Builder<ApplySoftwareUpdateRequest, Operation>
applySoftwareUpdateSettings()371         applySoftwareUpdateSettings() {
372       return getStubSettingsBuilder().applySoftwareUpdateSettings();
373     }
374 
375     /** Returns the builder for the settings used for calls to applySoftwareUpdate. */
376     public OperationCallSettings.Builder<ApplySoftwareUpdateRequest, Instance, OperationMetadata>
applySoftwareUpdateOperationSettings()377         applySoftwareUpdateOperationSettings() {
378       return getStubSettingsBuilder().applySoftwareUpdateOperationSettings();
379     }
380 
381     /** Returns the builder for the settings used for calls to rescheduleMaintenance. */
382     public UnaryCallSettings.Builder<RescheduleMaintenanceRequest, Operation>
rescheduleMaintenanceSettings()383         rescheduleMaintenanceSettings() {
384       return getStubSettingsBuilder().rescheduleMaintenanceSettings();
385     }
386 
387     /** Returns the builder for the settings used for calls to rescheduleMaintenance. */
388     public OperationCallSettings.Builder<RescheduleMaintenanceRequest, Instance, OperationMetadata>
rescheduleMaintenanceOperationSettings()389         rescheduleMaintenanceOperationSettings() {
390       return getStubSettingsBuilder().rescheduleMaintenanceOperationSettings();
391     }
392 
393     /** Returns the builder for the settings used for calls to listLocations. */
394     public PagedCallSettings.Builder<
395             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()396         listLocationsSettings() {
397       return getStubSettingsBuilder().listLocationsSettings();
398     }
399 
400     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()401     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
402       return getStubSettingsBuilder().getLocationSettings();
403     }
404 
405     @Override
build()406     public CloudMemcacheSettings build() throws IOException {
407       return new CloudMemcacheSettings(this);
408     }
409   }
410 }
411