• 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.v1;
18 
19 import static com.google.cloud.memcache.v1.CloudMemcacheClient.ListInstancesPagedResponse;
20 import static com.google.cloud.memcache.v1.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.v1.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 @Generated("by gapic-generator-java")
83 public class CloudMemcacheSettings extends ClientSettings<CloudMemcacheSettings> {
84 
85   /** Returns the object with the settings used for calls to listInstances. */
86   public PagedCallSettings<ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse>
listInstancesSettings()87       listInstancesSettings() {
88     return ((CloudMemcacheStubSettings) getStubSettings()).listInstancesSettings();
89   }
90 
91   /** Returns the object with the settings used for calls to getInstance. */
getInstanceSettings()92   public UnaryCallSettings<GetInstanceRequest, Instance> getInstanceSettings() {
93     return ((CloudMemcacheStubSettings) getStubSettings()).getInstanceSettings();
94   }
95 
96   /** Returns the object with the settings used for calls to createInstance. */
createInstanceSettings()97   public UnaryCallSettings<CreateInstanceRequest, Operation> createInstanceSettings() {
98     return ((CloudMemcacheStubSettings) getStubSettings()).createInstanceSettings();
99   }
100 
101   /** Returns the object with the settings used for calls to createInstance. */
102   public OperationCallSettings<CreateInstanceRequest, Instance, OperationMetadata>
createInstanceOperationSettings()103       createInstanceOperationSettings() {
104     return ((CloudMemcacheStubSettings) getStubSettings()).createInstanceOperationSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to updateInstance. */
updateInstanceSettings()108   public UnaryCallSettings<UpdateInstanceRequest, Operation> updateInstanceSettings() {
109     return ((CloudMemcacheStubSettings) getStubSettings()).updateInstanceSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to updateInstance. */
113   public OperationCallSettings<UpdateInstanceRequest, Instance, OperationMetadata>
updateInstanceOperationSettings()114       updateInstanceOperationSettings() {
115     return ((CloudMemcacheStubSettings) getStubSettings()).updateInstanceOperationSettings();
116   }
117 
118   /** Returns the object with the settings used for calls to updateParameters. */
updateParametersSettings()119   public UnaryCallSettings<UpdateParametersRequest, Operation> updateParametersSettings() {
120     return ((CloudMemcacheStubSettings) getStubSettings()).updateParametersSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to updateParameters. */
124   public OperationCallSettings<UpdateParametersRequest, Instance, OperationMetadata>
updateParametersOperationSettings()125       updateParametersOperationSettings() {
126     return ((CloudMemcacheStubSettings) getStubSettings()).updateParametersOperationSettings();
127   }
128 
129   /** Returns the object with the settings used for calls to deleteInstance. */
deleteInstanceSettings()130   public UnaryCallSettings<DeleteInstanceRequest, Operation> deleteInstanceSettings() {
131     return ((CloudMemcacheStubSettings) getStubSettings()).deleteInstanceSettings();
132   }
133 
134   /** Returns the object with the settings used for calls to deleteInstance. */
135   public OperationCallSettings<DeleteInstanceRequest, Empty, OperationMetadata>
deleteInstanceOperationSettings()136       deleteInstanceOperationSettings() {
137     return ((CloudMemcacheStubSettings) getStubSettings()).deleteInstanceOperationSettings();
138   }
139 
140   /** Returns the object with the settings used for calls to applyParameters. */
applyParametersSettings()141   public UnaryCallSettings<ApplyParametersRequest, Operation> applyParametersSettings() {
142     return ((CloudMemcacheStubSettings) getStubSettings()).applyParametersSettings();
143   }
144 
145   /** Returns the object with the settings used for calls to applyParameters. */
146   public OperationCallSettings<ApplyParametersRequest, Instance, OperationMetadata>
applyParametersOperationSettings()147       applyParametersOperationSettings() {
148     return ((CloudMemcacheStubSettings) getStubSettings()).applyParametersOperationSettings();
149   }
150 
151   /** Returns the object with the settings used for calls to rescheduleMaintenance. */
152   public UnaryCallSettings<RescheduleMaintenanceRequest, Operation>
rescheduleMaintenanceSettings()153       rescheduleMaintenanceSettings() {
154     return ((CloudMemcacheStubSettings) getStubSettings()).rescheduleMaintenanceSettings();
155   }
156 
157   /** Returns the object with the settings used for calls to rescheduleMaintenance. */
158   public OperationCallSettings<RescheduleMaintenanceRequest, Instance, OperationMetadata>
rescheduleMaintenanceOperationSettings()159       rescheduleMaintenanceOperationSettings() {
160     return ((CloudMemcacheStubSettings) getStubSettings()).rescheduleMaintenanceOperationSettings();
161   }
162 
163   /** Returns the object with the settings used for calls to listLocations. */
164   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()165       listLocationsSettings() {
166     return ((CloudMemcacheStubSettings) getStubSettings()).listLocationsSettings();
167   }
168 
169   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()170   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
171     return ((CloudMemcacheStubSettings) getStubSettings()).getLocationSettings();
172   }
173 
create(CloudMemcacheStubSettings stub)174   public static final CloudMemcacheSettings create(CloudMemcacheStubSettings stub)
175       throws IOException {
176     return new CloudMemcacheSettings.Builder(stub.toBuilder()).build();
177   }
178 
179   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()180   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
181     return CloudMemcacheStubSettings.defaultExecutorProviderBuilder();
182   }
183 
184   /** Returns the default service endpoint. */
getDefaultEndpoint()185   public static String getDefaultEndpoint() {
186     return CloudMemcacheStubSettings.getDefaultEndpoint();
187   }
188 
189   /** Returns the default service scopes. */
getDefaultServiceScopes()190   public static List<String> getDefaultServiceScopes() {
191     return CloudMemcacheStubSettings.getDefaultServiceScopes();
192   }
193 
194   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()195   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
196     return CloudMemcacheStubSettings.defaultCredentialsProviderBuilder();
197   }
198 
199   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()200   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
201     return CloudMemcacheStubSettings.defaultGrpcTransportProviderBuilder();
202   }
203 
204   /** Returns a builder for the default REST ChannelProvider for this service. */
205   @BetaApi
206   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()207       defaultHttpJsonTransportProviderBuilder() {
208     return CloudMemcacheStubSettings.defaultHttpJsonTransportProviderBuilder();
209   }
210 
defaultTransportChannelProvider()211   public static TransportChannelProvider defaultTransportChannelProvider() {
212     return CloudMemcacheStubSettings.defaultTransportChannelProvider();
213   }
214 
215   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()216   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
217     return CloudMemcacheStubSettings.defaultApiClientHeaderProviderBuilder();
218   }
219 
220   /** Returns a new gRPC builder for this class. */
newBuilder()221   public static Builder newBuilder() {
222     return Builder.createDefault();
223   }
224 
225   /** Returns a new REST builder for this class. */
226   @BetaApi
newHttpJsonBuilder()227   public static Builder newHttpJsonBuilder() {
228     return Builder.createHttpJsonDefault();
229   }
230 
231   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)232   public static Builder newBuilder(ClientContext clientContext) {
233     return new Builder(clientContext);
234   }
235 
236   /** Returns a builder containing all the values of this settings class. */
toBuilder()237   public Builder toBuilder() {
238     return new Builder(this);
239   }
240 
CloudMemcacheSettings(Builder settingsBuilder)241   protected CloudMemcacheSettings(Builder settingsBuilder) throws IOException {
242     super(settingsBuilder);
243   }
244 
245   /** Builder for CloudMemcacheSettings. */
246   public static class Builder extends ClientSettings.Builder<CloudMemcacheSettings, Builder> {
247 
Builder()248     protected Builder() throws IOException {
249       this(((ClientContext) null));
250     }
251 
Builder(ClientContext clientContext)252     protected Builder(ClientContext clientContext) {
253       super(CloudMemcacheStubSettings.newBuilder(clientContext));
254     }
255 
Builder(CloudMemcacheSettings settings)256     protected Builder(CloudMemcacheSettings settings) {
257       super(settings.getStubSettings().toBuilder());
258     }
259 
Builder(CloudMemcacheStubSettings.Builder stubSettings)260     protected Builder(CloudMemcacheStubSettings.Builder stubSettings) {
261       super(stubSettings);
262     }
263 
createDefault()264     private static Builder createDefault() {
265       return new Builder(CloudMemcacheStubSettings.newBuilder());
266     }
267 
268     @BetaApi
createHttpJsonDefault()269     private static Builder createHttpJsonDefault() {
270       return new Builder(CloudMemcacheStubSettings.newHttpJsonBuilder());
271     }
272 
getStubSettingsBuilder()273     public CloudMemcacheStubSettings.Builder getStubSettingsBuilder() {
274       return ((CloudMemcacheStubSettings.Builder) getStubSettings());
275     }
276 
277     /**
278      * Applies the given settings updater function to all of the unary API methods in this service.
279      *
280      * <p>Note: This method does not support applying settings to streaming methods.
281      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)282     public Builder applyToAllUnaryMethods(
283         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
284       super.applyToAllUnaryMethods(
285           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
286       return this;
287     }
288 
289     /** Returns the builder for the settings used for calls to listInstances. */
290     public PagedCallSettings.Builder<
291             ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse>
listInstancesSettings()292         listInstancesSettings() {
293       return getStubSettingsBuilder().listInstancesSettings();
294     }
295 
296     /** Returns the builder for the settings used for calls to getInstance. */
getInstanceSettings()297     public UnaryCallSettings.Builder<GetInstanceRequest, Instance> getInstanceSettings() {
298       return getStubSettingsBuilder().getInstanceSettings();
299     }
300 
301     /** Returns the builder for the settings used for calls to createInstance. */
createInstanceSettings()302     public UnaryCallSettings.Builder<CreateInstanceRequest, Operation> createInstanceSettings() {
303       return getStubSettingsBuilder().createInstanceSettings();
304     }
305 
306     /** Returns the builder for the settings used for calls to createInstance. */
307     public OperationCallSettings.Builder<CreateInstanceRequest, Instance, OperationMetadata>
createInstanceOperationSettings()308         createInstanceOperationSettings() {
309       return getStubSettingsBuilder().createInstanceOperationSettings();
310     }
311 
312     /** Returns the builder for the settings used for calls to updateInstance. */
updateInstanceSettings()313     public UnaryCallSettings.Builder<UpdateInstanceRequest, Operation> updateInstanceSettings() {
314       return getStubSettingsBuilder().updateInstanceSettings();
315     }
316 
317     /** Returns the builder for the settings used for calls to updateInstance. */
318     public OperationCallSettings.Builder<UpdateInstanceRequest, Instance, OperationMetadata>
updateInstanceOperationSettings()319         updateInstanceOperationSettings() {
320       return getStubSettingsBuilder().updateInstanceOperationSettings();
321     }
322 
323     /** Returns the builder for the settings used for calls to updateParameters. */
324     public UnaryCallSettings.Builder<UpdateParametersRequest, Operation>
updateParametersSettings()325         updateParametersSettings() {
326       return getStubSettingsBuilder().updateParametersSettings();
327     }
328 
329     /** Returns the builder for the settings used for calls to updateParameters. */
330     public OperationCallSettings.Builder<UpdateParametersRequest, Instance, OperationMetadata>
updateParametersOperationSettings()331         updateParametersOperationSettings() {
332       return getStubSettingsBuilder().updateParametersOperationSettings();
333     }
334 
335     /** Returns the builder for the settings used for calls to deleteInstance. */
deleteInstanceSettings()336     public UnaryCallSettings.Builder<DeleteInstanceRequest, Operation> deleteInstanceSettings() {
337       return getStubSettingsBuilder().deleteInstanceSettings();
338     }
339 
340     /** Returns the builder for the settings used for calls to deleteInstance. */
341     public OperationCallSettings.Builder<DeleteInstanceRequest, Empty, OperationMetadata>
deleteInstanceOperationSettings()342         deleteInstanceOperationSettings() {
343       return getStubSettingsBuilder().deleteInstanceOperationSettings();
344     }
345 
346     /** Returns the builder for the settings used for calls to applyParameters. */
applyParametersSettings()347     public UnaryCallSettings.Builder<ApplyParametersRequest, Operation> applyParametersSettings() {
348       return getStubSettingsBuilder().applyParametersSettings();
349     }
350 
351     /** Returns the builder for the settings used for calls to applyParameters. */
352     public OperationCallSettings.Builder<ApplyParametersRequest, Instance, OperationMetadata>
applyParametersOperationSettings()353         applyParametersOperationSettings() {
354       return getStubSettingsBuilder().applyParametersOperationSettings();
355     }
356 
357     /** Returns the builder for the settings used for calls to rescheduleMaintenance. */
358     public UnaryCallSettings.Builder<RescheduleMaintenanceRequest, Operation>
rescheduleMaintenanceSettings()359         rescheduleMaintenanceSettings() {
360       return getStubSettingsBuilder().rescheduleMaintenanceSettings();
361     }
362 
363     /** Returns the builder for the settings used for calls to rescheduleMaintenance. */
364     public OperationCallSettings.Builder<RescheduleMaintenanceRequest, Instance, OperationMetadata>
rescheduleMaintenanceOperationSettings()365         rescheduleMaintenanceOperationSettings() {
366       return getStubSettingsBuilder().rescheduleMaintenanceOperationSettings();
367     }
368 
369     /** Returns the builder for the settings used for calls to listLocations. */
370     public PagedCallSettings.Builder<
371             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()372         listLocationsSettings() {
373       return getStubSettingsBuilder().listLocationsSettings();
374     }
375 
376     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()377     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
378       return getStubSettingsBuilder().getLocationSettings();
379     }
380 
381     @Override
build()382     public CloudMemcacheSettings build() throws IOException {
383       return new CloudMemcacheSettings(this);
384     }
385   }
386 }
387