@maxim_mazurok/gapi.client.monitoring-v3 0.0.20220806

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.monitoring-v3",
3
+ "version": "0.0.20220806",
4
+ "description": "TypeScript typings for Cloud Monitoring API v3",
5
+ "license": "MIT",
6
+ "author": {
7
+ "email": "maxim@mazurok.com",
8
+ "name": "Maxim Mazurok",
9
+ "url": "https://maxim.mazurok.com"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,107 @@
1
+ # TypeScript typings for Cloud Monitoring API v3
2
+
3
+ Manages your Cloud Monitoring data and configurations.
4
+ For detailed description please check [documentation](https://cloud.google.com/monitoring/api/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud Monitoring API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.monitoring-v3 --save-dev
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You need to initialize Google API client in your code:
17
+
18
+ ```typescript
19
+ gapi.load('client', () => {
20
+ // now we can use gapi.client
21
+ // ...
22
+ });
23
+ ```
24
+
25
+ Then load api client wrapper:
26
+
27
+ ```typescript
28
+ gapi.client.load('https://monitoring.googleapis.com/$discovery/rest?version=v3', () => {
29
+ // now we can use:
30
+ // gapi.client.monitoring
31
+ });
32
+ ```
33
+
34
+ ```typescript
35
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
36
+ gapi.client.load('monitoring', 'v3', () => {
37
+ // now we can use:
38
+ // gapi.client.monitoring
39
+ });
40
+ ```
41
+
42
+ Don't forget to authenticate your client before sending any request to resources:
43
+
44
+ ```typescript
45
+ // declare client_id registered in Google Developers Console
46
+ var client_id = '',
47
+ scope = [
48
+ // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
49
+ 'https://www.googleapis.com/auth/cloud-platform',
50
+
51
+ // View and write monitoring data for all of your Google and third-party Cloud and API projects
52
+ 'https://www.googleapis.com/auth/monitoring',
53
+
54
+ // View monitoring data for all of your Google Cloud and third-party projects
55
+ 'https://www.googleapis.com/auth/monitoring.read',
56
+
57
+ // Publish metric data to your Google Cloud projects
58
+ 'https://www.googleapis.com/auth/monitoring.write',
59
+ ],
60
+ immediate = true;
61
+ // ...
62
+
63
+ gapi.auth.authorize(
64
+ { client_id: client_id, scope: scope, immediate: immediate },
65
+ authResult => {
66
+ if (authResult && !authResult.error) {
67
+ /* handle successful authorization */
68
+ } else {
69
+ /* handle authorization error */
70
+ }
71
+ });
72
+ ```
73
+
74
+ After that you can use Cloud Monitoring API resources: <!-- TODO: make this work for multiple namespaces -->
75
+
76
+ ```typescript
77
+
78
+ /*
79
+ Create a Service.
80
+ */
81
+ await gapi.client.monitoring.services.create({ parent: "parent", });
82
+
83
+ /*
84
+ Soft delete this Service.
85
+ */
86
+ await gapi.client.monitoring.services.delete({ name: "name", });
87
+
88
+ /*
89
+ Get the named Service.
90
+ */
91
+ await gapi.client.monitoring.services.get({ name: "name", });
92
+
93
+ /*
94
+ List Services for this Metrics Scope.
95
+ */
96
+ await gapi.client.monitoring.services.list({ parent: "parent", });
97
+
98
+ /*
99
+ Update this Service.
100
+ */
101
+ await gapi.client.monitoring.services.patch({ name: "name", });
102
+
103
+ /*
104
+ Returns the list of IP addresses that checkers run from
105
+ */
106
+ await gapi.client.monitoring.uptimeCheckIps.list({ });
107
+ ```