@maxim_mazurok/gapi.client.redis-v1 0.0.20220728

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.redis-v1",
3
+ "version": "0.0.20220728",
4
+ "description": "TypeScript typings for Google Cloud Memorystore for Redis 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 Google Cloud Memorystore for Redis API v1
2
+
3
+ Creates and manages Redis instances on the Google Cloud Platform.
4
+ For detailed description please check [documentation](https://cloud.google.com/memorystore/docs/redis/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Google Cloud Memorystore for Redis API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.redis-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://redis.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.redis
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('redis', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.redis
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 Google Cloud Memorystore for Redis API resources: <!-- TODO: make this work for multiple namespaces -->
66
+
67
+ ```typescript
68
+ ```
package/tests.ts ADDED
@@ -0,0 +1,318 @@
1
+ /* This is stub file for gapi.client.redis-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: 20220728
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://redis.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.redis */
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.redis.projects.locations.get({
34
+ name: "Test string",
35
+ });
36
+ /** Lists information about the supported locations for this service. */
37
+ await gapi.client.redis.projects.locations.list({
38
+ filter: "Test string",
39
+ name: "Test string",
40
+ pageSize: 42,
41
+ pageToken: "Test string",
42
+ });
43
+ /**
44
+ * Creates a Redis instance based on the specified tier and memory size. By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc).
45
+ * The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional.
46
+ * Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to
47
+ * call DeleteOperation.
48
+ */
49
+ await gapi.client.redis.projects.locations.instances.create({
50
+ instanceId: "Test string",
51
+ parent: "Test string",
52
+ }, {
53
+ alternativeLocationId: "Test string",
54
+ authEnabled: true,
55
+ authorizedNetwork: "Test string",
56
+ connectMode: "Test string",
57
+ createTime: "Test string",
58
+ currentLocationId: "Test string",
59
+ customerManagedKey: "Test string",
60
+ displayName: "Test string",
61
+ host: "Test string",
62
+ labels: {
63
+ A: "Test string"
64
+ },
65
+ locationId: "Test string",
66
+ maintenancePolicy: {
67
+ createTime: "Test string",
68
+ description: "Test string",
69
+ updateTime: "Test string",
70
+ weeklyMaintenanceWindow: [
71
+ {
72
+ day: "Test string",
73
+ duration: "Test string",
74
+ startTime: {
75
+ hours: 42,
76
+ minutes: 42,
77
+ nanos: 42,
78
+ seconds: 42,
79
+ },
80
+ }
81
+ ],
82
+ },
83
+ maintenanceSchedule: {
84
+ canReschedule: true,
85
+ endTime: "Test string",
86
+ scheduleDeadlineTime: "Test string",
87
+ startTime: "Test string",
88
+ },
89
+ memorySizeGb: 42,
90
+ name: "Test string",
91
+ nodes: [
92
+ {
93
+ id: "Test string",
94
+ zone: "Test string",
95
+ }
96
+ ],
97
+ persistenceConfig: {
98
+ persistenceMode: "Test string",
99
+ rdbNextSnapshotTime: "Test string",
100
+ rdbSnapshotPeriod: "Test string",
101
+ rdbSnapshotStartTime: "Test string",
102
+ },
103
+ persistenceIamIdentity: "Test string",
104
+ port: 42,
105
+ readEndpoint: "Test string",
106
+ readEndpointPort: 42,
107
+ readReplicasMode: "Test string",
108
+ redisConfigs: {
109
+ A: "Test string"
110
+ },
111
+ redisVersion: "Test string",
112
+ replicaCount: 42,
113
+ reservedIpRange: "Test string",
114
+ secondaryIpRange: "Test string",
115
+ serverCaCerts: [
116
+ {
117
+ cert: "Test string",
118
+ createTime: "Test string",
119
+ expireTime: "Test string",
120
+ serialNumber: "Test string",
121
+ sha1Fingerprint: "Test string",
122
+ }
123
+ ],
124
+ state: "Test string",
125
+ statusMessage: "Test string",
126
+ suspensionReasons: [
127
+ "Test string"
128
+ ],
129
+ tier: "Test string",
130
+ transitEncryptionMode: "Test string",
131
+ });
132
+ /** Deletes a specific Redis instance. Instance stops serving and data is deleted. */
133
+ await gapi.client.redis.projects.locations.instances.delete({
134
+ name: "Test string",
135
+ });
136
+ /**
137
+ * Export Redis instance data into a Redis RDB format file in Cloud Storage. Redis will continue serving during this operation. The returned operation is automatically deleted after a few
138
+ * hours, so there is no need to call DeleteOperation.
139
+ */
140
+ await gapi.client.redis.projects.locations.instances.export({
141
+ name: "Test string",
142
+ }, {
143
+ outputConfig: {
144
+ gcsDestination: {
145
+ uri: "Test string",
146
+ },
147
+ },
148
+ });
149
+ /** Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance. */
150
+ await gapi.client.redis.projects.locations.instances.failover({
151
+ name: "Test string",
152
+ }, {
153
+ dataProtectionMode: "Test string",
154
+ });
155
+ /** Gets the details of a specific Redis instance. */
156
+ await gapi.client.redis.projects.locations.instances.get({
157
+ name: "Test string",
158
+ });
159
+ /** Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response will be empty. This information is not included in the details returned to GetInstance. */
160
+ await gapi.client.redis.projects.locations.instances.getAuthString({
161
+ name: "Test string",
162
+ });
163
+ /**
164
+ * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When
165
+ * complete, the instance will contain only data from the imported file. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
166
+ */
167
+ await gapi.client.redis.projects.locations.instances.import({
168
+ name: "Test string",
169
+ }, {
170
+ inputConfig: {
171
+ gcsSource: {
172
+ uri: "Test string",
173
+ },
174
+ },
175
+ });
176
+ /**
177
+ * Lists all Redis instances owned by a project in either the specified location (region) or all locations. The location should have the following format: *
178
+ * `projects/{project_id}/locations/{location_id}` If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
179
+ */
180
+ await gapi.client.redis.projects.locations.instances.list({
181
+ pageSize: 42,
182
+ pageToken: "Test string",
183
+ parent: "Test string",
184
+ });
185
+ /**
186
+ * Updates the metadata and configuration of a specific Redis instance. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation
187
+ * is automatically deleted after a few hours, so there is no need to call DeleteOperation.
188
+ */
189
+ await gapi.client.redis.projects.locations.instances.patch({
190
+ name: "Test string",
191
+ updateMask: "Test string",
192
+ }, {
193
+ alternativeLocationId: "Test string",
194
+ authEnabled: true,
195
+ authorizedNetwork: "Test string",
196
+ connectMode: "Test string",
197
+ createTime: "Test string",
198
+ currentLocationId: "Test string",
199
+ customerManagedKey: "Test string",
200
+ displayName: "Test string",
201
+ host: "Test string",
202
+ labels: {
203
+ A: "Test string"
204
+ },
205
+ locationId: "Test string",
206
+ maintenancePolicy: {
207
+ createTime: "Test string",
208
+ description: "Test string",
209
+ updateTime: "Test string",
210
+ weeklyMaintenanceWindow: [
211
+ {
212
+ day: "Test string",
213
+ duration: "Test string",
214
+ startTime: {
215
+ hours: 42,
216
+ minutes: 42,
217
+ nanos: 42,
218
+ seconds: 42,
219
+ },
220
+ }
221
+ ],
222
+ },
223
+ maintenanceSchedule: {
224
+ canReschedule: true,
225
+ endTime: "Test string",
226
+ scheduleDeadlineTime: "Test string",
227
+ startTime: "Test string",
228
+ },
229
+ memorySizeGb: 42,
230
+ name: "Test string",
231
+ nodes: [
232
+ {
233
+ id: "Test string",
234
+ zone: "Test string",
235
+ }
236
+ ],
237
+ persistenceConfig: {
238
+ persistenceMode: "Test string",
239
+ rdbNextSnapshotTime: "Test string",
240
+ rdbSnapshotPeriod: "Test string",
241
+ rdbSnapshotStartTime: "Test string",
242
+ },
243
+ persistenceIamIdentity: "Test string",
244
+ port: 42,
245
+ readEndpoint: "Test string",
246
+ readEndpointPort: 42,
247
+ readReplicasMode: "Test string",
248
+ redisConfigs: {
249
+ A: "Test string"
250
+ },
251
+ redisVersion: "Test string",
252
+ replicaCount: 42,
253
+ reservedIpRange: "Test string",
254
+ secondaryIpRange: "Test string",
255
+ serverCaCerts: [
256
+ {
257
+ cert: "Test string",
258
+ createTime: "Test string",
259
+ expireTime: "Test string",
260
+ serialNumber: "Test string",
261
+ sha1Fingerprint: "Test string",
262
+ }
263
+ ],
264
+ state: "Test string",
265
+ statusMessage: "Test string",
266
+ suspensionReasons: [
267
+ "Test string"
268
+ ],
269
+ tier: "Test string",
270
+ transitEncryptionMode: "Test string",
271
+ });
272
+ /** Reschedule maintenance for a given instance in a given project and location. */
273
+ await gapi.client.redis.projects.locations.instances.rescheduleMaintenance({
274
+ name: "Test string",
275
+ }, {
276
+ rescheduleType: "Test string",
277
+ scheduleTime: "Test string",
278
+ });
279
+ /** Upgrades Redis instance to the newer Redis version specified in the request. */
280
+ await gapi.client.redis.projects.locations.instances.upgrade({
281
+ name: "Test string",
282
+ }, {
283
+ redisVersion: "Test string",
284
+ });
285
+ /**
286
+ * 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
287
+ * 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
288
+ * 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
289
+ * 1, corresponding to `Code.CANCELLED`.
290
+ */
291
+ await gapi.client.redis.projects.locations.operations.cancel({
292
+ name: "Test string",
293
+ });
294
+ /**
295
+ * 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
296
+ * this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
297
+ */
298
+ await gapi.client.redis.projects.locations.operations.delete({
299
+ name: "Test string",
300
+ });
301
+ /** 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. */
302
+ await gapi.client.redis.projects.locations.operations.get({
303
+ name: "Test string",
304
+ });
305
+ /**
306
+ * 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
307
+ * 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
308
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
309
+ * ensure the name binding is the parent resource, without the operations collection id.
310
+ */
311
+ await gapi.client.redis.projects.locations.operations.list({
312
+ filter: "Test string",
313
+ name: "Test string",
314
+ pageSize: 42,
315
+ pageToken: "Test string",
316
+ });
317
+ }
318
+ });
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
+ }