The Cloud OS Login API allows you to manage users and their associated SSH public keys for + * logging into virtual machines on Google Cloud Platform. + * + *
This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UserName parent = UserName.of("[USER]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ *
+ * Note: close() needs to be called on the OsLoginServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *
| Method | + *Description | + *Method Variants | + *
|---|---|---|
CreateSshPublicKey |
+ * Create an SSH public key |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
DeletePosixAccount |
+ * Deletes a POSIX account. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
DeleteSshPublicKey |
+ * Deletes an SSH public key. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
GetLoginProfile |
+ * Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
GetSshPublicKey |
+ * Retrieves an SSH public key. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
ImportSshPublicKey |
+ * Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
UpdateSshPublicKey |
+ * Updates an SSH public key and returns the profile information. This method supports patch semantics. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
SignSshPublicKey |
+ * Signs an SSH public key for a user to authenticate to an instance. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of OsLoginServiceSettings to + * create(). For example: + * + *
To customize credentials: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * OsLoginServiceSettings osLoginServiceSettings =
+ * OsLoginServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create(osLoginServiceSettings);
+ * }
+ *
+ * To customize the endpoint: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * OsLoginServiceSettings osLoginServiceSettings =
+ * OsLoginServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create(osLoginServiceSettings);
+ * }
+ *
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * OsLoginServiceSettings osLoginServiceSettings =
+ * OsLoginServiceSettings.newHttpJsonBuilder().build();
+ * OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create(osLoginServiceSettings);
+ * }
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class OsLoginServiceClient implements BackgroundResource { + private final OsLoginServiceSettings settings; + private final OsLoginServiceStub stub; + + /** Constructs an instance of OsLoginServiceClient with default settings. */ + public static final OsLoginServiceClient create() throws IOException { + return create(OsLoginServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of OsLoginServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final OsLoginServiceClient create(OsLoginServiceSettings settings) + throws IOException { + return new OsLoginServiceClient(settings); + } + + /** + * Constructs an instance of OsLoginServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(OsLoginServiceSettings). + */ + public static final OsLoginServiceClient create(OsLoginServiceStub stub) { + return new OsLoginServiceClient(stub); + } + + /** + * Constructs an instance of OsLoginServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected OsLoginServiceClient(OsLoginServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((OsLoginServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected OsLoginServiceClient(OsLoginServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final OsLoginServiceSettings getSettings() { + return settings; + } + + public OsLoginServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create an SSH public key + * + *
Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UserName parent = UserName.of("[USER]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ *
+ * @param parent Required. The unique ID for the user in format `users/{user}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey createSshPublicKey(
+ UserName parent, OsLoginProto.SshPublicKey sshPublicKey) {
+ CreateSshPublicKeyRequest request =
+ CreateSshPublicKeyRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setSshPublicKey(sshPublicKey)
+ .build();
+ return createSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create an SSH public key
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String parent = UserName.of("[USER]").toString();
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ *
+ * @param parent Required. The unique ID for the user in format `users/{user}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey createSshPublicKey(
+ String parent, OsLoginProto.SshPublicKey sshPublicKey) {
+ CreateSshPublicKeyRequest request =
+ CreateSshPublicKeyRequest.newBuilder()
+ .setParent(parent)
+ .setSshPublicKey(sshPublicKey)
+ .build();
+ return createSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create an SSH public key
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * CreateSshPublicKeyRequest request =
+ * CreateSshPublicKeyRequest.newBuilder()
+ * .setParent(UserName.of("[USER]").toString())
+ * .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
+ * .build();
+ * OsLoginProto.SshPublicKey response = osLoginServiceClient.createSshPublicKey(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey createSshPublicKey(CreateSshPublicKeyRequest request) {
+ return createSshPublicKeyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create an SSH public key
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * CreateSshPublicKeyRequest request =
+ * CreateSshPublicKeyRequest.newBuilder()
+ * .setParent(UserName.of("[USER]").toString())
+ * .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.createSshPublicKeyCallable().futureCall(request);
+ * // Do something.
+ * OsLoginProto.SshPublicKey response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * ProjectName name = ProjectName.of("[USER]", "[PROJECT]");
+ * osLoginServiceClient.deletePosixAccount(name);
+ * }
+ * }
+ *
+ * @param name Required. A reference to the POSIX account to update. POSIX accounts are identified
+ * by the project ID they are associated with. A reference to the POSIX account is in format
+ * `users/{user}/projects/{project}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deletePosixAccount(ProjectName name) {
+ DeletePosixAccountRequest request =
+ DeletePosixAccountRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deletePosixAccount(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a POSIX account.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String name = ProjectName.of("[USER]", "[PROJECT]").toString();
+ * osLoginServiceClient.deletePosixAccount(name);
+ * }
+ * }
+ *
+ * @param name Required. A reference to the POSIX account to update. POSIX accounts are identified
+ * by the project ID they are associated with. A reference to the POSIX account is in format
+ * `users/{user}/projects/{project}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deletePosixAccount(String name) {
+ DeletePosixAccountRequest request =
+ DeletePosixAccountRequest.newBuilder().setName(name).build();
+ deletePosixAccount(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a POSIX account.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * DeletePosixAccountRequest request =
+ * DeletePosixAccountRequest.newBuilder()
+ * .setName(ProjectName.of("[USER]", "[PROJECT]").toString())
+ * .build();
+ * osLoginServiceClient.deletePosixAccount(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deletePosixAccount(DeletePosixAccountRequest request) {
+ deletePosixAccountCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a POSIX account.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * DeletePosixAccountRequest request =
+ * DeletePosixAccountRequest.newBuilder()
+ * .setName(ProjectName.of("[USER]", "[PROJECT]").toString())
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.deletePosixAccountCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
+ * osLoginServiceClient.deleteSshPublicKey(name);
+ * }
+ * }
+ *
+ * @param name Required. The fingerprint of the public key to update. Public keys are identified
+ * by their SHA-256 fingerprint. The fingerprint of the public key is in format
+ * `users/{user}/sshPublicKeys/{fingerprint}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteSshPublicKey(FingerprintName name) {
+ DeleteSshPublicKeyRequest request =
+ DeleteSshPublicKeyRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes an SSH public key.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String name = FingerprintName.of("[USER]", "[FINGERPRINT]").toString();
+ * osLoginServiceClient.deleteSshPublicKey(name);
+ * }
+ * }
+ *
+ * @param name Required. The fingerprint of the public key to update. Public keys are identified
+ * by their SHA-256 fingerprint. The fingerprint of the public key is in format
+ * `users/{user}/sshPublicKeys/{fingerprint}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteSshPublicKey(String name) {
+ DeleteSshPublicKeyRequest request =
+ DeleteSshPublicKeyRequest.newBuilder().setName(name).build();
+ deleteSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes an SSH public key.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * DeleteSshPublicKeyRequest request =
+ * DeleteSshPublicKeyRequest.newBuilder()
+ * .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ * .build();
+ * osLoginServiceClient.deleteSshPublicKey(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteSshPublicKey(DeleteSshPublicKeyRequest request) {
+ deleteSshPublicKeyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes an SSH public key.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * DeleteSshPublicKeyRequest request =
+ * DeleteSshPublicKeyRequest.newBuilder()
+ * .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.deleteSshPublicKeyCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UserName name = UserName.of("[USER]");
+ * LoginProfile response = osLoginServiceClient.getLoginProfile(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique ID for the user in format `users/{user}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LoginProfile getLoginProfile(UserName name) {
+ GetLoginProfileRequest request =
+ GetLoginProfileRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getLoginProfile(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the profile information used for logging in to a virtual machine on Google Compute
+ * Engine.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String name = UserName.of("[USER]").toString();
+ * LoginProfile response = osLoginServiceClient.getLoginProfile(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique ID for the user in format `users/{user}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LoginProfile getLoginProfile(String name) {
+ GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder().setName(name).build();
+ return getLoginProfile(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the profile information used for logging in to a virtual machine on Google Compute
+ * Engine.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * GetLoginProfileRequest request =
+ * GetLoginProfileRequest.newBuilder()
+ * .setName(UserName.of("[USER]").toString())
+ * .setProjectId("projectId-894832108")
+ * .setSystemId("systemId1976085418")
+ * .setView(LoginProfileView.forNumber(0))
+ * .build();
+ * LoginProfile response = osLoginServiceClient.getLoginProfile(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LoginProfile getLoginProfile(GetLoginProfileRequest request) {
+ return getLoginProfileCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the profile information used for logging in to a virtual machine on Google Compute
+ * Engine.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * GetLoginProfileRequest request =
+ * GetLoginProfileRequest.newBuilder()
+ * .setName(UserName.of("[USER]").toString())
+ * .setProjectId("projectId-894832108")
+ * .setSystemId("systemId1976085418")
+ * .setView(LoginProfileView.forNumber(0))
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.getLoginProfileCallable().futureCall(request);
+ * // Do something.
+ * LoginProfile response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
+ * OsLoginProto.SshPublicKey response = osLoginServiceClient.getSshPublicKey(name);
+ * }
+ * }
+ *
+ * @param name Required. The fingerprint of the public key to retrieve. Public keys are identified
+ * by their SHA-256 fingerprint. The fingerprint of the public key is in format
+ * `users/{user}/sshPublicKeys/{fingerprint}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey getSshPublicKey(FingerprintName name) {
+ GetSshPublicKeyRequest request =
+ GetSshPublicKeyRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves an SSH public key.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String name = FingerprintName.of("[USER]", "[FINGERPRINT]").toString();
+ * OsLoginProto.SshPublicKey response = osLoginServiceClient.getSshPublicKey(name);
+ * }
+ * }
+ *
+ * @param name Required. The fingerprint of the public key to retrieve. Public keys are identified
+ * by their SHA-256 fingerprint. The fingerprint of the public key is in format
+ * `users/{user}/sshPublicKeys/{fingerprint}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey getSshPublicKey(String name) {
+ GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder().setName(name).build();
+ return getSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves an SSH public key.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * GetSshPublicKeyRequest request =
+ * GetSshPublicKeyRequest.newBuilder()
+ * .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ * .build();
+ * OsLoginProto.SshPublicKey response = osLoginServiceClient.getSshPublicKey(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey getSshPublicKey(GetSshPublicKeyRequest request) {
+ return getSshPublicKeyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves an SSH public key.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * GetSshPublicKeyRequest request =
+ * GetSshPublicKeyRequest.newBuilder()
+ * .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.getSshPublicKeyCallable().futureCall(request);
+ * // Do something.
+ * OsLoginProto.SshPublicKey response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UserName parent = UserName.of("[USER]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * ImportSshPublicKeyResponse response =
+ * osLoginServiceClient.importSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ *
+ * @param parent The unique ID for the user in format `users/{user}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ImportSshPublicKeyResponse importSshPublicKey(
+ UserName parent, OsLoginProto.SshPublicKey sshPublicKey) {
+ ImportSshPublicKeyRequest request =
+ ImportSshPublicKeyRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setSshPublicKey(sshPublicKey)
+ .build();
+ return importSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Adds an SSH public key and returns the profile information. Default POSIX account information
+ * is set when no username and UID exist as part of the login profile.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String parent = UserName.of("[USER]").toString();
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * ImportSshPublicKeyResponse response =
+ * osLoginServiceClient.importSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ *
+ * @param parent The unique ID for the user in format `users/{user}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ImportSshPublicKeyResponse importSshPublicKey(
+ String parent, OsLoginProto.SshPublicKey sshPublicKey) {
+ ImportSshPublicKeyRequest request =
+ ImportSshPublicKeyRequest.newBuilder()
+ .setParent(parent)
+ .setSshPublicKey(sshPublicKey)
+ .build();
+ return importSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Adds an SSH public key and returns the profile information. Default POSIX account information
+ * is set when no username and UID exist as part of the login profile.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UserName parent = UserName.of("[USER]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * String projectId = "projectId-894832108";
+ * ImportSshPublicKeyResponse response =
+ * osLoginServiceClient.importSshPublicKey(parent, sshPublicKey, projectId);
+ * }
+ * }
+ *
+ * @param parent The unique ID for the user in format `users/{user}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @param projectId The project ID of the Google Cloud Platform project.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ImportSshPublicKeyResponse importSshPublicKey(
+ UserName parent, OsLoginProto.SshPublicKey sshPublicKey, String projectId) {
+ ImportSshPublicKeyRequest request =
+ ImportSshPublicKeyRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setSshPublicKey(sshPublicKey)
+ .setProjectId(projectId)
+ .build();
+ return importSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Adds an SSH public key and returns the profile information. Default POSIX account information
+ * is set when no username and UID exist as part of the login profile.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String parent = UserName.of("[USER]").toString();
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * String projectId = "projectId-894832108";
+ * ImportSshPublicKeyResponse response =
+ * osLoginServiceClient.importSshPublicKey(parent, sshPublicKey, projectId);
+ * }
+ * }
+ *
+ * @param parent The unique ID for the user in format `users/{user}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @param projectId The project ID of the Google Cloud Platform project.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ImportSshPublicKeyResponse importSshPublicKey(
+ String parent, OsLoginProto.SshPublicKey sshPublicKey, String projectId) {
+ ImportSshPublicKeyRequest request =
+ ImportSshPublicKeyRequest.newBuilder()
+ .setParent(parent)
+ .setSshPublicKey(sshPublicKey)
+ .setProjectId(projectId)
+ .build();
+ return importSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Adds an SSH public key and returns the profile information. Default POSIX account information
+ * is set when no username and UID exist as part of the login profile.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * ImportSshPublicKeyRequest request =
+ * ImportSshPublicKeyRequest.newBuilder()
+ * .setParent(UserName.of("[USER]").toString())
+ * .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
+ * .setProjectId("projectId-894832108")
+ * .setView(LoginProfileView.forNumber(0))
+ * .addAllRegions(new ArrayList())
+ * .build();
+ * ImportSshPublicKeyResponse response = osLoginServiceClient.importSshPublicKey(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ImportSshPublicKeyResponse importSshPublicKey(ImportSshPublicKeyRequest request) {
+ return importSshPublicKeyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Adds an SSH public key and returns the profile information. Default POSIX account information
+ * is set when no username and UID exist as part of the login profile.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * ImportSshPublicKeyRequest request =
+ * ImportSshPublicKeyRequest.newBuilder()
+ * .setParent(UserName.of("[USER]").toString())
+ * .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
+ * .setProjectId("projectId-894832108")
+ * .setView(LoginProfileView.forNumber(0))
+ * .addAllRegions(new ArrayList())
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.importSshPublicKeyCallable().futureCall(request);
+ * // Do something.
+ * ImportSshPublicKeyResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.updateSshPublicKey(name, sshPublicKey);
+ * }
+ * }
+ *
+ * @param name Required. The fingerprint of the public key to update. Public keys are identified
+ * by their SHA-256 fingerprint. The fingerprint of the public key is in format
+ * `users/{user}/sshPublicKeys/{fingerprint}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey updateSshPublicKey(
+ FingerprintName name, OsLoginProto.SshPublicKey sshPublicKey) {
+ UpdateSshPublicKeyRequest request =
+ UpdateSshPublicKeyRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .setSshPublicKey(sshPublicKey)
+ .build();
+ return updateSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an SSH public key and returns the profile information. This method supports patch
+ * semantics.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String name = FingerprintName.of("[USER]", "[FINGERPRINT]").toString();
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.updateSshPublicKey(name, sshPublicKey);
+ * }
+ * }
+ *
+ * @param name Required. The fingerprint of the public key to update. Public keys are identified
+ * by their SHA-256 fingerprint. The fingerprint of the public key is in format
+ * `users/{user}/sshPublicKeys/{fingerprint}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey updateSshPublicKey(
+ String name, OsLoginProto.SshPublicKey sshPublicKey) {
+ UpdateSshPublicKeyRequest request =
+ UpdateSshPublicKeyRequest.newBuilder().setName(name).setSshPublicKey(sshPublicKey).build();
+ return updateSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an SSH public key and returns the profile information. This method supports patch
+ * semantics.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.updateSshPublicKey(name, sshPublicKey, updateMask);
+ * }
+ * }
+ *
+ * @param name Required. The fingerprint of the public key to update. Public keys are identified
+ * by their SHA-256 fingerprint. The fingerprint of the public key is in format
+ * `users/{user}/sshPublicKeys/{fingerprint}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @param updateMask Mask to control which fields get updated. Updates all if not present.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey updateSshPublicKey(
+ FingerprintName name, OsLoginProto.SshPublicKey sshPublicKey, FieldMask updateMask) {
+ UpdateSshPublicKeyRequest request =
+ UpdateSshPublicKeyRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .setSshPublicKey(sshPublicKey)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an SSH public key and returns the profile information. This method supports patch
+ * semantics.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String name = FingerprintName.of("[USER]", "[FINGERPRINT]").toString();
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.updateSshPublicKey(name, sshPublicKey, updateMask);
+ * }
+ * }
+ *
+ * @param name Required. The fingerprint of the public key to update. Public keys are identified
+ * by their SHA-256 fingerprint. The fingerprint of the public key is in format
+ * `users/{user}/sshPublicKeys/{fingerprint}`.
+ * @param sshPublicKey Required. The SSH public key and expiration time.
+ * @param updateMask Mask to control which fields get updated. Updates all if not present.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey updateSshPublicKey(
+ String name, OsLoginProto.SshPublicKey sshPublicKey, FieldMask updateMask) {
+ UpdateSshPublicKeyRequest request =
+ UpdateSshPublicKeyRequest.newBuilder()
+ .setName(name)
+ .setSshPublicKey(sshPublicKey)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an SSH public key and returns the profile information. This method supports patch
+ * semantics.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UpdateSshPublicKeyRequest request =
+ * UpdateSshPublicKeyRequest.newBuilder()
+ * .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ * .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * OsLoginProto.SshPublicKey response = osLoginServiceClient.updateSshPublicKey(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OsLoginProto.SshPublicKey updateSshPublicKey(UpdateSshPublicKeyRequest request) {
+ return updateSshPublicKeyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an SSH public key and returns the profile information. This method supports patch
+ * semantics.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UpdateSshPublicKeyRequest request =
+ * UpdateSshPublicKeyRequest.newBuilder()
+ * .setName(FingerprintName.of("[USER]", "[FINGERPRINT]").toString())
+ * .setSshPublicKey(OsLoginProto.SshPublicKey.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.updateSshPublicKeyCallable().futureCall(request);
+ * // Do something.
+ * OsLoginProto.SshPublicKey response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * String parent = "parent-995424086";
+ * String sshPublicKey = "sshPublicKey1661966862";
+ * SignSshPublicKeyResponse response =
+ * osLoginServiceClient.signSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ *
+ * @param parent The parent project and region for the signing request.
+ * @param sshPublicKey The SSH public key to sign.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SignSshPublicKeyResponse signSshPublicKey(String parent, String sshPublicKey) {
+ SignSshPublicKeyRequest request =
+ SignSshPublicKeyRequest.newBuilder()
+ .setParent(parent)
+ .setSshPublicKey(sshPublicKey)
+ .build();
+ return signSshPublicKey(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Signs an SSH public key for a user to authenticate to an instance.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * SignSshPublicKeyRequest request =
+ * SignSshPublicKeyRequest.newBuilder()
+ * .setSshPublicKey("sshPublicKey1661966862")
+ * .setParent("parent-995424086")
+ * .build();
+ * SignSshPublicKeyResponse response = osLoginServiceClient.signSshPublicKey(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SignSshPublicKeyResponse signSshPublicKey(SignSshPublicKeyRequest request) {
+ return signSshPublicKeyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Signs an SSH public key for a user to authenticate to an instance.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * SignSshPublicKeyRequest request =
+ * SignSshPublicKeyRequest.newBuilder()
+ * .setSshPublicKey("sshPublicKey1661966862")
+ * .setParent("parent-995424086")
+ * .build();
+ * ApiFuture future =
+ * osLoginServiceClient.signSshPublicKeyCallable().futureCall(request);
+ * // Do something.
+ * SignSshPublicKeyResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableThe default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createSshPublicKey: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * OsLoginServiceSettings.Builder osLoginServiceSettingsBuilder =
+ * OsLoginServiceSettings.newBuilder();
+ * osLoginServiceSettingsBuilder
+ * .createSshPublicKeySettings()
+ * .setRetrySettings(
+ * osLoginServiceSettingsBuilder
+ * .createSshPublicKeySettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
+ * .build());
+ * OsLoginServiceSettings osLoginServiceSettings = osLoginServiceSettingsBuilder.build();
+ * }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting
+ * retries.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class OsLoginServiceSettings extends ClientSettingsNote: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= OsLoginServiceClient =======================
+ *
+ * Service Description: Cloud OS Login API
+ *
+ * The Cloud OS Login API allows you to manage users and their associated SSH public keys for
+ * logging into virtual machines on Google Cloud Platform.
+ *
+ * Sample for OsLoginServiceClient:
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcOsLoginServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcOsLoginServiceStub extends OsLoginServiceStub {
+ private static final MethodDescriptor This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonOsLoginServiceCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonOsLoginServiceStub extends OsLoginServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public abstract class OsLoginServiceStub implements BackgroundResource {
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the
+ * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
+ * of createSshPublicKey:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
+ * UserName parent = UserName.of("[USER]");
+ * OsLoginProto.SshPublicKey sshPublicKey = OsLoginProto.SshPublicKey.newBuilder().build();
+ * OsLoginProto.SshPublicKey response =
+ * osLoginServiceClient.createSshPublicKey(parent, sshPublicKey);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.cloud.oslogin.v1beta;
+
+import javax.annotation.Generated;
diff --git a/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1beta/stub/GrpcOsLoginServiceCallableFactory.java b/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1beta/stub/GrpcOsLoginServiceCallableFactory.java
new file mode 100644
index 000000000000..1ce776042caf
--- /dev/null
+++ b/java-os-login/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1beta/stub/GrpcOsLoginServiceCallableFactory.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2026 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.oslogin.v1beta.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the OsLoginService service API.
+ *
+ *
+ *
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * OsLoginServiceStubSettings.Builder osLoginServiceSettingsBuilder =
+ * OsLoginServiceStubSettings.newBuilder();
+ * osLoginServiceSettingsBuilder
+ * .createSshPublicKeySettings()
+ * .setRetrySettings(
+ * osLoginServiceSettingsBuilder
+ * .createSshPublicKeySettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
+ * .build());
+ * OsLoginServiceStubSettings osLoginServiceSettings = osLoginServiceSettingsBuilder.build();
+ * }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://docs.cloud.google.com/java/docs/client-retries) for additional support in setting
+ * retries.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+@SuppressWarnings("CanonicalDuration")
+public class OsLoginServiceStubSettings extends StubSettings