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