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.dataproc.v1; 18 19 import static com.google.cloud.dataproc.v1.ClusterControllerClient.ListClustersPagedResponse; 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.dataproc.v1.stub.ClusterControllerStubSettings; 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 ClusterControllerClient}. 44 * 45 * <p>The default instance has everything set to sensible defaults: 46 * 47 * <ul> 48 * <li>The default service address (dataproc.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 getCluster 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 * ClusterControllerSettings.Builder clusterControllerSettingsBuilder = 65 * ClusterControllerSettings.newBuilder(); 66 * clusterControllerSettingsBuilder 67 * .getClusterSettings() 68 * .setRetrySettings( 69 * clusterControllerSettingsBuilder 70 * .getClusterSettings() 71 * .getRetrySettings() 72 * .toBuilder() 73 * .setTotalTimeout(Duration.ofSeconds(30)) 74 * .build()); 75 * ClusterControllerSettings clusterControllerSettings = clusterControllerSettingsBuilder.build(); 76 * }</pre> 77 */ 78 @Generated("by gapic-generator-java") 79 public class ClusterControllerSettings extends ClientSettings<ClusterControllerSettings> { 80 81 /** Returns the object with the settings used for calls to createCluster. */ createClusterSettings()82 public UnaryCallSettings<CreateClusterRequest, Operation> createClusterSettings() { 83 return ((ClusterControllerStubSettings) getStubSettings()).createClusterSettings(); 84 } 85 86 /** Returns the object with the settings used for calls to createCluster. */ 87 public OperationCallSettings<CreateClusterRequest, Cluster, ClusterOperationMetadata> createClusterOperationSettings()88 createClusterOperationSettings() { 89 return ((ClusterControllerStubSettings) getStubSettings()).createClusterOperationSettings(); 90 } 91 92 /** Returns the object with the settings used for calls to updateCluster. */ updateClusterSettings()93 public UnaryCallSettings<UpdateClusterRequest, Operation> updateClusterSettings() { 94 return ((ClusterControllerStubSettings) getStubSettings()).updateClusterSettings(); 95 } 96 97 /** Returns the object with the settings used for calls to updateCluster. */ 98 public OperationCallSettings<UpdateClusterRequest, Cluster, ClusterOperationMetadata> updateClusterOperationSettings()99 updateClusterOperationSettings() { 100 return ((ClusterControllerStubSettings) getStubSettings()).updateClusterOperationSettings(); 101 } 102 103 /** Returns the object with the settings used for calls to stopCluster. */ stopClusterSettings()104 public UnaryCallSettings<StopClusterRequest, Operation> stopClusterSettings() { 105 return ((ClusterControllerStubSettings) getStubSettings()).stopClusterSettings(); 106 } 107 108 /** Returns the object with the settings used for calls to stopCluster. */ 109 public OperationCallSettings<StopClusterRequest, Cluster, ClusterOperationMetadata> stopClusterOperationSettings()110 stopClusterOperationSettings() { 111 return ((ClusterControllerStubSettings) getStubSettings()).stopClusterOperationSettings(); 112 } 113 114 /** Returns the object with the settings used for calls to startCluster. */ startClusterSettings()115 public UnaryCallSettings<StartClusterRequest, Operation> startClusterSettings() { 116 return ((ClusterControllerStubSettings) getStubSettings()).startClusterSettings(); 117 } 118 119 /** Returns the object with the settings used for calls to startCluster. */ 120 public OperationCallSettings<StartClusterRequest, Cluster, ClusterOperationMetadata> startClusterOperationSettings()121 startClusterOperationSettings() { 122 return ((ClusterControllerStubSettings) getStubSettings()).startClusterOperationSettings(); 123 } 124 125 /** Returns the object with the settings used for calls to deleteCluster. */ deleteClusterSettings()126 public UnaryCallSettings<DeleteClusterRequest, Operation> deleteClusterSettings() { 127 return ((ClusterControllerStubSettings) getStubSettings()).deleteClusterSettings(); 128 } 129 130 /** Returns the object with the settings used for calls to deleteCluster. */ 131 public OperationCallSettings<DeleteClusterRequest, Empty, ClusterOperationMetadata> deleteClusterOperationSettings()132 deleteClusterOperationSettings() { 133 return ((ClusterControllerStubSettings) getStubSettings()).deleteClusterOperationSettings(); 134 } 135 136 /** Returns the object with the settings used for calls to getCluster. */ getClusterSettings()137 public UnaryCallSettings<GetClusterRequest, Cluster> getClusterSettings() { 138 return ((ClusterControllerStubSettings) getStubSettings()).getClusterSettings(); 139 } 140 141 /** Returns the object with the settings used for calls to listClusters. */ 142 public PagedCallSettings<ListClustersRequest, ListClustersResponse, ListClustersPagedResponse> listClustersSettings()143 listClustersSettings() { 144 return ((ClusterControllerStubSettings) getStubSettings()).listClustersSettings(); 145 } 146 147 /** Returns the object with the settings used for calls to diagnoseCluster. */ diagnoseClusterSettings()148 public UnaryCallSettings<DiagnoseClusterRequest, Operation> diagnoseClusterSettings() { 149 return ((ClusterControllerStubSettings) getStubSettings()).diagnoseClusterSettings(); 150 } 151 152 /** Returns the object with the settings used for calls to diagnoseCluster. */ 153 public OperationCallSettings< 154 DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationSettings()155 diagnoseClusterOperationSettings() { 156 return ((ClusterControllerStubSettings) getStubSettings()).diagnoseClusterOperationSettings(); 157 } 158 create(ClusterControllerStubSettings stub)159 public static final ClusterControllerSettings create(ClusterControllerStubSettings stub) 160 throws IOException { 161 return new ClusterControllerSettings.Builder(stub.toBuilder()).build(); 162 } 163 164 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()165 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 166 return ClusterControllerStubSettings.defaultExecutorProviderBuilder(); 167 } 168 169 /** Returns the default service endpoint. */ getDefaultEndpoint()170 public static String getDefaultEndpoint() { 171 return ClusterControllerStubSettings.getDefaultEndpoint(); 172 } 173 174 /** Returns the default service scopes. */ getDefaultServiceScopes()175 public static List<String> getDefaultServiceScopes() { 176 return ClusterControllerStubSettings.getDefaultServiceScopes(); 177 } 178 179 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()180 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 181 return ClusterControllerStubSettings.defaultCredentialsProviderBuilder(); 182 } 183 184 /** Returns a builder for the default gRPC ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()185 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 186 return ClusterControllerStubSettings.defaultGrpcTransportProviderBuilder(); 187 } 188 189 /** Returns a builder for the default REST ChannelProvider for this service. */ 190 @BetaApi 191 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()192 defaultHttpJsonTransportProviderBuilder() { 193 return ClusterControllerStubSettings.defaultHttpJsonTransportProviderBuilder(); 194 } 195 defaultTransportChannelProvider()196 public static TransportChannelProvider defaultTransportChannelProvider() { 197 return ClusterControllerStubSettings.defaultTransportChannelProvider(); 198 } 199 200 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()201 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 202 return ClusterControllerStubSettings.defaultApiClientHeaderProviderBuilder(); 203 } 204 205 /** Returns a new gRPC builder for this class. */ newBuilder()206 public static Builder newBuilder() { 207 return Builder.createDefault(); 208 } 209 210 /** Returns a new REST builder for this class. */ 211 @BetaApi newHttpJsonBuilder()212 public static Builder newHttpJsonBuilder() { 213 return Builder.createHttpJsonDefault(); 214 } 215 216 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)217 public static Builder newBuilder(ClientContext clientContext) { 218 return new Builder(clientContext); 219 } 220 221 /** Returns a builder containing all the values of this settings class. */ toBuilder()222 public Builder toBuilder() { 223 return new Builder(this); 224 } 225 ClusterControllerSettings(Builder settingsBuilder)226 protected ClusterControllerSettings(Builder settingsBuilder) throws IOException { 227 super(settingsBuilder); 228 } 229 230 /** Builder for ClusterControllerSettings. */ 231 public static class Builder extends ClientSettings.Builder<ClusterControllerSettings, Builder> { 232 Builder()233 protected Builder() throws IOException { 234 this(((ClientContext) null)); 235 } 236 Builder(ClientContext clientContext)237 protected Builder(ClientContext clientContext) { 238 super(ClusterControllerStubSettings.newBuilder(clientContext)); 239 } 240 Builder(ClusterControllerSettings settings)241 protected Builder(ClusterControllerSettings settings) { 242 super(settings.getStubSettings().toBuilder()); 243 } 244 Builder(ClusterControllerStubSettings.Builder stubSettings)245 protected Builder(ClusterControllerStubSettings.Builder stubSettings) { 246 super(stubSettings); 247 } 248 createDefault()249 private static Builder createDefault() { 250 return new Builder(ClusterControllerStubSettings.newBuilder()); 251 } 252 253 @BetaApi createHttpJsonDefault()254 private static Builder createHttpJsonDefault() { 255 return new Builder(ClusterControllerStubSettings.newHttpJsonBuilder()); 256 } 257 getStubSettingsBuilder()258 public ClusterControllerStubSettings.Builder getStubSettingsBuilder() { 259 return ((ClusterControllerStubSettings.Builder) getStubSettings()); 260 } 261 262 /** 263 * Applies the given settings updater function to all of the unary API methods in this service. 264 * 265 * <p>Note: This method does not support applying settings to streaming methods. 266 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)267 public Builder applyToAllUnaryMethods( 268 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 269 super.applyToAllUnaryMethods( 270 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 271 return this; 272 } 273 274 /** Returns the builder for the settings used for calls to createCluster. */ createClusterSettings()275 public UnaryCallSettings.Builder<CreateClusterRequest, Operation> createClusterSettings() { 276 return getStubSettingsBuilder().createClusterSettings(); 277 } 278 279 /** Returns the builder for the settings used for calls to createCluster. */ 280 public OperationCallSettings.Builder<CreateClusterRequest, Cluster, ClusterOperationMetadata> createClusterOperationSettings()281 createClusterOperationSettings() { 282 return getStubSettingsBuilder().createClusterOperationSettings(); 283 } 284 285 /** Returns the builder for the settings used for calls to updateCluster. */ updateClusterSettings()286 public UnaryCallSettings.Builder<UpdateClusterRequest, Operation> updateClusterSettings() { 287 return getStubSettingsBuilder().updateClusterSettings(); 288 } 289 290 /** Returns the builder for the settings used for calls to updateCluster. */ 291 public OperationCallSettings.Builder<UpdateClusterRequest, Cluster, ClusterOperationMetadata> updateClusterOperationSettings()292 updateClusterOperationSettings() { 293 return getStubSettingsBuilder().updateClusterOperationSettings(); 294 } 295 296 /** Returns the builder for the settings used for calls to stopCluster. */ stopClusterSettings()297 public UnaryCallSettings.Builder<StopClusterRequest, Operation> stopClusterSettings() { 298 return getStubSettingsBuilder().stopClusterSettings(); 299 } 300 301 /** Returns the builder for the settings used for calls to stopCluster. */ 302 public OperationCallSettings.Builder<StopClusterRequest, Cluster, ClusterOperationMetadata> stopClusterOperationSettings()303 stopClusterOperationSettings() { 304 return getStubSettingsBuilder().stopClusterOperationSettings(); 305 } 306 307 /** Returns the builder for the settings used for calls to startCluster. */ startClusterSettings()308 public UnaryCallSettings.Builder<StartClusterRequest, Operation> startClusterSettings() { 309 return getStubSettingsBuilder().startClusterSettings(); 310 } 311 312 /** Returns the builder for the settings used for calls to startCluster. */ 313 public OperationCallSettings.Builder<StartClusterRequest, Cluster, ClusterOperationMetadata> startClusterOperationSettings()314 startClusterOperationSettings() { 315 return getStubSettingsBuilder().startClusterOperationSettings(); 316 } 317 318 /** Returns the builder for the settings used for calls to deleteCluster. */ deleteClusterSettings()319 public UnaryCallSettings.Builder<DeleteClusterRequest, Operation> deleteClusterSettings() { 320 return getStubSettingsBuilder().deleteClusterSettings(); 321 } 322 323 /** Returns the builder for the settings used for calls to deleteCluster. */ 324 public OperationCallSettings.Builder<DeleteClusterRequest, Empty, ClusterOperationMetadata> deleteClusterOperationSettings()325 deleteClusterOperationSettings() { 326 return getStubSettingsBuilder().deleteClusterOperationSettings(); 327 } 328 329 /** Returns the builder for the settings used for calls to getCluster. */ getClusterSettings()330 public UnaryCallSettings.Builder<GetClusterRequest, Cluster> getClusterSettings() { 331 return getStubSettingsBuilder().getClusterSettings(); 332 } 333 334 /** Returns the builder for the settings used for calls to listClusters. */ 335 public PagedCallSettings.Builder< 336 ListClustersRequest, ListClustersResponse, ListClustersPagedResponse> listClustersSettings()337 listClustersSettings() { 338 return getStubSettingsBuilder().listClustersSettings(); 339 } 340 341 /** Returns the builder for the settings used for calls to diagnoseCluster. */ diagnoseClusterSettings()342 public UnaryCallSettings.Builder<DiagnoseClusterRequest, Operation> diagnoseClusterSettings() { 343 return getStubSettingsBuilder().diagnoseClusterSettings(); 344 } 345 346 /** Returns the builder for the settings used for calls to diagnoseCluster. */ 347 public OperationCallSettings.Builder< 348 DiagnoseClusterRequest, DiagnoseClusterResults, ClusterOperationMetadata> diagnoseClusterOperationSettings()349 diagnoseClusterOperationSettings() { 350 return getStubSettingsBuilder().diagnoseClusterOperationSettings(); 351 } 352 353 @Override build()354 public ClusterControllerSettings build() throws IOException { 355 return new ClusterControllerSettings(this); 356 } 357 } 358 } 359