@maxim_mazurok/gapi.client.networksecurity-v1 0.0.20220808

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.networksecurity-v1",
3
+ "version": "0.0.20220808",
4
+ "description": "TypeScript typings for Network Security 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 Network Security API v1
2
+
3
+
4
+ For detailed description please check [documentation](https://cloud.google.com/networking).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Network Security API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.networksecurity-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://networksecurity.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.networksecurity
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('networksecurity', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.networksecurity
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 Network Security API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,500 @@
1
+ /* This is stub file for gapi.client.networksecurity-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: 20220808
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://networksecurity.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.networksecurity */
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.networksecurity.projects.locations.get({
34
+ name: "Test string",
35
+ });
36
+ /** Lists information about the supported locations for this service. */
37
+ await gapi.client.networksecurity.projects.locations.list({
38
+ filter: "Test string",
39
+ name: "Test string",
40
+ pageSize: 42,
41
+ pageToken: "Test string",
42
+ });
43
+ /** Creates a new AuthorizationPolicy in a given project and location. */
44
+ await gapi.client.networksecurity.projects.locations.authorizationPolicies.create({
45
+ authorizationPolicyId: "Test string",
46
+ parent: "Test string",
47
+ }, {
48
+ action: "Test string",
49
+ createTime: "Test string",
50
+ description: "Test string",
51
+ labels: {
52
+ A: "Test string"
53
+ },
54
+ name: "Test string",
55
+ rules: [
56
+ {
57
+ destinations: [
58
+ {
59
+ hosts: [
60
+ "Test string"
61
+ ],
62
+ httpHeaderMatch: {
63
+ headerName: "Test string",
64
+ regexMatch: "Test string",
65
+ },
66
+ methods: [
67
+ "Test string"
68
+ ],
69
+ ports: [
70
+ 42
71
+ ],
72
+ }
73
+ ],
74
+ sources: [
75
+ {
76
+ ipBlocks: [
77
+ "Test string"
78
+ ],
79
+ principals: [
80
+ "Test string"
81
+ ],
82
+ }
83
+ ],
84
+ }
85
+ ],
86
+ updateTime: "Test string",
87
+ });
88
+ /** Deletes a single AuthorizationPolicy. */
89
+ await gapi.client.networksecurity.projects.locations.authorizationPolicies.delete({
90
+ name: "Test string",
91
+ });
92
+ /** Gets details of a single AuthorizationPolicy. */
93
+ await gapi.client.networksecurity.projects.locations.authorizationPolicies.get({
94
+ name: "Test string",
95
+ });
96
+ /** Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. */
97
+ await gapi.client.networksecurity.projects.locations.authorizationPolicies.getIamPolicy({
98
+ "options.requestedPolicyVersion": 42,
99
+ resource: "Test string",
100
+ });
101
+ /** Lists AuthorizationPolicies in a given project and location. */
102
+ await gapi.client.networksecurity.projects.locations.authorizationPolicies.list({
103
+ pageSize: 42,
104
+ pageToken: "Test string",
105
+ parent: "Test string",
106
+ });
107
+ /** Updates the parameters of a single AuthorizationPolicy. */
108
+ await gapi.client.networksecurity.projects.locations.authorizationPolicies.patch({
109
+ name: "Test string",
110
+ updateMask: "Test string",
111
+ }, {
112
+ action: "Test string",
113
+ createTime: "Test string",
114
+ description: "Test string",
115
+ labels: {
116
+ A: "Test string"
117
+ },
118
+ name: "Test string",
119
+ rules: [
120
+ {
121
+ destinations: [
122
+ {
123
+ hosts: [
124
+ "Test string"
125
+ ],
126
+ httpHeaderMatch: {
127
+ headerName: "Test string",
128
+ regexMatch: "Test string",
129
+ },
130
+ methods: [
131
+ "Test string"
132
+ ],
133
+ ports: [
134
+ 42
135
+ ],
136
+ }
137
+ ],
138
+ sources: [
139
+ {
140
+ ipBlocks: [
141
+ "Test string"
142
+ ],
143
+ principals: [
144
+ "Test string"
145
+ ],
146
+ }
147
+ ],
148
+ }
149
+ ],
150
+ updateTime: "Test string",
151
+ });
152
+ /** Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. */
153
+ await gapi.client.networksecurity.projects.locations.authorizationPolicies.setIamPolicy({
154
+ resource: "Test string",
155
+ }, {
156
+ policy: {
157
+ auditConfigs: [
158
+ {
159
+ auditLogConfigs: [
160
+ {
161
+ exemptedMembers: [
162
+ "Test string"
163
+ ],
164
+ logType: "Test string",
165
+ }
166
+ ],
167
+ service: "Test string",
168
+ }
169
+ ],
170
+ bindings: [
171
+ {
172
+ condition: {
173
+ description: "Test string",
174
+ expression: "Test string",
175
+ location: "Test string",
176
+ title: "Test string",
177
+ },
178
+ members: [
179
+ "Test string"
180
+ ],
181
+ role: "Test string",
182
+ }
183
+ ],
184
+ etag: "Test string",
185
+ version: 42,
186
+ },
187
+ updateMask: "Test string",
188
+ });
189
+ /**
190
+ * 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
191
+ * 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.
192
+ */
193
+ await gapi.client.networksecurity.projects.locations.authorizationPolicies.testIamPermissions({
194
+ resource: "Test string",
195
+ }, {
196
+ permissions: [
197
+ "Test string"
198
+ ],
199
+ });
200
+ /** Creates a new ClientTlsPolicy in a given project and location. */
201
+ await gapi.client.networksecurity.projects.locations.clientTlsPolicies.create({
202
+ clientTlsPolicyId: "Test string",
203
+ parent: "Test string",
204
+ }, {
205
+ clientCertificate: {
206
+ certificateProviderInstance: {
207
+ pluginInstance: "Test string",
208
+ },
209
+ grpcEndpoint: {
210
+ targetUri: "Test string",
211
+ },
212
+ },
213
+ createTime: "Test string",
214
+ description: "Test string",
215
+ labels: {
216
+ A: "Test string"
217
+ },
218
+ name: "Test string",
219
+ serverValidationCa: [
220
+ {
221
+ certificateProviderInstance: {
222
+ pluginInstance: "Test string",
223
+ },
224
+ grpcEndpoint: {
225
+ targetUri: "Test string",
226
+ },
227
+ }
228
+ ],
229
+ sni: "Test string",
230
+ updateTime: "Test string",
231
+ });
232
+ /** Deletes a single ClientTlsPolicy. */
233
+ await gapi.client.networksecurity.projects.locations.clientTlsPolicies.delete({
234
+ name: "Test string",
235
+ });
236
+ /** Gets details of a single ClientTlsPolicy. */
237
+ await gapi.client.networksecurity.projects.locations.clientTlsPolicies.get({
238
+ name: "Test string",
239
+ });
240
+ /** Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. */
241
+ await gapi.client.networksecurity.projects.locations.clientTlsPolicies.getIamPolicy({
242
+ "options.requestedPolicyVersion": 42,
243
+ resource: "Test string",
244
+ });
245
+ /** Lists ClientTlsPolicies in a given project and location. */
246
+ await gapi.client.networksecurity.projects.locations.clientTlsPolicies.list({
247
+ pageSize: 42,
248
+ pageToken: "Test string",
249
+ parent: "Test string",
250
+ });
251
+ /** Updates the parameters of a single ClientTlsPolicy. */
252
+ await gapi.client.networksecurity.projects.locations.clientTlsPolicies.patch({
253
+ name: "Test string",
254
+ updateMask: "Test string",
255
+ }, {
256
+ clientCertificate: {
257
+ certificateProviderInstance: {
258
+ pluginInstance: "Test string",
259
+ },
260
+ grpcEndpoint: {
261
+ targetUri: "Test string",
262
+ },
263
+ },
264
+ createTime: "Test string",
265
+ description: "Test string",
266
+ labels: {
267
+ A: "Test string"
268
+ },
269
+ name: "Test string",
270
+ serverValidationCa: [
271
+ {
272
+ certificateProviderInstance: {
273
+ pluginInstance: "Test string",
274
+ },
275
+ grpcEndpoint: {
276
+ targetUri: "Test string",
277
+ },
278
+ }
279
+ ],
280
+ sni: "Test string",
281
+ updateTime: "Test string",
282
+ });
283
+ /** Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. */
284
+ await gapi.client.networksecurity.projects.locations.clientTlsPolicies.setIamPolicy({
285
+ resource: "Test string",
286
+ }, {
287
+ policy: {
288
+ auditConfigs: [
289
+ {
290
+ auditLogConfigs: [
291
+ {
292
+ exemptedMembers: [
293
+ "Test string"
294
+ ],
295
+ logType: "Test string",
296
+ }
297
+ ],
298
+ service: "Test string",
299
+ }
300
+ ],
301
+ bindings: [
302
+ {
303
+ condition: {
304
+ description: "Test string",
305
+ expression: "Test string",
306
+ location: "Test string",
307
+ title: "Test string",
308
+ },
309
+ members: [
310
+ "Test string"
311
+ ],
312
+ role: "Test string",
313
+ }
314
+ ],
315
+ etag: "Test string",
316
+ version: 42,
317
+ },
318
+ updateMask: "Test string",
319
+ });
320
+ /**
321
+ * 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
322
+ * 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.
323
+ */
324
+ await gapi.client.networksecurity.projects.locations.clientTlsPolicies.testIamPermissions({
325
+ resource: "Test string",
326
+ }, {
327
+ permissions: [
328
+ "Test string"
329
+ ],
330
+ });
331
+ /**
332
+ * 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
333
+ * 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
334
+ * 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
335
+ * 1, corresponding to `Code.CANCELLED`.
336
+ */
337
+ await gapi.client.networksecurity.projects.locations.operations.cancel({
338
+ name: "Test string",
339
+ }, {
340
+ });
341
+ /**
342
+ * 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
343
+ * this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
344
+ */
345
+ await gapi.client.networksecurity.projects.locations.operations.delete({
346
+ name: "Test string",
347
+ });
348
+ /** 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. */
349
+ await gapi.client.networksecurity.projects.locations.operations.get({
350
+ name: "Test string",
351
+ });
352
+ /**
353
+ * 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
354
+ * 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
355
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
356
+ * ensure the name binding is the parent resource, without the operations collection id.
357
+ */
358
+ await gapi.client.networksecurity.projects.locations.operations.list({
359
+ filter: "Test string",
360
+ name: "Test string",
361
+ pageSize: 42,
362
+ pageToken: "Test string",
363
+ });
364
+ /** Creates a new ServerTlsPolicy in a given project and location. */
365
+ await gapi.client.networksecurity.projects.locations.serverTlsPolicies.create({
366
+ parent: "Test string",
367
+ serverTlsPolicyId: "Test string",
368
+ }, {
369
+ allowOpen: true,
370
+ createTime: "Test string",
371
+ description: "Test string",
372
+ labels: {
373
+ A: "Test string"
374
+ },
375
+ mtlsPolicy: {
376
+ clientValidationCa: [
377
+ {
378
+ certificateProviderInstance: {
379
+ pluginInstance: "Test string",
380
+ },
381
+ grpcEndpoint: {
382
+ targetUri: "Test string",
383
+ },
384
+ }
385
+ ],
386
+ },
387
+ name: "Test string",
388
+ serverCertificate: {
389
+ certificateProviderInstance: {
390
+ pluginInstance: "Test string",
391
+ },
392
+ grpcEndpoint: {
393
+ targetUri: "Test string",
394
+ },
395
+ },
396
+ updateTime: "Test string",
397
+ });
398
+ /** Deletes a single ServerTlsPolicy. */
399
+ await gapi.client.networksecurity.projects.locations.serverTlsPolicies.delete({
400
+ name: "Test string",
401
+ });
402
+ /** Gets details of a single ServerTlsPolicy. */
403
+ await gapi.client.networksecurity.projects.locations.serverTlsPolicies.get({
404
+ name: "Test string",
405
+ });
406
+ /** Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. */
407
+ await gapi.client.networksecurity.projects.locations.serverTlsPolicies.getIamPolicy({
408
+ "options.requestedPolicyVersion": 42,
409
+ resource: "Test string",
410
+ });
411
+ /** Lists ServerTlsPolicies in a given project and location. */
412
+ await gapi.client.networksecurity.projects.locations.serverTlsPolicies.list({
413
+ pageSize: 42,
414
+ pageToken: "Test string",
415
+ parent: "Test string",
416
+ });
417
+ /** Updates the parameters of a single ServerTlsPolicy. */
418
+ await gapi.client.networksecurity.projects.locations.serverTlsPolicies.patch({
419
+ name: "Test string",
420
+ updateMask: "Test string",
421
+ }, {
422
+ allowOpen: true,
423
+ createTime: "Test string",
424
+ description: "Test string",
425
+ labels: {
426
+ A: "Test string"
427
+ },
428
+ mtlsPolicy: {
429
+ clientValidationCa: [
430
+ {
431
+ certificateProviderInstance: {
432
+ pluginInstance: "Test string",
433
+ },
434
+ grpcEndpoint: {
435
+ targetUri: "Test string",
436
+ },
437
+ }
438
+ ],
439
+ },
440
+ name: "Test string",
441
+ serverCertificate: {
442
+ certificateProviderInstance: {
443
+ pluginInstance: "Test string",
444
+ },
445
+ grpcEndpoint: {
446
+ targetUri: "Test string",
447
+ },
448
+ },
449
+ updateTime: "Test string",
450
+ });
451
+ /** Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. */
452
+ await gapi.client.networksecurity.projects.locations.serverTlsPolicies.setIamPolicy({
453
+ resource: "Test string",
454
+ }, {
455
+ policy: {
456
+ auditConfigs: [
457
+ {
458
+ auditLogConfigs: [
459
+ {
460
+ exemptedMembers: [
461
+ "Test string"
462
+ ],
463
+ logType: "Test string",
464
+ }
465
+ ],
466
+ service: "Test string",
467
+ }
468
+ ],
469
+ bindings: [
470
+ {
471
+ condition: {
472
+ description: "Test string",
473
+ expression: "Test string",
474
+ location: "Test string",
475
+ title: "Test string",
476
+ },
477
+ members: [
478
+ "Test string"
479
+ ],
480
+ role: "Test string",
481
+ }
482
+ ],
483
+ etag: "Test string",
484
+ version: 42,
485
+ },
486
+ updateMask: "Test string",
487
+ });
488
+ /**
489
+ * 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
490
+ * 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.
491
+ */
492
+ await gapi.client.networksecurity.projects.locations.serverTlsPolicies.testIamPermissions({
493
+ resource: "Test string",
494
+ }, {
495
+ permissions: [
496
+ "Test string"
497
+ ],
498
+ });
499
+ }
500
+ });
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
+ }