@Generated(value="by gapic-generator") @BetaApi public class OsLoginServiceClient extends Object implements BackgroundResource
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:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
ProjectName name = ProjectName.of("[USER]", "[PROJECT]");
osLoginServiceClient.deletePosixAccount(name);
}
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().
The surface of this class includes several types of Java methods for each of the API's methods:
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:
OsLoginServiceSettings osLoginServiceSettings =
OsLoginServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
OsLoginServiceClient osLoginServiceClient =
OsLoginServiceClient.create(osLoginServiceSettings);
To customize the endpoint:
OsLoginServiceSettings osLoginServiceSettings =
OsLoginServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
OsLoginServiceClient osLoginServiceClient =
OsLoginServiceClient.create(osLoginServiceSettings);
Modifier | Constructor and Description |
---|---|
protected |
OsLoginServiceClient(OsLoginServiceSettings settings)
Constructs an instance of OsLoginServiceClient, using the given settings.
|
protected |
OsLoginServiceClient(OsLoginServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static OsLoginServiceClient |
create()
Constructs an instance of OsLoginServiceClient with default settings.
|
static OsLoginServiceClient |
create(OsLoginServiceSettings settings)
Constructs an instance of OsLoginServiceClient, using the given settings.
|
static OsLoginServiceClient |
create(OsLoginServiceStub stub)
Constructs an instance of OsLoginServiceClient, using the given stub for making calls.
|
void |
deletePosixAccount(com.google.cloud.oslogin.v1.DeletePosixAccountRequest request)
Deletes a POSIX account.
|
void |
deletePosixAccount(com.google.cloud.oslogin.v1.ProjectName name)
Deletes a POSIX account.
|
void |
deletePosixAccount(String name)
Deletes a POSIX account.
|
UnaryCallable<com.google.cloud.oslogin.v1.DeletePosixAccountRequest,Empty> |
deletePosixAccountCallable()
Deletes a POSIX account.
|
void |
deleteSshPublicKey(com.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest request)
Deletes an SSH public key.
|
void |
deleteSshPublicKey(com.google.cloud.oslogin.v1.FingerprintName name)
Deletes an SSH public key.
|
void |
deleteSshPublicKey(String name)
Deletes an SSH public key.
|
UnaryCallable<com.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest,Empty> |
deleteSshPublicKeyCallable()
Deletes an SSH public key.
|
com.google.cloud.oslogin.v1.LoginProfile |
getLoginProfile(com.google.cloud.oslogin.v1.GetLoginProfileRequest request)
Retrieves the profile information used for logging in to a virtual machine on Google Compute
Engine.
|
com.google.cloud.oslogin.v1.LoginProfile |
getLoginProfile(String name)
Retrieves the profile information used for logging in to a virtual machine on Google Compute
Engine.
|
com.google.cloud.oslogin.v1.LoginProfile |
getLoginProfile(com.google.cloud.oslogin.v1.UserName name)
Retrieves the profile information used for logging in to a virtual machine on Google Compute
Engine.
|
UnaryCallable<com.google.cloud.oslogin.v1.GetLoginProfileRequest,com.google.cloud.oslogin.v1.LoginProfile> |
getLoginProfileCallable()
Retrieves the profile information used for logging in to a virtual machine on Google Compute
Engine.
|
OsLoginServiceSettings |
getSettings() |
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey |
getSshPublicKey(com.google.cloud.oslogin.v1.FingerprintName name)
Retrieves an SSH public key.
|
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey |
getSshPublicKey(com.google.cloud.oslogin.v1.GetSshPublicKeyRequest request)
Retrieves an SSH public key.
|
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey |
getSshPublicKey(String name)
Retrieves an SSH public key.
|
UnaryCallable<com.google.cloud.oslogin.v1.GetSshPublicKeyRequest,com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey> |
getSshPublicKeyCallable()
Retrieves an SSH public key.
|
OsLoginServiceStub |
getStub() |
com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse |
importSshPublicKey(com.google.cloud.oslogin.v1.ImportSshPublicKeyRequest request)
Adds an SSH public key and returns the profile information.
|
com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse |
importSshPublicKey(String parent,
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey)
Adds an SSH public key and returns the profile information.
|
com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse |
importSshPublicKey(String parent,
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey,
String projectId)
Adds an SSH public key and returns the profile information.
|
com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse |
importSshPublicKey(com.google.cloud.oslogin.v1.UserName parent,
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey)
Adds an SSH public key and returns the profile information.
|
com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse |
importSshPublicKey(com.google.cloud.oslogin.v1.UserName parent,
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey,
String projectId)
Adds an SSH public key and returns the profile information.
|
UnaryCallable<com.google.cloud.oslogin.v1.ImportSshPublicKeyRequest,com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse> |
importSshPublicKeyCallable()
Adds an SSH public key and returns the profile information.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
shutdown() |
void |
shutdownNow() |
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey |
updateSshPublicKey(com.google.cloud.oslogin.v1.FingerprintName name,
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey)
Updates an SSH public key and returns the profile information.
|
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey |
updateSshPublicKey(com.google.cloud.oslogin.v1.FingerprintName name,
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey,
FieldMask updateMask)
Updates an SSH public key and returns the profile information.
|
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey |
updateSshPublicKey(String name,
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey)
Updates an SSH public key and returns the profile information.
|
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey |
updateSshPublicKey(String name,
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey,
FieldMask updateMask)
Updates an SSH public key and returns the profile information.
|
com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey |
updateSshPublicKey(com.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest request)
Updates an SSH public key and returns the profile information.
|
UnaryCallable<com.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest,com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey> |
updateSshPublicKeyCallable()
Updates an SSH public key and returns the profile information.
|
protected OsLoginServiceClient(OsLoginServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected OsLoginServiceClient(OsLoginServiceStub stub)
public static final OsLoginServiceClient create() throws IOException
IOException
public static final OsLoginServiceClient create(OsLoginServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final OsLoginServiceClient create(OsLoginServiceStub stub)
public final OsLoginServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public OsLoginServiceStub getStub()
public final void deletePosixAccount(com.google.cloud.oslogin.v1.ProjectName name)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
ProjectName name = ProjectName.of("[USER]", "[PROJECT]");
osLoginServiceClient.deletePosixAccount(name);
}
name
- 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}`.ApiException
- if the remote call failspublic final void deletePosixAccount(String name)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
ProjectName name = ProjectName.of("[USER]", "[PROJECT]");
osLoginServiceClient.deletePosixAccount(name.toString());
}
name
- 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}`.ApiException
- if the remote call failspublic final void deletePosixAccount(com.google.cloud.oslogin.v1.DeletePosixAccountRequest request)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
ProjectName name = ProjectName.of("[USER]", "[PROJECT]");
DeletePosixAccountRequest request = DeletePosixAccountRequest.newBuilder()
.setName(name.toString())
.build();
osLoginServiceClient.deletePosixAccount(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.oslogin.v1.DeletePosixAccountRequest,Empty> deletePosixAccountCallable()
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
ProjectName name = ProjectName.of("[USER]", "[PROJECT]");
DeletePosixAccountRequest request = DeletePosixAccountRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = osLoginServiceClient.deletePosixAccountCallable().futureCall(request);
// Do something
future.get();
}
public final void deleteSshPublicKey(com.google.cloud.oslogin.v1.FingerprintName name)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
osLoginServiceClient.deleteSshPublicKey(name);
}
name
- 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}`.ApiException
- if the remote call failspublic final void deleteSshPublicKey(String name)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
osLoginServiceClient.deleteSshPublicKey(name.toString());
}
name
- 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}`.ApiException
- if the remote call failspublic final void deleteSshPublicKey(com.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest request)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
DeleteSshPublicKeyRequest request = DeleteSshPublicKeyRequest.newBuilder()
.setName(name.toString())
.build();
osLoginServiceClient.deleteSshPublicKey(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest,Empty> deleteSshPublicKeyCallable()
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
DeleteSshPublicKeyRequest request = DeleteSshPublicKeyRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = osLoginServiceClient.deleteSshPublicKeyCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.cloud.oslogin.v1.LoginProfile getLoginProfile(com.google.cloud.oslogin.v1.UserName name)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName name = UserName.of("[USER]");
LoginProfile response = osLoginServiceClient.getLoginProfile(name);
}
name
- The unique ID for the user in format `users/{user}`.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.v1.LoginProfile getLoginProfile(String name)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName name = UserName.of("[USER]");
LoginProfile response = osLoginServiceClient.getLoginProfile(name.toString());
}
name
- The unique ID for the user in format `users/{user}`.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.v1.LoginProfile getLoginProfile(com.google.cloud.oslogin.v1.GetLoginProfileRequest request)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName name = UserName.of("[USER]");
GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder()
.setName(name.toString())
.build();
LoginProfile response = osLoginServiceClient.getLoginProfile(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.oslogin.v1.GetLoginProfileRequest,com.google.cloud.oslogin.v1.LoginProfile> getLoginProfileCallable()
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName name = UserName.of("[USER]");
GetLoginProfileRequest request = GetLoginProfileRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<LoginProfile> future = osLoginServiceClient.getLoginProfileCallable().futureCall(request);
// Do something
LoginProfile response = future.get();
}
public final com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey getSshPublicKey(com.google.cloud.oslogin.v1.FingerprintName name)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey response = osLoginServiceClient.getSshPublicKey(name);
}
name
- 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}`.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey getSshPublicKey(String name)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey response = osLoginServiceClient.getSshPublicKey(name.toString());
}
name
- 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}`.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey getSshPublicKey(com.google.cloud.oslogin.v1.GetSshPublicKeyRequest request)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder()
.setName(name.toString())
.build();
SshPublicKey response = osLoginServiceClient.getSshPublicKey(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.oslogin.v1.GetSshPublicKeyRequest,com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey> getSshPublicKeyCallable()
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
GetSshPublicKeyRequest request = GetSshPublicKeyRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<SshPublicKey> future = osLoginServiceClient.getSshPublicKeyCallable().futureCall(request);
// Do something
SshPublicKey response = future.get();
}
public final com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse importSshPublicKey(com.google.cloud.oslogin.v1.UserName parent, com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName parent = UserName.of("[USER]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
ImportSshPublicKeyResponse response = osLoginServiceClient.importSshPublicKey(parent, sshPublicKey);
}
parent
- The unique ID for the user in format `users/{user}`.sshPublicKey
- The SSH public key and expiration time.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse importSshPublicKey(String parent, com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName parent = UserName.of("[USER]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
ImportSshPublicKeyResponse response = osLoginServiceClient.importSshPublicKey(parent.toString(), sshPublicKey);
}
parent
- The unique ID for the user in format `users/{user}`.sshPublicKey
- The SSH public key and expiration time.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse importSshPublicKey(com.google.cloud.oslogin.v1.UserName parent, com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey, String projectId)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName parent = UserName.of("[USER]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
String projectId = "";
ImportSshPublicKeyResponse response = osLoginServiceClient.importSshPublicKey(parent, sshPublicKey, projectId);
}
parent
- The unique ID for the user in format `users/{user}`.sshPublicKey
- The SSH public key and expiration time.projectId
- The project ID of the Google Cloud Platform project.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse importSshPublicKey(String parent, com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey, String projectId)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName parent = UserName.of("[USER]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
String projectId = "";
ImportSshPublicKeyResponse response = osLoginServiceClient.importSshPublicKey(parent.toString(), sshPublicKey, projectId);
}
parent
- The unique ID for the user in format `users/{user}`.sshPublicKey
- The SSH public key and expiration time.projectId
- The project ID of the Google Cloud Platform project.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse importSshPublicKey(com.google.cloud.oslogin.v1.ImportSshPublicKeyRequest request)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName parent = UserName.of("[USER]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
ImportSshPublicKeyRequest request = ImportSshPublicKeyRequest.newBuilder()
.setParent(parent.toString())
.setSshPublicKey(sshPublicKey)
.build();
ImportSshPublicKeyResponse response = osLoginServiceClient.importSshPublicKey(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.oslogin.v1.ImportSshPublicKeyRequest,com.google.cloud.oslogin.v1.ImportSshPublicKeyResponse> importSshPublicKeyCallable()
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
UserName parent = UserName.of("[USER]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
ImportSshPublicKeyRequest request = ImportSshPublicKeyRequest.newBuilder()
.setParent(parent.toString())
.setSshPublicKey(sshPublicKey)
.build();
ApiFuture<ImportSshPublicKeyResponse> future = osLoginServiceClient.importSshPublicKeyCallable().futureCall(request);
// Do something
ImportSshPublicKeyResponse response = future.get();
}
public final com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey updateSshPublicKey(com.google.cloud.oslogin.v1.FingerprintName name, com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
SshPublicKey response = osLoginServiceClient.updateSshPublicKey(name, sshPublicKey);
}
name
- 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}`.sshPublicKey
- The SSH public key and expiration time.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey updateSshPublicKey(String name, com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
SshPublicKey response = osLoginServiceClient.updateSshPublicKey(name.toString(), sshPublicKey);
}
name
- 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}`.sshPublicKey
- The SSH public key and expiration time.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey updateSshPublicKey(com.google.cloud.oslogin.v1.FingerprintName name, com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey, FieldMask updateMask)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
SshPublicKey response = osLoginServiceClient.updateSshPublicKey(name, sshPublicKey, updateMask);
}
name
- 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}`.sshPublicKey
- The SSH public key and expiration time.updateMask
- Mask to control which fields get updated. Updates all if not present.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey updateSshPublicKey(String name, com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey sshPublicKey, FieldMask updateMask)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
SshPublicKey response = osLoginServiceClient.updateSshPublicKey(name.toString(), sshPublicKey, updateMask);
}
name
- 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}`.sshPublicKey
- The SSH public key and expiration time.updateMask
- Mask to control which fields get updated. Updates all if not present.ApiException
- if the remote call failspublic final com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey updateSshPublicKey(com.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest request)
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
UpdateSshPublicKeyRequest request = UpdateSshPublicKeyRequest.newBuilder()
.setName(name.toString())
.setSshPublicKey(sshPublicKey)
.build();
SshPublicKey response = osLoginServiceClient.updateSshPublicKey(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest,com.google.cloud.oslogin.common.OsLoginProto.SshPublicKey> updateSshPublicKeyCallable()
Sample code:
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
UpdateSshPublicKeyRequest request = UpdateSshPublicKeyRequest.newBuilder()
.setName(name.toString())
.setSshPublicKey(sshPublicKey)
.build();
ApiFuture<SshPublicKey> future = osLoginServiceClient.updateSshPublicKeyCallable().futureCall(request);
// Do something
SshPublicKey response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.