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