• 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 static com.google.cloud.talent.v4.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.v4.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 @Generated("by gapic-generator-java")
77 public class CompanyServiceSettings extends ClientSettings<CompanyServiceSettings> {
78 
79   /** Returns the object with the settings used for calls to createCompany. */
createCompanySettings()80   public UnaryCallSettings<CreateCompanyRequest, Company> createCompanySettings() {
81     return ((CompanyServiceStubSettings) getStubSettings()).createCompanySettings();
82   }
83 
84   /** Returns the object with the settings used for calls to getCompany. */
getCompanySettings()85   public UnaryCallSettings<GetCompanyRequest, Company> getCompanySettings() {
86     return ((CompanyServiceStubSettings) getStubSettings()).getCompanySettings();
87   }
88 
89   /** Returns the object with the settings used for calls to updateCompany. */
updateCompanySettings()90   public UnaryCallSettings<UpdateCompanyRequest, Company> updateCompanySettings() {
91     return ((CompanyServiceStubSettings) getStubSettings()).updateCompanySettings();
92   }
93 
94   /** Returns the object with the settings used for calls to deleteCompany. */
deleteCompanySettings()95   public UnaryCallSettings<DeleteCompanyRequest, Empty> deleteCompanySettings() {
96     return ((CompanyServiceStubSettings) getStubSettings()).deleteCompanySettings();
97   }
98 
99   /** Returns the object with the settings used for calls to listCompanies. */
100   public PagedCallSettings<ListCompaniesRequest, ListCompaniesResponse, ListCompaniesPagedResponse>
listCompaniesSettings()101       listCompaniesSettings() {
102     return ((CompanyServiceStubSettings) getStubSettings()).listCompaniesSettings();
103   }
104 
create(CompanyServiceStubSettings stub)105   public static final CompanyServiceSettings create(CompanyServiceStubSettings stub)
106       throws IOException {
107     return new CompanyServiceSettings.Builder(stub.toBuilder()).build();
108   }
109 
110   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()111   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
112     return CompanyServiceStubSettings.defaultExecutorProviderBuilder();
113   }
114 
115   /** Returns the default service endpoint. */
getDefaultEndpoint()116   public static String getDefaultEndpoint() {
117     return CompanyServiceStubSettings.getDefaultEndpoint();
118   }
119 
120   /** Returns the default service scopes. */
getDefaultServiceScopes()121   public static List<String> getDefaultServiceScopes() {
122     return CompanyServiceStubSettings.getDefaultServiceScopes();
123   }
124 
125   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()126   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
127     return CompanyServiceStubSettings.defaultCredentialsProviderBuilder();
128   }
129 
130   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()131   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
132     return CompanyServiceStubSettings.defaultGrpcTransportProviderBuilder();
133   }
134 
135   /** Returns a builder for the default REST ChannelProvider for this service. */
136   @BetaApi
137   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()138       defaultHttpJsonTransportProviderBuilder() {
139     return CompanyServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
140   }
141 
defaultTransportChannelProvider()142   public static TransportChannelProvider defaultTransportChannelProvider() {
143     return CompanyServiceStubSettings.defaultTransportChannelProvider();
144   }
145 
146   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()147   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
148     return CompanyServiceStubSettings.defaultApiClientHeaderProviderBuilder();
149   }
150 
151   /** Returns a new gRPC builder for this class. */
newBuilder()152   public static Builder newBuilder() {
153     return Builder.createDefault();
154   }
155 
156   /** Returns a new REST builder for this class. */
157   @BetaApi
newHttpJsonBuilder()158   public static Builder newHttpJsonBuilder() {
159     return Builder.createHttpJsonDefault();
160   }
161 
162   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)163   public static Builder newBuilder(ClientContext clientContext) {
164     return new Builder(clientContext);
165   }
166 
167   /** Returns a builder containing all the values of this settings class. */
toBuilder()168   public Builder toBuilder() {
169     return new Builder(this);
170   }
171 
CompanyServiceSettings(Builder settingsBuilder)172   protected CompanyServiceSettings(Builder settingsBuilder) throws IOException {
173     super(settingsBuilder);
174   }
175 
176   /** Builder for CompanyServiceSettings. */
177   public static class Builder extends ClientSettings.Builder<CompanyServiceSettings, Builder> {
178 
Builder()179     protected Builder() throws IOException {
180       this(((ClientContext) null));
181     }
182 
Builder(ClientContext clientContext)183     protected Builder(ClientContext clientContext) {
184       super(CompanyServiceStubSettings.newBuilder(clientContext));
185     }
186 
Builder(CompanyServiceSettings settings)187     protected Builder(CompanyServiceSettings settings) {
188       super(settings.getStubSettings().toBuilder());
189     }
190 
Builder(CompanyServiceStubSettings.Builder stubSettings)191     protected Builder(CompanyServiceStubSettings.Builder stubSettings) {
192       super(stubSettings);
193     }
194 
createDefault()195     private static Builder createDefault() {
196       return new Builder(CompanyServiceStubSettings.newBuilder());
197     }
198 
199     @BetaApi
createHttpJsonDefault()200     private static Builder createHttpJsonDefault() {
201       return new Builder(CompanyServiceStubSettings.newHttpJsonBuilder());
202     }
203 
getStubSettingsBuilder()204     public CompanyServiceStubSettings.Builder getStubSettingsBuilder() {
205       return ((CompanyServiceStubSettings.Builder) getStubSettings());
206     }
207 
208     /**
209      * Applies the given settings updater function to all of the unary API methods in this service.
210      *
211      * <p>Note: This method does not support applying settings to streaming methods.
212      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)213     public Builder applyToAllUnaryMethods(
214         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
215       super.applyToAllUnaryMethods(
216           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
217       return this;
218     }
219 
220     /** Returns the builder for the settings used for calls to createCompany. */
createCompanySettings()221     public UnaryCallSettings.Builder<CreateCompanyRequest, Company> createCompanySettings() {
222       return getStubSettingsBuilder().createCompanySettings();
223     }
224 
225     /** Returns the builder for the settings used for calls to getCompany. */
getCompanySettings()226     public UnaryCallSettings.Builder<GetCompanyRequest, Company> getCompanySettings() {
227       return getStubSettingsBuilder().getCompanySettings();
228     }
229 
230     /** Returns the builder for the settings used for calls to updateCompany. */
updateCompanySettings()231     public UnaryCallSettings.Builder<UpdateCompanyRequest, Company> updateCompanySettings() {
232       return getStubSettingsBuilder().updateCompanySettings();
233     }
234 
235     /** Returns the builder for the settings used for calls to deleteCompany. */
deleteCompanySettings()236     public UnaryCallSettings.Builder<DeleteCompanyRequest, Empty> deleteCompanySettings() {
237       return getStubSettingsBuilder().deleteCompanySettings();
238     }
239 
240     /** Returns the builder for the settings used for calls to listCompanies. */
241     public PagedCallSettings.Builder<
242             ListCompaniesRequest, ListCompaniesResponse, ListCompaniesPagedResponse>
listCompaniesSettings()243         listCompaniesSettings() {
244       return getStubSettingsBuilder().listCompaniesSettings();
245     }
246 
247     @Override
build()248     public CompanyServiceSettings build() throws IOException {
249       return new CompanyServiceSettings(this);
250     }
251   }
252 }
253