@maxim_mazurok/gapi.client.datamigration-v1 0.0.20220804

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.datamigration-v1",
3
+ "version": "0.0.20220804",
4
+ "description": "TypeScript typings for Database Migration 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 Database Migration API v1
2
+
3
+ Manage Cloud Database Migration Service resources on Google Cloud Platform.
4
+ For detailed description please check [documentation](https://cloud.google.com/database-migration/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Database Migration API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.datamigration-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://datamigration.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.datamigration
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('datamigration', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.datamigration
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 Database Migration API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,564 @@
1
+ /* This is stub file for gapi.client.datamigration-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: 20220804
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://datamigration.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.datamigration */
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.datamigration.projects.locations.get({
34
+ name: "Test string",
35
+ });
36
+ /** Lists information about the supported locations for this service. */
37
+ await gapi.client.datamigration.projects.locations.list({
38
+ filter: "Test string",
39
+ name: "Test string",
40
+ pageSize: 42,
41
+ pageToken: "Test string",
42
+ });
43
+ /** Creates a new connection profile in a given project and location. */
44
+ await gapi.client.datamigration.projects.locations.connectionProfiles.create({
45
+ connectionProfileId: "Test string",
46
+ parent: "Test string",
47
+ requestId: "Test string",
48
+ }, {
49
+ cloudsql: {
50
+ cloudSqlId: "Test string",
51
+ privateIp: "Test string",
52
+ publicIp: "Test string",
53
+ settings: {
54
+ activationPolicy: "Test string",
55
+ autoStorageIncrease: true,
56
+ cmekKeyName: "Test string",
57
+ collation: "Test string",
58
+ databaseFlags: {
59
+ A: "Test string"
60
+ },
61
+ databaseVersion: "Test string",
62
+ dataDiskSizeGb: "Test string",
63
+ dataDiskType: "Test string",
64
+ ipConfig: {
65
+ authorizedNetworks: [
66
+ {
67
+ expireTime: "Test string",
68
+ label: "Test string",
69
+ ttl: "Test string",
70
+ value: "Test string",
71
+ }
72
+ ],
73
+ enableIpv4: true,
74
+ privateNetwork: "Test string",
75
+ requireSsl: true,
76
+ },
77
+ rootPassword: "Test string",
78
+ rootPasswordSet: true,
79
+ sourceId: "Test string",
80
+ storageAutoResizeLimit: "Test string",
81
+ tier: "Test string",
82
+ userLabels: {
83
+ A: "Test string"
84
+ },
85
+ zone: "Test string",
86
+ },
87
+ },
88
+ createTime: "Test string",
89
+ displayName: "Test string",
90
+ error: {
91
+ code: 42,
92
+ details: [
93
+ {
94
+ A: 42
95
+ }
96
+ ],
97
+ message: "Test string",
98
+ },
99
+ labels: {
100
+ A: "Test string"
101
+ },
102
+ mysql: {
103
+ cloudSqlId: "Test string",
104
+ host: "Test string",
105
+ password: "Test string",
106
+ passwordSet: true,
107
+ port: 42,
108
+ ssl: {
109
+ caCertificate: "Test string",
110
+ clientCertificate: "Test string",
111
+ clientKey: "Test string",
112
+ type: "Test string",
113
+ },
114
+ username: "Test string",
115
+ },
116
+ name: "Test string",
117
+ postgresql: {
118
+ cloudSqlId: "Test string",
119
+ host: "Test string",
120
+ password: "Test string",
121
+ passwordSet: true,
122
+ port: 42,
123
+ ssl: {
124
+ caCertificate: "Test string",
125
+ clientCertificate: "Test string",
126
+ clientKey: "Test string",
127
+ type: "Test string",
128
+ },
129
+ username: "Test string",
130
+ },
131
+ provider: "Test string",
132
+ state: "Test string",
133
+ updateTime: "Test string",
134
+ });
135
+ /** Deletes a single Database Migration Service connection profile. A connection profile can only be deleted if it is not in use by any active migration jobs. */
136
+ await gapi.client.datamigration.projects.locations.connectionProfiles.delete({
137
+ force: true,
138
+ name: "Test string",
139
+ requestId: "Test string",
140
+ });
141
+ /** Gets details of a single connection profile. */
142
+ await gapi.client.datamigration.projects.locations.connectionProfiles.get({
143
+ name: "Test string",
144
+ });
145
+ /** Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. */
146
+ await gapi.client.datamigration.projects.locations.connectionProfiles.getIamPolicy({
147
+ "options.requestedPolicyVersion": 42,
148
+ resource: "Test string",
149
+ });
150
+ /** Retrieves a list of all connection profiles in a given project and location. */
151
+ await gapi.client.datamigration.projects.locations.connectionProfiles.list({
152
+ filter: "Test string",
153
+ orderBy: "Test string",
154
+ pageSize: 42,
155
+ pageToken: "Test string",
156
+ parent: "Test string",
157
+ });
158
+ /** Update the configuration of a single connection profile. */
159
+ await gapi.client.datamigration.projects.locations.connectionProfiles.patch({
160
+ name: "Test string",
161
+ requestId: "Test string",
162
+ updateMask: "Test string",
163
+ }, {
164
+ cloudsql: {
165
+ cloudSqlId: "Test string",
166
+ privateIp: "Test string",
167
+ publicIp: "Test string",
168
+ settings: {
169
+ activationPolicy: "Test string",
170
+ autoStorageIncrease: true,
171
+ cmekKeyName: "Test string",
172
+ collation: "Test string",
173
+ databaseFlags: {
174
+ A: "Test string"
175
+ },
176
+ databaseVersion: "Test string",
177
+ dataDiskSizeGb: "Test string",
178
+ dataDiskType: "Test string",
179
+ ipConfig: {
180
+ authorizedNetworks: [
181
+ {
182
+ expireTime: "Test string",
183
+ label: "Test string",
184
+ ttl: "Test string",
185
+ value: "Test string",
186
+ }
187
+ ],
188
+ enableIpv4: true,
189
+ privateNetwork: "Test string",
190
+ requireSsl: true,
191
+ },
192
+ rootPassword: "Test string",
193
+ rootPasswordSet: true,
194
+ sourceId: "Test string",
195
+ storageAutoResizeLimit: "Test string",
196
+ tier: "Test string",
197
+ userLabels: {
198
+ A: "Test string"
199
+ },
200
+ zone: "Test string",
201
+ },
202
+ },
203
+ createTime: "Test string",
204
+ displayName: "Test string",
205
+ error: {
206
+ code: 42,
207
+ details: [
208
+ {
209
+ A: 42
210
+ }
211
+ ],
212
+ message: "Test string",
213
+ },
214
+ labels: {
215
+ A: "Test string"
216
+ },
217
+ mysql: {
218
+ cloudSqlId: "Test string",
219
+ host: "Test string",
220
+ password: "Test string",
221
+ passwordSet: true,
222
+ port: 42,
223
+ ssl: {
224
+ caCertificate: "Test string",
225
+ clientCertificate: "Test string",
226
+ clientKey: "Test string",
227
+ type: "Test string",
228
+ },
229
+ username: "Test string",
230
+ },
231
+ name: "Test string",
232
+ postgresql: {
233
+ cloudSqlId: "Test string",
234
+ host: "Test string",
235
+ password: "Test string",
236
+ passwordSet: true,
237
+ port: 42,
238
+ ssl: {
239
+ caCertificate: "Test string",
240
+ clientCertificate: "Test string",
241
+ clientKey: "Test string",
242
+ type: "Test string",
243
+ },
244
+ username: "Test string",
245
+ },
246
+ provider: "Test string",
247
+ state: "Test string",
248
+ updateTime: "Test string",
249
+ });
250
+ /** Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. */
251
+ await gapi.client.datamigration.projects.locations.connectionProfiles.setIamPolicy({
252
+ resource: "Test string",
253
+ }, {
254
+ policy: {
255
+ auditConfigs: [
256
+ {
257
+ auditLogConfigs: [
258
+ {
259
+ exemptedMembers: [
260
+ "Test string"
261
+ ],
262
+ logType: "Test string",
263
+ }
264
+ ],
265
+ service: "Test string",
266
+ }
267
+ ],
268
+ bindings: [
269
+ {
270
+ condition: {
271
+ description: "Test string",
272
+ expression: "Test string",
273
+ location: "Test string",
274
+ title: "Test string",
275
+ },
276
+ members: [
277
+ "Test string"
278
+ ],
279
+ role: "Test string",
280
+ }
281
+ ],
282
+ etag: "Test string",
283
+ version: 42,
284
+ },
285
+ updateMask: "Test string",
286
+ });
287
+ /**
288
+ * 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
289
+ * 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.
290
+ */
291
+ await gapi.client.datamigration.projects.locations.connectionProfiles.testIamPermissions({
292
+ resource: "Test string",
293
+ }, {
294
+ permissions: [
295
+ "Test string"
296
+ ],
297
+ });
298
+ /** Creates a new migration job in a given project and location. */
299
+ await gapi.client.datamigration.projects.locations.migrationJobs.create({
300
+ migrationJobId: "Test string",
301
+ parent: "Test string",
302
+ requestId: "Test string",
303
+ }, {
304
+ createTime: "Test string",
305
+ destination: "Test string",
306
+ destinationDatabase: {
307
+ engine: "Test string",
308
+ provider: "Test string",
309
+ },
310
+ displayName: "Test string",
311
+ dumpFlags: {
312
+ dumpFlags: [
313
+ {
314
+ name: "Test string",
315
+ value: "Test string",
316
+ }
317
+ ],
318
+ },
319
+ dumpPath: "Test string",
320
+ duration: "Test string",
321
+ endTime: "Test string",
322
+ error: {
323
+ code: 42,
324
+ details: [
325
+ {
326
+ A: 42
327
+ }
328
+ ],
329
+ message: "Test string",
330
+ },
331
+ labels: {
332
+ A: "Test string"
333
+ },
334
+ name: "Test string",
335
+ phase: "Test string",
336
+ reverseSshConnectivity: {
337
+ vm: "Test string",
338
+ vmIp: "Test string",
339
+ vmPort: 42,
340
+ vpc: "Test string",
341
+ },
342
+ source: "Test string",
343
+ sourceDatabase: {
344
+ engine: "Test string",
345
+ provider: "Test string",
346
+ },
347
+ state: "Test string",
348
+ staticIpConnectivity: {
349
+ },
350
+ type: "Test string",
351
+ updateTime: "Test string",
352
+ vpcPeeringConnectivity: {
353
+ vpc: "Test string",
354
+ },
355
+ });
356
+ /** Deletes a single migration job. */
357
+ await gapi.client.datamigration.projects.locations.migrationJobs.delete({
358
+ force: true,
359
+ name: "Test string",
360
+ requestId: "Test string",
361
+ });
362
+ /** Generate a SSH configuration script to configure the reverse SSH connectivity. */
363
+ await gapi.client.datamigration.projects.locations.migrationJobs.generateSshScript({
364
+ migrationJob: "Test string",
365
+ }, {
366
+ vm: "Test string",
367
+ vmCreationConfig: {
368
+ subnet: "Test string",
369
+ vmMachineType: "Test string",
370
+ vmZone: "Test string",
371
+ },
372
+ vmPort: 42,
373
+ vmSelectionConfig: {
374
+ vmZone: "Test string",
375
+ },
376
+ });
377
+ /** Gets details of a single migration job. */
378
+ await gapi.client.datamigration.projects.locations.migrationJobs.get({
379
+ name: "Test string",
380
+ });
381
+ /** Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. */
382
+ await gapi.client.datamigration.projects.locations.migrationJobs.getIamPolicy({
383
+ "options.requestedPolicyVersion": 42,
384
+ resource: "Test string",
385
+ });
386
+ /** Lists migration jobs in a given project and location. */
387
+ await gapi.client.datamigration.projects.locations.migrationJobs.list({
388
+ filter: "Test string",
389
+ orderBy: "Test string",
390
+ pageSize: 42,
391
+ pageToken: "Test string",
392
+ parent: "Test string",
393
+ });
394
+ /** Updates the parameters of a single migration job. */
395
+ await gapi.client.datamigration.projects.locations.migrationJobs.patch({
396
+ name: "Test string",
397
+ requestId: "Test string",
398
+ updateMask: "Test string",
399
+ }, {
400
+ createTime: "Test string",
401
+ destination: "Test string",
402
+ destinationDatabase: {
403
+ engine: "Test string",
404
+ provider: "Test string",
405
+ },
406
+ displayName: "Test string",
407
+ dumpFlags: {
408
+ dumpFlags: [
409
+ {
410
+ name: "Test string",
411
+ value: "Test string",
412
+ }
413
+ ],
414
+ },
415
+ dumpPath: "Test string",
416
+ duration: "Test string",
417
+ endTime: "Test string",
418
+ error: {
419
+ code: 42,
420
+ details: [
421
+ {
422
+ A: 42
423
+ }
424
+ ],
425
+ message: "Test string",
426
+ },
427
+ labels: {
428
+ A: "Test string"
429
+ },
430
+ name: "Test string",
431
+ phase: "Test string",
432
+ reverseSshConnectivity: {
433
+ vm: "Test string",
434
+ vmIp: "Test string",
435
+ vmPort: 42,
436
+ vpc: "Test string",
437
+ },
438
+ source: "Test string",
439
+ sourceDatabase: {
440
+ engine: "Test string",
441
+ provider: "Test string",
442
+ },
443
+ state: "Test string",
444
+ staticIpConnectivity: {
445
+ },
446
+ type: "Test string",
447
+ updateTime: "Test string",
448
+ vpcPeeringConnectivity: {
449
+ vpc: "Test string",
450
+ },
451
+ });
452
+ /** Promote a migration job, stopping replication to the destination and promoting the destination to be a standalone database. */
453
+ await gapi.client.datamigration.projects.locations.migrationJobs.promote({
454
+ name: "Test string",
455
+ }, {
456
+ });
457
+ /** Restart a stopped or failed migration job, resetting the destination instance to its original state and starting the migration process from scratch. */
458
+ await gapi.client.datamigration.projects.locations.migrationJobs.restart({
459
+ name: "Test string",
460
+ }, {
461
+ });
462
+ /** Resume a migration job that is currently stopped and is resumable (was stopped during CDC phase). */
463
+ await gapi.client.datamigration.projects.locations.migrationJobs.resume({
464
+ name: "Test string",
465
+ }, {
466
+ });
467
+ /** Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. */
468
+ await gapi.client.datamigration.projects.locations.migrationJobs.setIamPolicy({
469
+ resource: "Test string",
470
+ }, {
471
+ policy: {
472
+ auditConfigs: [
473
+ {
474
+ auditLogConfigs: [
475
+ {
476
+ exemptedMembers: [
477
+ "Test string"
478
+ ],
479
+ logType: "Test string",
480
+ }
481
+ ],
482
+ service: "Test string",
483
+ }
484
+ ],
485
+ bindings: [
486
+ {
487
+ condition: {
488
+ description: "Test string",
489
+ expression: "Test string",
490
+ location: "Test string",
491
+ title: "Test string",
492
+ },
493
+ members: [
494
+ "Test string"
495
+ ],
496
+ role: "Test string",
497
+ }
498
+ ],
499
+ etag: "Test string",
500
+ version: 42,
501
+ },
502
+ updateMask: "Test string",
503
+ });
504
+ /** Start an already created migration job. */
505
+ await gapi.client.datamigration.projects.locations.migrationJobs.start({
506
+ name: "Test string",
507
+ }, {
508
+ });
509
+ /** Stops a running migration job. */
510
+ await gapi.client.datamigration.projects.locations.migrationJobs.stop({
511
+ name: "Test string",
512
+ }, {
513
+ });
514
+ /**
515
+ * 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
516
+ * 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.
517
+ */
518
+ await gapi.client.datamigration.projects.locations.migrationJobs.testIamPermissions({
519
+ resource: "Test string",
520
+ }, {
521
+ permissions: [
522
+ "Test string"
523
+ ],
524
+ });
525
+ /** Verify a migration job, making sure the destination can reach the source and that all configuration and prerequisites are met. */
526
+ await gapi.client.datamigration.projects.locations.migrationJobs.verify({
527
+ name: "Test string",
528
+ }, {
529
+ });
530
+ /**
531
+ * 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
532
+ * 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
533
+ * 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
534
+ * 1, corresponding to `Code.CANCELLED`.
535
+ */
536
+ await gapi.client.datamigration.projects.locations.operations.cancel({
537
+ name: "Test string",
538
+ }, {
539
+ });
540
+ /**
541
+ * 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
542
+ * this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
543
+ */
544
+ await gapi.client.datamigration.projects.locations.operations.delete({
545
+ name: "Test string",
546
+ });
547
+ /** 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. */
548
+ await gapi.client.datamigration.projects.locations.operations.get({
549
+ name: "Test string",
550
+ });
551
+ /**
552
+ * 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
553
+ * 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
554
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
555
+ * ensure the name binding is the parent resource, without the operations collection id.
556
+ */
557
+ await gapi.client.datamigration.projects.locations.operations.list({
558
+ filter: "Test string",
559
+ name: "Test string",
560
+ pageSize: 42,
561
+ pageToken: "Test string",
562
+ });
563
+ }
564
+ });
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
+ }