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