@origincloud/kms 0.0.0-stage → 0.28.0
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/LICENSE +202 -0
- package/README.md +24 -2
- package/dist/v1beta1/grant.d.ts +149 -0
- package/dist/v1beta1/grant.d.ts.map +1 -0
- package/dist/v1beta1/grant.js +123 -0
- package/dist/v1beta1/grant.js.map +1 -0
- package/dist/v1beta1/index.d.ts +3 -0
- package/dist/v1beta1/index.d.ts.map +1 -0
- package/dist/v1beta1/index.js +4 -0
- package/dist/v1beta1/index.js.map +1 -0
- package/dist/v1beta1/key.d.ts +398 -0
- package/dist/v1beta1/key.d.ts.map +1 -0
- package/dist/v1beta1/key.js +261 -0
- package/dist/v1beta1/key.js.map +1 -0
- package/package.json +40 -4
- package/src/v1beta1/grant.ts +240 -0
- package/src/v1beta1/index.ts +4 -0
- package/src/v1beta1/key.ts +590 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @origincloud/kms
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The client of Origin Cloud's KMS service: grants: permission for one platform
|
|
4
|
+
host to use one key for one operation and one encryption context, for at most an
|
|
5
|
+
hour at a time. Part of the [Origin Cloud SDK for
|
|
6
|
+
TypeScript](https://github.com/origincloudhq/sdk-typescript), generated from the
|
|
7
|
+
API definitions in [origincloudhq/api](https://github.com/origincloudhq/api).
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Client } from "@origincloud/core";
|
|
11
|
+
import { GrantClient } from "@origincloud/kms/v1beta1";
|
|
12
|
+
|
|
13
|
+
const grants = new GrantClient(new Client());
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
| Import | API |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `@origincloud/kms/v1beta1` | Grants: permission for one platform host to use one key for one operation and one encryption context, for at most an hour at a time |
|
|
19
|
+
|
|
20
|
+
`v1beta1` is a preview version and may change in incompatible ways, like the API
|
|
21
|
+
itself. See the [repository's
|
|
22
|
+
README](https://github.com/origincloudhq/sdk-typescript#readme) for credentials
|
|
23
|
+
and behaviour.
|
|
24
|
+
|
|
25
|
+
Apache License 2.0.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { type CallOptions, type Client, type Empty, type Service } from "@origincloud/core";
|
|
2
|
+
/**
|
|
3
|
+
* Calls GrantService.
|
|
4
|
+
*
|
|
5
|
+
* A key's grants.
|
|
6
|
+
*
|
|
7
|
+
* Making, renewing and deleting a grant needs `kms.grant.create`,
|
|
8
|
+
* `kms.grant.update` and `kms.grant.delete` on the key's project, which the
|
|
9
|
+
* platform's own services hold where you let them use your keys; none of
|
|
10
|
+
* them lets the holder use the key itself. Reading and listing need
|
|
11
|
+
* `kms.grant.get` and `kms.grant.list`.
|
|
12
|
+
*/
|
|
13
|
+
export declare class GrantClient {
|
|
14
|
+
/**
|
|
15
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
16
|
+
* operations its methods answer with.
|
|
17
|
+
*/
|
|
18
|
+
readonly service: Service;
|
|
19
|
+
/** A client of GrantService that sends its calls through `client`. */
|
|
20
|
+
constructor(client: Client);
|
|
21
|
+
/**
|
|
22
|
+
* Returns a grant that hasn't expired; an expired one is `NOT_FOUND`. A
|
|
23
|
+
* grant made moments ago may be refused with `SERVICE_UNAVAILABLE`,
|
|
24
|
+
* retryable, until its zone's change arrives. Needs `kms.grant.get` on
|
|
25
|
+
* the project.
|
|
26
|
+
*/
|
|
27
|
+
getGrant(request: GetGrantRequest, options?: CallOptions): Promise<Grant>;
|
|
28
|
+
/**
|
|
29
|
+
* Lists a key's grants that haven't expired, in every zone, ordered by
|
|
30
|
+
* name. A grant made moments ago may be missing from the list until its
|
|
31
|
+
* zone's change arrives. Needs `kms.grant.list` on the project.
|
|
32
|
+
*/
|
|
33
|
+
listGrants(request: ListGrantsRequest, options?: CallOptions): Promise<ListGrantsResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Iterates over everything listGrants lists from the request's page on,
|
|
36
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
37
|
+
* the iteration with its error.
|
|
38
|
+
*/
|
|
39
|
+
allGrants(request: ListGrantsRequest, options?: CallOptions): AsyncGenerator<Grant, void, undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* Makes a grant on an `ENCRYPT_DECRYPT` key for one host, refused with
|
|
42
|
+
* `BAD_REQUEST` for a key of another purpose, a host that isn't one of
|
|
43
|
+
* the region's, an empty encryption context, or a `ttl` outside 1 to 60
|
|
44
|
+
* minutes, and with `CONFLICT` for a key that isn't enabled. Needs
|
|
45
|
+
* `kms.grant.create` on the project.
|
|
46
|
+
*/
|
|
47
|
+
createGrant(request: CreateGrantRequest, options?: CallOptions): Promise<Grant>;
|
|
48
|
+
/**
|
|
49
|
+
* Extends a grant that hasn't expired to `ttl` from now. An expired
|
|
50
|
+
* grant isn't renewed: `CONFLICT`, and a new one is made instead. Needs
|
|
51
|
+
* `kms.grant.update` on the project.
|
|
52
|
+
*/
|
|
53
|
+
renewGrant(request: RenewGrantRequest, options?: CallOptions): Promise<Grant>;
|
|
54
|
+
/**
|
|
55
|
+
* Ends a grant before it expires: from then on it opens nothing. Needs
|
|
56
|
+
* `kms.grant.delete` on the project.
|
|
57
|
+
*/
|
|
58
|
+
deleteGrant(request: DeleteGrantRequest, options?: CallOptions): Promise<Empty>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A grant: one host may use one key for one operation, with exactly one
|
|
62
|
+
* encryption context, until `expireTime`.
|
|
63
|
+
*/
|
|
64
|
+
export interface Grant {
|
|
65
|
+
/** The grant's resource name. */
|
|
66
|
+
name?: string;
|
|
67
|
+
/** What the host may do with the key. */
|
|
68
|
+
operation?: Grant_Operation;
|
|
69
|
+
/**
|
|
70
|
+
* The platform host the grant is for, by the SPIFFE ID its certificate
|
|
71
|
+
* names, which ends in `/zones/{zone}/hosts/{host}`.
|
|
72
|
+
*/
|
|
73
|
+
grantee?: string;
|
|
74
|
+
/** The encryption context a use must carry, exactly; never empty. */
|
|
75
|
+
encryptionContext?: Record<string, string>;
|
|
76
|
+
/** How long the grant lives from now: 1 to 60 minutes. */
|
|
77
|
+
ttl?: string;
|
|
78
|
+
/** The zone that keeps the grant: its host's. */
|
|
79
|
+
zone?: string;
|
|
80
|
+
/** Who made the grant. */
|
|
81
|
+
delegate?: string;
|
|
82
|
+
/** When the grant was made. */
|
|
83
|
+
createTime?: string;
|
|
84
|
+
/** When the grant was last renewed, or made. */
|
|
85
|
+
renewTime?: string;
|
|
86
|
+
/** When the grant stops opening anything unless renewed before. */
|
|
87
|
+
expireTime?: string;
|
|
88
|
+
}
|
|
89
|
+
/** What a grant lets its host do. */
|
|
90
|
+
export declare const Grant_Operation: {
|
|
91
|
+
/** Not set. */
|
|
92
|
+
readonly OPERATION_UNSPECIFIED: "OPERATION_UNSPECIFIED";
|
|
93
|
+
/**
|
|
94
|
+
* Decrypt ciphertexts made under the key with the grant's encryption
|
|
95
|
+
* context.
|
|
96
|
+
*/
|
|
97
|
+
readonly DECRYPT: "DECRYPT";
|
|
98
|
+
};
|
|
99
|
+
/** What a grant lets its host do. */
|
|
100
|
+
export type Grant_Operation = (typeof Grant_Operation)[keyof typeof Grant_Operation];
|
|
101
|
+
/** The request for GetGrant. */
|
|
102
|
+
export interface GetGrantRequest {
|
|
103
|
+
/** The grant to return. */
|
|
104
|
+
name?: string;
|
|
105
|
+
}
|
|
106
|
+
/** The request for ListGrants. */
|
|
107
|
+
export interface ListGrantsRequest {
|
|
108
|
+
/** The key whose grants to list. */
|
|
109
|
+
parent?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The most grants to return; the server clamps it, and 0 means its
|
|
112
|
+
* default.
|
|
113
|
+
*/
|
|
114
|
+
pageSize?: number;
|
|
115
|
+
/** A previous response's `nextPageToken`, for the page after it. */
|
|
116
|
+
pageToken?: string;
|
|
117
|
+
}
|
|
118
|
+
/** The response for ListGrants. */
|
|
119
|
+
export interface ListGrantsResponse {
|
|
120
|
+
/** The grants on this page. */
|
|
121
|
+
grants?: Grant[];
|
|
122
|
+
/** The token for the next page; empty on the last one. */
|
|
123
|
+
nextPageToken?: string;
|
|
124
|
+
}
|
|
125
|
+
/** The request for CreateGrant. */
|
|
126
|
+
export interface CreateGrantRequest {
|
|
127
|
+
/** The key to grant. */
|
|
128
|
+
parent?: string;
|
|
129
|
+
/** The grant to make: its operation, host, encryption context and `ttl`. */
|
|
130
|
+
grant?: Grant;
|
|
131
|
+
/**
|
|
132
|
+
* A UUID; a repeat with the same id within a day returns the grant the
|
|
133
|
+
* first request made, instead of making a second.
|
|
134
|
+
*/
|
|
135
|
+
requestId?: string;
|
|
136
|
+
}
|
|
137
|
+
/** The request for RenewGrant. */
|
|
138
|
+
export interface RenewGrantRequest {
|
|
139
|
+
/** The grant to renew. */
|
|
140
|
+
name?: string;
|
|
141
|
+
/** How long the grant lives from now: 1 to 60 minutes. */
|
|
142
|
+
ttl?: string;
|
|
143
|
+
}
|
|
144
|
+
/** The request for DeleteGrant. */
|
|
145
|
+
export interface DeleteGrantRequest {
|
|
146
|
+
/** The grant to end. */
|
|
147
|
+
name?: string;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=grant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.d.ts","sourceRoot":"","sources":["../../src/v1beta1/grant.ts"],"names":[],"mappings":"AAGA,OAAO,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AA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Code generated by the SDK's generator (generator/). DO NOT EDIT.
|
|
2
|
+
// source: origincloud/kms/v1beta1/grant.proto
|
|
3
|
+
import { newRequestId, pathValue, query, } from "@origincloud/core";
|
|
4
|
+
/**
|
|
5
|
+
* Calls GrantService.
|
|
6
|
+
*
|
|
7
|
+
* A key's grants.
|
|
8
|
+
*
|
|
9
|
+
* Making, renewing and deleting a grant needs `kms.grant.create`,
|
|
10
|
+
* `kms.grant.update` and `kms.grant.delete` on the key's project, which the
|
|
11
|
+
* platform's own services hold where you let them use your keys; none of
|
|
12
|
+
* them lets the holder use the key itself. Reading and listing need
|
|
13
|
+
* `kms.grant.get` and `kms.grant.list`.
|
|
14
|
+
*/
|
|
15
|
+
export class GrantClient {
|
|
16
|
+
/**
|
|
17
|
+
* The endpoint the client sends its calls to, which also serves the
|
|
18
|
+
* operations its methods answer with.
|
|
19
|
+
*/
|
|
20
|
+
service;
|
|
21
|
+
/** A client of GrantService that sends its calls through `client`. */
|
|
22
|
+
constructor(client) {
|
|
23
|
+
this.service = client.service("kms", true);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns a grant that hasn't expired; an expired one is `NOT_FOUND`. A
|
|
27
|
+
* grant made moments ago may be refused with `SERVICE_UNAVAILABLE`,
|
|
28
|
+
* retryable, until its zone's change arrives. Needs `kms.grant.get` on
|
|
29
|
+
* the project.
|
|
30
|
+
*/
|
|
31
|
+
async getGrant(request, options) {
|
|
32
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*/grants/*");
|
|
33
|
+
return this.service.call({
|
|
34
|
+
method: "GET",
|
|
35
|
+
path: `/v1beta1/${p0}`,
|
|
36
|
+
query: query(request, ["name"]),
|
|
37
|
+
idempotent: true,
|
|
38
|
+
}, options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Lists a key's grants that haven't expired, in every zone, ordered by
|
|
42
|
+
* name. A grant made moments ago may be missing from the list until its
|
|
43
|
+
* zone's change arrives. Needs `kms.grant.list` on the project.
|
|
44
|
+
*/
|
|
45
|
+
async listGrants(request, options) {
|
|
46
|
+
const p0 = pathValue("parent", request.parent, "projects/*/regions/*/keys/*");
|
|
47
|
+
return this.service.call({
|
|
48
|
+
method: "GET",
|
|
49
|
+
path: `/v1beta1/${p0}/grants`,
|
|
50
|
+
query: query(request, ["parent"]),
|
|
51
|
+
idempotent: true,
|
|
52
|
+
}, options);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Iterates over everything listGrants lists from the request's page on,
|
|
56
|
+
* fetching the next page as the loop reaches it. A page that fails ends
|
|
57
|
+
* the iteration with its error.
|
|
58
|
+
*/
|
|
59
|
+
async *allGrants(request, options) {
|
|
60
|
+
for (let page = request;;) {
|
|
61
|
+
const response = await this.listGrants(page, options);
|
|
62
|
+
yield* response.grants ?? [];
|
|
63
|
+
if (!response.nextPageToken)
|
|
64
|
+
return;
|
|
65
|
+
page = { ...page, pageToken: response.nextPageToken };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Makes a grant on an `ENCRYPT_DECRYPT` key for one host, refused with
|
|
70
|
+
* `BAD_REQUEST` for a key of another purpose, a host that isn't one of
|
|
71
|
+
* the region's, an empty encryption context, or a `ttl` outside 1 to 60
|
|
72
|
+
* minutes, and with `CONFLICT` for a key that isn't enabled. Needs
|
|
73
|
+
* `kms.grant.create` on the project.
|
|
74
|
+
*/
|
|
75
|
+
async createGrant(request, options) {
|
|
76
|
+
if (!request.requestId)
|
|
77
|
+
request = { ...request, requestId: newRequestId() };
|
|
78
|
+
const p0 = pathValue("parent", request.parent, "projects/*/regions/*/keys/*");
|
|
79
|
+
return this.service.call({
|
|
80
|
+
method: "POST",
|
|
81
|
+
path: `/v1beta1/${p0}/grants`,
|
|
82
|
+
body: request.grant,
|
|
83
|
+
query: query(request, ["parent", "grant"]),
|
|
84
|
+
idempotent: true,
|
|
85
|
+
}, options);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Extends a grant that hasn't expired to `ttl` from now. An expired
|
|
89
|
+
* grant isn't renewed: `CONFLICT`, and a new one is made instead. Needs
|
|
90
|
+
* `kms.grant.update` on the project.
|
|
91
|
+
*/
|
|
92
|
+
async renewGrant(request, options) {
|
|
93
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*/grants/*");
|
|
94
|
+
return this.service.call({
|
|
95
|
+
method: "POST",
|
|
96
|
+
path: `/v1beta1/${p0}:renew`,
|
|
97
|
+
body: request,
|
|
98
|
+
}, options);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Ends a grant before it expires: from then on it opens nothing. Needs
|
|
102
|
+
* `kms.grant.delete` on the project.
|
|
103
|
+
*/
|
|
104
|
+
async deleteGrant(request, options) {
|
|
105
|
+
const p0 = pathValue("name", request.name, "projects/*/regions/*/keys/*/grants/*");
|
|
106
|
+
return this.service.call({
|
|
107
|
+
method: "DELETE",
|
|
108
|
+
path: `/v1beta1/${p0}`,
|
|
109
|
+
query: query(request, ["name"]),
|
|
110
|
+
}, options);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** What a grant lets its host do. */
|
|
114
|
+
export const Grant_Operation = {
|
|
115
|
+
/** Not set. */
|
|
116
|
+
OPERATION_UNSPECIFIED: "OPERATION_UNSPECIFIED",
|
|
117
|
+
/**
|
|
118
|
+
* Decrypt ciphertexts made under the key with the grant's encryption
|
|
119
|
+
* context.
|
|
120
|
+
*/
|
|
121
|
+
DECRYPT: "DECRYPT",
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=grant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.js","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,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CAAC,OAA2B,EAAE,OAAqB;QAClE,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,YAAY,EAAE,EAAE;YACtB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;SAChC,EACD,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAgCD,qCAAqC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,eAAe;IACf,qBAAqB,EAAE,uBAAuB;IAC9C;;;OAGG;IACH,OAAO,EAAE,SAAS;CACV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1beta1/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|