|
| 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.dialogflow.v2; |
| 18 | + |
| 19 | +import static com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse; |
| 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.dialogflow.v2.stub.AgentsStubSettings; |
| 34 | +import com.google.longrunning.Operation; |
| 35 | +import com.google.protobuf.Empty; |
| 36 | +import com.google.protobuf.Struct; |
| 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 AgentsClient}. |
| 44 | + * |
| 45 | + * <p>The default instance has everything set to sensible defaults: |
| 46 | + * |
| 47 | + * <ul> |
| 48 | + * <li>The default service address (dialogflow.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 getAgent to 30 seconds: |
| 57 | + * |
| 58 | + * <pre>{@code |
| 59 | + * AgentsSettings.Builder agentsSettingsBuilder = AgentsSettings.newBuilder(); |
| 60 | + * agentsSettingsBuilder |
| 61 | + * .getAgentSettings() |
| 62 | + * .setRetrySettings( |
| 63 | + * agentsSettingsBuilder |
| 64 | + * .getAgentSettings() |
| 65 | + * .getRetrySettings() |
| 66 | + * .toBuilder() |
| 67 | + * .setTotalTimeout(Duration.ofSeconds(30)) |
| 68 | + * .build()); |
| 69 | + * AgentsSettings agentsSettings = agentsSettingsBuilder.build(); |
| 70 | + * }</pre> |
| 71 | + */ |
| 72 | +@Generated("by gapic-generator-java") |
| 73 | +public class AgentsSettings extends ClientSettings<AgentsSettings> { |
| 74 | + |
| 75 | + /** Returns the object with the settings used for calls to getAgent. */ |
| 76 | + public UnaryCallSettings<GetAgentRequest, Agent> getAgentSettings() { |
| 77 | + return ((AgentsStubSettings) getStubSettings()).getAgentSettings(); |
| 78 | + } |
| 79 | + |
| 80 | + /** Returns the object with the settings used for calls to setAgent. */ |
| 81 | + public UnaryCallSettings<SetAgentRequest, Agent> setAgentSettings() { |
| 82 | + return ((AgentsStubSettings) getStubSettings()).setAgentSettings(); |
| 83 | + } |
| 84 | + |
| 85 | + /** Returns the object with the settings used for calls to deleteAgent. */ |
| 86 | + public UnaryCallSettings<DeleteAgentRequest, Empty> deleteAgentSettings() { |
| 87 | + return ((AgentsStubSettings) getStubSettings()).deleteAgentSettings(); |
| 88 | + } |
| 89 | + |
| 90 | + /** Returns the object with the settings used for calls to searchAgents. */ |
| 91 | + public PagedCallSettings<SearchAgentsRequest, SearchAgentsResponse, SearchAgentsPagedResponse> |
| 92 | + searchAgentsSettings() { |
| 93 | + return ((AgentsStubSettings) getStubSettings()).searchAgentsSettings(); |
| 94 | + } |
| 95 | + |
| 96 | + /** Returns the object with the settings used for calls to trainAgent. */ |
| 97 | + public UnaryCallSettings<TrainAgentRequest, Operation> trainAgentSettings() { |
| 98 | + return ((AgentsStubSettings) getStubSettings()).trainAgentSettings(); |
| 99 | + } |
| 100 | + |
| 101 | + /** Returns the object with the settings used for calls to trainAgent. */ |
| 102 | + public OperationCallSettings<TrainAgentRequest, Empty, Struct> trainAgentOperationSettings() { |
| 103 | + return ((AgentsStubSettings) getStubSettings()).trainAgentOperationSettings(); |
| 104 | + } |
| 105 | + |
| 106 | + /** Returns the object with the settings used for calls to exportAgent. */ |
| 107 | + public UnaryCallSettings<ExportAgentRequest, Operation> exportAgentSettings() { |
| 108 | + return ((AgentsStubSettings) getStubSettings()).exportAgentSettings(); |
| 109 | + } |
| 110 | + |
| 111 | + /** Returns the object with the settings used for calls to exportAgent. */ |
| 112 | + public OperationCallSettings<ExportAgentRequest, ExportAgentResponse, Struct> |
| 113 | + exportAgentOperationSettings() { |
| 114 | + return ((AgentsStubSettings) getStubSettings()).exportAgentOperationSettings(); |
| 115 | + } |
| 116 | + |
| 117 | + /** Returns the object with the settings used for calls to importAgent. */ |
| 118 | + public UnaryCallSettings<ImportAgentRequest, Operation> importAgentSettings() { |
| 119 | + return ((AgentsStubSettings) getStubSettings()).importAgentSettings(); |
| 120 | + } |
| 121 | + |
| 122 | + /** Returns the object with the settings used for calls to importAgent. */ |
| 123 | + public OperationCallSettings<ImportAgentRequest, Empty, Struct> importAgentOperationSettings() { |
| 124 | + return ((AgentsStubSettings) getStubSettings()).importAgentOperationSettings(); |
| 125 | + } |
| 126 | + |
| 127 | + /** Returns the object with the settings used for calls to restoreAgent. */ |
| 128 | + public UnaryCallSettings<RestoreAgentRequest, Operation> restoreAgentSettings() { |
| 129 | + return ((AgentsStubSettings) getStubSettings()).restoreAgentSettings(); |
| 130 | + } |
| 131 | + |
| 132 | + /** Returns the object with the settings used for calls to restoreAgent. */ |
| 133 | + public OperationCallSettings<RestoreAgentRequest, Empty, Struct> restoreAgentOperationSettings() { |
| 134 | + return ((AgentsStubSettings) getStubSettings()).restoreAgentOperationSettings(); |
| 135 | + } |
| 136 | + |
| 137 | + /** Returns the object with the settings used for calls to getValidationResult. */ |
| 138 | + public UnaryCallSettings<GetValidationResultRequest, ValidationResult> |
| 139 | + getValidationResultSettings() { |
| 140 | + return ((AgentsStubSettings) getStubSettings()).getValidationResultSettings(); |
| 141 | + } |
| 142 | + |
| 143 | + public static final AgentsSettings create(AgentsStubSettings stub) throws IOException { |
| 144 | + return new AgentsSettings.Builder(stub.toBuilder()).build(); |
| 145 | + } |
| 146 | + |
| 147 | + /** Returns a builder for the default ExecutorProvider for this service. */ |
| 148 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { |
| 149 | + return AgentsStubSettings.defaultExecutorProviderBuilder(); |
| 150 | + } |
| 151 | + |
| 152 | + /** Returns the default service endpoint. */ |
| 153 | + public static String getDefaultEndpoint() { |
| 154 | + return AgentsStubSettings.getDefaultEndpoint(); |
| 155 | + } |
| 156 | + |
| 157 | + /** Returns the default service scopes. */ |
| 158 | + public static List<String> getDefaultServiceScopes() { |
| 159 | + return AgentsStubSettings.getDefaultServiceScopes(); |
| 160 | + } |
| 161 | + |
| 162 | + /** Returns a builder for the default credentials for this service. */ |
| 163 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { |
| 164 | + return AgentsStubSettings.defaultCredentialsProviderBuilder(); |
| 165 | + } |
| 166 | + |
| 167 | + /** Returns a builder for the default ChannelProvider for this service. */ |
| 168 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { |
| 169 | + return AgentsStubSettings.defaultGrpcTransportProviderBuilder(); |
| 170 | + } |
| 171 | + |
| 172 | + public static TransportChannelProvider defaultTransportChannelProvider() { |
| 173 | + return AgentsStubSettings.defaultTransportChannelProvider(); |
| 174 | + } |
| 175 | + |
| 176 | + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") |
| 177 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { |
| 178 | + return AgentsStubSettings.defaultApiClientHeaderProviderBuilder(); |
| 179 | + } |
| 180 | + |
| 181 | + /** Returns a new builder for this class. */ |
| 182 | + public static Builder newBuilder() { |
| 183 | + return Builder.createDefault(); |
| 184 | + } |
| 185 | + |
| 186 | + /** Returns a new builder for this class. */ |
| 187 | + public static Builder newBuilder(ClientContext clientContext) { |
| 188 | + return new Builder(clientContext); |
| 189 | + } |
| 190 | + |
| 191 | + /** Returns a builder containing all the values of this settings class. */ |
| 192 | + public Builder toBuilder() { |
| 193 | + return new Builder(this); |
| 194 | + } |
| 195 | + |
| 196 | + protected AgentsSettings(Builder settingsBuilder) throws IOException { |
| 197 | + super(settingsBuilder); |
| 198 | + } |
| 199 | + |
| 200 | + /** Builder for AgentsSettings. */ |
| 201 | + public static class Builder extends ClientSettings.Builder<AgentsSettings, Builder> { |
| 202 | + |
| 203 | + protected Builder() throws IOException { |
| 204 | + this(((ClientContext) null)); |
| 205 | + } |
| 206 | + |
| 207 | + protected Builder(ClientContext clientContext) { |
| 208 | + super(AgentsStubSettings.newBuilder(clientContext)); |
| 209 | + } |
| 210 | + |
| 211 | + protected Builder(AgentsSettings settings) { |
| 212 | + super(settings.getStubSettings().toBuilder()); |
| 213 | + } |
| 214 | + |
| 215 | + protected Builder(AgentsStubSettings.Builder stubSettings) { |
| 216 | + super(stubSettings); |
| 217 | + } |
| 218 | + |
| 219 | + private static Builder createDefault() { |
| 220 | + return new Builder(AgentsStubSettings.newBuilder()); |
| 221 | + } |
| 222 | + |
| 223 | + public AgentsStubSettings.Builder getStubSettingsBuilder() { |
| 224 | + return ((AgentsStubSettings.Builder) getStubSettings()); |
| 225 | + } |
| 226 | + |
| 227 | + /** |
| 228 | + * Applies the given settings updater function to all of the unary API methods in this service. |
| 229 | + * |
| 230 | + * <p>Note: This method does not support applying settings to streaming methods. |
| 231 | + */ |
| 232 | + public Builder applyToAllUnaryMethods( |
| 233 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { |
| 234 | + super.applyToAllUnaryMethods( |
| 235 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); |
| 236 | + return this; |
| 237 | + } |
| 238 | + |
| 239 | + /** Returns the builder for the settings used for calls to getAgent. */ |
| 240 | + public UnaryCallSettings.Builder<GetAgentRequest, Agent> getAgentSettings() { |
| 241 | + return getStubSettingsBuilder().getAgentSettings(); |
| 242 | + } |
| 243 | + |
| 244 | + /** Returns the builder for the settings used for calls to setAgent. */ |
| 245 | + public UnaryCallSettings.Builder<SetAgentRequest, Agent> setAgentSettings() { |
| 246 | + return getStubSettingsBuilder().setAgentSettings(); |
| 247 | + } |
| 248 | + |
| 249 | + /** Returns the builder for the settings used for calls to deleteAgent. */ |
| 250 | + public UnaryCallSettings.Builder<DeleteAgentRequest, Empty> deleteAgentSettings() { |
| 251 | + return getStubSettingsBuilder().deleteAgentSettings(); |
| 252 | + } |
| 253 | + |
| 254 | + /** Returns the builder for the settings used for calls to searchAgents. */ |
| 255 | + public PagedCallSettings.Builder< |
| 256 | + SearchAgentsRequest, SearchAgentsResponse, SearchAgentsPagedResponse> |
| 257 | + searchAgentsSettings() { |
| 258 | + return getStubSettingsBuilder().searchAgentsSettings(); |
| 259 | + } |
| 260 | + |
| 261 | + /** Returns the builder for the settings used for calls to trainAgent. */ |
| 262 | + public UnaryCallSettings.Builder<TrainAgentRequest, Operation> trainAgentSettings() { |
| 263 | + return getStubSettingsBuilder().trainAgentSettings(); |
| 264 | + } |
| 265 | + |
| 266 | + /** Returns the builder for the settings used for calls to trainAgent. */ |
| 267 | + public OperationCallSettings.Builder<TrainAgentRequest, Empty, Struct> |
| 268 | + trainAgentOperationSettings() { |
| 269 | + return getStubSettingsBuilder().trainAgentOperationSettings(); |
| 270 | + } |
| 271 | + |
| 272 | + /** Returns the builder for the settings used for calls to exportAgent. */ |
| 273 | + public UnaryCallSettings.Builder<ExportAgentRequest, Operation> exportAgentSettings() { |
| 274 | + return getStubSettingsBuilder().exportAgentSettings(); |
| 275 | + } |
| 276 | + |
| 277 | + /** Returns the builder for the settings used for calls to exportAgent. */ |
| 278 | + public OperationCallSettings.Builder<ExportAgentRequest, ExportAgentResponse, Struct> |
| 279 | + exportAgentOperationSettings() { |
| 280 | + return getStubSettingsBuilder().exportAgentOperationSettings(); |
| 281 | + } |
| 282 | + |
| 283 | + /** Returns the builder for the settings used for calls to importAgent. */ |
| 284 | + public UnaryCallSettings.Builder<ImportAgentRequest, Operation> importAgentSettings() { |
| 285 | + return getStubSettingsBuilder().importAgentSettings(); |
| 286 | + } |
| 287 | + |
| 288 | + /** Returns the builder for the settings used for calls to importAgent. */ |
| 289 | + public OperationCallSettings.Builder<ImportAgentRequest, Empty, Struct> |
| 290 | + importAgentOperationSettings() { |
| 291 | + return getStubSettingsBuilder().importAgentOperationSettings(); |
| 292 | + } |
| 293 | + |
| 294 | + /** Returns the builder for the settings used for calls to restoreAgent. */ |
| 295 | + public UnaryCallSettings.Builder<RestoreAgentRequest, Operation> restoreAgentSettings() { |
| 296 | + return getStubSettingsBuilder().restoreAgentSettings(); |
| 297 | + } |
| 298 | + |
| 299 | + /** Returns the builder for the settings used for calls to restoreAgent. */ |
| 300 | + public OperationCallSettings.Builder<RestoreAgentRequest, Empty, Struct> |
| 301 | + restoreAgentOperationSettings() { |
| 302 | + return getStubSettingsBuilder().restoreAgentOperationSettings(); |
| 303 | + } |
| 304 | + |
| 305 | + /** Returns the builder for the settings used for calls to getValidationResult. */ |
| 306 | + public UnaryCallSettings.Builder<GetValidationResultRequest, ValidationResult> |
| 307 | + getValidationResultSettings() { |
| 308 | + return getStubSettingsBuilder().getValidationResultSettings(); |
| 309 | + } |
| 310 | + |
| 311 | + @Override |
| 312 | + public AgentsSettings build() throws IOException { |
| 313 | + return new AgentsSettings(this); |
| 314 | + } |
| 315 | + } |
| 316 | +} |
0 commit comments