: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new OsLoginServiceClient({fallback: true}, gax); ```
Properties
apiEndpoint
staticgetapiEndpoint():string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
{Promise} - The promise which resolves to an array. The first element of the array is an object representing SshPublicKey. Please see the documentation for more details and examples.
Example
/** * 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. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. The unique ID for the user in format `users/{user}`. */// const parent = 'abc123'/** * Required. The SSH public key and expiration time. */// const sshPublicKey = {}// Imports the Oslogin libraryconst{OsLoginServiceClient}=require('@google-cloud/os-login').v1;// Instantiates a clientconstosloginClient=newOsLoginServiceClient();asyncfunctioncallCreateSshPublicKey(){// Construct requestconstrequest={parent,sshPublicKey,};// Run requestconstresponse=awaitosloginClient.createSshPublicKey(request);console.log(response);}callCreateSshPublicKey();
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.
Example
/** * 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. * TODO(developer): Uncomment these variables before running the sample. *//** * 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}`. */// const name = 'abc123'// Imports the Oslogin libraryconst{OsLoginServiceClient}=require('@google-cloud/os-login').v1;// Instantiates a clientconstosloginClient=newOsLoginServiceClient();asyncfunctioncallDeletePosixAccount(){// Construct requestconstrequest={name,};// Run requestconstresponse=awaitosloginClient.deletePosixAccount(request);console.log(response);}callDeletePosixAccount();
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.
Example
/** * 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. * TODO(developer): Uncomment these variables before running the sample. *//** * 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}`. */// const name = 'abc123'// Imports the Oslogin libraryconst{OsLoginServiceClient}=require('@google-cloud/os-login').v1;// Instantiates a clientconstosloginClient=newOsLoginServiceClient();asyncfunctioncallDeleteSshPublicKey(){// Construct requestconstrequest={name,};// Run requestconstresponse=awaitosloginClient.deleteSshPublicKey(request);console.log(response);}callDeleteSshPublicKey();
{Promise} - The promise which resolves to an array. The first element of the array is an object representing LoginProfile. Please see the documentation for more details and examples.
Example
/** * 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. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. The unique ID for the user in format `users/{user}`. */// const name = 'abc123'/** * The project ID of the Google Cloud Platform project. */// const projectId = 'abc123'/** * A system ID for filtering the results of the request. */// const systemId = 'abc123'// Imports the Oslogin libraryconst{OsLoginServiceClient}=require('@google-cloud/os-login').v1;// Instantiates a clientconstosloginClient=newOsLoginServiceClient();asyncfunctioncallGetLoginProfile(){// Construct requestconstrequest={name,};// Run requestconstresponse=awaitosloginClient.getLoginProfile(request);console.log(response);}callGetLoginProfile();
{Promise} - The promise which resolves to an array. The first element of the array is an object representing SshPublicKey. Please see the documentation for more details and examples.
Example
/** * 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. * TODO(developer): Uncomment these variables before running the sample. *//** * 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}`. */// const name = 'abc123'// Imports the Oslogin libraryconst{OsLoginServiceClient}=require('@google-cloud/os-login').v1;// Instantiates a clientconstosloginClient=newOsLoginServiceClient();asyncfunctioncallGetSshPublicKey(){// Construct requestconstrequest={name,};// Run requestconstresponse=awaitosloginClient.getSshPublicKey(request);console.log(response);}callGetSshPublicKey();
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.
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ImportSshPublicKeyResponse. Please see the documentation for more details and examples.
Example
/** * 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. * TODO(developer): Uncomment these variables before running the sample. *//** * Required. The unique ID for the user in format `users/{user}`. */// const parent = 'abc123'/** * Optional. The SSH public key and expiration time. */// const sshPublicKey = {}/** * The project ID of the Google Cloud Platform project. */// const projectId = 'abc123'// Imports the Oslogin libraryconst{OsLoginServiceClient}=require('@google-cloud/os-login').v1;// Instantiates a clientconstosloginClient=newOsLoginServiceClient();asyncfunctioncallImportSshPublicKey(){// Construct requestconstrequest={parent,};// Run requestconstresponse=awaitosloginClient.importSshPublicKey(request);console.log(response);}callImportSshPublicKey();
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns
Type
Description
Promise<{
[name: string]: Function;
}>
{Promise} A promise that resolves to an authenticated service stub.
{Promise} - The promise which resolves to an array. The first element of the array is an object representing SshPublicKey. Please see the documentation for more details and examples.
Example
/** * 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. * TODO(developer): Uncomment these variables before running the sample. *//** * 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}`. */// const name = 'abc123'/** * Required. The SSH public key and expiration time. */// const sshPublicKey = {}/** * Mask to control which fields get updated. Updates all if not present. */// const updateMask = {}// Imports the Oslogin libraryconst{OsLoginServiceClient}=require('@google-cloud/os-login').v1;// Instantiates a clientconstosloginClient=newOsLoginServiceClient();asyncfunctioncallUpdateSshPublicKey(){// Construct requestconstrequest={name,sshPublicKey,};// Run requestconstresponse=awaitosloginClient.updateSshPublicKey(request);console.log(response);}callUpdateSshPublicKey();
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-17 UTC."],[],[]]