|
1 |
| -// Copyright 2017 Google LLC |
| 1 | +// Copyright 2022 Google LLC |
2 | 2 | //
|
3 | 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | // you may not use this file except in compliance with the License.
|
5 | 5 | // You may obtain a copy of the License at
|
6 | 6 | //
|
7 |
| -// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
8 | 8 | //
|
9 | 9 | // Unless required by applicable law or agreed to in writing, software
|
10 | 10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
11 | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 | 12 | // See the License for the specific language governing permissions and
|
13 | 13 | // limitations under the License.
|
| 14 | +// |
| 15 | +// ** This file is automatically generated by gapic-generator-typescript. ** |
| 16 | +// ** https://github.com/googleapis/gapic-generator-typescript ** |
| 17 | +// ** All changes to this file may be overwritten. ** |
14 | 18 |
|
15 | 19 | 'use strict';
|
16 | 20 |
|
17 |
| -async function main() { |
| 21 | +function main(name) { |
18 | 22 | // [START oslogin_quickstart]
|
19 |
| - const {OsLoginServiceClient} = require('@google-cloud/os-login'); |
20 |
| - const client = new OsLoginServiceClient(); |
21 |
| - |
22 |
| - async function quickstart() { |
23 |
| - const [loginProfile] = await client.getLoginProfile({ |
24 |
| - |
25 |
| - }); |
26 |
| - console.log('Login Profile:'); |
27 |
| - console.log(loginProfile); |
| 23 | + /** |
| 24 | + * TODO(developer): Uncomment these variables before running the sample. |
| 25 | + */ |
| 26 | + /** |
| 27 | + * Required. The unique ID for the user in format `users/{user}`. |
| 28 | + */ |
| 29 | + // const name = 'abc123' |
| 30 | + /** |
| 31 | + * The project ID of the Google Cloud Platform project. |
| 32 | + */ |
| 33 | + // const projectId = 'abc123' |
| 34 | + /** |
| 35 | + * A system ID for filtering the results of the request. |
| 36 | + */ |
| 37 | + // const systemId = 'abc123' |
| 38 | + |
| 39 | + // Imports the Oslogin library |
| 40 | + const {OsLoginServiceClient} = require('@google-cloud/os-login').v1; |
| 41 | + |
| 42 | + // Instantiates a client |
| 43 | + const osloginClient = new OsLoginServiceClient(); |
| 44 | + |
| 45 | + async function callGetLoginProfile() { |
| 46 | + // Construct request |
| 47 | + const request = { |
| 48 | + name, |
| 49 | + }; |
| 50 | + |
| 51 | + // Run request |
| 52 | + const response = await osloginClient.getLoginProfile(request); |
| 53 | + console.log(response[0]); |
28 | 54 | }
|
29 | 55 |
|
30 |
| - quickstart(); |
| 56 | + callGetLoginProfile(); |
31 | 57 | // [END oslogin_quickstart]
|
32 | 58 | }
|
33 | 59 |
|
34 |
| -main(); |
| 60 | +process.on('unhandledRejection', err => { |
| 61 | + console.error(err.message); |
| 62 | + process.exitCode = 1; |
| 63 | +}); |
| 64 | +main(...process.argv.slice(2)); |
0 commit comments