@maxim_mazurok/gapi.client.securitycenter-v1beta1 0.0.20220809
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 +2307 -0
- package/package.json +20 -0
- package/readme.md +78 -0
- package/tests.ts +292 -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.securitycenter-v1beta1",
|
|
3
|
+
"version": "0.0.20220809",
|
|
4
|
+
"description": "TypeScript typings for Security Command Center API v1beta1",
|
|
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,78 @@
|
|
|
1
|
+
# TypeScript typings for Security Command Center API v1beta1
|
|
2
|
+
|
|
3
|
+
Security Command Center API provides access to temporal views of assets and findings within an organization.
|
|
4
|
+
For detailed description please check [documentation](https://cloud.google.com/security-command-center).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Security Command Center API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.securitycenter-v1beta1 --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://securitycenter.googleapis.com/$discovery/rest?version=v1beta1', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.securitycenter
|
|
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('securitycenter', 'v1beta1', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.securitycenter
|
|
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 Security Command Center API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
Gets the settings for an organization.
|
|
71
|
+
*/
|
|
72
|
+
await gapi.client.securitycenter.organizations.getOrganizationSettings({ name: "name", });
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
Updates an organization's settings.
|
|
76
|
+
*/
|
|
77
|
+
await gapi.client.securitycenter.organizations.updateOrganizationSettings({ name: "name", });
|
|
78
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.securitycenter-v1beta1 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: 20220809
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://securitycenter.googleapis.com/$discovery/rest?version=v1beta1');
|
|
12
|
+
/** now we can use gapi.client.securitycenter */
|
|
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 the settings for an organization. */
|
|
33
|
+
await gapi.client.securitycenter.organizations.getOrganizationSettings({
|
|
34
|
+
name: "Test string",
|
|
35
|
+
});
|
|
36
|
+
/** Updates an organization's settings. */
|
|
37
|
+
await gapi.client.securitycenter.organizations.updateOrganizationSettings({
|
|
38
|
+
name: "Test string",
|
|
39
|
+
updateMask: "Test string",
|
|
40
|
+
}, {
|
|
41
|
+
assetDiscoveryConfig: {
|
|
42
|
+
inclusionMode: "Test string",
|
|
43
|
+
projectIds: [
|
|
44
|
+
"Test string"
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
enableAssetDiscovery: true,
|
|
48
|
+
name: "Test string",
|
|
49
|
+
});
|
|
50
|
+
/** Filters an organization's assets and groups them by their specified properties. */
|
|
51
|
+
await gapi.client.securitycenter.organizations.assets.group({
|
|
52
|
+
parent: "Test string",
|
|
53
|
+
}, {
|
|
54
|
+
compareDuration: "Test string",
|
|
55
|
+
filter: "Test string",
|
|
56
|
+
groupBy: "Test string",
|
|
57
|
+
pageSize: 42,
|
|
58
|
+
pageToken: "Test string",
|
|
59
|
+
readTime: "Test string",
|
|
60
|
+
});
|
|
61
|
+
/** Lists an organization's assets. */
|
|
62
|
+
await gapi.client.securitycenter.organizations.assets.list({
|
|
63
|
+
compareDuration: "Test string",
|
|
64
|
+
fieldMask: "Test string",
|
|
65
|
+
filter: "Test string",
|
|
66
|
+
orderBy: "Test string",
|
|
67
|
+
pageSize: 42,
|
|
68
|
+
pageToken: "Test string",
|
|
69
|
+
parent: "Test string",
|
|
70
|
+
readTime: "Test string",
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* Runs asset discovery. The discovery is tracked with a long-running operation. This API can only be called with limited frequency for an organization. If it is called too frequently the
|
|
74
|
+
* caller will receive a TOO_MANY_REQUESTS error.
|
|
75
|
+
*/
|
|
76
|
+
await gapi.client.securitycenter.organizations.assets.runDiscovery({
|
|
77
|
+
parent: "Test string",
|
|
78
|
+
}, {
|
|
79
|
+
});
|
|
80
|
+
/** Updates security marks. */
|
|
81
|
+
await gapi.client.securitycenter.organizations.assets.updateSecurityMarks({
|
|
82
|
+
name: "Test string",
|
|
83
|
+
startTime: "Test string",
|
|
84
|
+
updateMask: "Test string",
|
|
85
|
+
}, {
|
|
86
|
+
marks: {
|
|
87
|
+
A: "Test string"
|
|
88
|
+
},
|
|
89
|
+
name: "Test string",
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* 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
|
|
93
|
+
* 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
|
|
94
|
+
* 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
|
|
95
|
+
* 1, corresponding to `Code.CANCELLED`.
|
|
96
|
+
*/
|
|
97
|
+
await gapi.client.securitycenter.organizations.operations.cancel({
|
|
98
|
+
name: "Test string",
|
|
99
|
+
}, {
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* 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
|
|
103
|
+
* this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
|
|
104
|
+
*/
|
|
105
|
+
await gapi.client.securitycenter.organizations.operations.delete({
|
|
106
|
+
name: "Test string",
|
|
107
|
+
});
|
|
108
|
+
/** 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. */
|
|
109
|
+
await gapi.client.securitycenter.organizations.operations.get({
|
|
110
|
+
name: "Test string",
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* 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
|
|
114
|
+
* 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
|
|
115
|
+
* `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
|
|
116
|
+
* ensure the name binding is the parent resource, without the operations collection id.
|
|
117
|
+
*/
|
|
118
|
+
await gapi.client.securitycenter.organizations.operations.list({
|
|
119
|
+
filter: "Test string",
|
|
120
|
+
name: "Test string",
|
|
121
|
+
pageSize: 42,
|
|
122
|
+
pageToken: "Test string",
|
|
123
|
+
});
|
|
124
|
+
/** Creates a source. */
|
|
125
|
+
await gapi.client.securitycenter.organizations.sources.create({
|
|
126
|
+
parent: "Test string",
|
|
127
|
+
}, {
|
|
128
|
+
description: "Test string",
|
|
129
|
+
displayName: "Test string",
|
|
130
|
+
name: "Test string",
|
|
131
|
+
});
|
|
132
|
+
/** Gets a source. */
|
|
133
|
+
await gapi.client.securitycenter.organizations.sources.get({
|
|
134
|
+
name: "Test string",
|
|
135
|
+
});
|
|
136
|
+
/** Gets the access control policy on the specified Source. */
|
|
137
|
+
await gapi.client.securitycenter.organizations.sources.getIamPolicy({
|
|
138
|
+
resource: "Test string",
|
|
139
|
+
}, {
|
|
140
|
+
options: {
|
|
141
|
+
requestedPolicyVersion: 42,
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
/** Lists all sources belonging to an organization. */
|
|
145
|
+
await gapi.client.securitycenter.organizations.sources.list({
|
|
146
|
+
pageSize: 42,
|
|
147
|
+
pageToken: "Test string",
|
|
148
|
+
parent: "Test string",
|
|
149
|
+
});
|
|
150
|
+
/** Updates a source. */
|
|
151
|
+
await gapi.client.securitycenter.organizations.sources.patch({
|
|
152
|
+
name: "Test string",
|
|
153
|
+
updateMask: "Test string",
|
|
154
|
+
}, {
|
|
155
|
+
description: "Test string",
|
|
156
|
+
displayName: "Test string",
|
|
157
|
+
name: "Test string",
|
|
158
|
+
});
|
|
159
|
+
/** Sets the access control policy on the specified Source. */
|
|
160
|
+
await gapi.client.securitycenter.organizations.sources.setIamPolicy({
|
|
161
|
+
resource: "Test string",
|
|
162
|
+
}, {
|
|
163
|
+
policy: {
|
|
164
|
+
auditConfigs: [
|
|
165
|
+
{
|
|
166
|
+
auditLogConfigs: [
|
|
167
|
+
{
|
|
168
|
+
exemptedMembers: [
|
|
169
|
+
"Test string"
|
|
170
|
+
],
|
|
171
|
+
logType: "Test string",
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
service: "Test string",
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
bindings: [
|
|
178
|
+
{
|
|
179
|
+
condition: {
|
|
180
|
+
description: "Test string",
|
|
181
|
+
expression: "Test string",
|
|
182
|
+
location: "Test string",
|
|
183
|
+
title: "Test string",
|
|
184
|
+
},
|
|
185
|
+
members: [
|
|
186
|
+
"Test string"
|
|
187
|
+
],
|
|
188
|
+
role: "Test string",
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
etag: "Test string",
|
|
192
|
+
version: 42,
|
|
193
|
+
},
|
|
194
|
+
updateMask: "Test string",
|
|
195
|
+
});
|
|
196
|
+
/** Returns the permissions that a caller has on the specified source. */
|
|
197
|
+
await gapi.client.securitycenter.organizations.sources.testIamPermissions({
|
|
198
|
+
resource: "Test string",
|
|
199
|
+
}, {
|
|
200
|
+
permissions: [
|
|
201
|
+
"Test string"
|
|
202
|
+
],
|
|
203
|
+
});
|
|
204
|
+
/** Creates a finding. The corresponding source must exist for finding creation to succeed. */
|
|
205
|
+
await gapi.client.securitycenter.organizations.sources.findings.create({
|
|
206
|
+
findingId: "Test string",
|
|
207
|
+
parent: "Test string",
|
|
208
|
+
}, {
|
|
209
|
+
category: "Test string",
|
|
210
|
+
createTime: "Test string",
|
|
211
|
+
eventTime: "Test string",
|
|
212
|
+
externalUri: "Test string",
|
|
213
|
+
name: "Test string",
|
|
214
|
+
parent: "Test string",
|
|
215
|
+
resourceName: "Test string",
|
|
216
|
+
securityMarks: {
|
|
217
|
+
marks: {
|
|
218
|
+
A: "Test string"
|
|
219
|
+
},
|
|
220
|
+
name: "Test string",
|
|
221
|
+
},
|
|
222
|
+
sourceProperties: {
|
|
223
|
+
A: 42
|
|
224
|
+
},
|
|
225
|
+
state: "Test string",
|
|
226
|
+
});
|
|
227
|
+
/**
|
|
228
|
+
* Filters an organization or source's findings and groups them by their specified properties. To group across all sources provide a `-` as the source id. Example:
|
|
229
|
+
* /v1beta1/organizations/{organization_id}/sources/-/findings
|
|
230
|
+
*/
|
|
231
|
+
await gapi.client.securitycenter.organizations.sources.findings.group({
|
|
232
|
+
parent: "Test string",
|
|
233
|
+
}, {
|
|
234
|
+
filter: "Test string",
|
|
235
|
+
groupBy: "Test string",
|
|
236
|
+
pageSize: 42,
|
|
237
|
+
pageToken: "Test string",
|
|
238
|
+
readTime: "Test string",
|
|
239
|
+
});
|
|
240
|
+
/** Lists an organization or source's findings. To list across all sources provide a `-` as the source id. Example: /v1beta1/organizations/{organization_id}/sources/-/findings */
|
|
241
|
+
await gapi.client.securitycenter.organizations.sources.findings.list({
|
|
242
|
+
fieldMask: "Test string",
|
|
243
|
+
filter: "Test string",
|
|
244
|
+
orderBy: "Test string",
|
|
245
|
+
pageSize: 42,
|
|
246
|
+
pageToken: "Test string",
|
|
247
|
+
parent: "Test string",
|
|
248
|
+
readTime: "Test string",
|
|
249
|
+
});
|
|
250
|
+
/** Creates or updates a finding. The corresponding source must exist for a finding creation to succeed. */
|
|
251
|
+
await gapi.client.securitycenter.organizations.sources.findings.patch({
|
|
252
|
+
name: "Test string",
|
|
253
|
+
updateMask: "Test string",
|
|
254
|
+
}, {
|
|
255
|
+
category: "Test string",
|
|
256
|
+
createTime: "Test string",
|
|
257
|
+
eventTime: "Test string",
|
|
258
|
+
externalUri: "Test string",
|
|
259
|
+
name: "Test string",
|
|
260
|
+
parent: "Test string",
|
|
261
|
+
resourceName: "Test string",
|
|
262
|
+
securityMarks: {
|
|
263
|
+
marks: {
|
|
264
|
+
A: "Test string"
|
|
265
|
+
},
|
|
266
|
+
name: "Test string",
|
|
267
|
+
},
|
|
268
|
+
sourceProperties: {
|
|
269
|
+
A: 42
|
|
270
|
+
},
|
|
271
|
+
state: "Test string",
|
|
272
|
+
});
|
|
273
|
+
/** Updates the state of a finding. */
|
|
274
|
+
await gapi.client.securitycenter.organizations.sources.findings.setState({
|
|
275
|
+
name: "Test string",
|
|
276
|
+
}, {
|
|
277
|
+
startTime: "Test string",
|
|
278
|
+
state: "Test string",
|
|
279
|
+
});
|
|
280
|
+
/** Updates security marks. */
|
|
281
|
+
await gapi.client.securitycenter.organizations.sources.findings.updateSecurityMarks({
|
|
282
|
+
name: "Test string",
|
|
283
|
+
startTime: "Test string",
|
|
284
|
+
updateMask: "Test string",
|
|
285
|
+
}, {
|
|
286
|
+
marks: {
|
|
287
|
+
A: "Test string"
|
|
288
|
+
},
|
|
289
|
+
name: "Test string",
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
});
|
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
|
+
}
|