|
| 1 | +/* |
| 2 | + * Copyright 2021 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.BatchControllerClient.ListBatchesPagedResponse; |
| 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.rpc.ApiClientHeaderProvider; |
| 27 | +import com.google.api.gax.rpc.ClientContext; |
| 28 | +import com.google.api.gax.rpc.ClientSettings; |
| 29 | +import com.google.api.gax.rpc.OperationCallSettings; |
| 30 | +import com.google.api.gax.rpc.PagedCallSettings; |
| 31 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 32 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 33 | +import com.google.cloud.dataproc.v1.stub.BatchControllerStubSettings; |
| 34 | +import com.google.longrunning.Operation; |
| 35 | +import com.google.protobuf.Empty; |
| 36 | +import java.io.IOException; |
| 37 | +import java.util.List; |
| 38 | +import javax.annotation.Generated; |
| 39 | + |
| 40 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 41 | +/** |
| 42 | + * Settings class to configure an instance of {@link BatchControllerClient}. |
| 43 | + * |
| 44 | + * <p>The default instance has everything set to sensible defaults: |
| 45 | + * |
| 46 | + * <ul> |
| 47 | + * <li>The default service address (dataproc.googleapis.com) and default port (443) are used. |
| 48 | + * <li>Credentials are acquired automatically through Application Default Credentials. |
| 49 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 50 | + * </ul> |
| 51 | + * |
| 52 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 53 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 54 | + * |
| 55 | + * <p>For example, to set the total timeout of getBatch to 30 seconds: |
| 56 | + * |
| 57 | + * <pre>{@code |
| 58 | + * BatchControllerSettings.Builder batchControllerSettingsBuilder = |
| 59 | + * BatchControllerSettings.newBuilder(); |
| 60 | + * batchControllerSettingsBuilder |
| 61 | + * .getBatchSettings() |
| 62 | + * .setRetrySettings( |
| 63 | + * batchControllerSettingsBuilder |
| 64 | + * .getBatchSettings() |
| 65 | + * .getRetrySettings() |
| 66 | + * .toBuilder() |
| 67 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 68 | + * .build()); |
| 69 | + * BatchControllerSettings batchControllerSettings = batchControllerSettingsBuilder.build(); |
| 70 | + * }</pre> |
| 71 | + */ |
| 72 | +@Generated("by gapic-generator-java") |
| 73 | +public class BatchControllerSettings extends ClientSettings<BatchControllerSettings> { |
| 74 | + |
| 75 | + /** Returns the object with the settings used for calls to createBatch. */ |
| 76 | + public UnaryCallSettings<CreateBatchRequest, Operation> createBatchSettings() { |
| 77 | + return ((BatchControllerStubSettings) getStubSettings()).createBatchSettings(); |
| 78 | + } |
| 79 | + |
| 80 | + /** Returns the object with the settings used for calls to createBatch. */ |
| 81 | + public OperationCallSettings<CreateBatchRequest, Batch, BatchOperationMetadata> |
| 82 | + createBatchOperationSettings() { |
| 83 | + return ((BatchControllerStubSettings) getStubSettings()).createBatchOperationSettings(); |
| 84 | + } |
| 85 | + |
| 86 | + /** Returns the object with the settings used for calls to getBatch. */ |
| 87 | + public UnaryCallSettings<GetBatchRequest, Batch> getBatchSettings() { |
| 88 | + return ((BatchControllerStubSettings) getStubSettings()).getBatchSettings(); |
| 89 | + } |
| 90 | + |
| 91 | + /** Returns the object with the settings used for calls to listBatches. */ |
| 92 | + public PagedCallSettings<ListBatchesRequest, ListBatchesResponse, ListBatchesPagedResponse> |
| 93 | + listBatchesSettings() { |
| 94 | + return ((BatchControllerStubSettings) getStubSettings()).listBatchesSettings(); |
| 95 | + } |
| 96 | + |
| 97 | + /** Returns the object with the settings used for calls to deleteBatch. */ |
| 98 | + public UnaryCallSettings<DeleteBatchRequest, Empty> deleteBatchSettings() { |
| 99 | + return ((BatchControllerStubSettings) getStubSettings()).deleteBatchSettings(); |
| 100 | + } |
| 101 | + |
| 102 | + public static final BatchControllerSettings create(BatchControllerStubSettings stub) |
| 103 | + throws IOException { |
| 104 | + return new BatchControllerSettings.Builder(stub.toBuilder()).build(); |
| 105 | + } |
| 106 | + |
| 107 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 108 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 109 | + return BatchControllerStubSettings.defaultExecutorProviderBuilder(); |
| 110 | + } |
| 111 | + |
| 112 | + /** Returns the default service endpoint. */ |
| 113 | + public static String getDefaultEndpoint() { |
| 114 | + return BatchControllerStubSettings.getDefaultEndpoint(); |
| 115 | + } |
| 116 | + |
| 117 | + /** Returns the default service scopes. */ |
| 118 | + public static List<String> getDefaultServiceScopes() { |
| 119 | + return BatchControllerStubSettings.getDefaultServiceScopes(); |
| 120 | + } |
| 121 | + |
| 122 | + /** Returns a builder for the default credentials for this service. */ |
| 123 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 124 | + return BatchControllerStubSettings.defaultCredentialsProviderBuilder(); |
| 125 | + } |
| 126 | + |
| 127 | + /** Returns a builder for the default ChannelProvider for this service. */ |
| 128 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 129 | + return BatchControllerStubSettings.defaultGrpcTransportProviderBuilder(); |
| 130 | + } |
| 131 | + |
| 132 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 133 | + return BatchControllerStubSettings.defaultTransportChannelProvider(); |
| 134 | + } |
| 135 | + |
| 136 | + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") |
| 137 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 138 | + return BatchControllerStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 139 | + } |
| 140 | + |
| 141 | + /** Returns a new builder for this class. */ |
| 142 | + public static Builder newBuilder() { |
| 143 | + return Builder.createDefault(); |
| 144 | + } |
| 145 | + |
| 146 | + /** Returns a new builder for this class. */ |
| 147 | + public static Builder newBuilder(ClientContext clientContext) { |
| 148 | + return new Builder(clientContext); |
| 149 | + } |
| 150 | + |
| 151 | + /** Returns a builder containing all the values of this settings class. */ |
| 152 | + public Builder toBuilder() { |
| 153 | + return new Builder(this); |
| 154 | + } |
| 155 | + |
| 156 | + protected BatchControllerSettings(Builder settingsBuilder) throws IOException { |
| 157 | + super(settingsBuilder); |
| 158 | + } |
| 159 | + |
| 160 | + /** Builder for BatchControllerSettings. */ |
| 161 | + public static class Builder extends ClientSettings.Builder<BatchControllerSettings, Builder> { |
| 162 | + |
| 163 | + protected Builder() throws IOException { |
| 164 | + this(((ClientContext) null)); |
| 165 | + } |
| 166 | + |
| 167 | + protected Builder(ClientContext clientContext) { |
| 168 | + super(BatchControllerStubSettings.newBuilder(clientContext)); |
| 169 | + } |
| 170 | + |
| 171 | + protected Builder(BatchControllerSettings settings) { |
| 172 | + super(settings.getStubSettings().toBuilder()); |
| 173 | + } |
| 174 | + |
| 175 | + protected Builder(BatchControllerStubSettings.Builder stubSettings) { |
| 176 | + super(stubSettings); |
| 177 | + } |
| 178 | + |
| 179 | + private static Builder createDefault() { |
| 180 | + return new Builder(BatchControllerStubSettings.newBuilder()); |
| 181 | + } |
| 182 | + |
| 183 | + public BatchControllerStubSettings.Builder getStubSettingsBuilder() { |
| 184 | + return ((BatchControllerStubSettings.Builder) getStubSettings()); |
| 185 | + } |
| 186 | + |
| 187 | + /** |
| 188 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 189 | + * |
| 190 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 191 | + */ |
| 192 | + public Builder applyToAllUnaryMethods( |
| 193 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 194 | + super.applyToAllUnaryMethods( |
| 195 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 196 | + return this; |
| 197 | + } |
| 198 | + |
| 199 | + /** Returns the builder for the settings used for calls to createBatch. */ |
| 200 | + public UnaryCallSettings.Builder<CreateBatchRequest, Operation> createBatchSettings() { |
| 201 | + return getStubSettingsBuilder().createBatchSettings(); |
| 202 | + } |
| 203 | + |
| 204 | + /** Returns the builder for the settings used for calls to createBatch. */ |
| 205 | + public OperationCallSettings.Builder<CreateBatchRequest, Batch, BatchOperationMetadata> |
| 206 | + createBatchOperationSettings() { |
| 207 | + return getStubSettingsBuilder().createBatchOperationSettings(); |
| 208 | + } |
| 209 | + |
| 210 | + /** Returns the builder for the settings used for calls to getBatch. */ |
| 211 | + public UnaryCallSettings.Builder<GetBatchRequest, Batch> getBatchSettings() { |
| 212 | + return getStubSettingsBuilder().getBatchSettings(); |
| 213 | + } |
| 214 | + |
| 215 | + /** Returns the builder for the settings used for calls to listBatches. */ |
| 216 | + public PagedCallSettings.Builder< |
| 217 | + ListBatchesRequest, ListBatchesResponse, ListBatchesPagedResponse> |
| 218 | + listBatchesSettings() { |
| 219 | + return getStubSettingsBuilder().listBatchesSettings(); |
| 220 | + } |
| 221 | + |
| 222 | + /** Returns the builder for the settings used for calls to deleteBatch. */ |
| 223 | + public UnaryCallSettings.Builder<DeleteBatchRequest, Empty> deleteBatchSettings() { |
| 224 | + return getStubSettingsBuilder().deleteBatchSettings(); |
| 225 | + } |
| 226 | + |
| 227 | + @Override |
| 228 | + public BatchControllerSettings build() throws IOException { |
| 229 | + return new BatchControllerSettings(this); |
| 230 | + } |
| 231 | + } |
| 232 | +} |
0 commit comments