• 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.gaming.v1beta;
18 
19 import static com.google.cloud.gaming.v1beta.RealmsServiceClient.ListRealmsPagedResponse;
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.grpc.InstantiatingGrpcChannelProvider;
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.gaming.v1beta.stub.RealmsServiceStubSettings;
35 import com.google.longrunning.Operation;
36 import com.google.protobuf.Empty;
37 import java.io.IOException;
38 import java.util.List;
39 import javax.annotation.Generated;
40 
41 // AUTO-GENERATED DOCUMENTATION AND CLASS.
42 /**
43  * Settings class to configure an instance of {@link RealmsServiceClient}.
44  *
45  * <p>The default instance has everything set to sensible defaults:
46  *
47  * <ul>
48  *   <li>The default service address (gameservices.googleapis.com) and default port (443) are used.
49  *   <li>Credentials are acquired automatically through Application Default Credentials.
50  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
51  * </ul>
52  *
53  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
54  * build() is called, the tree of builders is called to create the complete settings object.
55  *
56  * <p>For example, to set the total timeout of getRealm to 30 seconds:
57  *
58  * <pre>{@code
59  * // This snippet has been automatically generated and should be regarded as a code template only.
60  * // It will require modifications to work:
61  * // - It may require correct/in-range values for request initialization.
62  * // - It may require specifying regional endpoints when creating the service client as shown in
63  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
64  * RealmsServiceSettings.Builder realmsServiceSettingsBuilder = RealmsServiceSettings.newBuilder();
65  * realmsServiceSettingsBuilder
66  *     .getRealmSettings()
67  *     .setRetrySettings(
68  *         realmsServiceSettingsBuilder
69  *             .getRealmSettings()
70  *             .getRetrySettings()
71  *             .toBuilder()
72  *             .setTotalTimeout(Duration.ofSeconds(30))
73  *             .build());
74  * RealmsServiceSettings realmsServiceSettings = realmsServiceSettingsBuilder.build();
75  * }</pre>
76  */
77 @BetaApi
78 @Generated("by gapic-generator-java")
79 public class RealmsServiceSettings extends ClientSettings<RealmsServiceSettings> {
80 
81   /** Returns the object with the settings used for calls to listRealms. */
82   public PagedCallSettings<ListRealmsRequest, ListRealmsResponse, ListRealmsPagedResponse>
listRealmsSettings()83       listRealmsSettings() {
84     return ((RealmsServiceStubSettings) getStubSettings()).listRealmsSettings();
85   }
86 
87   /** Returns the object with the settings used for calls to getRealm. */
getRealmSettings()88   public UnaryCallSettings<GetRealmRequest, Realm> getRealmSettings() {
89     return ((RealmsServiceStubSettings) getStubSettings()).getRealmSettings();
90   }
91 
92   /** Returns the object with the settings used for calls to createRealm. */
createRealmSettings()93   public UnaryCallSettings<CreateRealmRequest, Operation> createRealmSettings() {
94     return ((RealmsServiceStubSettings) getStubSettings()).createRealmSettings();
95   }
96 
97   /** Returns the object with the settings used for calls to createRealm. */
98   public OperationCallSettings<CreateRealmRequest, Realm, OperationMetadata>
createRealmOperationSettings()99       createRealmOperationSettings() {
100     return ((RealmsServiceStubSettings) getStubSettings()).createRealmOperationSettings();
101   }
102 
103   /** Returns the object with the settings used for calls to deleteRealm. */
deleteRealmSettings()104   public UnaryCallSettings<DeleteRealmRequest, Operation> deleteRealmSettings() {
105     return ((RealmsServiceStubSettings) getStubSettings()).deleteRealmSettings();
106   }
107 
108   /** Returns the object with the settings used for calls to deleteRealm. */
109   public OperationCallSettings<DeleteRealmRequest, Empty, OperationMetadata>
deleteRealmOperationSettings()110       deleteRealmOperationSettings() {
111     return ((RealmsServiceStubSettings) getStubSettings()).deleteRealmOperationSettings();
112   }
113 
114   /** Returns the object with the settings used for calls to updateRealm. */
updateRealmSettings()115   public UnaryCallSettings<UpdateRealmRequest, Operation> updateRealmSettings() {
116     return ((RealmsServiceStubSettings) getStubSettings()).updateRealmSettings();
117   }
118 
119   /** Returns the object with the settings used for calls to updateRealm. */
120   public OperationCallSettings<UpdateRealmRequest, Realm, OperationMetadata>
updateRealmOperationSettings()121       updateRealmOperationSettings() {
122     return ((RealmsServiceStubSettings) getStubSettings()).updateRealmOperationSettings();
123   }
124 
125   /** Returns the object with the settings used for calls to previewRealmUpdate. */
126   public UnaryCallSettings<PreviewRealmUpdateRequest, PreviewRealmUpdateResponse>
previewRealmUpdateSettings()127       previewRealmUpdateSettings() {
128     return ((RealmsServiceStubSettings) getStubSettings()).previewRealmUpdateSettings();
129   }
130 
create(RealmsServiceStubSettings stub)131   public static final RealmsServiceSettings create(RealmsServiceStubSettings stub)
132       throws IOException {
133     return new RealmsServiceSettings.Builder(stub.toBuilder()).build();
134   }
135 
136   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()137   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
138     return RealmsServiceStubSettings.defaultExecutorProviderBuilder();
139   }
140 
141   /** Returns the default service endpoint. */
getDefaultEndpoint()142   public static String getDefaultEndpoint() {
143     return RealmsServiceStubSettings.getDefaultEndpoint();
144   }
145 
146   /** Returns the default service scopes. */
getDefaultServiceScopes()147   public static List<String> getDefaultServiceScopes() {
148     return RealmsServiceStubSettings.getDefaultServiceScopes();
149   }
150 
151   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()152   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
153     return RealmsServiceStubSettings.defaultCredentialsProviderBuilder();
154   }
155 
156   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()157   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
158     return RealmsServiceStubSettings.defaultGrpcTransportProviderBuilder();
159   }
160 
161   /** Returns a builder for the default REST ChannelProvider for this service. */
162   @BetaApi
163   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()164       defaultHttpJsonTransportProviderBuilder() {
165     return RealmsServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
166   }
167 
defaultTransportChannelProvider()168   public static TransportChannelProvider defaultTransportChannelProvider() {
169     return RealmsServiceStubSettings.defaultTransportChannelProvider();
170   }
171 
172   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()173   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
174     return RealmsServiceStubSettings.defaultApiClientHeaderProviderBuilder();
175   }
176 
177   /** Returns a new gRPC builder for this class. */
newBuilder()178   public static Builder newBuilder() {
179     return Builder.createDefault();
180   }
181 
182   /** Returns a new REST builder for this class. */
183   @BetaApi
newHttpJsonBuilder()184   public static Builder newHttpJsonBuilder() {
185     return Builder.createHttpJsonDefault();
186   }
187 
188   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)189   public static Builder newBuilder(ClientContext clientContext) {
190     return new Builder(clientContext);
191   }
192 
193   /** Returns a builder containing all the values of this settings class. */
toBuilder()194   public Builder toBuilder() {
195     return new Builder(this);
196   }
197 
RealmsServiceSettings(Builder settingsBuilder)198   protected RealmsServiceSettings(Builder settingsBuilder) throws IOException {
199     super(settingsBuilder);
200   }
201 
202   /** Builder for RealmsServiceSettings. */
203   public static class Builder extends ClientSettings.Builder<RealmsServiceSettings, Builder> {
204 
Builder()205     protected Builder() throws IOException {
206       this(((ClientContext) null));
207     }
208 
Builder(ClientContext clientContext)209     protected Builder(ClientContext clientContext) {
210       super(RealmsServiceStubSettings.newBuilder(clientContext));
211     }
212 
Builder(RealmsServiceSettings settings)213     protected Builder(RealmsServiceSettings settings) {
214       super(settings.getStubSettings().toBuilder());
215     }
216 
Builder(RealmsServiceStubSettings.Builder stubSettings)217     protected Builder(RealmsServiceStubSettings.Builder stubSettings) {
218       super(stubSettings);
219     }
220 
createDefault()221     private static Builder createDefault() {
222       return new Builder(RealmsServiceStubSettings.newBuilder());
223     }
224 
225     @BetaApi
createHttpJsonDefault()226     private static Builder createHttpJsonDefault() {
227       return new Builder(RealmsServiceStubSettings.newHttpJsonBuilder());
228     }
229 
getStubSettingsBuilder()230     public RealmsServiceStubSettings.Builder getStubSettingsBuilder() {
231       return ((RealmsServiceStubSettings.Builder) getStubSettings());
232     }
233 
234     /**
235      * Applies the given settings updater function to all of the unary API methods in this service.
236      *
237      * <p>Note: This method does not support applying settings to streaming methods.
238      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)239     public Builder applyToAllUnaryMethods(
240         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
241       super.applyToAllUnaryMethods(
242           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
243       return this;
244     }
245 
246     /** Returns the builder for the settings used for calls to listRealms. */
247     public PagedCallSettings.Builder<ListRealmsRequest, ListRealmsResponse, ListRealmsPagedResponse>
listRealmsSettings()248         listRealmsSettings() {
249       return getStubSettingsBuilder().listRealmsSettings();
250     }
251 
252     /** Returns the builder for the settings used for calls to getRealm. */
getRealmSettings()253     public UnaryCallSettings.Builder<GetRealmRequest, Realm> getRealmSettings() {
254       return getStubSettingsBuilder().getRealmSettings();
255     }
256 
257     /** Returns the builder for the settings used for calls to createRealm. */
createRealmSettings()258     public UnaryCallSettings.Builder<CreateRealmRequest, Operation> createRealmSettings() {
259       return getStubSettingsBuilder().createRealmSettings();
260     }
261 
262     /** Returns the builder for the settings used for calls to createRealm. */
263     public OperationCallSettings.Builder<CreateRealmRequest, Realm, OperationMetadata>
createRealmOperationSettings()264         createRealmOperationSettings() {
265       return getStubSettingsBuilder().createRealmOperationSettings();
266     }
267 
268     /** Returns the builder for the settings used for calls to deleteRealm. */
deleteRealmSettings()269     public UnaryCallSettings.Builder<DeleteRealmRequest, Operation> deleteRealmSettings() {
270       return getStubSettingsBuilder().deleteRealmSettings();
271     }
272 
273     /** Returns the builder for the settings used for calls to deleteRealm. */
274     public OperationCallSettings.Builder<DeleteRealmRequest, Empty, OperationMetadata>
deleteRealmOperationSettings()275         deleteRealmOperationSettings() {
276       return getStubSettingsBuilder().deleteRealmOperationSettings();
277     }
278 
279     /** Returns the builder for the settings used for calls to updateRealm. */
updateRealmSettings()280     public UnaryCallSettings.Builder<UpdateRealmRequest, Operation> updateRealmSettings() {
281       return getStubSettingsBuilder().updateRealmSettings();
282     }
283 
284     /** Returns the builder for the settings used for calls to updateRealm. */
285     public OperationCallSettings.Builder<UpdateRealmRequest, Realm, OperationMetadata>
updateRealmOperationSettings()286         updateRealmOperationSettings() {
287       return getStubSettingsBuilder().updateRealmOperationSettings();
288     }
289 
290     /** Returns the builder for the settings used for calls to previewRealmUpdate. */
291     public UnaryCallSettings.Builder<PreviewRealmUpdateRequest, PreviewRealmUpdateResponse>
previewRealmUpdateSettings()292         previewRealmUpdateSettings() {
293       return getStubSettingsBuilder().previewRealmUpdateSettings();
294     }
295 
296     @Override
build()297     public RealmsServiceSettings build() throws IOException {
298       return new RealmsServiceSettings(this);
299     }
300   }
301 }
302