@maxim_mazurok/gapi.client.tpu-v2 0.0.20221130

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.tpu-v2",
3
+ "version": "0.0.20221130",
4
+ "description": "TypeScript typings for Cloud TPU API v2",
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,68 @@
1
+ # TypeScript typings for Cloud TPU API v2
2
+
3
+ TPU API provides customers with access to Google TPU technology.
4
+ For detailed description please check [documentation](https://cloud.google.com/tpu/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud TPU API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.tpu-v2 --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://tpu.googleapis.com/$discovery/rest?version=v2', () => {
29
+ // now we can use:
30
+ // gapi.client.tpu
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('tpu', 'v2', () => {
37
+ // now we can use:
38
+ // gapi.client.tpu
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
+ immediate = true;
52
+ // ...
53
+
54
+ gapi.auth.authorize(
55
+ { client_id: client_id, scope: scope, immediate: immediate },
56
+ authResult => {
57
+ if (authResult && !authResult.error) {
58
+ /* handle successful authorization */
59
+ } else {
60
+ /* handle authorization error */
61
+ }
62
+ });
63
+ ```
64
+
65
+ After that you can use Cloud TPU API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,274 @@
1
+ /* This is stub file for gapi.client.tpu-v2 definition tests */
2
+ // IMPORTANT
3
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
+
6
+ // Revision: 20221130
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://tpu.googleapis.com/$discovery/rest?version=v2');
12
+ /** now we can use gapi.client.tpu */
13
+
14
+ /** don't forget to authenticate your client before sending any request to resources: */
15
+ /** declare client_id registered in Google Developers Console */
16
+ const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
+ const scope = [
18
+ /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
19
+ 'https://www.googleapis.com/auth/cloud-platform',
20
+ ];
21
+ const immediate = false;
22
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
23
+ if (authResult && !authResult.error) {
24
+ /** handle successful authorization */
25
+ run();
26
+ } else {
27
+ /** handle authorization error */
28
+ }
29
+ });
30
+
31
+ async function run() {
32
+ /** Generates the Cloud TPU service identity for the project. */
33
+ await gapi.client.tpu.projects.locations.generateServiceIdentity({
34
+ parent: "Test string",
35
+ }, {
36
+ });
37
+ /** Gets information about a location. */
38
+ await gapi.client.tpu.projects.locations.get({
39
+ name: "Test string",
40
+ });
41
+ /** Lists information about the supported locations for this service. */
42
+ await gapi.client.tpu.projects.locations.list({
43
+ filter: "Test string",
44
+ name: "Test string",
45
+ pageSize: 42,
46
+ pageToken: "Test string",
47
+ });
48
+ /** Gets AcceleratorType. */
49
+ await gapi.client.tpu.projects.locations.acceleratorTypes.get({
50
+ name: "Test string",
51
+ });
52
+ /** Lists accelerator types supported by this API. */
53
+ await gapi.client.tpu.projects.locations.acceleratorTypes.list({
54
+ filter: "Test string",
55
+ orderBy: "Test string",
56
+ pageSize: 42,
57
+ pageToken: "Test string",
58
+ parent: "Test string",
59
+ });
60
+ /** Creates a node. */
61
+ await gapi.client.tpu.projects.locations.nodes.create({
62
+ nodeId: "Test string",
63
+ parent: "Test string",
64
+ }, {
65
+ acceleratorType: "Test string",
66
+ apiVersion: "Test string",
67
+ cidrBlock: "Test string",
68
+ createTime: "Test string",
69
+ dataDisks: [
70
+ {
71
+ mode: "Test string",
72
+ sourceDisk: "Test string",
73
+ }
74
+ ],
75
+ description: "Test string",
76
+ health: "Test string",
77
+ healthDescription: "Test string",
78
+ id: "Test string",
79
+ labels: {
80
+ A: "Test string"
81
+ },
82
+ metadata: {
83
+ A: "Test string"
84
+ },
85
+ name: "Test string",
86
+ networkConfig: {
87
+ canIpForward: true,
88
+ enableExternalIps: true,
89
+ network: "Test string",
90
+ subnetwork: "Test string",
91
+ },
92
+ networkEndpoints: [
93
+ {
94
+ accessConfig: {
95
+ externalIp: "Test string",
96
+ },
97
+ ipAddress: "Test string",
98
+ port: 42,
99
+ }
100
+ ],
101
+ runtimeVersion: "Test string",
102
+ schedulingConfig: {
103
+ preemptible: true,
104
+ reserved: true,
105
+ },
106
+ serviceAccount: {
107
+ email: "Test string",
108
+ scope: [
109
+ "Test string"
110
+ ],
111
+ },
112
+ shieldedInstanceConfig: {
113
+ enableSecureBoot: true,
114
+ },
115
+ state: "Test string",
116
+ symptoms: [
117
+ {
118
+ createTime: "Test string",
119
+ details: "Test string",
120
+ symptomType: "Test string",
121
+ workerId: "Test string",
122
+ }
123
+ ],
124
+ tags: [
125
+ "Test string"
126
+ ],
127
+ });
128
+ /** Deletes a node. */
129
+ await gapi.client.tpu.projects.locations.nodes.delete({
130
+ name: "Test string",
131
+ });
132
+ /** Gets the details of a node. */
133
+ await gapi.client.tpu.projects.locations.nodes.get({
134
+ name: "Test string",
135
+ });
136
+ /** Retrieves the guest attributes for the node. */
137
+ await gapi.client.tpu.projects.locations.nodes.getGuestAttributes({
138
+ name: "Test string",
139
+ }, {
140
+ queryPath: "Test string",
141
+ workerIds: [
142
+ "Test string"
143
+ ],
144
+ });
145
+ /** Lists nodes. */
146
+ await gapi.client.tpu.projects.locations.nodes.list({
147
+ pageSize: 42,
148
+ pageToken: "Test string",
149
+ parent: "Test string",
150
+ });
151
+ /** Updates the configurations of a node. */
152
+ await gapi.client.tpu.projects.locations.nodes.patch({
153
+ name: "Test string",
154
+ updateMask: "Test string",
155
+ }, {
156
+ acceleratorType: "Test string",
157
+ apiVersion: "Test string",
158
+ cidrBlock: "Test string",
159
+ createTime: "Test string",
160
+ dataDisks: [
161
+ {
162
+ mode: "Test string",
163
+ sourceDisk: "Test string",
164
+ }
165
+ ],
166
+ description: "Test string",
167
+ health: "Test string",
168
+ healthDescription: "Test string",
169
+ id: "Test string",
170
+ labels: {
171
+ A: "Test string"
172
+ },
173
+ metadata: {
174
+ A: "Test string"
175
+ },
176
+ name: "Test string",
177
+ networkConfig: {
178
+ canIpForward: true,
179
+ enableExternalIps: true,
180
+ network: "Test string",
181
+ subnetwork: "Test string",
182
+ },
183
+ networkEndpoints: [
184
+ {
185
+ accessConfig: {
186
+ externalIp: "Test string",
187
+ },
188
+ ipAddress: "Test string",
189
+ port: 42,
190
+ }
191
+ ],
192
+ runtimeVersion: "Test string",
193
+ schedulingConfig: {
194
+ preemptible: true,
195
+ reserved: true,
196
+ },
197
+ serviceAccount: {
198
+ email: "Test string",
199
+ scope: [
200
+ "Test string"
201
+ ],
202
+ },
203
+ shieldedInstanceConfig: {
204
+ enableSecureBoot: true,
205
+ },
206
+ state: "Test string",
207
+ symptoms: [
208
+ {
209
+ createTime: "Test string",
210
+ details: "Test string",
211
+ symptomType: "Test string",
212
+ workerId: "Test string",
213
+ }
214
+ ],
215
+ tags: [
216
+ "Test string"
217
+ ],
218
+ });
219
+ /** Starts a node. */
220
+ await gapi.client.tpu.projects.locations.nodes.start({
221
+ name: "Test string",
222
+ }, {
223
+ });
224
+ /** Stops a node. This operation is only available with single TPU nodes. */
225
+ await gapi.client.tpu.projects.locations.nodes.stop({
226
+ name: "Test string",
227
+ }, {
228
+ });
229
+ /**
230
+ * Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this
231
+ * method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation
232
+ * completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of
233
+ * 1, corresponding to `Code.CANCELLED`.
234
+ */
235
+ await gapi.client.tpu.projects.locations.operations.cancel({
236
+ name: "Test string",
237
+ });
238
+ /**
239
+ * Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support
240
+ * this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
241
+ */
242
+ await gapi.client.tpu.projects.locations.operations.delete({
243
+ name: "Test string",
244
+ });
245
+ /** Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. */
246
+ await gapi.client.tpu.projects.locations.operations.get({
247
+ name: "Test string",
248
+ });
249
+ /**
250
+ * Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to
251
+ * override the binding to use different resource name schemes, such as `users/*‍/operations`. To override the binding, API services can add a binding such as
252
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
253
+ * ensure the name binding is the parent resource, without the operations collection id.
254
+ */
255
+ await gapi.client.tpu.projects.locations.operations.list({
256
+ filter: "Test string",
257
+ name: "Test string",
258
+ pageSize: 42,
259
+ pageToken: "Test string",
260
+ });
261
+ /** Gets a runtime version. */
262
+ await gapi.client.tpu.projects.locations.runtimeVersions.get({
263
+ name: "Test string",
264
+ });
265
+ /** Lists runtime versions supported by this API. */
266
+ await gapi.client.tpu.projects.locations.runtimeVersions.list({
267
+ filter: "Test string",
268
+ orderBy: "Test string",
269
+ pageSize: 42,
270
+ pageToken: "Test string",
271
+ parent: "Test string",
272
+ });
273
+ }
274
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "lib": ["es6", "dom"],
5
+ "noImplicitAny": true,
6
+ "noImplicitThis": true,
7
+ "strictNullChecks": true,
8
+ "baseUrl": "../",
9
+ "typeRoots": [
10
+ "../"
11
+ ],
12
+ "types": [],
13
+ "noEmit": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strictFunctionTypes": true
16
+ },
17
+ "files": ["index.d.ts", "tests.ts"]
18
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }