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.v1; 18 19 import static com.google.cloud.gaming.v1.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.v1.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 @Generated("by gapic-generator-java") 78 public class RealmsServiceSettings extends ClientSettings<RealmsServiceSettings> { 79 80 /** Returns the object with the settings used for calls to listRealms. */ 81 public PagedCallSettings<ListRealmsRequest, ListRealmsResponse, ListRealmsPagedResponse> listRealmsSettings()82 listRealmsSettings() { 83 return ((RealmsServiceStubSettings) getStubSettings()).listRealmsSettings(); 84 } 85 86 /** Returns the object with the settings used for calls to getRealm. */ getRealmSettings()87 public UnaryCallSettings<GetRealmRequest, Realm> getRealmSettings() { 88 return ((RealmsServiceStubSettings) getStubSettings()).getRealmSettings(); 89 } 90 91 /** Returns the object with the settings used for calls to createRealm. */ createRealmSettings()92 public UnaryCallSettings<CreateRealmRequest, Operation> createRealmSettings() { 93 return ((RealmsServiceStubSettings) getStubSettings()).createRealmSettings(); 94 } 95 96 /** Returns the object with the settings used for calls to createRealm. */ 97 public OperationCallSettings<CreateRealmRequest, Realm, OperationMetadata> createRealmOperationSettings()98 createRealmOperationSettings() { 99 return ((RealmsServiceStubSettings) getStubSettings()).createRealmOperationSettings(); 100 } 101 102 /** Returns the object with the settings used for calls to deleteRealm. */ deleteRealmSettings()103 public UnaryCallSettings<DeleteRealmRequest, Operation> deleteRealmSettings() { 104 return ((RealmsServiceStubSettings) getStubSettings()).deleteRealmSettings(); 105 } 106 107 /** Returns the object with the settings used for calls to deleteRealm. */ 108 public OperationCallSettings<DeleteRealmRequest, Empty, OperationMetadata> deleteRealmOperationSettings()109 deleteRealmOperationSettings() { 110 return ((RealmsServiceStubSettings) getStubSettings()).deleteRealmOperationSettings(); 111 } 112 113 /** Returns the object with the settings used for calls to updateRealm. */ updateRealmSettings()114 public UnaryCallSettings<UpdateRealmRequest, Operation> updateRealmSettings() { 115 return ((RealmsServiceStubSettings) getStubSettings()).updateRealmSettings(); 116 } 117 118 /** Returns the object with the settings used for calls to updateRealm. */ 119 public OperationCallSettings<UpdateRealmRequest, Realm, OperationMetadata> updateRealmOperationSettings()120 updateRealmOperationSettings() { 121 return ((RealmsServiceStubSettings) getStubSettings()).updateRealmOperationSettings(); 122 } 123 124 /** Returns the object with the settings used for calls to previewRealmUpdate. */ 125 public UnaryCallSettings<PreviewRealmUpdateRequest, PreviewRealmUpdateResponse> previewRealmUpdateSettings()126 previewRealmUpdateSettings() { 127 return ((RealmsServiceStubSettings) getStubSettings()).previewRealmUpdateSettings(); 128 } 129 create(RealmsServiceStubSettings stub)130 public static final RealmsServiceSettings create(RealmsServiceStubSettings stub) 131 throws IOException { 132 return new RealmsServiceSettings.Builder(stub.toBuilder()).build(); 133 } 134 135 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()136 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 137 return RealmsServiceStubSettings.defaultExecutorProviderBuilder(); 138 } 139 140 /** Returns the default service endpoint. */ getDefaultEndpoint()141 public static String getDefaultEndpoint() { 142 return RealmsServiceStubSettings.getDefaultEndpoint(); 143 } 144 145 /** Returns the default service scopes. */ getDefaultServiceScopes()146 public static List<String> getDefaultServiceScopes() { 147 return RealmsServiceStubSettings.getDefaultServiceScopes(); 148 } 149 150 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()151 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 152 return RealmsServiceStubSettings.defaultCredentialsProviderBuilder(); 153 } 154 155 /** Returns a builder for the default gRPC ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()156 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 157 return RealmsServiceStubSettings.defaultGrpcTransportProviderBuilder(); 158 } 159 160 /** Returns a builder for the default REST ChannelProvider for this service. */ 161 @BetaApi 162 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()163 defaultHttpJsonTransportProviderBuilder() { 164 return RealmsServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); 165 } 166 defaultTransportChannelProvider()167 public static TransportChannelProvider defaultTransportChannelProvider() { 168 return RealmsServiceStubSettings.defaultTransportChannelProvider(); 169 } 170 171 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()172 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 173 return RealmsServiceStubSettings.defaultApiClientHeaderProviderBuilder(); 174 } 175 176 /** Returns a new gRPC builder for this class. */ newBuilder()177 public static Builder newBuilder() { 178 return Builder.createDefault(); 179 } 180 181 /** Returns a new REST builder for this class. */ 182 @BetaApi newHttpJsonBuilder()183 public static Builder newHttpJsonBuilder() { 184 return Builder.createHttpJsonDefault(); 185 } 186 187 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)188 public static Builder newBuilder(ClientContext clientContext) { 189 return new Builder(clientContext); 190 } 191 192 /** Returns a builder containing all the values of this settings class. */ toBuilder()193 public Builder toBuilder() { 194 return new Builder(this); 195 } 196 RealmsServiceSettings(Builder settingsBuilder)197 protected RealmsServiceSettings(Builder settingsBuilder) throws IOException { 198 super(settingsBuilder); 199 } 200 201 /** Builder for RealmsServiceSettings. */ 202 public static class Builder extends ClientSettings.Builder<RealmsServiceSettings, Builder> { 203 Builder()204 protected Builder() throws IOException { 205 this(((ClientContext) null)); 206 } 207 Builder(ClientContext clientContext)208 protected Builder(ClientContext clientContext) { 209 super(RealmsServiceStubSettings.newBuilder(clientContext)); 210 } 211 Builder(RealmsServiceSettings settings)212 protected Builder(RealmsServiceSettings settings) { 213 super(settings.getStubSettings().toBuilder()); 214 } 215 Builder(RealmsServiceStubSettings.Builder stubSettings)216 protected Builder(RealmsServiceStubSettings.Builder stubSettings) { 217 super(stubSettings); 218 } 219 createDefault()220 private static Builder createDefault() { 221 return new Builder(RealmsServiceStubSettings.newBuilder()); 222 } 223 224 @BetaApi createHttpJsonDefault()225 private static Builder createHttpJsonDefault() { 226 return new Builder(RealmsServiceStubSettings.newHttpJsonBuilder()); 227 } 228 getStubSettingsBuilder()229 public RealmsServiceStubSettings.Builder getStubSettingsBuilder() { 230 return ((RealmsServiceStubSettings.Builder) getStubSettings()); 231 } 232 233 /** 234 * Applies the given settings updater function to all of the unary API methods in this service. 235 * 236 * <p>Note: This method does not support applying settings to streaming methods. 237 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)238 public Builder applyToAllUnaryMethods( 239 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 240 super.applyToAllUnaryMethods( 241 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 242 return this; 243 } 244 245 /** Returns the builder for the settings used for calls to listRealms. */ 246 public PagedCallSettings.Builder<ListRealmsRequest, ListRealmsResponse, ListRealmsPagedResponse> listRealmsSettings()247 listRealmsSettings() { 248 return getStubSettingsBuilder().listRealmsSettings(); 249 } 250 251 /** Returns the builder for the settings used for calls to getRealm. */ getRealmSettings()252 public UnaryCallSettings.Builder<GetRealmRequest, Realm> getRealmSettings() { 253 return getStubSettingsBuilder().getRealmSettings(); 254 } 255 256 /** Returns the builder for the settings used for calls to createRealm. */ createRealmSettings()257 public UnaryCallSettings.Builder<CreateRealmRequest, Operation> createRealmSettings() { 258 return getStubSettingsBuilder().createRealmSettings(); 259 } 260 261 /** Returns the builder for the settings used for calls to createRealm. */ 262 public OperationCallSettings.Builder<CreateRealmRequest, Realm, OperationMetadata> createRealmOperationSettings()263 createRealmOperationSettings() { 264 return getStubSettingsBuilder().createRealmOperationSettings(); 265 } 266 267 /** Returns the builder for the settings used for calls to deleteRealm. */ deleteRealmSettings()268 public UnaryCallSettings.Builder<DeleteRealmRequest, Operation> deleteRealmSettings() { 269 return getStubSettingsBuilder().deleteRealmSettings(); 270 } 271 272 /** Returns the builder for the settings used for calls to deleteRealm. */ 273 public OperationCallSettings.Builder<DeleteRealmRequest, Empty, OperationMetadata> deleteRealmOperationSettings()274 deleteRealmOperationSettings() { 275 return getStubSettingsBuilder().deleteRealmOperationSettings(); 276 } 277 278 /** Returns the builder for the settings used for calls to updateRealm. */ updateRealmSettings()279 public UnaryCallSettings.Builder<UpdateRealmRequest, Operation> updateRealmSettings() { 280 return getStubSettingsBuilder().updateRealmSettings(); 281 } 282 283 /** Returns the builder for the settings used for calls to updateRealm. */ 284 public OperationCallSettings.Builder<UpdateRealmRequest, Realm, OperationMetadata> updateRealmOperationSettings()285 updateRealmOperationSettings() { 286 return getStubSettingsBuilder().updateRealmOperationSettings(); 287 } 288 289 /** Returns the builder for the settings used for calls to previewRealmUpdate. */ 290 public UnaryCallSettings.Builder<PreviewRealmUpdateRequest, PreviewRealmUpdateResponse> previewRealmUpdateSettings()291 previewRealmUpdateSettings() { 292 return getStubSettingsBuilder().previewRealmUpdateSettings(); 293 } 294 295 @Override build()296 public RealmsServiceSettings build() throws IOException { 297 return new RealmsServiceSettings(this); 298 } 299 } 300 } 301