@maxim_mazurok/gapi.client.serviceusage-v1beta1 0.0.20220811

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.serviceusage-v1beta1",
3
+ "version": "0.0.20220811",
4
+ "description": "TypeScript typings for Service Usage 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,114 @@
1
+ # TypeScript typings for Service Usage API v1beta1
2
+
3
+ Enables services that service consumers want to use on Google Cloud Platform, lists the available or enabled services, or disables services that service consumers no longer use.
4
+ For detailed description please check [documentation](https://cloud.google.com/service-usage/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Service Usage API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.serviceusage-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://serviceusage.googleapis.com/$discovery/rest?version=v1beta1', () => {
29
+ // now we can use:
30
+ // gapi.client.serviceusage
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('serviceusage', 'v1beta1', () => {
37
+ // now we can use:
38
+ // gapi.client.serviceusage
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
+ // View your data across Google Cloud services and see the email address of your Google Account
52
+ 'https://www.googleapis.com/auth/cloud-platform.read-only',
53
+
54
+ // Manage your Google API service configuration
55
+ 'https://www.googleapis.com/auth/service.management',
56
+ ],
57
+ immediate = true;
58
+ // ...
59
+
60
+ gapi.auth.authorize(
61
+ { client_id: client_id, scope: scope, immediate: immediate },
62
+ authResult => {
63
+ if (authResult && !authResult.error) {
64
+ /* handle successful authorization */
65
+ } else {
66
+ /* handle authorization error */
67
+ }
68
+ });
69
+ ```
70
+
71
+ After that you can use Service Usage API resources: <!-- TODO: make this work for multiple namespaces -->
72
+
73
+ ```typescript
74
+
75
+ /*
76
+ 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.
77
+ */
78
+ await gapi.client.serviceusage.operations.get({ name: "name", });
79
+
80
+ /*
81
+ 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 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 `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
82
+ */
83
+ await gapi.client.serviceusage.operations.list({ });
84
+
85
+ /*
86
+ Enables multiple services on a project. The operation is atomic: if enabling any service fails, then the entire batch fails, and no state changes occur. Operation response type: `google.protobuf.Empty`
87
+ */
88
+ await gapi.client.serviceusage.services.batchEnable({ parent: "parent", });
89
+
90
+ /*
91
+ Disables a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks. It is not valid to call the disable method on a service that is not currently enabled. Callers will receive a `FAILED_PRECONDITION` status if the target service is not currently enabled. Operation response type: `google.protobuf.Empty`
92
+ */
93
+ await gapi.client.serviceusage.services.disable({ name: "name", });
94
+
95
+ /*
96
+ Enables a service so that it can be used with a project. Operation response type: `google.protobuf.Empty`
97
+ */
98
+ await gapi.client.serviceusage.services.enable({ name: "name", });
99
+
100
+ /*
101
+ Generates service identity for service.
102
+ */
103
+ await gapi.client.serviceusage.services.generateServiceIdentity({ parent: "parent", });
104
+
105
+ /*
106
+ Returns the service configuration and enabled state for a given service.
107
+ */
108
+ await gapi.client.serviceusage.services.get({ name: "name", });
109
+
110
+ /*
111
+ Lists all services available to the specified project, and the current state of those services with respect to the project. The list includes all public services, all services for which the calling user has the `servicemanagement.services.bind` permission, and all services that have already been enabled on the project. The list can be filtered to only include services in a specific state, for example to only include services enabled on the project.
112
+ */
113
+ await gapi.client.serviceusage.services.list({ parent: "parent", });
114
+ ```
package/tests.ts ADDED
@@ -0,0 +1,261 @@
1
+ /* This is stub file for gapi.client.serviceusage-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: 20220811
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://serviceusage.googleapis.com/$discovery/rest?version=v1beta1');
12
+ /** now we can use gapi.client.serviceusage */
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
+ /** View your data across Google Cloud services and see the email address of your Google Account */
21
+ 'https://www.googleapis.com/auth/cloud-platform.read-only',
22
+ /** Manage your Google API service configuration */
23
+ 'https://www.googleapis.com/auth/service.management',
24
+ ];
25
+ const immediate = false;
26
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
27
+ if (authResult && !authResult.error) {
28
+ /** handle successful authorization */
29
+ run();
30
+ } else {
31
+ /** handle authorization error */
32
+ }
33
+ });
34
+
35
+ async function run() {
36
+ /** 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. */
37
+ await gapi.client.serviceusage.operations.get({
38
+ name: "Test string",
39
+ });
40
+ /**
41
+ * 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
42
+ * 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
43
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
44
+ * ensure the name binding is the parent resource, without the operations collection id.
45
+ */
46
+ await gapi.client.serviceusage.operations.list({
47
+ filter: "Test string",
48
+ name: "Test string",
49
+ pageSize: 42,
50
+ pageToken: "Test string",
51
+ });
52
+ /**
53
+ * Enables multiple services on a project. The operation is atomic: if enabling any service fails, then the entire batch fails, and no state changes occur. Operation response type:
54
+ * `google.protobuf.Empty`
55
+ */
56
+ await gapi.client.serviceusage.services.batchEnable({
57
+ parent: "Test string",
58
+ }, {
59
+ serviceIds: [
60
+ "Test string"
61
+ ],
62
+ });
63
+ /**
64
+ * Disables a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks. It is not valid to call
65
+ * the disable method on a service that is not currently enabled. Callers will receive a `FAILED_PRECONDITION` status if the target service is not currently enabled. Operation response
66
+ * type: `google.protobuf.Empty`
67
+ */
68
+ await gapi.client.serviceusage.services.disable({
69
+ name: "Test string",
70
+ }, {
71
+ });
72
+ /** Enables a service so that it can be used with a project. Operation response type: `google.protobuf.Empty` */
73
+ await gapi.client.serviceusage.services.enable({
74
+ name: "Test string",
75
+ }, {
76
+ });
77
+ /** Generates service identity for service. */
78
+ await gapi.client.serviceusage.services.generateServiceIdentity({
79
+ parent: "Test string",
80
+ });
81
+ /** Returns the service configuration and enabled state for a given service. */
82
+ await gapi.client.serviceusage.services.get({
83
+ name: "Test string",
84
+ });
85
+ /**
86
+ * Lists all services available to the specified project, and the current state of those services with respect to the project. The list includes all public services, all services for which
87
+ * the calling user has the `servicemanagement.services.bind` permission, and all services that have already been enabled on the project. The list can be filtered to only include services
88
+ * in a specific state, for example to only include services enabled on the project.
89
+ */
90
+ await gapi.client.serviceusage.services.list({
91
+ filter: "Test string",
92
+ pageSize: 42,
93
+ pageToken: "Test string",
94
+ parent: "Test string",
95
+ });
96
+ /** Retrieves a summary of quota information for a specific quota metric */
97
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.get({
98
+ name: "Test string",
99
+ view: "Test string",
100
+ });
101
+ /**
102
+ * Creates or updates multiple admin overrides atomically, all on the same consumer, but on many different metrics or limits. The name field in the quota override message should not be
103
+ * set.
104
+ */
105
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.importAdminOverrides({
106
+ parent: "Test string",
107
+ }, {
108
+ force: true,
109
+ forceOnly: [
110
+ "Test string"
111
+ ],
112
+ inlineSource: {
113
+ overrides: [
114
+ {
115
+ adminOverrideAncestor: "Test string",
116
+ dimensions: {
117
+ A: "Test string"
118
+ },
119
+ metric: "Test string",
120
+ name: "Test string",
121
+ overrideValue: "Test string",
122
+ unit: "Test string",
123
+ }
124
+ ],
125
+ },
126
+ });
127
+ /**
128
+ * Creates or updates multiple consumer overrides atomically, all on the same consumer, but on many different metrics or limits. The name field in the quota override message should not be
129
+ * set.
130
+ */
131
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.importConsumerOverrides({
132
+ parent: "Test string",
133
+ }, {
134
+ force: true,
135
+ forceOnly: [
136
+ "Test string"
137
+ ],
138
+ inlineSource: {
139
+ overrides: [
140
+ {
141
+ adminOverrideAncestor: "Test string",
142
+ dimensions: {
143
+ A: "Test string"
144
+ },
145
+ metric: "Test string",
146
+ name: "Test string",
147
+ overrideValue: "Test string",
148
+ unit: "Test string",
149
+ }
150
+ ],
151
+ },
152
+ });
153
+ /**
154
+ * Retrieves a summary of all quota information visible to the service consumer, organized by service metric. Each metric includes information about all of its defined limits. Each limit
155
+ * includes the limit configuration (quota unit, preciseness, default value), the current effective limit value, and all of the overrides applied to the limit.
156
+ */
157
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.list({
158
+ pageSize: 42,
159
+ pageToken: "Test string",
160
+ parent: "Test string",
161
+ view: "Test string",
162
+ });
163
+ /** Retrieves a summary of quota information for a specific quota limit. */
164
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.get({
165
+ name: "Test string",
166
+ view: "Test string",
167
+ });
168
+ /**
169
+ * Creates an admin override. An admin override is applied by an administrator of a parent folder or parent organization of the consumer receiving the override. An admin override is
170
+ * intended to limit the amount of quota the consumer can use out of the total quota pool allocated to all children of the folder or organization.
171
+ */
172
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.adminOverrides.create({
173
+ force: true,
174
+ forceOnly: "Test string",
175
+ parent: "Test string",
176
+ }, {
177
+ adminOverrideAncestor: "Test string",
178
+ dimensions: {
179
+ A: "Test string"
180
+ },
181
+ metric: "Test string",
182
+ name: "Test string",
183
+ overrideValue: "Test string",
184
+ unit: "Test string",
185
+ });
186
+ /** Deletes an admin override. */
187
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.adminOverrides.delete({
188
+ force: true,
189
+ forceOnly: "Test string",
190
+ name: "Test string",
191
+ });
192
+ /** Lists all admin overrides on this limit. */
193
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.adminOverrides.list({
194
+ pageSize: 42,
195
+ pageToken: "Test string",
196
+ parent: "Test string",
197
+ });
198
+ /** Updates an admin override. */
199
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.adminOverrides.patch({
200
+ force: true,
201
+ forceOnly: "Test string",
202
+ name: "Test string",
203
+ updateMask: "Test string",
204
+ }, {
205
+ adminOverrideAncestor: "Test string",
206
+ dimensions: {
207
+ A: "Test string"
208
+ },
209
+ metric: "Test string",
210
+ name: "Test string",
211
+ overrideValue: "Test string",
212
+ unit: "Test string",
213
+ });
214
+ /**
215
+ * Creates a consumer override. A consumer override is applied to the consumer on its own authority to limit its own quota usage. Consumer overrides cannot be used to grant more quota than
216
+ * would be allowed by admin overrides, producer overrides, or the default limit of the service.
217
+ */
218
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.consumerOverrides.create({
219
+ force: true,
220
+ forceOnly: "Test string",
221
+ parent: "Test string",
222
+ }, {
223
+ adminOverrideAncestor: "Test string",
224
+ dimensions: {
225
+ A: "Test string"
226
+ },
227
+ metric: "Test string",
228
+ name: "Test string",
229
+ overrideValue: "Test string",
230
+ unit: "Test string",
231
+ });
232
+ /** Deletes a consumer override. */
233
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.consumerOverrides.delete({
234
+ force: true,
235
+ forceOnly: "Test string",
236
+ name: "Test string",
237
+ });
238
+ /** Lists all consumer overrides on this limit. */
239
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.consumerOverrides.list({
240
+ pageSize: 42,
241
+ pageToken: "Test string",
242
+ parent: "Test string",
243
+ });
244
+ /** Updates a consumer override. */
245
+ await gapi.client.serviceusage.services.consumerQuotaMetrics.limits.consumerOverrides.patch({
246
+ force: true,
247
+ forceOnly: "Test string",
248
+ name: "Test string",
249
+ updateMask: "Test string",
250
+ }, {
251
+ adminOverrideAncestor: "Test string",
252
+ dimensions: {
253
+ A: "Test string"
254
+ },
255
+ metric: "Test string",
256
+ name: "Test string",
257
+ overrideValue: "Test string",
258
+ unit: "Test string",
259
+ });
260
+ }
261
+ });
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
+ }