• 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.gax.core.BackgroundResource;
20 import com.google.api.gax.rpc.UnaryCallable;
21 import com.google.cloud.oslogin.common.OsLoginProto;
22 import com.google.cloud.oslogin.v1.stub.OsLoginServiceStub;
23 import com.google.cloud.oslogin.v1.stub.OsLoginServiceStubSettings;
24 import com.google.protobuf.Empty;
25 import com.google.protobuf.FieldMask;
26 import java.io.IOException;
27 import java.util.concurrent.TimeUnit;
28 import javax.annotation.Generated;
29 
30 // AUTO-GENERATED DOCUMENTATION AND CLASS.
31 /**
32  * Service Description: Cloud OS Login API
33  *
34  * <p>The Cloud OS Login API allows you to manage users and their associated SSH public keys for
35  * logging into virtual machines on Google Cloud Platform.
36  *
37  * <p>This class provides the ability to make remote calls to the backing service through method
38  * calls that map to API methods. Sample code to get started:
39  *
40  * <pre>{@code
41  * // This snippet has been automatically generated and should be regarded as a code template only.
42  * // It will require modifications to work:
43  * // - It may require correct/in-range values for request initialization.
44  * // - It may require specifying regional endpoints when creating the service client as shown in
45  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
46  * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
47  *   UserName parent = UserName.of("[USER]");
48  *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
49  *   OsLoginProto.SshPublicKey response =
50  *       osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
51  * }
52  * }</pre>
53  *
54  * <p>Note: close() needs to be called on the OsLoginServiceClient object to clean up resources such
55  * as threads. In the example above, try-with-resources is used, which automatically calls close().
56  *
57  * <p>The surface of this class includes several types of Java methods for each of the API's
58  * methods:
59  *
60  * <ol>
61  *   <li>A "flattened" method. With this type of method, the fields of the request type have been
62  *       converted into function parameters. It may be the case that not all fields are available as
63  *       parameters, and not every API method will have a flattened method entry point.
64  *   <li>A "request object" method. This type of method only takes one parameter, a request object,
65  *       which must be constructed before the call. Not every API method will have a request object
66  *       method.
67  *   <li>A "callable" method. This type of method takes no parameters and returns an immutable API
68  *       callable object, which can be used to initiate calls to the service.
69  * </ol>
70  *
71  * <p>See the individual methods for example code.
72  *
73  * <p>Many parameters require resource names to be formatted in a particular way. To assist with
74  * these names, this class includes a format method for each type of name, and additionally a parse
75  * method to extract the individual identifiers contained within names that are returned.
76  *
77  * <p>This class can be customized by passing in a custom instance of OsLoginServiceSettings to
78  * create(). For example:
79  *
80  * <p>To customize credentials:
81  *
82  * <pre>{@code
83  * // This snippet has been automatically generated and should be regarded as a code template only.
84  * // It will require modifications to work:
85  * // - It may require correct/in-range values for request initialization.
86  * // - It may require specifying regional endpoints when creating the service client as shown in
87  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
88  * OsLoginServiceSettings osLoginServiceSettings =
89  *     OsLoginServiceSettings.newBuilder()
90  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
91  *         .build();
92  * OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create(osLoginServiceSettings);
93  * }</pre>
94  *
95  * <p>To customize the endpoint:
96  *
97  * <pre>{@code
98  * // This snippet has been automatically generated and should be regarded as a code template only.
99  * // It will require modifications to work:
100  * // - It may require correct/in-range values for request initialization.
101  * // - It may require specifying regional endpoints when creating the service client as shown in
102  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
103  * OsLoginServiceSettings osLoginServiceSettings =
104  *     OsLoginServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
105  * OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create(osLoginServiceSettings);
106  * }</pre>
107  *
108  * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
109  * the wire:
110  *
111  * <pre>{@code
112  * // This snippet has been automatically generated and should be regarded as a code template only.
113  * // It will require modifications to work:
114  * // - It may require correct/in-range values for request initialization.
115  * // - It may require specifying regional endpoints when creating the service client as shown in
116  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
117  * OsLoginServiceSettings osLoginServiceSettings =
118  *     OsLoginServiceSettings.newHttpJsonBuilder().build();
119  * OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create(osLoginServiceSettings);
120  * }</pre>
121  *
122  * <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
123  */
124 @Generated("by gapic-generator-java")
125 public class OsLoginServiceClient implements BackgroundResource {
126   private final OsLoginServiceSettings settings;
127   private final OsLoginServiceStub stub;
128 
129   /** Constructs an instance of OsLoginServiceClient with default settings. */
create()130   public static final OsLoginServiceClient create() throws IOException {
131     return create(OsLoginServiceSettings.newBuilder().build());
132   }
133 
134   /**
135    * Constructs an instance of OsLoginServiceClient, using the given settings. The channels are
136    * created based on the settings passed in, or defaults for any settings that are not set.
137    */
create(OsLoginServiceSettings settings)138   public static final OsLoginServiceClient create(OsLoginServiceSettings settings)
139       throws IOException {
140     return new OsLoginServiceClient(settings);
141   }
142 
143   /**
144    * Constructs an instance of OsLoginServiceClient, using the given stub for making calls. This is
145    * for advanced usage - prefer using create(OsLoginServiceSettings).
146    */
create(OsLoginServiceStub stub)147   public static final OsLoginServiceClient create(OsLoginServiceStub stub) {
148     return new OsLoginServiceClient(stub);
149   }
150 
151   /**
152    * Constructs an instance of OsLoginServiceClient, using the given settings. This is protected so
153    * that it is easy to make a subclass, but otherwise, the static factory methods should be
154    * preferred.
155    */
OsLoginServiceClient(OsLoginServiceSettings settings)156   protected OsLoginServiceClient(OsLoginServiceSettings settings) throws IOException {
157     this.settings = settings;
158     this.stub = ((OsLoginServiceStubSettings) settings.getStubSettings()).createStub();
159   }
160 
OsLoginServiceClient(OsLoginServiceStub stub)161   protected OsLoginServiceClient(OsLoginServiceStub stub) {
162     this.settings = null;
163     this.stub = stub;
164   }
165 
getSettings()166   public final OsLoginServiceSettings getSettings() {
167     return settings;
168   }
169 
getStub()170   public OsLoginServiceStub getStub() {
171     return stub;
172   }
173 
174   // AUTO-GENERATED DOCUMENTATION AND METHOD.
175   /**
176    * Create an SSH public key
177    *
178    * <p>Sample code:
179    *
180    * <pre>{@code
181    * // This snippet has been automatically generated and should be regarded as a code template only.
182    * // It will require modifications to work:
183    * // - It may require correct/in-range values for request initialization.
184    * // - It may require specifying regional endpoints when creating the service client as shown in
185    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
186    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
187    *   UserName parent = UserName.of("[USER]");
188    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
189    *   OsLoginProto.SshPublicKey response =
190    *       osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
191    * }
192    * }</pre>
193    *
194    * @param parent Required. The unique ID for the user in format `users/{user}`.
195    * @param sshPublicKey Required. The SSH public key and expiration time.
196    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
197    */
createSshPublicKey( UserName parent, OsLoginProto.SshPublicKey sshPublicKey)198   public final OsLoginProto.SshPublicKey createSshPublicKey(
199       UserName parent, OsLoginProto.SshPublicKey sshPublicKey) {
200     CreateSshPublicKeyRequest request =
201         CreateSshPublicKeyRequest.newBuilder()
202             .setParent(parent == null ? null : parent.toString())
203             .setSshPublicKey(sshPublicKey)
204             .build();
205     return createSshPublicKey(request);
206   }
207 
208   // AUTO-GENERATED DOCUMENTATION AND METHOD.
209   /**
210    * Create an SSH public key
211    *
212    * <p>Sample code:
213    *
214    * <pre>{@code
215    * // This snippet has been automatically generated and should be regarded as a code template only.
216    * // It will require modifications to work:
217    * // - It may require correct/in-range values for request initialization.
218    * // - It may require specifying regional endpoints when creating the service client as shown in
219    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
220    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
221    *   String parent = UserName.of("[USER]").toString();
222    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
223    *   OsLoginProto.SshPublicKey response =
224    *       osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
225    * }
226    * }</pre>
227    *
228    * @param parent Required. The unique ID for the user in format `users/{user}`.
229    * @param sshPublicKey Required. The SSH public key and expiration time.
230    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
231    */
createSshPublicKey( String parent, OsLoginProto.SshPublicKey sshPublicKey)232   public final OsLoginProto.SshPublicKey createSshPublicKey(
233       String parent, OsLoginProto.SshPublicKey sshPublicKey) {
234     CreateSshPublicKeyRequest request =
235         CreateSshPublicKeyRequest.newBuilder()
236             .setParent(parent)
237             .setSshPublicKey(sshPublicKey)
238             .build();
239     return createSshPublicKey(request);
240   }
241 
242   // AUTO-GENERATED DOCUMENTATION AND METHOD.
243   /**
244    * Create an SSH public key
245    *
246    * <p>Sample code:
247    *
248    * <pre>{@code
249    * // This snippet has been automatically generated and should be regarded as a code template only.
250    * // It will require modifications to work:
251    * // - It may require correct/in-range values for request initialization.
252    * // - It may require specifying regional endpoints when creating the service client as shown in
253    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
254    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
255    *   CreateSshPublicKeyRequest request =
256    *       CreateSshPublicKeyRequest.newBuilder()
257    *           .setParent(UserName.of("[USER]").toString())
258    *           .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
259    *           .build();
260    *   OsLoginProto.SshPublicKey response = osLoginServiceClient.createSshPublicKey(request);
261    * }
262    * }</pre>
263    *
264    * @param request The request object containing all of the parameters for the API call.
265    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
266    */
createSshPublicKey(CreateSshPublicKeyRequest request)267   public final OsLoginProto.SshPublicKey createSshPublicKey(CreateSshPublicKeyRequest request) {
268     return createSshPublicKeyCallable().call(request);
269   }
270 
271   // AUTO-GENERATED DOCUMENTATION AND METHOD.
272   /**
273    * Create an SSH public key
274    *
275    * <p>Sample code:
276    *
277    * <pre>{@code
278    * // This snippet has been automatically generated and should be regarded as a code template only.
279    * // It will require modifications to work:
280    * // - It may require correct/in-range values for request initialization.
281    * // - It may require specifying regional endpoints when creating the service client as shown in
282    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
283    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
284    *   CreateSshPublicKeyRequest request =
285    *       CreateSshPublicKeyRequest.newBuilder()
286    *           .setParent(UserName.of("[USER]").toString())
287    *           .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
288    *           .build();
289    *   ApiFuture<OsLoginProto.SshPublicKey> future =
290    *       osLoginServiceClient.createSshPublicKeyCallable().futureCall(request);
291    *   // Do something.
292    *   OsLoginProto.SshPublicKey response = future.get();
293    * }
294    * }</pre>
295    */
296   public final UnaryCallable<CreateSshPublicKeyRequest, OsLoginProto.SshPublicKey>
createSshPublicKeyCallable()297       createSshPublicKeyCallable() {
298     return stub.createSshPublicKeyCallable();
299   }
300 
301   // AUTO-GENERATED DOCUMENTATION AND METHOD.
302   /**
303    * Deletes a POSIX account.
304    *
305    * <p>Sample code:
306    *
307    * <pre>{@code
308    * // This snippet has been automatically generated and should be regarded as a code template only.
309    * // It will require modifications to work:
310    * // - It may require correct/in-range values for request initialization.
311    * // - It may require specifying regional endpoints when creating the service client as shown in
312    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
313    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
314    *   ProjectName name = ProjectName.of("[USER]", "[PROJECT]");
315    *   osLoginServiceClient.deletePosixAccount(name);
316    * }
317    * }</pre>
318    *
319    * @param name Required. A reference to the POSIX account to update. POSIX accounts are identified
320    *     by the project ID they are associated with. A reference to the POSIX account is in format
321    *     `users/{user}/projects/{project}`.
322    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
323    */
deletePosixAccount(ProjectName name)324   public final void deletePosixAccount(ProjectName name) {
325     DeletePosixAccountRequest request =
326         DeletePosixAccountRequest.newBuilder()
327             .setName(name == null ? null : name.toString())
328             .build();
329     deletePosixAccount(request);
330   }
331 
332   // AUTO-GENERATED DOCUMENTATION AND METHOD.
333   /**
334    * Deletes a POSIX account.
335    *
336    * <p>Sample code:
337    *
338    * <pre>{@code
339    * // This snippet has been automatically generated and should be regarded as a code template only.
340    * // It will require modifications to work:
341    * // - It may require correct/in-range values for request initialization.
342    * // - It may require specifying regional endpoints when creating the service client as shown in
343    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
344    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
345    *   String name = ProjectName.of("[USER]", "[PROJECT]").toString();
346    *   osLoginServiceClient.deletePosixAccount(name);
347    * }
348    * }</pre>
349    *
350    * @param name Required. A reference to the POSIX account to update. POSIX accounts are identified
351    *     by the project ID they are associated with. A reference to the POSIX account is in format
352    *     `users/{user}/projects/{project}`.
353    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
354    */
deletePosixAccount(String name)355   public final void deletePosixAccount(String name) {
356     DeletePosixAccountRequest request =
357         DeletePosixAccountRequest.newBuilder().setName(name).build();
358     deletePosixAccount(request);
359   }
360 
361   // AUTO-GENERATED DOCUMENTATION AND METHOD.
362   /**
363    * Deletes a POSIX account.
364    *
365    * <p>Sample code:
366    *
367    * <pre>{@code
368    * // This snippet has been automatically generated and should be regarded as a code template only.
369    * // It will require modifications to work:
370    * // - It may require correct/in-range values for request initialization.
371    * // - It may require specifying regional endpoints when creating the service client as shown in
372    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
373    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
374    *   DeletePosixAccountRequest request =
375    *       DeletePosixAccountRequest.newBuilder()
376    *           .setName(ProjectName.of("[USER]", "[PROJECT]").toString())
377    *           .build();
378    *   osLoginServiceClient.deletePosixAccount(request);
379    * }
380    * }</pre>
381    *
382    * @param request The request object containing all of the parameters for the API call.
383    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
384    */
deletePosixAccount(DeletePosixAccountRequest request)385   public final void deletePosixAccount(DeletePosixAccountRequest request) {
386     deletePosixAccountCallable().call(request);
387   }
388 
389   // AUTO-GENERATED DOCUMENTATION AND METHOD.
390   /**
391    * Deletes a POSIX account.
392    *
393    * <p>Sample code:
394    *
395    * <pre>{@code
396    * // This snippet has been automatically generated and should be regarded as a code template only.
397    * // It will require modifications to work:
398    * // - It may require correct/in-range values for request initialization.
399    * // - It may require specifying regional endpoints when creating the service client as shown in
400    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
401    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
402    *   DeletePosixAccountRequest request =
403    *       DeletePosixAccountRequest.newBuilder()
404    *           .setName(ProjectName.of("[USER]", "[PROJECT]").toString())
405    *           .build();
406    *   ApiFuture<Empty> future =
407    *       osLoginServiceClient.deletePosixAccountCallable().futureCall(request);
408    *   // Do something.
409    *   future.get();
410    * }
411    * }</pre>
412    */
deletePosixAccountCallable()413   public final UnaryCallable<DeletePosixAccountRequest, Empty> deletePosixAccountCallable() {
414     return stub.deletePosixAccountCallable();
415   }
416 
417   // AUTO-GENERATED DOCUMENTATION AND METHOD.
418   /**
419    * Deletes an SSH public key.
420    *
421    * <p>Sample code:
422    *
423    * <pre>{@code
424    * // This snippet has been automatically generated and should be regarded as a code template only.
425    * // It will require modifications to work:
426    * // - It may require correct/in-range values for request initialization.
427    * // - It may require specifying regional endpoints when creating the service client as shown in
428    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
429    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
430    *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
431    *   osLoginServiceClient.deleteSshPublicKey(name);
432    * }
433    * }</pre>
434    *
435    * @param name Required. The fingerprint of the public key to update. Public keys are identified
436    *     by their SHA-256 fingerprint. The fingerprint of the public key is in format
437    *     `users/{user}/sshPublicKeys/{fingerprint}`.
438    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
439    */
deleteSshPublicKey(FingerprintName name)440   public final void deleteSshPublicKey(FingerprintName name) {
441     DeleteSshPublicKeyRequest request =
442         DeleteSshPublicKeyRequest.newBuilder()
443             .setName(name == null ? null : name.toString())
444             .build();
445     deleteSshPublicKey(request);
446   }
447 
448   // AUTO-GENERATED DOCUMENTATION AND METHOD.
449   /**
450    * Deletes an SSH public key.
451    *
452    * <p>Sample code:
453    *
454    * <pre>{@code
455    * // This snippet has been automatically generated and should be regarded as a code template only.
456    * // It will require modifications to work:
457    * // - It may require correct/in-range values for request initialization.
458    * // - It may require specifying regional endpoints when creating the service client as shown in
459    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
460    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
461    *   String name = FingerprintName.of("[USER]", "[FINGERPRINT]").toString();
462    *   osLoginServiceClient.deleteSshPublicKey(name);
463    * }
464    * }</pre>
465    *
466    * @param name Required. The fingerprint of the public key to update. Public keys are identified
467    *     by their SHA-256 fingerprint. The fingerprint of the public key is in format
468    *     `users/{user}/sshPublicKeys/{fingerprint}`.
469    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
470    */
deleteSshPublicKey(String name)471   public final void deleteSshPublicKey(String name) {
472     DeleteSshPublicKeyRequest request =
473         DeleteSshPublicKeyRequest.newBuilder().setName(name).build();
474     deleteSshPublicKey(request);
475   }
476 
477   // AUTO-GENERATED DOCUMENTATION AND METHOD.
478   /**
479    * Deletes an SSH public key.
480    *
481    * <p>Sample code:
482    *
483    * <pre>{@code
484    * // This snippet has been automatically generated and should be regarded as a code template only.
485    * // It will require modifications to work:
486    * // - It may require correct/in-range values for request initialization.
487    * // - It may require specifying regional endpoints when creating the service client as shown in
488    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
489    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
490    *   DeleteSshPublicKeyRequest request =
491    *       DeleteSshPublicKeyRequest.newBuilder()
492    *           .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
493    *           .build();
494    *   osLoginServiceClient.deleteSshPublicKey(request);
495    * }
496    * }</pre>
497    *
498    * @param request The request object containing all of the parameters for the API call.
499    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
500    */
deleteSshPublicKey(DeleteSshPublicKeyRequest request)501   public final void deleteSshPublicKey(DeleteSshPublicKeyRequest request) {
502     deleteSshPublicKeyCallable().call(request);
503   }
504 
505   // AUTO-GENERATED DOCUMENTATION AND METHOD.
506   /**
507    * Deletes an SSH public key.
508    *
509    * <p>Sample code:
510    *
511    * <pre>{@code
512    * // This snippet has been automatically generated and should be regarded as a code template only.
513    * // It will require modifications to work:
514    * // - It may require correct/in-range values for request initialization.
515    * // - It may require specifying regional endpoints when creating the service client as shown in
516    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
517    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
518    *   DeleteSshPublicKeyRequest request =
519    *       DeleteSshPublicKeyRequest.newBuilder()
520    *           .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
521    *           .build();
522    *   ApiFuture<Empty> future =
523    *       osLoginServiceClient.deleteSshPublicKeyCallable().futureCall(request);
524    *   // Do something.
525    *   future.get();
526    * }
527    * }</pre>
528    */
deleteSshPublicKeyCallable()529   public final UnaryCallable<DeleteSshPublicKeyRequest, Empty> deleteSshPublicKeyCallable() {
530     return stub.deleteSshPublicKeyCallable();
531   }
532 
533   // AUTO-GENERATED DOCUMENTATION AND METHOD.
534   /**
535    * Retrieves the profile information used for logging in to a virtual machine on Google Compute
536    * Engine.
537    *
538    * <p>Sample code:
539    *
540    * <pre>{@code
541    * // This snippet has been automatically generated and should be regarded as a code template only.
542    * // It will require modifications to work:
543    * // - It may require correct/in-range values for request initialization.
544    * // - It may require specifying regional endpoints when creating the service client as shown in
545    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
546    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
547    *   UserName name = UserName.of("[USER]");
548    *   LoginProfile response = osLoginServiceClient.getLoginProfile(name);
549    * }
550    * }</pre>
551    *
552    * @param name Required. The unique ID for the user in format `users/{user}`.
553    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
554    */
getLoginProfile(UserName name)555   public final LoginProfile getLoginProfile(UserName name) {
556     GetLoginProfileRequest request =
557         GetLoginProfileRequest.newBuilder().setName(name == null ? null : name.toString()).build();
558     return getLoginProfile(request);
559   }
560 
561   // AUTO-GENERATED DOCUMENTATION AND METHOD.
562   /**
563    * Retrieves the profile information used for logging in to a virtual machine on Google Compute
564    * Engine.
565    *
566    * <p>Sample code:
567    *
568    * <pre>{@code
569    * // This snippet has been automatically generated and should be regarded as a code template only.
570    * // It will require modifications to work:
571    * // - It may require correct/in-range values for request initialization.
572    * // - It may require specifying regional endpoints when creating the service client as shown in
573    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
574    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
575    *   String name = UserName.of("[USER]").toString();
576    *   LoginProfile response = osLoginServiceClient.getLoginProfile(name);
577    * }
578    * }</pre>
579    *
580    * @param name Required. The unique ID for the user in format `users/{user}`.
581    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
582    */
getLoginProfile(String name)583   public final LoginProfile getLoginProfile(String name) {
584     GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder().setName(name).build();
585     return getLoginProfile(request);
586   }
587 
588   // AUTO-GENERATED DOCUMENTATION AND METHOD.
589   /**
590    * Retrieves the profile information used for logging in to a virtual machine on Google Compute
591    * Engine.
592    *
593    * <p>Sample code:
594    *
595    * <pre>{@code
596    * // This snippet has been automatically generated and should be regarded as a code template only.
597    * // It will require modifications to work:
598    * // - It may require correct/in-range values for request initialization.
599    * // - It may require specifying regional endpoints when creating the service client as shown in
600    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
601    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
602    *   GetLoginProfileRequest request =
603    *       GetLoginProfileRequest.newBuilder()
604    *           .setName(UserName.of("[USER]").toString())
605    *           .setProjectId("projectId-894832108")
606    *           .setSystemId("systemId1976085418")
607    *           .build();
608    *   LoginProfile response = osLoginServiceClient.getLoginProfile(request);
609    * }
610    * }</pre>
611    *
612    * @param request The request object containing all of the parameters for the API call.
613    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
614    */
getLoginProfile(GetLoginProfileRequest request)615   public final LoginProfile getLoginProfile(GetLoginProfileRequest request) {
616     return getLoginProfileCallable().call(request);
617   }
618 
619   // AUTO-GENERATED DOCUMENTATION AND METHOD.
620   /**
621    * Retrieves the profile information used for logging in to a virtual machine on Google Compute
622    * Engine.
623    *
624    * <p>Sample code:
625    *
626    * <pre>{@code
627    * // This snippet has been automatically generated and should be regarded as a code template only.
628    * // It will require modifications to work:
629    * // - It may require correct/in-range values for request initialization.
630    * // - It may require specifying regional endpoints when creating the service client as shown in
631    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
632    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
633    *   GetLoginProfileRequest request =
634    *       GetLoginProfileRequest.newBuilder()
635    *           .setName(UserName.of("[USER]").toString())
636    *           .setProjectId("projectId-894832108")
637    *           .setSystemId("systemId1976085418")
638    *           .build();
639    *   ApiFuture<LoginProfile> future =
640    *       osLoginServiceClient.getLoginProfileCallable().futureCall(request);
641    *   // Do something.
642    *   LoginProfile response = future.get();
643    * }
644    * }</pre>
645    */
getLoginProfileCallable()646   public final UnaryCallable<GetLoginProfileRequest, LoginProfile> getLoginProfileCallable() {
647     return stub.getLoginProfileCallable();
648   }
649 
650   // AUTO-GENERATED DOCUMENTATION AND METHOD.
651   /**
652    * Retrieves an SSH public key.
653    *
654    * <p>Sample code:
655    *
656    * <pre>{@code
657    * // This snippet has been automatically generated and should be regarded as a code template only.
658    * // It will require modifications to work:
659    * // - It may require correct/in-range values for request initialization.
660    * // - It may require specifying regional endpoints when creating the service client as shown in
661    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
662    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
663    *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
664    *   OsLoginProto.SshPublicKey response = osLoginServiceClient.getSshPublicKey(name);
665    * }
666    * }</pre>
667    *
668    * @param name Required. The fingerprint of the public key to retrieve. Public keys are identified
669    *     by their SHA-256 fingerprint. The fingerprint of the public key is in format
670    *     `users/{user}/sshPublicKeys/{fingerprint}`.
671    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
672    */
getSshPublicKey(FingerprintName name)673   public final OsLoginProto.SshPublicKey getSshPublicKey(FingerprintName name) {
674     GetSshPublicKeyRequest request =
675         GetSshPublicKeyRequest.newBuilder().setName(name == null ? null : name.toString()).build();
676     return getSshPublicKey(request);
677   }
678 
679   // AUTO-GENERATED DOCUMENTATION AND METHOD.
680   /**
681    * Retrieves an SSH public key.
682    *
683    * <p>Sample code:
684    *
685    * <pre>{@code
686    * // This snippet has been automatically generated and should be regarded as a code template only.
687    * // It will require modifications to work:
688    * // - It may require correct/in-range values for request initialization.
689    * // - It may require specifying regional endpoints when creating the service client as shown in
690    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
691    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
692    *   String name = FingerprintName.of("[USER]", "[FINGERPRINT]").toString();
693    *   OsLoginProto.SshPublicKey response = osLoginServiceClient.getSshPublicKey(name);
694    * }
695    * }</pre>
696    *
697    * @param name Required. The fingerprint of the public key to retrieve. Public keys are identified
698    *     by their SHA-256 fingerprint. The fingerprint of the public key is in format
699    *     `users/{user}/sshPublicKeys/{fingerprint}`.
700    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
701    */
getSshPublicKey(String name)702   public final OsLoginProto.SshPublicKey getSshPublicKey(String name) {
703     GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder().setName(name).build();
704     return getSshPublicKey(request);
705   }
706 
707   // AUTO-GENERATED DOCUMENTATION AND METHOD.
708   /**
709    * Retrieves an SSH public key.
710    *
711    * <p>Sample code:
712    *
713    * <pre>{@code
714    * // This snippet has been automatically generated and should be regarded as a code template only.
715    * // It will require modifications to work:
716    * // - It may require correct/in-range values for request initialization.
717    * // - It may require specifying regional endpoints when creating the service client as shown in
718    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
719    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
720    *   GetSshPublicKeyRequest request =
721    *       GetSshPublicKeyRequest.newBuilder()
722    *           .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
723    *           .build();
724    *   OsLoginProto.SshPublicKey response = osLoginServiceClient.getSshPublicKey(request);
725    * }
726    * }</pre>
727    *
728    * @param request The request object containing all of the parameters for the API call.
729    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
730    */
getSshPublicKey(GetSshPublicKeyRequest request)731   public final OsLoginProto.SshPublicKey getSshPublicKey(GetSshPublicKeyRequest request) {
732     return getSshPublicKeyCallable().call(request);
733   }
734 
735   // AUTO-GENERATED DOCUMENTATION AND METHOD.
736   /**
737    * Retrieves an SSH public key.
738    *
739    * <p>Sample code:
740    *
741    * <pre>{@code
742    * // This snippet has been automatically generated and should be regarded as a code template only.
743    * // It will require modifications to work:
744    * // - It may require correct/in-range values for request initialization.
745    * // - It may require specifying regional endpoints when creating the service client as shown in
746    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
747    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
748    *   GetSshPublicKeyRequest request =
749    *       GetSshPublicKeyRequest.newBuilder()
750    *           .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
751    *           .build();
752    *   ApiFuture<OsLoginProto.SshPublicKey> future =
753    *       osLoginServiceClient.getSshPublicKeyCallable().futureCall(request);
754    *   // Do something.
755    *   OsLoginProto.SshPublicKey response = future.get();
756    * }
757    * }</pre>
758    */
759   public final UnaryCallable<GetSshPublicKeyRequest, OsLoginProto.SshPublicKey>
getSshPublicKeyCallable()760       getSshPublicKeyCallable() {
761     return stub.getSshPublicKeyCallable();
762   }
763 
764   // AUTO-GENERATED DOCUMENTATION AND METHOD.
765   /**
766    * Adds an SSH public key and returns the profile information. Default POSIX account information
767    * is set when no username and UID exist as part of the login profile.
768    *
769    * <p>Sample code:
770    *
771    * <pre>{@code
772    * // This snippet has been automatically generated and should be regarded as a code template only.
773    * // It will require modifications to work:
774    * // - It may require correct/in-range values for request initialization.
775    * // - It may require specifying regional endpoints when creating the service client as shown in
776    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
777    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
778    *   UserName parent = UserName.of("[USER]");
779    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
780    *   ImportSshPublicKeyResponse response =
781    *       osLoginServiceClient.importSshPublicKey(parent, sshPublicKey);
782    * }
783    * }</pre>
784    *
785    * @param parent Required. The unique ID for the user in format `users/{user}`.
786    * @param sshPublicKey Optional. The SSH public key and expiration time.
787    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
788    */
importSshPublicKey( UserName parent, OsLoginProto.SshPublicKey sshPublicKey)789   public final ImportSshPublicKeyResponse importSshPublicKey(
790       UserName parent, OsLoginProto.SshPublicKey sshPublicKey) {
791     ImportSshPublicKeyRequest request =
792         ImportSshPublicKeyRequest.newBuilder()
793             .setParent(parent == null ? null : parent.toString())
794             .setSshPublicKey(sshPublicKey)
795             .build();
796     return importSshPublicKey(request);
797   }
798 
799   // AUTO-GENERATED DOCUMENTATION AND METHOD.
800   /**
801    * Adds an SSH public key and returns the profile information. Default POSIX account information
802    * is set when no username and UID exist as part of the login profile.
803    *
804    * <p>Sample code:
805    *
806    * <pre>{@code
807    * // This snippet has been automatically generated and should be regarded as a code template only.
808    * // It will require modifications to work:
809    * // - It may require correct/in-range values for request initialization.
810    * // - It may require specifying regional endpoints when creating the service client as shown in
811    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
812    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
813    *   String parent = UserName.of("[USER]").toString();
814    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
815    *   ImportSshPublicKeyResponse response =
816    *       osLoginServiceClient.importSshPublicKey(parent, sshPublicKey);
817    * }
818    * }</pre>
819    *
820    * @param parent Required. The unique ID for the user in format `users/{user}`.
821    * @param sshPublicKey Optional. The SSH public key and expiration time.
822    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
823    */
importSshPublicKey( String parent, OsLoginProto.SshPublicKey sshPublicKey)824   public final ImportSshPublicKeyResponse importSshPublicKey(
825       String parent, OsLoginProto.SshPublicKey sshPublicKey) {
826     ImportSshPublicKeyRequest request =
827         ImportSshPublicKeyRequest.newBuilder()
828             .setParent(parent)
829             .setSshPublicKey(sshPublicKey)
830             .build();
831     return importSshPublicKey(request);
832   }
833 
834   // AUTO-GENERATED DOCUMENTATION AND METHOD.
835   /**
836    * Adds an SSH public key and returns the profile information. Default POSIX account information
837    * is set when no username and UID exist as part of the login profile.
838    *
839    * <p>Sample code:
840    *
841    * <pre>{@code
842    * // This snippet has been automatically generated and should be regarded as a code template only.
843    * // It will require modifications to work:
844    * // - It may require correct/in-range values for request initialization.
845    * // - It may require specifying regional endpoints when creating the service client as shown in
846    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
847    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
848    *   UserName parent = UserName.of("[USER]");
849    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
850    *   String projectId = "projectId-894832108";
851    *   ImportSshPublicKeyResponse response =
852    *       osLoginServiceClient.importSshPublicKey(parent, sshPublicKey, projectId);
853    * }
854    * }</pre>
855    *
856    * @param parent Required. The unique ID for the user in format `users/{user}`.
857    * @param sshPublicKey Optional. The SSH public key and expiration time.
858    * @param projectId The project ID of the Google Cloud Platform project.
859    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
860    */
importSshPublicKey( UserName parent, OsLoginProto.SshPublicKey sshPublicKey, String projectId)861   public final ImportSshPublicKeyResponse importSshPublicKey(
862       UserName parent, OsLoginProto.SshPublicKey sshPublicKey, String projectId) {
863     ImportSshPublicKeyRequest request =
864         ImportSshPublicKeyRequest.newBuilder()
865             .setParent(parent == null ? null : parent.toString())
866             .setSshPublicKey(sshPublicKey)
867             .setProjectId(projectId)
868             .build();
869     return importSshPublicKey(request);
870   }
871 
872   // AUTO-GENERATED DOCUMENTATION AND METHOD.
873   /**
874    * Adds an SSH public key and returns the profile information. Default POSIX account information
875    * is set when no username and UID exist as part of the login profile.
876    *
877    * <p>Sample code:
878    *
879    * <pre>{@code
880    * // This snippet has been automatically generated and should be regarded as a code template only.
881    * // It will require modifications to work:
882    * // - It may require correct/in-range values for request initialization.
883    * // - It may require specifying regional endpoints when creating the service client as shown in
884    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
885    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
886    *   String parent = UserName.of("[USER]").toString();
887    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
888    *   String projectId = "projectId-894832108";
889    *   ImportSshPublicKeyResponse response =
890    *       osLoginServiceClient.importSshPublicKey(parent, sshPublicKey, projectId);
891    * }
892    * }</pre>
893    *
894    * @param parent Required. The unique ID for the user in format `users/{user}`.
895    * @param sshPublicKey Optional. The SSH public key and expiration time.
896    * @param projectId The project ID of the Google Cloud Platform project.
897    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
898    */
importSshPublicKey( String parent, OsLoginProto.SshPublicKey sshPublicKey, String projectId)899   public final ImportSshPublicKeyResponse importSshPublicKey(
900       String parent, OsLoginProto.SshPublicKey sshPublicKey, String projectId) {
901     ImportSshPublicKeyRequest request =
902         ImportSshPublicKeyRequest.newBuilder()
903             .setParent(parent)
904             .setSshPublicKey(sshPublicKey)
905             .setProjectId(projectId)
906             .build();
907     return importSshPublicKey(request);
908   }
909 
910   // AUTO-GENERATED DOCUMENTATION AND METHOD.
911   /**
912    * Adds an SSH public key and returns the profile information. Default POSIX account information
913    * is set when no username and UID exist as part of the login profile.
914    *
915    * <p>Sample code:
916    *
917    * <pre>{@code
918    * // This snippet has been automatically generated and should be regarded as a code template only.
919    * // It will require modifications to work:
920    * // - It may require correct/in-range values for request initialization.
921    * // - It may require specifying regional endpoints when creating the service client as shown in
922    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
923    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
924    *   ImportSshPublicKeyRequest request =
925    *       ImportSshPublicKeyRequest.newBuilder()
926    *           .setParent(UserName.of("[USER]").toString())
927    *           .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
928    *           .setProjectId("projectId-894832108")
929    *           .build();
930    *   ImportSshPublicKeyResponse response = osLoginServiceClient.importSshPublicKey(request);
931    * }
932    * }</pre>
933    *
934    * @param request The request object containing all of the parameters for the API call.
935    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
936    */
importSshPublicKey(ImportSshPublicKeyRequest request)937   public final ImportSshPublicKeyResponse importSshPublicKey(ImportSshPublicKeyRequest request) {
938     return importSshPublicKeyCallable().call(request);
939   }
940 
941   // AUTO-GENERATED DOCUMENTATION AND METHOD.
942   /**
943    * Adds an SSH public key and returns the profile information. Default POSIX account information
944    * is set when no username and UID exist as part of the login profile.
945    *
946    * <p>Sample code:
947    *
948    * <pre>{@code
949    * // This snippet has been automatically generated and should be regarded as a code template only.
950    * // It will require modifications to work:
951    * // - It may require correct/in-range values for request initialization.
952    * // - It may require specifying regional endpoints when creating the service client as shown in
953    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
954    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
955    *   ImportSshPublicKeyRequest request =
956    *       ImportSshPublicKeyRequest.newBuilder()
957    *           .setParent(UserName.of("[USER]").toString())
958    *           .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
959    *           .setProjectId("projectId-894832108")
960    *           .build();
961    *   ApiFuture<ImportSshPublicKeyResponse> future =
962    *       osLoginServiceClient.importSshPublicKeyCallable().futureCall(request);
963    *   // Do something.
964    *   ImportSshPublicKeyResponse response = future.get();
965    * }
966    * }</pre>
967    */
968   public final UnaryCallable<ImportSshPublicKeyRequest, ImportSshPublicKeyResponse>
importSshPublicKeyCallable()969       importSshPublicKeyCallable() {
970     return stub.importSshPublicKeyCallable();
971   }
972 
973   // AUTO-GENERATED DOCUMENTATION AND METHOD.
974   /**
975    * Updates an SSH public key and returns the profile information. This method supports patch
976    * semantics.
977    *
978    * <p>Sample code:
979    *
980    * <pre>{@code
981    * // This snippet has been automatically generated and should be regarded as a code template only.
982    * // It will require modifications to work:
983    * // - It may require correct/in-range values for request initialization.
984    * // - It may require specifying regional endpoints when creating the service client as shown in
985    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
986    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
987    *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
988    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
989    *   OsLoginProto.SshPublicKey response =
990    *       osLoginServiceClient.updateSshPublicKey(name, sshPublicKey);
991    * }
992    * }</pre>
993    *
994    * @param name Required. The fingerprint of the public key to update. Public keys are identified
995    *     by their SHA-256 fingerprint. The fingerprint of the public key is in format
996    *     `users/{user}/sshPublicKeys/{fingerprint}`.
997    * @param sshPublicKey Required. The SSH public key and expiration time.
998    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
999    */
updateSshPublicKey( FingerprintName name, OsLoginProto.SshPublicKey sshPublicKey)1000   public final OsLoginProto.SshPublicKey updateSshPublicKey(
1001       FingerprintName name, OsLoginProto.SshPublicKey sshPublicKey) {
1002     UpdateSshPublicKeyRequest request =
1003         UpdateSshPublicKeyRequest.newBuilder()
1004             .setName(name == null ? null : name.toString())
1005             .setSshPublicKey(sshPublicKey)
1006             .build();
1007     return updateSshPublicKey(request);
1008   }
1009 
1010   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1011   /**
1012    * Updates an SSH public key and returns the profile information. This method supports patch
1013    * semantics.
1014    *
1015    * <p>Sample code:
1016    *
1017    * <pre>{@code
1018    * // This snippet has been automatically generated and should be regarded as a code template only.
1019    * // It will require modifications to work:
1020    * // - It may require correct/in-range values for request initialization.
1021    * // - It may require specifying regional endpoints when creating the service client as shown in
1022    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1023    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
1024    *   String name = FingerprintName.of("[USER]", "[FINGERPRINT]").toString();
1025    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
1026    *   OsLoginProto.SshPublicKey response =
1027    *       osLoginServiceClient.updateSshPublicKey(name, sshPublicKey);
1028    * }
1029    * }</pre>
1030    *
1031    * @param name Required. The fingerprint of the public key to update. Public keys are identified
1032    *     by their SHA-256 fingerprint. The fingerprint of the public key is in format
1033    *     `users/{user}/sshPublicKeys/{fingerprint}`.
1034    * @param sshPublicKey Required. The SSH public key and expiration time.
1035    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1036    */
updateSshPublicKey( String name, OsLoginProto.SshPublicKey sshPublicKey)1037   public final OsLoginProto.SshPublicKey updateSshPublicKey(
1038       String name, OsLoginProto.SshPublicKey sshPublicKey) {
1039     UpdateSshPublicKeyRequest request =
1040         UpdateSshPublicKeyRequest.newBuilder().setName(name).setSshPublicKey(sshPublicKey).build();
1041     return updateSshPublicKey(request);
1042   }
1043 
1044   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1045   /**
1046    * Updates an SSH public key and returns the profile information. This method supports patch
1047    * semantics.
1048    *
1049    * <p>Sample code:
1050    *
1051    * <pre>{@code
1052    * // This snippet has been automatically generated and should be regarded as a code template only.
1053    * // It will require modifications to work:
1054    * // - It may require correct/in-range values for request initialization.
1055    * // - It may require specifying regional endpoints when creating the service client as shown in
1056    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1057    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
1058    *   FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
1059    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
1060    *   FieldMask updateMask = FieldMask.newBuilder().build();
1061    *   OsLoginProto.SshPublicKey response =
1062    *       osLoginServiceClient.updateSshPublicKey(name, sshPublicKey, updateMask);
1063    * }
1064    * }</pre>
1065    *
1066    * @param name Required. The fingerprint of the public key to update. Public keys are identified
1067    *     by their SHA-256 fingerprint. The fingerprint of the public key is in format
1068    *     `users/{user}/sshPublicKeys/{fingerprint}`.
1069    * @param sshPublicKey Required. The SSH public key and expiration time.
1070    * @param updateMask Mask to control which fields get updated. Updates all if not present.
1071    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1072    */
updateSshPublicKey( FingerprintName name, OsLoginProto.SshPublicKey sshPublicKey, FieldMask updateMask)1073   public final OsLoginProto.SshPublicKey updateSshPublicKey(
1074       FingerprintName name, OsLoginProto.SshPublicKey sshPublicKey, FieldMask updateMask) {
1075     UpdateSshPublicKeyRequest request =
1076         UpdateSshPublicKeyRequest.newBuilder()
1077             .setName(name == null ? null : name.toString())
1078             .setSshPublicKey(sshPublicKey)
1079             .setUpdateMask(updateMask)
1080             .build();
1081     return updateSshPublicKey(request);
1082   }
1083 
1084   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1085   /**
1086    * Updates an SSH public key and returns the profile information. This method supports patch
1087    * semantics.
1088    *
1089    * <p>Sample code:
1090    *
1091    * <pre>{@code
1092    * // This snippet has been automatically generated and should be regarded as a code template only.
1093    * // It will require modifications to work:
1094    * // - It may require correct/in-range values for request initialization.
1095    * // - It may require specifying regional endpoints when creating the service client as shown in
1096    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1097    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
1098    *   String name = FingerprintName.of("[USER]", "[FINGERPRINT]").toString();
1099    *   OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
1100    *   FieldMask updateMask = FieldMask.newBuilder().build();
1101    *   OsLoginProto.SshPublicKey response =
1102    *       osLoginServiceClient.updateSshPublicKey(name, sshPublicKey, updateMask);
1103    * }
1104    * }</pre>
1105    *
1106    * @param name Required. The fingerprint of the public key to update. Public keys are identified
1107    *     by their SHA-256 fingerprint. The fingerprint of the public key is in format
1108    *     `users/{user}/sshPublicKeys/{fingerprint}`.
1109    * @param sshPublicKey Required. The SSH public key and expiration time.
1110    * @param updateMask Mask to control which fields get updated. Updates all if not present.
1111    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1112    */
updateSshPublicKey( String name, OsLoginProto.SshPublicKey sshPublicKey, FieldMask updateMask)1113   public final OsLoginProto.SshPublicKey updateSshPublicKey(
1114       String name, OsLoginProto.SshPublicKey sshPublicKey, FieldMask updateMask) {
1115     UpdateSshPublicKeyRequest request =
1116         UpdateSshPublicKeyRequest.newBuilder()
1117             .setName(name)
1118             .setSshPublicKey(sshPublicKey)
1119             .setUpdateMask(updateMask)
1120             .build();
1121     return updateSshPublicKey(request);
1122   }
1123 
1124   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1125   /**
1126    * Updates an SSH public key and returns the profile information. This method supports patch
1127    * semantics.
1128    *
1129    * <p>Sample code:
1130    *
1131    * <pre>{@code
1132    * // This snippet has been automatically generated and should be regarded as a code template only.
1133    * // It will require modifications to work:
1134    * // - It may require correct/in-range values for request initialization.
1135    * // - It may require specifying regional endpoints when creating the service client as shown in
1136    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1137    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
1138    *   UpdateSshPublicKeyRequest request =
1139    *       UpdateSshPublicKeyRequest.newBuilder()
1140    *           .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
1141    *           .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
1142    *           .setUpdateMask(FieldMask.newBuilder().build())
1143    *           .build();
1144    *   OsLoginProto.SshPublicKey response = osLoginServiceClient.updateSshPublicKey(request);
1145    * }
1146    * }</pre>
1147    *
1148    * @param request The request object containing all of the parameters for the API call.
1149    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
1150    */
updateSshPublicKey(UpdateSshPublicKeyRequest request)1151   public final OsLoginProto.SshPublicKey updateSshPublicKey(UpdateSshPublicKeyRequest request) {
1152     return updateSshPublicKeyCallable().call(request);
1153   }
1154 
1155   // AUTO-GENERATED DOCUMENTATION AND METHOD.
1156   /**
1157    * Updates an SSH public key and returns the profile information. This method supports patch
1158    * semantics.
1159    *
1160    * <p>Sample code:
1161    *
1162    * <pre>{@code
1163    * // This snippet has been automatically generated and should be regarded as a code template only.
1164    * // It will require modifications to work:
1165    * // - It may require correct/in-range values for request initialization.
1166    * // - It may require specifying regional endpoints when creating the service client as shown in
1167    * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1168    * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
1169    *   UpdateSshPublicKeyRequest request =
1170    *       UpdateSshPublicKeyRequest.newBuilder()
1171    *           .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
1172    *           .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
1173    *           .setUpdateMask(FieldMask.newBuilder().build())
1174    *           .build();
1175    *   ApiFuture<OsLoginProto.SshPublicKey> future =
1176    *       osLoginServiceClient.updateSshPublicKeyCallable().futureCall(request);
1177    *   // Do something.
1178    *   OsLoginProto.SshPublicKey response = future.get();
1179    * }
1180    * }</pre>
1181    */
1182   public final UnaryCallable<UpdateSshPublicKeyRequest, OsLoginProto.SshPublicKey>
updateSshPublicKeyCallable()1183       updateSshPublicKeyCallable() {
1184     return stub.updateSshPublicKeyCallable();
1185   }
1186 
1187   @Override
close()1188   public final void close() {
1189     stub.close();
1190   }
1191 
1192   @Override
shutdown()1193   public void shutdown() {
1194     stub.shutdown();
1195   }
1196 
1197   @Override
isShutdown()1198   public boolean isShutdown() {
1199     return stub.isShutdown();
1200   }
1201 
1202   @Override
isTerminated()1203   public boolean isTerminated() {
1204     return stub.isTerminated();
1205   }
1206 
1207   @Override
shutdownNow()1208   public void shutdownNow() {
1209     stub.shutdownNow();
1210   }
1211 
1212   @Override
awaitTermination(long duration, TimeUnit unit)1213   public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
1214     return stub.awaitTermination(duration, unit);
1215   }
1216 }
1217