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