@maxim_mazurok/gapi.client.cloudasset-v1beta1 0.0.20220805

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.cloudasset-v1beta1",
3
+ "version": "0.0.20220805",
4
+ "description": "TypeScript typings for Cloud Asset 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,93 @@
1
+ # TypeScript typings for Cloud Asset API v1beta1
2
+
3
+ The cloud asset API manages the history and inventory of cloud resources.
4
+ For detailed description please check [documentation](https://cloud.google.com/asset-inventory/docs/quickstart).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud Asset API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.cloudasset-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://cloudasset.googleapis.com/$discovery/rest?version=v1beta1', () => {
29
+ // now we can use:
30
+ // gapi.client.cloudasset
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('cloudasset', 'v1beta1', () => {
37
+ // now we can use:
38
+ // gapi.client.cloudasset
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 Asset API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+
69
+ /*
70
+ Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
71
+ */
72
+ await gapi.client.cloudasset.folders.exportAssets({ parent: "parent", });
73
+
74
+ /*
75
+ Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.
76
+ */
77
+ await gapi.client.cloudasset.organizations.batchGetAssetsHistory({ parent: "parent", });
78
+
79
+ /*
80
+ Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
81
+ */
82
+ await gapi.client.cloudasset.organizations.exportAssets({ parent: "parent", });
83
+
84
+ /*
85
+ Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.
86
+ */
87
+ await gapi.client.cloudasset.projects.batchGetAssetsHistory({ parent: "parent", });
88
+
89
+ /*
90
+ Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.
91
+ */
92
+ await gapi.client.cloudasset.projects.exportAssets({ parent: "parent", });
93
+ ```
package/tests.ts ADDED
@@ -0,0 +1,129 @@
1
+ /* This is stub file for gapi.client.cloudasset-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: 20220805
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://cloudasset.googleapis.com/$discovery/rest?version=v1beta1');
12
+ /** now we can use gapi.client.cloudasset */
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
+ /**
33
+ * Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API
34
+ * allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the
35
+ * export operation usually finishes within 5 minutes.
36
+ */
37
+ await gapi.client.cloudasset.folders.exportAssets({
38
+ parent: "Test string",
39
+ }, {
40
+ assetTypes: [
41
+ "Test string"
42
+ ],
43
+ contentType: "Test string",
44
+ outputConfig: {
45
+ gcsDestination: {
46
+ uri: "Test string",
47
+ uriPrefix: "Test string",
48
+ },
49
+ },
50
+ readTime: "Test string",
51
+ });
52
+ /** 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. */
53
+ await gapi.client.cloudasset.folders.operations.get({
54
+ name: "Test string",
55
+ });
56
+ /**
57
+ * Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can
58
+ * create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an
59
+ * INVALID_ARGUMENT error.
60
+ */
61
+ await gapi.client.cloudasset.organizations.batchGetAssetsHistory({
62
+ assetNames: "Test string",
63
+ contentType: "Test string",
64
+ parent: "Test string",
65
+ "readTimeWindow.endTime": "Test string",
66
+ "readTimeWindow.startTime": "Test string",
67
+ });
68
+ /**
69
+ * Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API
70
+ * allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the
71
+ * export operation usually finishes within 5 minutes.
72
+ */
73
+ await gapi.client.cloudasset.organizations.exportAssets({
74
+ parent: "Test string",
75
+ }, {
76
+ assetTypes: [
77
+ "Test string"
78
+ ],
79
+ contentType: "Test string",
80
+ outputConfig: {
81
+ gcsDestination: {
82
+ uri: "Test string",
83
+ uriPrefix: "Test string",
84
+ },
85
+ },
86
+ readTime: "Test string",
87
+ });
88
+ /** 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. */
89
+ await gapi.client.cloudasset.organizations.operations.get({
90
+ name: "Test string",
91
+ });
92
+ /**
93
+ * Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can
94
+ * create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an
95
+ * INVALID_ARGUMENT error.
96
+ */
97
+ await gapi.client.cloudasset.projects.batchGetAssetsHistory({
98
+ assetNames: "Test string",
99
+ contentType: "Test string",
100
+ parent: "Test string",
101
+ "readTimeWindow.endTime": "Test string",
102
+ "readTimeWindow.startTime": "Test string",
103
+ });
104
+ /**
105
+ * Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the google.longrunning.Operation API
106
+ * allowing you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the
107
+ * export operation usually finishes within 5 minutes.
108
+ */
109
+ await gapi.client.cloudasset.projects.exportAssets({
110
+ parent: "Test string",
111
+ }, {
112
+ assetTypes: [
113
+ "Test string"
114
+ ],
115
+ contentType: "Test string",
116
+ outputConfig: {
117
+ gcsDestination: {
118
+ uri: "Test string",
119
+ uriPrefix: "Test string",
120
+ },
121
+ },
122
+ readTime: "Test string",
123
+ });
124
+ /** 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. */
125
+ await gapi.client.cloudasset.projects.operations.get({
126
+ name: "Test string",
127
+ });
128
+ }
129
+ });
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
+ }