@maxim_mazurok/gapi.client.batch-v1 0.0.20221214

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.batch-v1",
3
+ "version": "0.0.20221214",
4
+ "description": "TypeScript typings for Batch API v1",
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 Batch API v1
2
+
3
+ An API to manage the running of batch jobs on Google Cloud Platform.
4
+ For detailed description please check [documentation](https://cloud.google.com/batch/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Batch API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.batch-v1 --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://batch.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.batch
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('batch', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.batch
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 Batch API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,431 @@
1
+ /* This is stub file for gapi.client.batch-v1 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: 20221214
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://batch.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.batch */
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
+ /** Gets information about a location. */
33
+ await gapi.client.batch.projects.locations.get({
34
+ name: "Test string",
35
+ });
36
+ /** Lists information about the supported locations for this service. */
37
+ await gapi.client.batch.projects.locations.list({
38
+ filter: "Test string",
39
+ name: "Test string",
40
+ pageSize: 42,
41
+ pageToken: "Test string",
42
+ });
43
+ /** Create a Job. */
44
+ await gapi.client.batch.projects.locations.jobs.create({
45
+ jobId: "Test string",
46
+ parent: "Test string",
47
+ requestId: "Test string",
48
+ }, {
49
+ allocationPolicy: {
50
+ instances: [
51
+ {
52
+ installGpuDrivers: true,
53
+ instanceTemplate: "Test string",
54
+ policy: {
55
+ accelerators: [
56
+ {
57
+ count: "Test string",
58
+ installGpuDrivers: true,
59
+ type: "Test string",
60
+ }
61
+ ],
62
+ disks: [
63
+ {
64
+ deviceName: "Test string",
65
+ existingDisk: "Test string",
66
+ newDisk: {
67
+ diskInterface: "Test string",
68
+ image: "Test string",
69
+ sizeGb: "Test string",
70
+ snapshot: "Test string",
71
+ type: "Test string",
72
+ },
73
+ }
74
+ ],
75
+ machineType: "Test string",
76
+ minCpuPlatform: "Test string",
77
+ provisioningModel: "Test string",
78
+ },
79
+ }
80
+ ],
81
+ labels: {
82
+ A: "Test string"
83
+ },
84
+ location: {
85
+ allowedLocations: [
86
+ "Test string"
87
+ ],
88
+ },
89
+ network: {
90
+ networkInterfaces: [
91
+ {
92
+ network: "Test string",
93
+ noExternalIpAddress: true,
94
+ subnetwork: "Test string",
95
+ }
96
+ ],
97
+ },
98
+ serviceAccount: {
99
+ email: "Test string",
100
+ },
101
+ },
102
+ createTime: "Test string",
103
+ labels: {
104
+ A: "Test string"
105
+ },
106
+ logsPolicy: {
107
+ destination: "Test string",
108
+ logsPath: "Test string",
109
+ },
110
+ name: "Test string",
111
+ notifications: [
112
+ {
113
+ message: {
114
+ newJobState: "Test string",
115
+ newTaskState: "Test string",
116
+ type: "Test string",
117
+ },
118
+ pubsubTopic: "Test string",
119
+ }
120
+ ],
121
+ priority: "Test string",
122
+ status: {
123
+ runDuration: "Test string",
124
+ state: "Test string",
125
+ statusEvents: [
126
+ {
127
+ description: "Test string",
128
+ eventTime: "Test string",
129
+ taskExecution: {
130
+ exitCode: 42,
131
+ },
132
+ type: "Test string",
133
+ }
134
+ ],
135
+ taskGroups: {
136
+ A: {
137
+ counts: {
138
+ A: "Test string"
139
+ },
140
+ instances: [
141
+ {
142
+ machineType: "Test string",
143
+ provisioningModel: "Test string",
144
+ taskPack: "Test string",
145
+ }
146
+ ],
147
+ }
148
+ },
149
+ },
150
+ taskGroups: [
151
+ {
152
+ name: "Test string",
153
+ parallelism: "Test string",
154
+ permissiveSsh: true,
155
+ requireHostsFile: true,
156
+ taskCount: "Test string",
157
+ taskCountPerNode: "Test string",
158
+ taskEnvironments: [
159
+ {
160
+ encryptedVariables: {
161
+ cipherText: "Test string",
162
+ keyName: "Test string",
163
+ },
164
+ secretVariables: {
165
+ A: "Test string"
166
+ },
167
+ variables: {
168
+ A: "Test string"
169
+ },
170
+ }
171
+ ],
172
+ taskSpec: {
173
+ computeResource: {
174
+ bootDiskMib: "Test string",
175
+ cpuMilli: "Test string",
176
+ memoryMib: "Test string",
177
+ },
178
+ environment: {
179
+ encryptedVariables: {
180
+ cipherText: "Test string",
181
+ keyName: "Test string",
182
+ },
183
+ secretVariables: {
184
+ A: "Test string"
185
+ },
186
+ variables: {
187
+ A: "Test string"
188
+ },
189
+ },
190
+ environments: {
191
+ A: "Test string"
192
+ },
193
+ lifecyclePolicies: [
194
+ {
195
+ action: "Test string",
196
+ actionCondition: {
197
+ exitCodes: [
198
+ 42
199
+ ],
200
+ },
201
+ }
202
+ ],
203
+ maxRetryCount: 42,
204
+ maxRunDuration: "Test string",
205
+ runnables: [
206
+ {
207
+ alwaysRun: true,
208
+ background: true,
209
+ barrier: {
210
+ name: "Test string",
211
+ },
212
+ container: {
213
+ blockExternalNetwork: true,
214
+ commands: [
215
+ "Test string"
216
+ ],
217
+ entrypoint: "Test string",
218
+ imageUri: "Test string",
219
+ options: "Test string",
220
+ password: "Test string",
221
+ username: "Test string",
222
+ volumes: [
223
+ "Test string"
224
+ ],
225
+ },
226
+ environment: {
227
+ encryptedVariables: {
228
+ cipherText: "Test string",
229
+ keyName: "Test string",
230
+ },
231
+ secretVariables: {
232
+ A: "Test string"
233
+ },
234
+ variables: {
235
+ A: "Test string"
236
+ },
237
+ },
238
+ ignoreExitStatus: true,
239
+ script: {
240
+ path: "Test string",
241
+ text: "Test string",
242
+ },
243
+ timeout: "Test string",
244
+ }
245
+ ],
246
+ volumes: [
247
+ {
248
+ deviceName: "Test string",
249
+ gcs: {
250
+ remotePath: "Test string",
251
+ },
252
+ mountOptions: [
253
+ "Test string"
254
+ ],
255
+ mountPath: "Test string",
256
+ nfs: {
257
+ remotePath: "Test string",
258
+ server: "Test string",
259
+ },
260
+ }
261
+ ],
262
+ },
263
+ }
264
+ ],
265
+ uid: "Test string",
266
+ updateTime: "Test string",
267
+ });
268
+ /** Delete a Job. */
269
+ await gapi.client.batch.projects.locations.jobs.delete({
270
+ name: "Test string",
271
+ reason: "Test string",
272
+ requestId: "Test string",
273
+ });
274
+ /** Get a Job specified by its resource name. */
275
+ await gapi.client.batch.projects.locations.jobs.get({
276
+ name: "Test string",
277
+ });
278
+ /** Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. */
279
+ await gapi.client.batch.projects.locations.jobs.getIamPolicy({
280
+ "options.requestedPolicyVersion": 42,
281
+ resource: "Test string",
282
+ });
283
+ /** List all Jobs for a project within a region. */
284
+ await gapi.client.batch.projects.locations.jobs.list({
285
+ filter: "Test string",
286
+ pageSize: 42,
287
+ pageToken: "Test string",
288
+ parent: "Test string",
289
+ });
290
+ /** Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. */
291
+ await gapi.client.batch.projects.locations.jobs.setIamPolicy({
292
+ resource: "Test string",
293
+ }, {
294
+ policy: {
295
+ auditConfigs: [
296
+ {
297
+ auditLogConfigs: [
298
+ {
299
+ exemptedMembers: [
300
+ "Test string"
301
+ ],
302
+ logType: "Test string",
303
+ }
304
+ ],
305
+ service: "Test string",
306
+ }
307
+ ],
308
+ bindings: [
309
+ {
310
+ condition: {
311
+ description: "Test string",
312
+ expression: "Test string",
313
+ location: "Test string",
314
+ title: "Test string",
315
+ },
316
+ members: [
317
+ "Test string"
318
+ ],
319
+ role: "Test string",
320
+ }
321
+ ],
322
+ etag: "Test string",
323
+ version: 42,
324
+ },
325
+ updateMask: "Test string",
326
+ });
327
+ /**
328
+ * Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This
329
+ * operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
330
+ */
331
+ await gapi.client.batch.projects.locations.jobs.testIamPermissions({
332
+ resource: "Test string",
333
+ }, {
334
+ permissions: [
335
+ "Test string"
336
+ ],
337
+ });
338
+ /** Return a single Task. */
339
+ await gapi.client.batch.projects.locations.jobs.taskGroups.tasks.get({
340
+ name: "Test string",
341
+ });
342
+ /** List Tasks associated with a job. */
343
+ await gapi.client.batch.projects.locations.jobs.taskGroups.tasks.list({
344
+ filter: "Test string",
345
+ pageSize: 42,
346
+ pageToken: "Test string",
347
+ parent: "Test string",
348
+ });
349
+ /**
350
+ * 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
351
+ * 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
352
+ * 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
353
+ * 1, corresponding to `Code.CANCELLED`.
354
+ */
355
+ await gapi.client.batch.projects.locations.operations.cancel({
356
+ name: "Test string",
357
+ }, {
358
+ });
359
+ /**
360
+ * 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
361
+ * this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
362
+ */
363
+ await gapi.client.batch.projects.locations.operations.delete({
364
+ name: "Test string",
365
+ });
366
+ /** 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. */
367
+ await gapi.client.batch.projects.locations.operations.get({
368
+ name: "Test string",
369
+ });
370
+ /**
371
+ * 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
372
+ * 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
373
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
374
+ * ensure the name binding is the parent resource, without the operations collection id.
375
+ */
376
+ await gapi.client.batch.projects.locations.operations.list({
377
+ filter: "Test string",
378
+ name: "Test string",
379
+ pageSize: 42,
380
+ pageToken: "Test string",
381
+ });
382
+ /** Report agent's state, e.g. agent status and tasks information */
383
+ await gapi.client.batch.projects.locations.state.report({
384
+ parent: "Test string",
385
+ }, {
386
+ agentInfo: {
387
+ jobId: "Test string",
388
+ reportTime: "Test string",
389
+ state: "Test string",
390
+ taskGroupId: "Test string",
391
+ tasks: [
392
+ {
393
+ runnable: "Test string",
394
+ taskId: "Test string",
395
+ taskStatus: {
396
+ state: "Test string",
397
+ statusEvents: [
398
+ {
399
+ description: "Test string",
400
+ eventTime: "Test string",
401
+ taskExecution: {
402
+ exitCode: 42,
403
+ },
404
+ type: "Test string",
405
+ }
406
+ ],
407
+ },
408
+ }
409
+ ],
410
+ },
411
+ agentTimingInfo: {
412
+ agentStartupTime: "Test string",
413
+ bootTime: "Test string",
414
+ scriptStartupTime: "Test string",
415
+ },
416
+ metadata: {
417
+ creationTime: "Test string",
418
+ creator: "Test string",
419
+ imageVersion: "Test string",
420
+ instance: "Test string",
421
+ instanceId: "Test string",
422
+ instancePreemptionNoticeReceived: true,
423
+ osRelease: {
424
+ A: "Test string"
425
+ },
426
+ version: "Test string",
427
+ zone: "Test string",
428
+ },
429
+ });
430
+ }
431
+ });
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
+ }