|
| 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.speech.v1; |
| 18 | + |
| 19 | +import static com.google.cloud.speech.v1.AdaptationClient.ListCustomClassesPagedResponse; |
| 20 | +import static com.google.cloud.speech.v1.AdaptationClient.ListPhraseSetPagedResponse; |
| 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.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.PagedCallSettings; |
| 31 | +import com.google.api.gax.rpc.TransportChannelProvider; |
| 32 | +import com.google.api.gax.rpc.UnaryCallSettings; |
| 33 | +import com.google.cloud.speech.v1.stub.AdaptationStubSettings; |
| 34 | +import com.google.protobuf.Empty; |
| 35 | +import java.io.IOException; |
| 36 | +import java.util.List; |
| 37 | +import javax.annotation.Generated; |
| 38 | + |
| 39 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 40 | +/** |
| 41 | + * Settings class to configure an instance of {@link AdaptationClient}. |
| 42 | + * |
| 43 | + * The default instance has everything set to sensible defaults: |
| 44 | + * |
| 45 | + |
| 46 | + * The default service address (speech.googleapis.com) and default port (443) are used. |
| 47 | + * Credentials are acquired automatically through Application Default Credentials. |
| 48 | + * Retries are configured for idempotent methods but not for non-idempotent methods. |
| 49 | + * |
| 50 | + * |
| 51 | + * The builder of this class is recursive, so contained classes are themselves builders. When |
| 52 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 53 | + * |
| 54 | + * For example, to set the total timeout of createPhraseSet to 30 seconds: |
| 55 | + * |
| 56 | + |
| 57 | + * // This snippet has been automatically generated for illustrative purposes only. |
| 58 | + * // It may require modifications to work in your environment. |
| 59 | + * AdaptationSettings.Builder adaptationSettingsBuilder = AdaptationSettings.newBuilder(); |
| 60 | + * adaptationSettingsBuilder |
| 61 | + * .createPhraseSetSettings() |
| 62 | + * .setRetrySettings( |
| 63 | + * adaptationSettingsBuilder |
| 64 | + * .createPhraseSetSettings() |
| 65 | + * .getRetrySettings() |
| 66 | + * .toBuilder() |
| 67 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 68 | + * .build()); |
| 69 | + * AdaptationSettings adaptationSettings = adaptationSettingsBuilder.build(); |
| 70 | + * } |
| 71 | + */ |
| 72 | +@Generated("by gapic-generator-java") |
| 73 | +public class AdaptationSettings extends ClientSettings<AdaptationSettings> { |
| 74 | + |
| 75 | + /** Returns the object with the settings used for calls to createPhraseSet. */ |
| 76 | + public UnaryCallSettings<CreatePhraseSetRequest, PhraseSet> createPhraseSetSettings() { |
| 77 | + return ((AdaptationStubSettings) getStubSettings()).createPhraseSetSettings(); |
| 78 | + } |
| 79 | + |
| 80 | + /** Returns the object with the settings used for calls to getPhraseSet. */ |
| 81 | + public UnaryCallSettings<GetPhraseSetRequest, PhraseSet> getPhraseSetSettings() { |
| 82 | + return ((AdaptationStubSettings) getStubSettings()).getPhraseSetSettings(); |
| 83 | + } |
| 84 | + |
| 85 | + /** Returns the object with the settings used for calls to listPhraseSet. */ |
| 86 | + public PagedCallSettings<ListPhraseSetRequest, ListPhraseSetResponse, ListPhraseSetPagedResponse> |
| 87 | + listPhraseSetSettings() { |
| 88 | + return ((AdaptationStubSettings) getStubSettings()).listPhraseSetSettings(); |
| 89 | + } |
| 90 | + |
| 91 | + /** Returns the object with the settings used for calls to updatePhraseSet. */ |
| 92 | + public UnaryCallSettings<UpdatePhraseSetRequest, PhraseSet> updatePhraseSetSettings() { |
| 93 | + return ((AdaptationStubSettings) getStubSettings()).updatePhraseSetSettings(); |
| 94 | + } |
| 95 | + |
| 96 | + /** Returns the object with the settings used for calls to deletePhraseSet. */ |
| 97 | + public UnaryCallSettings<DeletePhraseSetRequest, Empty> deletePhraseSetSettings() { |
| 98 | + return ((AdaptationStubSettings) getStubSettings()).deletePhraseSetSettings(); |
| 99 | + } |
| 100 | + |
| 101 | + /** Returns the object with the settings used for calls to createCustomClass. */ |
| 102 | + public UnaryCallSettings<CreateCustomClassRequest, CustomClass> createCustomClassSettings() { |
| 103 | + return ((AdaptationStubSettings) getStubSettings()).createCustomClassSettings(); |
| 104 | + } |
| 105 | + |
| 106 | + /** Returns the object with the settings used for calls to getCustomClass. */ |
| 107 | + public UnaryCallSettings<GetCustomClassRequest, CustomClass> getCustomClassSettings() { |
| 108 | + return ((AdaptationStubSettings) getStubSettings()).getCustomClassSettings(); |
| 109 | + } |
| 110 | + |
| 111 | + /** Returns the object with the settings used for calls to listCustomClasses. */ |
| 112 | + public PagedCallSettings< |
| 113 | + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> |
| 114 | + listCustomClassesSettings() { |
| 115 | + return ((AdaptationStubSettings) getStubSettings()).listCustomClassesSettings(); |
| 116 | + } |
| 117 | + |
| 118 | + /** Returns the object with the settings used for calls to updateCustomClass. */ |
| 119 | + public UnaryCallSettings<UpdateCustomClassRequest, CustomClass> updateCustomClassSettings() { |
| 120 | + return ((AdaptationStubSettings) getStubSettings()).updateCustomClassSettings(); |
| 121 | + } |
| 122 | + |
| 123 | + /** Returns the object with the settings used for calls to deleteCustomClass. */ |
| 124 | + public UnaryCallSettings<DeleteCustomClassRequest, Empty> deleteCustomClassSettings() { |
| 125 | + return ((AdaptationStubSettings) getStubSettings()).deleteCustomClassSettings(); |
| 126 | + } |
| 127 | + |
| 128 | + public static final AdaptationSettings create(AdaptationStubSettings stub) throws IOException { |
| 129 | + return new AdaptationSettings.Builder(stub.toBuilder()).build(); |
| 130 | + } |
| 131 | + |
| 132 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 133 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 134 | + return AdaptationStubSettings.defaultExecutorProviderBuilder(); |
| 135 | + } |
| 136 | + |
| 137 | + /** Returns the default service endpoint. */ |
| 138 | + public static String getDefaultEndpoint() { |
| 139 | + return AdaptationStubSettings.getDefaultEndpoint(); |
| 140 | + } |
| 141 | + |
| 142 | + /** Returns the default service scopes. */ |
| 143 | + public static List<String> getDefaultServiceScopes() { |
| 144 | + return AdaptationStubSettings.getDefaultServiceScopes(); |
| 145 | + } |
| 146 | + |
| 147 | + /** Returns a builder for the default credentials for this service. */ |
| 148 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 149 | + return AdaptationStubSettings.defaultCredentialsProviderBuilder(); |
| 150 | + } |
| 151 | + |
| 152 | + /** Returns a builder for the default ChannelProvider for this service. */ |
| 153 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 154 | + return AdaptationStubSettings.defaultGrpcTransportProviderBuilder(); |
| 155 | + } |
| 156 | + |
| 157 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 158 | + return AdaptationStubSettings.defaultTransportChannelProvider(); |
| 159 | + } |
| 160 | + |
| 161 | + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") |
| 162 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 163 | + return AdaptationStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 164 | + } |
| 165 | + |
| 166 | + /** Returns a new builder for this class. */ |
| 167 | + public static Builder newBuilder() { |
| 168 | + return Builder.createDefault(); |
| 169 | + } |
| 170 | + |
| 171 | + /** Returns a new builder for this class. */ |
| 172 | + public static Builder newBuilder(ClientContext clientContext) { |
| 173 | + return new Builder(clientContext); |
| 174 | + } |
| 175 | + |
| 176 | + /** Returns a builder containing all the values of this settings class. */ |
| 177 | + public Builder toBuilder() { |
| 178 | + return new Builder(this); |
| 179 | + } |
| 180 | + |
| 181 | + protected AdaptationSettings(Builder settingsBuilder) throws IOException { |
| 182 | + super(settingsBuilder); |
| 183 | + } |
| 184 | + |
| 185 | + /** Builder for AdaptationSettings. */ |
| 186 | + public static class Builder extends ClientSettings.Builder<AdaptationSettings, Builder> { |
| 187 | + |
| 188 | + protected Builder() throws IOException { |
| 189 | + this(((ClientContext) null)); |
| 190 | + } |
| 191 | + |
| 192 | + protected Builder(ClientContext clientContext) { |
| 193 | + super(AdaptationStubSettings.newBuilder(clientContext)); |
| 194 | + } |
| 195 | + |
| 196 | + protected Builder(AdaptationSettings settings) { |
| 197 | + super(settings.getStubSettings().toBuilder()); |
| 198 | + } |
| 199 | + |
| 200 | + protected Builder(AdaptationStubSettings.Builder stubSettings) { |
| 201 | + super(stubSettings); |
| 202 | + } |
| 203 | + |
| 204 | + private static Builder createDefault() { |
| 205 | + return new Builder(AdaptationStubSettings.newBuilder()); |
| 206 | + } |
| 207 | + |
| 208 | + public AdaptationStubSettings.Builder getStubSettingsBuilder() { |
| 209 | + return ((AdaptationStubSettings.Builder) getStubSettings()); |
| 210 | + } |
| 211 | + |
| 212 | + /** |
| 213 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 214 | + * |
| 215 | + * Note: This method does not support applying settings to streaming methods. |
| 216 | + */ |
| 217 | + public Builder applyToAllUnaryMethods( |
| 218 | + ApiFunction<UnaryCallSettings.Builder, ?>, Void> settingsUpdater) { |
| 219 | + super.applyToAllUnaryMethods( |
| 220 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 221 | + return this; |
| 222 | + } |
| 223 | + |
| 224 | + /** Returns the builder for the settings used for calls to createPhraseSet. */ |
| 225 | + public UnaryCallSettings.Builder<CreatePhraseSetRequest, PhraseSet> createPhraseSetSettings() { |
| 226 | + return getStubSettingsBuilder().createPhraseSetSettings(); |
| 227 | + } |
| 228 | + |
| 229 | + /** Returns the builder for the settings used for calls to getPhraseSet. */ |
| 230 | + public UnaryCallSettings.Builder<GetPhraseSetRequest, PhraseSet> getPhraseSetSettings() { |
| 231 | + return getStubSettingsBuilder().getPhraseSetSettings(); |
| 232 | + } |
| 233 | + |
| 234 | + /** Returns the builder for the settings used for calls to listPhraseSet. */ |
| 235 | + public PagedCallSettings.Builder< |
| 236 | + ListPhraseSetRequest, ListPhraseSetResponse, ListPhraseSetPagedResponse> |
| 237 | + listPhraseSetSettings() { |
| 238 | + return getStubSettingsBuilder().listPhraseSetSettings(); |
| 239 | + } |
| 240 | + |
| 241 | + /** Returns the builder for the settings used for calls to updatePhraseSet. */ |
| 242 | + public UnaryCallSettings.Builder<UpdatePhraseSetRequest, PhraseSet> updatePhraseSetSettings() { |
| 243 | + return getStubSettingsBuilder().updatePhraseSetSettings(); |
| 244 | + } |
| 245 | + |
| 246 | + /** Returns the builder for the settings used for calls to deletePhraseSet. */ |
| 247 | + public UnaryCallSettings.Builder<DeletePhraseSetRequest, Empty> deletePhraseSetSettings() { |
| 248 | + return getStubSettingsBuilder().deletePhraseSetSettings(); |
| 249 | + } |
| 250 | + |
| 251 | + /** Returns the builder for the settings used for calls to createCustomClass. */ |
| 252 | + public UnaryCallSettings.Builder<CreateCustomClassRequest, CustomClass> |
| 253 | + createCustomClassSettings() { |
| 254 | + return getStubSettingsBuilder().createCustomClassSettings(); |
| 255 | + } |
| 256 | + |
| 257 | + /** Returns the builder for the settings used for calls to getCustomClass. */ |
| 258 | + public UnaryCallSettings.Builder<GetCustomClassRequest, CustomClass> getCustomClassSettings() { |
| 259 | + return getStubSettingsBuilder().getCustomClassSettings(); |
| 260 | + } |
| 261 | + |
| 262 | + /** Returns the builder for the settings used for calls to listCustomClasses. */ |
| 263 | + public PagedCallSettings.Builder< |
| 264 | + ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse> |
| 265 | + listCustomClassesSettings() { |
| 266 | + return getStubSettingsBuilder().listCustomClassesSettings(); |
| 267 | + } |
| 268 | + |
| 269 | + /** Returns the builder for the settings used for calls to updateCustomClass. */ |
| 270 | + public UnaryCallSettings.Builder<UpdateCustomClassRequest, CustomClass> |
| 271 | + updateCustomClassSettings() { |
| 272 | + return getStubSettingsBuilder().updateCustomClassSettings(); |
| 273 | + } |
| 274 | + |
| 275 | + /** Returns the builder for the settings used for calls to deleteCustomClass. */ |
| 276 | + public UnaryCallSettings.Builder<DeleteCustomClassRequest, Empty> deleteCustomClassSettings() { |
| 277 | + return getStubSettingsBuilder().deleteCustomClassSettings(); |
| 278 | + } |
| 279 | + |
| 280 | + @Override |
| 281 | + public AdaptationSettings build() throws IOException { |
| 282 | + return new AdaptationSettings(this); |
| 283 | + } |
| 284 | + } |
| 285 | +} |
0 commit comments