7
7
[ ![ AppVeyor] ( https://ci.appveyor.com/api/projects/status/github/googleapis/nodejs-os-login?branch=master&svg=true )] ( https://ci.appveyor.com/project/googleapis/nodejs-os-login )
8
8
[ ![ codecov] ( https://img.shields.io/codecov/c/github/googleapis/nodejs-os-login/master.svg?style=flat )] ( https://codecov.io/gh/googleapis/nodejs-os-login )
9
9
10
- > Node.js idiomatic client for [ OS Login] [ product-docs ] .
10
+ > Node.js idiomatic client for [ Cloud OS Login API ] [ product-docs ] .
11
11
12
- Manages OS login configuration for Directory API users.
12
+ The [ Google Cloud OS Login API ] ( https://cloud.google.com/compute/docs/oslogin/rest ) manages OS login configuration for Google account users.
13
13
14
14
15
- * [ OS Login Node.js Client API Reference] [ client-docs ]
15
+ * [ Cloud OS Login API Node.js Client API Reference] [ client-docs ]
16
16
* [ github.com/googleapis/nodejs-os-login] ( https://github.com/googleapis/nodejs-os-login )
17
- * [ OS Login Documentation] [ product-docs ]
17
+ * [ Cloud OS Login API Documentation] [ product-docs ]
18
18
19
19
Read more about the client libraries for Cloud APIs, including the older
20
20
Google APIs Client Libraries, in [ Client Libraries Explained] [ explained ] .
@@ -59,9 +59,42 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
59
59
60
60
npm install --save @google-cloud/os-login
61
61
62
+ ### Using the client library
62
63
64
+ ``` javascript
65
+ if (
66
+ ! process .env .GCLOUD_PROJECT ||
67
+ ! process .env .GOOGLE_APPLICATION_CREDENTIALS
68
+ ) {
69
+ throw new Error (
70
+ ' Usage: GCLOUD_PROJECT=<project_id> GOOGLE_APPLICATION_CREDENTIALS=<path to key json file> node #{$0}'
71
+ );
72
+ }
63
73
64
- The [ OS Login Node.js Client API Reference] [ client-docs ] documentation
74
+ const oslogin = require (' @google-cloud/oslogin' );
75
+
76
+ const projectId = process .env .GCLOUD_PROJECT ;
77
+
78
+ const client = new oslogin.OsLoginServiceClient ({
79
+ projectId: projectId
80
+ });
81
+
82
+ const request = {
83
+ name: ' users/1234abcd'
84
+ };
85
+
86
+ client .getLoginProfile (request)
87
+ .then (responses => {
88
+ const loginProfile = responses[0 ];
89
+ console .log (loginProfile);
90
+ })
91
+ .catch (err => {
92
+ console .error (' ERROR:' , err);
93
+ });
94
+ ```
95
+
96
+
97
+ The [ Cloud OS Login API Node.js Client API Reference] [ client-docs ] documentation
65
98
also contains samples.
66
99
67
100
## Versioning
@@ -87,5 +120,5 @@ Apache Version 2.0
87
120
See [ LICENSE] ( https://github.com/googleapis/nodejs-os-login/blob/master/LICENSE )
88
121
89
122
[ client-docs ] : https://cloud.google.com/nodejs/docs/reference/oslogin/latest/
90
- [ product-docs ] : https://cloud.google.com/compute/docs/oslogin/rest/
91
- [ shell_img ] : http: //gstatic.com/cloudssh/images/open-btn.png
123
+ [ product-docs ] : https://cloud.google.com/compute/docs/oslogin/rest
124
+ [ shell_img ] : //gstatic.com/cloudssh/images/open-btn.png
0 commit comments