Class v1beta.OsLoginServiceClient (4.0.4)

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. v1beta

Package

@google-cloud/os-login

Constructors

  constructor 
 ( 
 opts 
 ?: 
  
 ClientOptions 
 , 
  
 gaxInstance 
 ?: 
  
 typeof 
  
 gax 
  
 | 
  
 typeof 
  
 gax 
 . 
 fallback 
 ); 
 

Construct an instance of OsLoginServiceClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof gax.fallback

: 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: 'rest'}, gax); ```

Properties

  static 
  
 get 
  
 apiEndpoint 
 () 
 : 
  
 string 
 ; 
 

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

  auth 
 : 
  
 gax 
 . 
 GoogleAuth 
 ; 
 
  descriptors 
 : 
  
 Descriptors 
 ; 
 
  innerApiCalls 
 : 
  
 { 
  
 [ 
 name 
 : 
  
 string 
 ] 
 : 
  
 Function 
 ; 
  
 }; 
 
  osLoginServiceStub 
 ?: 
  
 Promise 
< { 
  
 [ 
 name 
 : 
  
 string 
 ] 
 : 
  
 Function 
 ; 
  
 }>; 
 
  pathTemplates 
 : 
  
 { 
  
 [ 
 name 
 : 
  
 string 
 ] 
 : 
  
 gax 
 . 
 PathTemplate 
 ; 
  
 }; 
 
  static 
  
 get 
  
 port 
 () 
 : 
  
 number 
 ; 
 

The port for this API service.

  static 
  
 get 
  
 scopes 
 () 
 : 
  
 string 
 []; 
 

The scopes needed to make gRPC calls for every method defined in this service.

  static 
  
 get 
  
 servicePath 
 () 
 : 
  
 string 
 ; 
 

The DNS address for this API service.

  warn 
 : 
  
 ( 
 code 
 : 
  
 string 
 , 
  
 message 
 : 
  
 string 
 , 
  
 warnType 
 ?: 
  
 string 
 ) 
  
 = 
>  
 void 
 ; 
 

Methods

  close 
 () 
 : 
  
 Promise<void> 
 ; 
 

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise <void>

{Promise} A promise that resolves when the client is closed.

  deletePosixAccount 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeletePosixAccountRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 protobuf 
 . 
 IEmpty 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeletePosixAccountRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Deletes a POSIX account.

Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IDeletePosixAccountRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise <[ protos. google.protobuf.IEmpty , protos. google.cloud.oslogin.v1beta.IDeletePosixAccountRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 library 
  
 const 
  
 { 
 OsLoginServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/os-login 
' 
 ). 
 v1beta 
 ; 
  
 // Instantiates a client 
  
 const 
  
 osloginClient 
  
 = 
  
 new 
  
  OsLoginServiceClient 
 
 (); 
  
 async 
  
 function 
  
 callDeletePosixAccount 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 osloginClient 
 . 
 deletePosixAccount 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callDeletePosixAccount 
 (); 
 
  deletePosixAccount 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeletePosixAccountRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 protobuf 
 . 
 IEmpty 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeletePosixAccountRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IDeletePosixAccountRequest
options CallOptions
callback Callback <protos. google.protobuf.IEmpty , protos. google.cloud.oslogin.v1beta.IDeletePosixAccountRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  deletePosixAccount 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeletePosixAccountRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 protobuf 
 . 
 IEmpty 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeletePosixAccountRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IDeletePosixAccountRequest
callback Callback <protos. google.protobuf.IEmpty , protos. google.cloud.oslogin.v1beta.IDeletePosixAccountRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  deleteSshPublicKey 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeleteSshPublicKeyRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 protobuf 
 . 
 IEmpty 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeleteSshPublicKeyRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Deletes an SSH public key.

Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise <[ protos. google.protobuf.IEmpty , protos. google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 library 
  
 const 
  
 { 
 OsLoginServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/os-login 
' 
 ). 
 v1beta 
 ; 
  
 // Instantiates a client 
  
 const 
  
 osloginClient 
  
 = 
  
 new 
  
  OsLoginServiceClient 
 
 (); 
  
 async 
  
 function 
  
 callDeleteSshPublicKey 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 osloginClient 
 . 
 deleteSshPublicKey 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callDeleteSshPublicKey 
 (); 
 
  deleteSshPublicKey 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeleteSshPublicKeyRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 protobuf 
 . 
 IEmpty 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeleteSshPublicKeyRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest
options CallOptions
callback Callback <protos. google.protobuf.IEmpty , protos. google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  deleteSshPublicKey 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeleteSshPublicKeyRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 protobuf 
 . 
 IEmpty 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IDeleteSshPublicKeyRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest
callback Callback <protos. google.protobuf.IEmpty , protos. google.cloud.oslogin.v1beta.IDeleteSshPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  getLoginProfile 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetLoginProfileRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 ILoginProfile 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetLoginProfileRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.

Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IGetLoginProfileRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise <[ protos. google.cloud.oslogin.v1beta.ILoginProfile , protos. google.cloud.oslogin.v1beta.IGetLoginProfileRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [LoginProfile]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 library 
  
 const 
  
 { 
 OsLoginServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/os-login 
' 
 ). 
 v1beta 
 ; 
  
 // Instantiates a client 
  
 const 
  
 osloginClient 
  
 = 
  
 new 
  
  OsLoginServiceClient 
 
 (); 
  
 async 
  
 function 
  
 callGetLoginProfile 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 osloginClient 
 . 
 getLoginProfile 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callGetLoginProfile 
 (); 
 
  getLoginProfile 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetLoginProfileRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 ILoginProfile 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetLoginProfileRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IGetLoginProfileRequest
options CallOptions
callback Callback <protos. google.cloud.oslogin.v1beta.ILoginProfile , protos. google.cloud.oslogin.v1beta.IGetLoginProfileRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  getLoginProfile 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetLoginProfileRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 ILoginProfile 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetLoginProfileRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IGetLoginProfileRequest
callback Callback <protos. google.cloud.oslogin.v1beta.ILoginProfile , protos. google.cloud.oslogin.v1beta.IGetLoginProfileRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  getProjectId 
 () 
 : 
  
 Promise<string> 
 ; 
 
Returns
Type Description
Promise <string>
  getProjectId 
 ( 
 callback 
 : 
  
 Callback<string 
 , 
  
 undefined 
 , 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameter
Name Description
callback Callback <string, undefined, undefined>
Returns
Type Description
void
  getSshPublicKey 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetSshPublicKeyRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 common 
 . 
 ISshPublicKey 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetSshPublicKeyRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Retrieves an SSH public key.

Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise <[ protos. google.cloud.oslogin.common.ISshPublicKey , protos. google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [SshPublicKey]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 library 
  
 const 
  
 { 
 OsLoginServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/os-login 
' 
 ). 
 v1beta 
 ; 
  
 // Instantiates a client 
  
 const 
  
 osloginClient 
  
 = 
  
 new 
  
  OsLoginServiceClient 
 
 (); 
  
 async 
  
 function 
  
 callGetSshPublicKey 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 osloginClient 
 . 
 getSshPublicKey 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callGetSshPublicKey 
 (); 
 
  getSshPublicKey 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetSshPublicKeyRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 common 
 . 
 ISshPublicKey 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetSshPublicKeyRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest
options CallOptions
callback Callback <protos. google.cloud.oslogin.common.ISshPublicKey , protos. google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  getSshPublicKey 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetSshPublicKeyRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 common 
 . 
 ISshPublicKey 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IGetSshPublicKeyRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest
callback Callback <protos. google.cloud.oslogin.common.ISshPublicKey , protos. google.cloud.oslogin.v1beta.IGetSshPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  importSshPublicKey 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

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.

Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise <[ protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse , protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [ImportSshPublicKeyResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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. 
 */ 
  
 /** 
 *  The unique ID for the user in format `users/{user}`. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  Required. The SSH public key and expiration time. 
 */ 
  
 // const sshPublicKey = {} 
  
 /** 
 *  The project ID of the Google Cloud Platform project. 
 */ 
  
 // const projectId = 'abc123' 
  
 // Imports the Oslogin library 
  
 const 
  
 { 
 OsLoginServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/os-login 
' 
 ). 
 v1beta 
 ; 
  
 // Instantiates a client 
  
 const 
  
 osloginClient 
  
 = 
  
 new 
  
  OsLoginServiceClient 
 
 (); 
  
 async 
  
 function 
  
 callImportSshPublicKey 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 sshPublicKey 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 osloginClient 
 . 
 importSshPublicKey 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callImportSshPublicKey 
 (); 
 
  importSshPublicKey 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest
options CallOptions
callback Callback <protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse , protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  importSshPublicKey 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IImportSshPublicKeyRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest
callback Callback <protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyResponse , protos. google.cloud.oslogin.v1beta.IImportSshPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  initialize 
 () 
 : 
  
 Promise 
< { 
  
 [ 
 name 
 : 
  
 string 
 ] 
 : 
  
 Function 
 ; 
  
 }>; 
 

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.

  matchFingerprintFromSshPublicKeyName 
 ( 
 sshPublicKeyName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the fingerprint from SshPublicKey resource.

Parameter
Name Description
sshPublicKeyName string

A fully-qualified path representing SshPublicKey resource.

Returns
Type Description
string | number

{string} A string representing the fingerprint.

  matchProjectFromPosixAccountName 
 ( 
 posixAccountName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from PosixAccount resource.

Parameter
Name Description
posixAccountName string

A fully-qualified path representing PosixAccount resource.

Returns
Type Description
string | number

{string} A string representing the project.

  matchUserFromPosixAccountName 
 ( 
 posixAccountName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the user from PosixAccount resource.

Parameter
Name Description
posixAccountName string

A fully-qualified path representing PosixAccount resource.

Returns
Type Description
string | number

{string} A string representing the user.

  matchUserFromSshPublicKeyName 
 ( 
 sshPublicKeyName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the user from SshPublicKey resource.

Parameter
Name Description
sshPublicKeyName string

A fully-qualified path representing SshPublicKey resource.

Returns
Type Description
string | number

{string} A string representing the user.

  matchUserFromUserName 
 ( 
 userName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the user from User resource.

Parameter
Name Description
userName string

A fully-qualified path representing User resource.

Returns
Type Description
string | number

{string} A string representing the user.

  posixAccountPath 
 ( 
 user 
 : 
  
 string 
 , 
  
 project 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified posixAccount resource name string.

Parameters
Name Description
user string
project string
Returns
Type Description
string

{string} Resource name string.

  sshPublicKeyPath 
 ( 
 user 
 : 
  
 string 
 , 
  
 fingerprint 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified sshPublicKey resource name string.

Parameters
Name Description
user string
fingerprint string
Returns
Type Description
string

{string} Resource name string.

  updateSshPublicKey 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IUpdateSshPublicKeyRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 common 
 . 
 ISshPublicKey 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IUpdateSshPublicKeyRequest 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 ]>; 
 

Updates an SSH public key and returns the profile information. This method supports patch semantics.

Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise <[ protos. google.cloud.oslogin.common.ISshPublicKey , protos. google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [SshPublicKey]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 library 
  
 const 
  
 { 
 OsLoginServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/os-login 
' 
 ). 
 v1beta 
 ; 
  
 // Instantiates a client 
  
 const 
  
 osloginClient 
  
 = 
  
 new 
  
  OsLoginServiceClient 
 
 (); 
  
 async 
  
 function 
  
 callUpdateSshPublicKey 
 () 
  
 { 
  
 // Construct request 
  
 const 
  
 request 
  
 = 
  
 { 
  
 name 
 , 
  
 sshPublicKey 
 , 
  
 }; 
  
 // Run request 
  
 const 
  
 response 
  
 = 
  
 await 
  
 osloginClient 
 . 
 updateSshPublicKey 
 ( 
 request 
 ); 
  
 console 
 . 
 log 
 ( 
 response 
 ); 
  
 } 
  
 callUpdateSshPublicKey 
 (); 
 
  updateSshPublicKey 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IUpdateSshPublicKeyRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 common 
 . 
 ISshPublicKey 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IUpdateSshPublicKeyRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest
options CallOptions
callback Callback <protos. google.cloud.oslogin.common.ISshPublicKey , protos. google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  updateSshPublicKey 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IUpdateSshPublicKeyRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 common 
 . 
 ISshPublicKey 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 oslogin 
 . 
 v1beta 
 . 
 IUpdateSshPublicKeyRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
request protos. google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest
callback Callback <protos. google.cloud.oslogin.common.ISshPublicKey , protos. google.cloud.oslogin.v1beta.IUpdateSshPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
  userPath 
 ( 
 user 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified user resource name string.

Parameter
Name Description
user string
Returns
Type Description
string

{string} Resource name string.

Create a Mobile Website
View Site in Mobile | Classic
Share by: