@maxim_mazurok/gapi.client.tpu-v2alpha1 0.0.20220725
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/index.d.ts +1111 -0
- package/package.json +20 -0
- package/readme.md +68 -0
- package/tests.ts +278 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.tpu-v2alpha1",
|
|
3
|
+
"version": "0.0.20220725",
|
|
4
|
+
"description": "TypeScript typings for Cloud TPU API v2alpha1",
|
|
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 v2alpha1
|
|
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-v2alpha1 --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=v2alpha1', () => {
|
|
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', 'v2alpha1', () => {
|
|
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,278 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.tpu-v2alpha1 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: 20220725
|
|
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=v2alpha1');
|
|
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
|
+
requestId: "Test string",
|
|
65
|
+
}, {
|
|
66
|
+
acceleratorType: "Test string",
|
|
67
|
+
apiVersion: "Test string",
|
|
68
|
+
cidrBlock: "Test string",
|
|
69
|
+
createTime: "Test string",
|
|
70
|
+
dataDisks: [
|
|
71
|
+
{
|
|
72
|
+
mode: "Test string",
|
|
73
|
+
sourceDisk: "Test string",
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
description: "Test string",
|
|
77
|
+
health: "Test string",
|
|
78
|
+
healthDescription: "Test string",
|
|
79
|
+
id: "Test string",
|
|
80
|
+
labels: {
|
|
81
|
+
A: "Test string"
|
|
82
|
+
},
|
|
83
|
+
metadata: {
|
|
84
|
+
A: "Test string"
|
|
85
|
+
},
|
|
86
|
+
name: "Test string",
|
|
87
|
+
networkConfig: {
|
|
88
|
+
canIpForward: true,
|
|
89
|
+
enableExternalIps: true,
|
|
90
|
+
network: "Test string",
|
|
91
|
+
subnetwork: "Test string",
|
|
92
|
+
},
|
|
93
|
+
networkEndpoints: [
|
|
94
|
+
{
|
|
95
|
+
accessConfig: {
|
|
96
|
+
externalIp: "Test string",
|
|
97
|
+
},
|
|
98
|
+
ipAddress: "Test string",
|
|
99
|
+
port: 42,
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
runtimeVersion: "Test string",
|
|
103
|
+
schedulingConfig: {
|
|
104
|
+
preemptible: true,
|
|
105
|
+
reserved: true,
|
|
106
|
+
},
|
|
107
|
+
serviceAccount: {
|
|
108
|
+
email: "Test string",
|
|
109
|
+
scope: [
|
|
110
|
+
"Test string"
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
state: "Test string",
|
|
114
|
+
symptoms: [
|
|
115
|
+
{
|
|
116
|
+
createTime: "Test string",
|
|
117
|
+
details: "Test string",
|
|
118
|
+
symptomType: "Test string",
|
|
119
|
+
workerId: "Test string",
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
tags: [
|
|
123
|
+
"Test string"
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
/** Deletes a node. */
|
|
127
|
+
await gapi.client.tpu.projects.locations.nodes.delete({
|
|
128
|
+
name: "Test string",
|
|
129
|
+
requestId: "Test string",
|
|
130
|
+
});
|
|
131
|
+
/** Gets the details of a node. */
|
|
132
|
+
await gapi.client.tpu.projects.locations.nodes.get({
|
|
133
|
+
name: "Test string",
|
|
134
|
+
});
|
|
135
|
+
/** Retrieves the guest attributes for the node. */
|
|
136
|
+
await gapi.client.tpu.projects.locations.nodes.getGuestAttributes({
|
|
137
|
+
name: "Test string",
|
|
138
|
+
}, {
|
|
139
|
+
queryPath: "Test string",
|
|
140
|
+
workerIds: [
|
|
141
|
+
"Test string"
|
|
142
|
+
],
|
|
143
|
+
});
|
|
144
|
+
/** Lists nodes. */
|
|
145
|
+
await gapi.client.tpu.projects.locations.nodes.list({
|
|
146
|
+
pageSize: 42,
|
|
147
|
+
pageToken: "Test string",
|
|
148
|
+
parent: "Test string",
|
|
149
|
+
});
|
|
150
|
+
/** Updates the configurations of a node. */
|
|
151
|
+
await gapi.client.tpu.projects.locations.nodes.patch({
|
|
152
|
+
name: "Test string",
|
|
153
|
+
updateMask: "Test string",
|
|
154
|
+
}, {
|
|
155
|
+
acceleratorType: "Test string",
|
|
156
|
+
apiVersion: "Test string",
|
|
157
|
+
cidrBlock: "Test string",
|
|
158
|
+
createTime: "Test string",
|
|
159
|
+
dataDisks: [
|
|
160
|
+
{
|
|
161
|
+
mode: "Test string",
|
|
162
|
+
sourceDisk: "Test string",
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
description: "Test string",
|
|
166
|
+
health: "Test string",
|
|
167
|
+
healthDescription: "Test string",
|
|
168
|
+
id: "Test string",
|
|
169
|
+
labels: {
|
|
170
|
+
A: "Test string"
|
|
171
|
+
},
|
|
172
|
+
metadata: {
|
|
173
|
+
A: "Test string"
|
|
174
|
+
},
|
|
175
|
+
name: "Test string",
|
|
176
|
+
networkConfig: {
|
|
177
|
+
canIpForward: true,
|
|
178
|
+
enableExternalIps: true,
|
|
179
|
+
network: "Test string",
|
|
180
|
+
subnetwork: "Test string",
|
|
181
|
+
},
|
|
182
|
+
networkEndpoints: [
|
|
183
|
+
{
|
|
184
|
+
accessConfig: {
|
|
185
|
+
externalIp: "Test string",
|
|
186
|
+
},
|
|
187
|
+
ipAddress: "Test string",
|
|
188
|
+
port: 42,
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
runtimeVersion: "Test string",
|
|
192
|
+
schedulingConfig: {
|
|
193
|
+
preemptible: true,
|
|
194
|
+
reserved: true,
|
|
195
|
+
},
|
|
196
|
+
serviceAccount: {
|
|
197
|
+
email: "Test string",
|
|
198
|
+
scope: [
|
|
199
|
+
"Test string"
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
state: "Test string",
|
|
203
|
+
symptoms: [
|
|
204
|
+
{
|
|
205
|
+
createTime: "Test string",
|
|
206
|
+
details: "Test string",
|
|
207
|
+
symptomType: "Test string",
|
|
208
|
+
workerId: "Test string",
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
tags: [
|
|
212
|
+
"Test string"
|
|
213
|
+
],
|
|
214
|
+
});
|
|
215
|
+
/** Simulates a maintenance event. */
|
|
216
|
+
await gapi.client.tpu.projects.locations.nodes.simulateMaintenanceEvent({
|
|
217
|
+
name: "Test string",
|
|
218
|
+
}, {
|
|
219
|
+
workerIds: [
|
|
220
|
+
"Test string"
|
|
221
|
+
],
|
|
222
|
+
});
|
|
223
|
+
/** Starts a node. */
|
|
224
|
+
await gapi.client.tpu.projects.locations.nodes.start({
|
|
225
|
+
name: "Test string",
|
|
226
|
+
}, {
|
|
227
|
+
});
|
|
228
|
+
/** Stops a node. This operation is only available with single TPU nodes. */
|
|
229
|
+
await gapi.client.tpu.projects.locations.nodes.stop({
|
|
230
|
+
name: "Test string",
|
|
231
|
+
}, {
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* 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
|
|
235
|
+
* 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
|
|
236
|
+
* 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
|
|
237
|
+
* 1, corresponding to `Code.CANCELLED`.
|
|
238
|
+
*/
|
|
239
|
+
await gapi.client.tpu.projects.locations.operations.cancel({
|
|
240
|
+
name: "Test string",
|
|
241
|
+
});
|
|
242
|
+
/**
|
|
243
|
+
* 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
|
|
244
|
+
* this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
|
|
245
|
+
*/
|
|
246
|
+
await gapi.client.tpu.projects.locations.operations.delete({
|
|
247
|
+
name: "Test string",
|
|
248
|
+
});
|
|
249
|
+
/** 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. */
|
|
250
|
+
await gapi.client.tpu.projects.locations.operations.get({
|
|
251
|
+
name: "Test string",
|
|
252
|
+
});
|
|
253
|
+
/**
|
|
254
|
+
* 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
|
|
255
|
+
* 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
|
|
256
|
+
* `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
|
|
257
|
+
* ensure the name binding is the parent resource, without the operations collection id.
|
|
258
|
+
*/
|
|
259
|
+
await gapi.client.tpu.projects.locations.operations.list({
|
|
260
|
+
filter: "Test string",
|
|
261
|
+
name: "Test string",
|
|
262
|
+
pageSize: 42,
|
|
263
|
+
pageToken: "Test string",
|
|
264
|
+
});
|
|
265
|
+
/** Gets a runtime version. */
|
|
266
|
+
await gapi.client.tpu.projects.locations.runtimeVersions.get({
|
|
267
|
+
name: "Test string",
|
|
268
|
+
});
|
|
269
|
+
/** Lists runtime versions supported by this API. */
|
|
270
|
+
await gapi.client.tpu.projects.locations.runtimeVersions.list({
|
|
271
|
+
filter: "Test string",
|
|
272
|
+
orderBy: "Test string",
|
|
273
|
+
pageSize: 42,
|
|
274
|
+
pageToken: "Test string",
|
|
275
|
+
parent: "Test string",
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
});
|
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
|
+
}
|