@maxim_mazurok/gapi.client.gkehub-v2alpha 0.0.20220729

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 ADDED
@@ -0,0 +1,289 @@
1
+ /* Type definitions for non-npm package GKE Hub API v2alpha 0.0 */
2
+ // Project: https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster
3
+ // Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
4
+ // Nick Amoscato <https://github.com/namoscato>
5
+ // Declan Vong <https://github.com/declanvong>
6
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
+ // TypeScript Version: 2.8
8
+
9
+ // IMPORTANT
10
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
11
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
12
+ // Generated from: https://gkehub.googleapis.com/$discovery/rest?version=v2alpha
13
+ // Revision: 20220729
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load GKE Hub API v2alpha */
19
+ function load(urlOrObject: "https://gkehub.googleapis.com/$discovery/rest?version=v2alpha"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "gkehub", version: "v2alpha"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "gkehub", version: "v2alpha", callback: () => any): void;
24
+
25
+ namespace gkehub {
26
+ // tslint:disable-next-line:no-empty-interface
27
+ interface CancelOperationRequest {
28
+ }
29
+ // tslint:disable-next-line:no-empty-interface
30
+ interface Empty {
31
+ }
32
+ interface GoogleRpcStatus {
33
+ /** The status code, which should be an enum value of google.rpc.Code. */
34
+ code?: number;
35
+ /** A list of messages that carry the error details. There is a common set of message types for APIs to use. */
36
+ details?: Array<{ [P in string]: any }>;
37
+ /**
38
+ * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the
39
+ * client.
40
+ */
41
+ message?: string;
42
+ }
43
+ interface ListLocationsResponse {
44
+ /** A list of locations that matches the specified filter in the request. */
45
+ locations?: Location[];
46
+ /** The standard List next-page token. */
47
+ nextPageToken?: string;
48
+ }
49
+ interface ListOperationsResponse {
50
+ /** The standard List next-page token. */
51
+ nextPageToken?: string;
52
+ /** A list of operations that matches the specified filter in the request. */
53
+ operations?: Operation[];
54
+ }
55
+ interface Location {
56
+ /** The friendly name for this location, typically a nearby city name. For example, "Tokyo". */
57
+ displayName?: string;
58
+ /** Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"} */
59
+ labels?: { [P in string]: string };
60
+ /** The canonical id for this location. For example: `"us-east1"`. */
61
+ locationId?: string;
62
+ /** Service-specific metadata. For example the available capacity at the given location. */
63
+ metadata?: { [P in string]: any };
64
+ /** Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"` */
65
+ name?: string;
66
+ }
67
+ interface Operation {
68
+ /** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */
69
+ done?: boolean;
70
+ /** The error result of the operation in case of failure or cancellation. */
71
+ error?: GoogleRpcStatus;
72
+ /**
73
+ * Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such
74
+ * metadata. Any method that returns a long-running operation should document the metadata type, if any.
75
+ */
76
+ metadata?: { [P in string]: any };
77
+ /**
78
+ * The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending
79
+ * with `operations/{unique_id}`.
80
+ */
81
+ name?: string;
82
+ /**
83
+ * The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the
84
+ * original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the
85
+ * original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
86
+ */
87
+ response?: { [P in string]: any };
88
+ }
89
+ interface OperationsResource {
90
+ /**
91
+ * 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
92
+ * this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the
93
+ * operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a
94
+ * google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
95
+ */
96
+ cancel(request: {
97
+ /** V1 error format. */
98
+ "$.xgafv"?: string;
99
+ /** OAuth access token. */
100
+ access_token?: string;
101
+ /** Data format for response. */
102
+ alt?: string;
103
+ /** JSONP */
104
+ callback?: string;
105
+ /** Selector specifying which fields to include in a partial response. */
106
+ fields?: string;
107
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
108
+ key?: string;
109
+ /** The name of the operation resource to be cancelled. */
110
+ name: string;
111
+ /** OAuth 2.0 token for the current user. */
112
+ oauth_token?: string;
113
+ /** Returns response with indentations and line breaks. */
114
+ prettyPrint?: boolean;
115
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
116
+ quotaUser?: string;
117
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
118
+ upload_protocol?: string;
119
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
120
+ uploadType?: string;
121
+ /** Request body */
122
+ resource: CancelOperationRequest;
123
+ }): Request<{}>;
124
+ cancel(request: {
125
+ /** V1 error format. */
126
+ "$.xgafv"?: string;
127
+ /** OAuth access token. */
128
+ access_token?: string;
129
+ /** Data format for response. */
130
+ alt?: string;
131
+ /** JSONP */
132
+ callback?: string;
133
+ /** Selector specifying which fields to include in a partial response. */
134
+ fields?: string;
135
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
136
+ key?: string;
137
+ /** The name of the operation resource to be cancelled. */
138
+ name: string;
139
+ /** OAuth 2.0 token for the current user. */
140
+ oauth_token?: string;
141
+ /** Returns response with indentations and line breaks. */
142
+ prettyPrint?: boolean;
143
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
144
+ quotaUser?: string;
145
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
146
+ upload_protocol?: string;
147
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
148
+ uploadType?: string;
149
+ },
150
+ body: CancelOperationRequest): Request<{}>;
151
+ /** 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. */
152
+ get(request?: {
153
+ /** V1 error format. */
154
+ "$.xgafv"?: string;
155
+ /** OAuth access token. */
156
+ access_token?: string;
157
+ /** Data format for response. */
158
+ alt?: string;
159
+ /** JSONP */
160
+ callback?: string;
161
+ /** Selector specifying which fields to include in a partial response. */
162
+ fields?: string;
163
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
164
+ key?: string;
165
+ /** The name of the operation resource. */
166
+ name: string;
167
+ /** OAuth 2.0 token for the current user. */
168
+ oauth_token?: string;
169
+ /** Returns response with indentations and line breaks. */
170
+ prettyPrint?: boolean;
171
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
172
+ quotaUser?: string;
173
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
174
+ upload_protocol?: string;
175
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
176
+ uploadType?: string;
177
+ }): Request<Operation>;
178
+ /**
179
+ * 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
180
+ * 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
181
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
182
+ * ensure the name binding is the parent resource, without the operations collection id.
183
+ */
184
+ list(request?: {
185
+ /** V1 error format. */
186
+ "$.xgafv"?: string;
187
+ /** OAuth access token. */
188
+ access_token?: string;
189
+ /** Data format for response. */
190
+ alt?: string;
191
+ /** JSONP */
192
+ callback?: string;
193
+ /** Selector specifying which fields to include in a partial response. */
194
+ fields?: string;
195
+ /** The standard list filter. */
196
+ filter?: string;
197
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
198
+ key?: string;
199
+ /** The name of the operation's parent resource. */
200
+ name: string;
201
+ /** OAuth 2.0 token for the current user. */
202
+ oauth_token?: string;
203
+ /** The standard list page size. */
204
+ pageSize?: number;
205
+ /** The standard list page token. */
206
+ pageToken?: string;
207
+ /** Returns response with indentations and line breaks. */
208
+ prettyPrint?: boolean;
209
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
210
+ quotaUser?: string;
211
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
212
+ upload_protocol?: string;
213
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
214
+ uploadType?: string;
215
+ }): Request<ListOperationsResponse>;
216
+ }
217
+ interface LocationsResource {
218
+ /** Gets information about a location. */
219
+ get(request?: {
220
+ /** V1 error format. */
221
+ "$.xgafv"?: string;
222
+ /** OAuth access token. */
223
+ access_token?: string;
224
+ /** Data format for response. */
225
+ alt?: string;
226
+ /** JSONP */
227
+ callback?: string;
228
+ /** Selector specifying which fields to include in a partial response. */
229
+ fields?: string;
230
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
231
+ key?: string;
232
+ /** Resource name for the location. */
233
+ name: string;
234
+ /** OAuth 2.0 token for the current user. */
235
+ oauth_token?: string;
236
+ /** Returns response with indentations and line breaks. */
237
+ prettyPrint?: boolean;
238
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
239
+ quotaUser?: string;
240
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
241
+ upload_protocol?: string;
242
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
243
+ uploadType?: string;
244
+ }): Request<Location>;
245
+ /** Lists information about the supported locations for this service. */
246
+ list(request?: {
247
+ /** V1 error format. */
248
+ "$.xgafv"?: string;
249
+ /** OAuth access token. */
250
+ access_token?: string;
251
+ /** Data format for response. */
252
+ alt?: string;
253
+ /** JSONP */
254
+ callback?: string;
255
+ /** Selector specifying which fields to include in a partial response. */
256
+ fields?: string;
257
+ /**
258
+ * A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in
259
+ * [AIP-160](https://google.aip.dev/160).
260
+ */
261
+ filter?: string;
262
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
263
+ key?: string;
264
+ /** The resource that owns the locations collection, if applicable. */
265
+ name: string;
266
+ /** OAuth 2.0 token for the current user. */
267
+ oauth_token?: string;
268
+ /** The maximum number of results to return. If not set, the service selects a default. */
269
+ pageSize?: number;
270
+ /** A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page. */
271
+ pageToken?: string;
272
+ /** Returns response with indentations and line breaks. */
273
+ prettyPrint?: boolean;
274
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
275
+ quotaUser?: string;
276
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
277
+ upload_protocol?: string;
278
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
279
+ uploadType?: string;
280
+ }): Request<ListLocationsResponse>;
281
+ operations: OperationsResource;
282
+ }
283
+ interface ProjectsResource {
284
+ locations: LocationsResource;
285
+ }
286
+
287
+ const projects: ProjectsResource;
288
+ }
289
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.gkehub-v2alpha",
3
+ "version": "0.0.20220729",
4
+ "description": "TypeScript typings for GKE Hub API v2alpha",
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 GKE Hub API v2alpha
2
+
3
+
4
+ For detailed description please check [documentation](https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster).
5
+
6
+ ## Installing
7
+
8
+ Install typings for GKE Hub API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.gkehub-v2alpha --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://gkehub.googleapis.com/$discovery/rest?version=v2alpha', () => {
29
+ // now we can use:
30
+ // gapi.client.gkehub
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('gkehub', 'v2alpha', () => {
37
+ // now we can use:
38
+ // gapi.client.gkehub
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 GKE Hub API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,70 @@
1
+ /* This is stub file for gapi.client.gkehub-v2alpha 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: 20220729
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://gkehub.googleapis.com/$discovery/rest?version=v2alpha');
12
+ /** now we can use gapi.client.gkehub */
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.gkehub.projects.locations.get({
34
+ name: "Test string",
35
+ });
36
+ /** Lists information about the supported locations for this service. */
37
+ await gapi.client.gkehub.projects.locations.list({
38
+ filter: "Test string",
39
+ name: "Test string",
40
+ pageSize: 42,
41
+ pageToken: "Test string",
42
+ });
43
+ /**
44
+ * 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
45
+ * 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
46
+ * 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
47
+ * 1, corresponding to `Code.CANCELLED`.
48
+ */
49
+ await gapi.client.gkehub.projects.locations.operations.cancel({
50
+ name: "Test string",
51
+ }, {
52
+ });
53
+ /** 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. */
54
+ await gapi.client.gkehub.projects.locations.operations.get({
55
+ name: "Test string",
56
+ });
57
+ /**
58
+ * 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
59
+ * 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
60
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
61
+ * ensure the name binding is the parent resource, without the operations collection id.
62
+ */
63
+ await gapi.client.gkehub.projects.locations.operations.list({
64
+ filter: "Test string",
65
+ name: "Test string",
66
+ pageSize: 42,
67
+ pageToken: "Test string",
68
+ });
69
+ }
70
+ });
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
+ }