|
| 1 | +/* |
| 2 | + * Copyright 2023 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.dialogflow.cx.v3; |
| 18 | + |
| 19 | +import static com.google.cloud.dialogflow.cx.v3.GeneratorsClient.ListGeneratorsPagedResponse; |
| 20 | +import static com.google.cloud.dialogflow.cx.v3.GeneratorsClient.ListLocationsPagedResponse; |
| 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.httpjson.InstantiatingHttpJsonChannelProvider; |
| 28 | +import com.google.api.gax.rpc.ApiClientHeaderProvider; |
| 29 | +import com.google.api.gax.rpc.ClientContext; |
| 30 | +import com.google.api.gax.rpc.ClientSettings; |
| 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.dialogflow.cx.v3.stub.GeneratorsStubSettings; |
| 35 | +import com.google.cloud.location.GetLocationRequest; |
| 36 | +import com.google.cloud.location.ListLocationsRequest; |
| 37 | +import com.google.cloud.location.ListLocationsResponse; |
| 38 | +import com.google.cloud.location.Location; |
| 39 | +import com.google.protobuf.Empty; |
| 40 | +import java.io.IOException; |
| 41 | +import java.util.List; |
| 42 | +import javax.annotation.Generated; |
| 43 | + |
| 44 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. |
| 45 | +/** |
| 46 | + * Settings class to configure an instance of {@link GeneratorsClient}. |
| 47 | + * |
| 48 | + * <p>The default instance has everything set to sensible defaults: |
| 49 | + * |
| 50 | + * <ul> |
| 51 | + * <li>The default service address (dialogflow.googleapis.com) and default port (443) are used. |
| 52 | + * <li>Credentials are acquired automatically through Application Default Credentials. |
| 53 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. |
| 54 | + * </ul> |
| 55 | + * |
| 56 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When |
| 57 | + * build() is called, the tree of builders is called to create the complete settings object. |
| 58 | + * |
| 59 | + * <p>For example, to set the total timeout of getGenerator to 30 seconds: |
| 60 | + * |
| 61 | + * <pre>{@code |
| 62 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 63 | + * // It will require modifications to work: |
| 64 | + * // - It may require correct/in-range values for request initialization. |
| 65 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 66 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 67 | + * GeneratorsSettings.Builder generatorsSettingsBuilder = GeneratorsSettings.newBuilder(); |
| 68 | + * generatorsSettingsBuilder |
| 69 | + * .getGeneratorSettings() |
| 70 | + * .setRetrySettings( |
| 71 | + * generatorsSettingsBuilder |
| 72 | + * .getGeneratorSettings() |
| 73 | + * .getRetrySettings() |
| 74 | + * .toBuilder() |
| 75 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 76 | + * .build()); |
| 77 | + * GeneratorsSettings generatorsSettings = generatorsSettingsBuilder.build(); |
| 78 | + * }</pre> |
| 79 | + */ |
| 80 | +@Generated("by gapic-generator-java") |
| 81 | +public class GeneratorsSettings extends ClientSettings<GeneratorsSettings> { |
| 82 | + |
| 83 | + /** Returns the object with the settings used for calls to listGenerators. */ |
| 84 | + public PagedCallSettings< |
| 85 | + ListGeneratorsRequest, ListGeneratorsResponse, ListGeneratorsPagedResponse> |
| 86 | + listGeneratorsSettings() { |
| 87 | + return ((GeneratorsStubSettings) getStubSettings()).listGeneratorsSettings(); |
| 88 | + } |
| 89 | + |
| 90 | + /** Returns the object with the settings used for calls to getGenerator. */ |
| 91 | + public UnaryCallSettings<GetGeneratorRequest, Generator> getGeneratorSettings() { |
| 92 | + return ((GeneratorsStubSettings) getStubSettings()).getGeneratorSettings(); |
| 93 | + } |
| 94 | + |
| 95 | + /** Returns the object with the settings used for calls to createGenerator. */ |
| 96 | + public UnaryCallSettings<CreateGeneratorRequest, Generator> createGeneratorSettings() { |
| 97 | + return ((GeneratorsStubSettings) getStubSettings()).createGeneratorSettings(); |
| 98 | + } |
| 99 | + |
| 100 | + /** Returns the object with the settings used for calls to updateGenerator. */ |
| 101 | + public UnaryCallSettings<UpdateGeneratorRequest, Generator> updateGeneratorSettings() { |
| 102 | + return ((GeneratorsStubSettings) getStubSettings()).updateGeneratorSettings(); |
| 103 | + } |
| 104 | + |
| 105 | + /** Returns the object with the settings used for calls to deleteGenerator. */ |
| 106 | + public UnaryCallSettings<DeleteGeneratorRequest, Empty> deleteGeneratorSettings() { |
| 107 | + return ((GeneratorsStubSettings) getStubSettings()).deleteGeneratorSettings(); |
| 108 | + } |
| 109 | + |
| 110 | + /** Returns the object with the settings used for calls to listLocations. */ |
| 111 | + public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> |
| 112 | + listLocationsSettings() { |
| 113 | + return ((GeneratorsStubSettings) getStubSettings()).listLocationsSettings(); |
| 114 | + } |
| 115 | + |
| 116 | + /** Returns the object with the settings used for calls to getLocation. */ |
| 117 | + public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() { |
| 118 | + return ((GeneratorsStubSettings) getStubSettings()).getLocationSettings(); |
| 119 | + } |
| 120 | + |
| 121 | + public static final GeneratorsSettings create(GeneratorsStubSettings stub) throws IOException { |
| 122 | + return new GeneratorsSettings.Builder(stub.toBuilder()).build(); |
| 123 | + } |
| 124 | + |
| 125 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 126 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 127 | + return GeneratorsStubSettings.defaultExecutorProviderBuilder(); |
| 128 | + } |
| 129 | + |
| 130 | + /** Returns the default service endpoint. */ |
| 131 | + public static String getDefaultEndpoint() { |
| 132 | + return GeneratorsStubSettings.getDefaultEndpoint(); |
| 133 | + } |
| 134 | + |
| 135 | + /** Returns the default service scopes. */ |
| 136 | + public static List<String> getDefaultServiceScopes() { |
| 137 | + return GeneratorsStubSettings.getDefaultServiceScopes(); |
| 138 | + } |
| 139 | + |
| 140 | + /** Returns a builder for the default credentials for this service. */ |
| 141 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 142 | + return GeneratorsStubSettings.defaultCredentialsProviderBuilder(); |
| 143 | + } |
| 144 | + |
| 145 | + /** Returns a builder for the default gRPC ChannelProvider for this service. */ |
| 146 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 147 | + return GeneratorsStubSettings.defaultGrpcTransportProviderBuilder(); |
| 148 | + } |
| 149 | + |
| 150 | + /** Returns a builder for the default REST ChannelProvider for this service. */ |
| 151 | + @BetaApi |
| 152 | + public static InstantiatingHttpJsonChannelProvider.Builder |
| 153 | + defaultHttpJsonTransportProviderBuilder() { |
| 154 | + return GeneratorsStubSettings.defaultHttpJsonTransportProviderBuilder(); |
| 155 | + } |
| 156 | + |
| 157 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 158 | + return GeneratorsStubSettings.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 GeneratorsStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 164 | + } |
| 165 | + |
| 166 | + /** Returns a new gRPC builder for this class. */ |
| 167 | + public static Builder newBuilder() { |
| 168 | + return Builder.createDefault(); |
| 169 | + } |
| 170 | + |
| 171 | + /** Returns a new REST builder for this class. */ |
| 172 | + @BetaApi |
| 173 | + public static Builder newHttpJsonBuilder() { |
| 174 | + return Builder.createHttpJsonDefault(); |
| 175 | + } |
| 176 | + |
| 177 | + /** Returns a new builder for this class. */ |
| 178 | + public static Builder newBuilder(ClientContext clientContext) { |
| 179 | + return new Builder(clientContext); |
| 180 | + } |
| 181 | + |
| 182 | + /** Returns a builder containing all the values of this settings class. */ |
| 183 | + public Builder toBuilder() { |
| 184 | + return new Builder(this); |
| 185 | + } |
| 186 | + |
| 187 | + protected GeneratorsSettings(Builder settingsBuilder) throws IOException { |
| 188 | + super(settingsBuilder); |
| 189 | + } |
| 190 | + |
| 191 | + /** Builder for GeneratorsSettings. */ |
| 192 | + public static class Builder extends ClientSettings.Builder<GeneratorsSettings, Builder> { |
| 193 | + |
| 194 | + protected Builder() throws IOException { |
| 195 | + this(((ClientContext) null)); |
| 196 | + } |
| 197 | + |
| 198 | + protected Builder(ClientContext clientContext) { |
| 199 | + super(GeneratorsStubSettings.newBuilder(clientContext)); |
| 200 | + } |
| 201 | + |
| 202 | + protected Builder(GeneratorsSettings settings) { |
| 203 | + super(settings.getStubSettings().toBuilder()); |
| 204 | + } |
| 205 | + |
| 206 | + protected Builder(GeneratorsStubSettings.Builder stubSettings) { |
| 207 | + super(stubSettings); |
| 208 | + } |
| 209 | + |
| 210 | + private static Builder createDefault() { |
| 211 | + return new Builder(GeneratorsStubSettings.newBuilder()); |
| 212 | + } |
| 213 | + |
| 214 | + @BetaApi |
| 215 | + private static Builder createHttpJsonDefault() { |
| 216 | + return new Builder(GeneratorsStubSettings.newHttpJsonBuilder()); |
| 217 | + } |
| 218 | + |
| 219 | + public GeneratorsStubSettings.Builder getStubSettingsBuilder() { |
| 220 | + return ((GeneratorsStubSettings.Builder) getStubSettings()); |
| 221 | + } |
| 222 | + |
| 223 | + /** |
| 224 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 225 | + * |
| 226 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 227 | + */ |
| 228 | + public Builder applyToAllUnaryMethods( |
| 229 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 230 | + super.applyToAllUnaryMethods( |
| 231 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 232 | + return this; |
| 233 | + } |
| 234 | + |
| 235 | + /** Returns the builder for the settings used for calls to listGenerators. */ |
| 236 | + public PagedCallSettings.Builder< |
| 237 | + ListGeneratorsRequest, ListGeneratorsResponse, ListGeneratorsPagedResponse> |
| 238 | + listGeneratorsSettings() { |
| 239 | + return getStubSettingsBuilder().listGeneratorsSettings(); |
| 240 | + } |
| 241 | + |
| 242 | + /** Returns the builder for the settings used for calls to getGenerator. */ |
| 243 | + public UnaryCallSettings.Builder<GetGeneratorRequest, Generator> getGeneratorSettings() { |
| 244 | + return getStubSettingsBuilder().getGeneratorSettings(); |
| 245 | + } |
| 246 | + |
| 247 | + /** Returns the builder for the settings used for calls to createGenerator. */ |
| 248 | + public UnaryCallSettings.Builder<CreateGeneratorRequest, Generator> createGeneratorSettings() { |
| 249 | + return getStubSettingsBuilder().createGeneratorSettings(); |
| 250 | + } |
| 251 | + |
| 252 | + /** Returns the builder for the settings used for calls to updateGenerator. */ |
| 253 | + public UnaryCallSettings.Builder<UpdateGeneratorRequest, Generator> updateGeneratorSettings() { |
| 254 | + return getStubSettingsBuilder().updateGeneratorSettings(); |
| 255 | + } |
| 256 | + |
| 257 | + /** Returns the builder for the settings used for calls to deleteGenerator. */ |
| 258 | + public UnaryCallSettings.Builder<DeleteGeneratorRequest, Empty> deleteGeneratorSettings() { |
| 259 | + return getStubSettingsBuilder().deleteGeneratorSettings(); |
| 260 | + } |
| 261 | + |
| 262 | + /** Returns the builder for the settings used for calls to listLocations. */ |
| 263 | + public PagedCallSettings.Builder< |
| 264 | + ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> |
| 265 | + listLocationsSettings() { |
| 266 | + return getStubSettingsBuilder().listLocationsSettings(); |
| 267 | + } |
| 268 | + |
| 269 | + /** Returns the builder for the settings used for calls to getLocation. */ |
| 270 | + public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { |
| 271 | + return getStubSettingsBuilder().getLocationSettings(); |
| 272 | + } |
| 273 | + |
| 274 | + @Override |
| 275 | + public GeneratorsSettings build() throws IOException { |
| 276 | + return new GeneratorsSettings(this); |
| 277 | + } |
| 278 | + } |
| 279 | +} |
0 commit comments