@origincloud/dns 0.0.0-stage → 0.15.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.
@@ -0,0 +1,379 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/dns/v1beta1/record_set.proto
3
+
4
+ import {
5
+ type CallOptions,
6
+ type Client,
7
+ type Empty,
8
+ type Service,
9
+ newRequestId,
10
+ pathValue,
11
+ query,
12
+ } from "@origincloud/core";
13
+
14
+ /**
15
+ * Calls RecordSetService.
16
+ *
17
+ * Record sets: every record of one name and type in a hosted zone. A zone
18
+ * holds one record set per name and type, whatever its kind. A CNAME is
19
+ * alone at its name and never at the zone's apex. The apex's SOA and NS
20
+ * records are the platform's, written from the zone's name servers; they
21
+ * aren't record sets, and no NS record delegates a name below the apex.
22
+ *
23
+ * A change is recorded when its method answers, and answered wherever the
24
+ * zone is served. `BatchChangeRecordSets` makes several changes at once,
25
+ * all or none.
26
+ */
27
+ export class RecordSetClient {
28
+ /**
29
+ * The endpoint the client sends its calls to, which also serves the
30
+ * operations its methods answer with.
31
+ */
32
+ readonly service: Service;
33
+
34
+ /** A client of RecordSetService that sends its calls through `client`. */
35
+ constructor(client: Client) {
36
+ this.service = client.service("dns", false);
37
+ }
38
+
39
+ /** Returns a record set. */
40
+ async getRecordSet(request: GetRecordSetRequest, options?: CallOptions): Promise<RecordSet> {
41
+ const p0 = pathValue("name", request.name, "projects/*/hostedZones/*/recordSets/*");
42
+ return this.service.call<RecordSet>(
43
+ {
44
+ method: "GET",
45
+ path: `/v1beta1/${p0}`,
46
+ query: query(request, ["name"]),
47
+ idempotent: true,
48
+ },
49
+ options,
50
+ );
51
+ }
52
+
53
+ /** Lists a zone's record sets by `dnsName`, then by `type`. */
54
+ async listRecordSets(request: ListRecordSetsRequest, options?: CallOptions): Promise<ListRecordSetsResponse> {
55
+ const p0 = pathValue("parent", request.parent, "projects/*/hostedZones/*");
56
+ return this.service.call<ListRecordSetsResponse>(
57
+ {
58
+ method: "GET",
59
+ path: `/v1beta1/${p0}/recordSets`,
60
+ query: query(request, ["parent"]),
61
+ idempotent: true,
62
+ },
63
+ options,
64
+ );
65
+ }
66
+
67
+ /**
68
+ * Iterates over everything listRecordSets lists from the request's page on,
69
+ * fetching the next page as the loop reaches it. A page that fails ends
70
+ * the iteration with its error.
71
+ */
72
+ async *allRecordSets(request: ListRecordSetsRequest, options?: CallOptions): AsyncGenerator<RecordSet, void, undefined> {
73
+ for (let page = request; ; ) {
74
+ const response = await this.listRecordSets(page, options);
75
+ yield* response.recordSets ?? [];
76
+ if (!response.nextPageToken) return;
77
+ page = { ...page, pageToken: response.nextPageToken };
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Creates a record set. Refused with `CONFLICT` when the zone holds a
83
+ * record set of that name and type, or when a CNAME would share its name.
84
+ * Refused with `BAD_REQUEST` for a name outside the zone, a value its
85
+ * type doesn't take, an alias to a Floating IP outside the zone's
86
+ * project, or once the project's or organization's quota of record sets
87
+ * is used up. An alias to a Floating IP that was created moments ago may
88
+ * be refused with `SERVICE_UNAVAILABLE`, retryable.
89
+ */
90
+ async createRecordSet(request: CreateRecordSetRequest, options?: CallOptions): Promise<RecordSet> {
91
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
92
+ const p0 = pathValue("parent", request.parent, "projects/*/hostedZones/*");
93
+ return this.service.call<RecordSet>(
94
+ {
95
+ method: "POST",
96
+ path: `/v1beta1/${p0}/recordSets`,
97
+ body: request.recordSet,
98
+ query: query(request, ["parent", "recordSet"]),
99
+ idempotent: true,
100
+ },
101
+ options,
102
+ );
103
+ }
104
+
105
+ /**
106
+ * Replaces a record set's TTL or what it answers with: `ttl`, `basic` or
107
+ * `alias`, or `*`. Naming one kind in `updateMask` replaces the kind the
108
+ * record set had. With `*`, a TTL left out keeps the record set's; naming
109
+ * `ttl` without one sets the default, 300 seconds. Its name and type
110
+ * stay; another type is a new record set.
111
+ */
112
+ async updateRecordSet(request: UpdateRecordSetRequest, options?: CallOptions): Promise<RecordSet> {
113
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
114
+ const p0 = pathValue("recordSet.name", request.recordSet?.name, "projects/*/hostedZones/*/recordSets/*");
115
+ return this.service.call<RecordSet>(
116
+ {
117
+ method: "PATCH",
118
+ path: `/v1beta1/${p0}`,
119
+ body: request.recordSet,
120
+ query: query(request, ["recordSet.name", "recordSet"]),
121
+ idempotent: true,
122
+ },
123
+ options,
124
+ );
125
+ }
126
+
127
+ /** Deletes a record set. */
128
+ async deleteRecordSet(request: DeleteRecordSetRequest, options?: CallOptions): Promise<Empty> {
129
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
130
+ const p0 = pathValue("name", request.name, "projects/*/hostedZones/*/recordSets/*");
131
+ return this.service.call<Empty>(
132
+ {
133
+ method: "DELETE",
134
+ path: `/v1beta1/${p0}`,
135
+ query: query(request, ["name"]),
136
+ idempotent: true,
137
+ },
138
+ options,
139
+ );
140
+ }
141
+
142
+ /**
143
+ * Deletes, replaces and creates record sets of one zone together, all or
144
+ * none. The zone is checked as the changes leave it, not after each
145
+ * change, so a CNAME may take the place of the A record set it replaces
146
+ * in one call. A batch makes 1 to 1000 changes, and names a record set
147
+ * once at most across `deletions` and `updates`. Each change is refused
148
+ * as its own method would refuse it, naming the change; then none is
149
+ * made.
150
+ */
151
+ async batchChangeRecordSets(request: BatchChangeRecordSetsRequest, options?: CallOptions): Promise<BatchChangeRecordSetsResponse> {
152
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
153
+ const p0 = pathValue("parent", request.parent, "projects/*/hostedZones/*");
154
+ return this.service.call<BatchChangeRecordSetsResponse>(
155
+ {
156
+ method: "POST",
157
+ path: `/v1beta1/${p0}/recordSets:batchChange`,
158
+ body: request,
159
+ idempotent: true,
160
+ },
161
+ options,
162
+ );
163
+ }
164
+ }
165
+
166
+ /** Every record of one name and type in a hosted zone. */
167
+ export interface RecordSet {
168
+ /** The record set's resource name. */
169
+ name?: string;
170
+ /**
171
+ * The record set's URN, the identifier access policies and the audit log
172
+ * use.
173
+ */
174
+ urn?: string;
175
+ /**
176
+ * The name the records answer for: the zone's `dnsName` or a name below
177
+ * it, written in full, such as `www.example.com`, without the final dot;
178
+ * answered in lowercase. Labels may hold `_` (`_dmarc.example.com`), and
179
+ * `*` only as the whole leftmost label, for a wildcard.
180
+ */
181
+ dnsName?: string;
182
+ /** The records' type. An alias is `A`. */
183
+ type?: RecordSet_Type;
184
+ /**
185
+ * How long resolvers may keep the answer, from 30 seconds to 7 days, in
186
+ * whole seconds. 300 seconds when left out.
187
+ */
188
+ ttl?: string;
189
+ /** Values of its own. */
190
+ basic?: BasicRecordData;
191
+ /** The address of a platform resource, followed as it changes. */
192
+ alias?: AliasRecordData;
193
+ /** When the record set was created. */
194
+ createTime?: string;
195
+ /** When the record set was last changed. */
196
+ updateTime?: string;
197
+ }
198
+
199
+ /** A record type. */
200
+ export const RecordSet_Type = {
201
+ /** Not set. */
202
+ TYPE_UNSPECIFIED: "TYPE_UNSPECIFIED",
203
+ /** IPv4 addresses. */
204
+ A: "A",
205
+ /** IPv6 addresses. */
206
+ AAAA: "AAAA",
207
+ /** Another name this one is an alias of. */
208
+ CNAME: "CNAME",
209
+ /** Text. */
210
+ TXT: "TXT",
211
+ /** Mail exchangers. */
212
+ MX: "MX",
213
+ /** Service locations. */
214
+ SRV: "SRV",
215
+ /** The certificate authorities that may issue for the name. */
216
+ CAA: "CAA",
217
+ } as const;
218
+
219
+ /** A record type. */
220
+ export type RecordSet_Type = (typeof RecordSet_Type)[keyof typeof RecordSet_Type];
221
+
222
+ /** A record set's own values. */
223
+ export interface BasicRecordData {
224
+ /**
225
+ * The records' values, 1 to 100, each once, written as `type` says. Names
226
+ * are written in full without the final dot, and answered in lowercase.
227
+ * - `A`: an IPv4 address, `192.0.2.10`.
228
+ * - `AAAA`: an IPv6 address, `2001:db8::10`.
229
+ * - `CNAME`: one name, `www.example.net`.
230
+ * - `TXT`: the text as it is, printable ASCII, up to 4000 characters,
231
+ * without quotes; it is split into strings of 255 characters on the
232
+ * wire.
233
+ * - `MX`: `{preference} {exchange}`, `10 mail.example.com`. `0 .`, alone,
234
+ * says the name takes no mail.
235
+ * - `SRV`: `{priority} {weight} {port} {target}`,
236
+ * `10 5 5060 sip.example.com`. A target of `.`, alone, says the service
237
+ * isn't offered.
238
+ * - `CAA`: `{flags} {tag} {value}`, `0 issue letsencrypt.org`: flags 0 or
239
+ * 128, the value as it is, without quotes.
240
+ *
241
+ * A record set's records take at most 16 KiB on the wire.
242
+ */
243
+ values?: string[];
244
+ }
245
+
246
+ /**
247
+ * An alias: the record set answers with a platform resource's address, and
248
+ * follows it as it changes.
249
+ */
250
+ export interface AliasRecordData {
251
+ /**
252
+ * The Floating IP whose address the record set answers with, in the
253
+ * zone's project. A Floating IP's address is an IPv4 address, so the
254
+ * record set is of type `A`; an `AAAA` alias is refused.
255
+ */
256
+ floatingIp?: string;
257
+ }
258
+
259
+ /** The request for GetRecordSet. */
260
+ export interface GetRecordSetRequest {
261
+ /** The record set to return. */
262
+ name?: string;
263
+ }
264
+
265
+ /** The request for ListRecordSets. */
266
+ export interface ListRecordSetsRequest {
267
+ /**
268
+ * The zone whose record sets to list,
269
+ * `projects/{project}/hostedZones/{hosted_zone}`.
270
+ */
271
+ parent?: string;
272
+ /**
273
+ * The most record sets to return; the server clamps it, and 0 means its
274
+ * default.
275
+ */
276
+ pageSize?: number;
277
+ /** A previous response's `nextPageToken`, for the page after it. */
278
+ pageToken?: string;
279
+ /**
280
+ * Only the record sets of this name, written as `dnsName` is; every
281
+ * name's when left empty.
282
+ */
283
+ dnsName?: string;
284
+ /** Only the record sets of this type; every type's when left unset. */
285
+ type?: RecordSet_Type;
286
+ }
287
+
288
+ /** The response for ListRecordSets. */
289
+ export interface ListRecordSetsResponse {
290
+ /** The record sets on this page. */
291
+ recordSets?: RecordSet[];
292
+ /** The token for the next page; empty on the last one. */
293
+ nextPageToken?: string;
294
+ }
295
+
296
+ /** The request for CreateRecordSet. */
297
+ export interface CreateRecordSetRequest {
298
+ /**
299
+ * The zone to create the record set in,
300
+ * `projects/{project}/hostedZones/{hosted_zone}`.
301
+ */
302
+ parent?: string;
303
+ /**
304
+ * The record set to create: its `dnsName`, `type`, optionally its
305
+ * `ttl`, and one of `basic` and `alias`.
306
+ */
307
+ recordSet?: RecordSet;
308
+ /**
309
+ * A UUID; a repeat with the same id within a day returns the record set
310
+ * the first request created, as it is now, instead of being refused as a
311
+ * conflict.
312
+ */
313
+ requestId?: string;
314
+ }
315
+
316
+ /** The request for UpdateRecordSet. */
317
+ export interface UpdateRecordSetRequest {
318
+ /** The record set, by its name, with the fields to change. */
319
+ recordSet?: RecordSet;
320
+ /** The fields to change: `ttl`, `basic`, `alias`, or `*`. */
321
+ updateMask?: string;
322
+ /**
323
+ * A UUID; a repeat with the same id within a day returns the record set
324
+ * as the first request left it, instead of changing it again.
325
+ */
326
+ requestId?: string;
327
+ }
328
+
329
+ /** The request for DeleteRecordSet. */
330
+ export interface DeleteRecordSetRequest {
331
+ /** The record set to delete. */
332
+ name?: string;
333
+ /**
334
+ * A UUID; a repeat with the same id within a day succeeds as the first
335
+ * did, instead of answering `NOT_FOUND`.
336
+ */
337
+ requestId?: string;
338
+ }
339
+
340
+ /** The request for BatchChangeRecordSets. */
341
+ export interface BatchChangeRecordSetsRequest {
342
+ /**
343
+ * The zone whose record sets to change,
344
+ * `projects/{project}/hostedZones/{hosted_zone}`.
345
+ */
346
+ parent?: string;
347
+ /** The record sets to delete, by name. */
348
+ deletions?: string[];
349
+ /**
350
+ * The record sets to change, each with the fields to change, as
351
+ * `UpdateRecordSet` takes them.
352
+ */
353
+ updates?: RecordSetUpdate[];
354
+ /** The record sets to create, as `CreateRecordSet` takes them. */
355
+ creations?: RecordSet[];
356
+ /**
357
+ * A UUID; a repeat with the same id within a day answers with the record
358
+ * sets the first request changed and created, as they are now, instead of
359
+ * making the changes again.
360
+ */
361
+ requestId?: string;
362
+ }
363
+
364
+ /** One change of a `BatchChangeRecordSets` request. */
365
+ export interface RecordSetUpdate {
366
+ /** The record set, by its name, with the fields to change. */
367
+ recordSet?: RecordSet;
368
+ /** The fields to change: `ttl`, `basic`, `alias`, or `*`. */
369
+ updateMask?: string;
370
+ }
371
+
372
+ /** The response for BatchChangeRecordSets. */
373
+ export interface BatchChangeRecordSetsResponse {
374
+ /**
375
+ * The record sets changed, then those created, each in the order of the
376
+ * request.
377
+ */
378
+ recordSets?: RecordSet[];
379
+ }
@@ -0,0 +1,201 @@
1
+ // Code generated by the SDK's generator (generator/). DO NOT EDIT.
2
+ // source: origincloud/dns/v1beta1/vpc_attachment.proto
3
+
4
+ import {
5
+ type CallOptions,
6
+ type Client,
7
+ type Empty,
8
+ type Service,
9
+ newRequestId,
10
+ pathValue,
11
+ query,
12
+ } from "@origincloud/core";
13
+
14
+ /**
15
+ * Calls VpcAttachmentService.
16
+ *
17
+ * VPC attachments: the VPCs a private zone answers in. Each attachment
18
+ * makes the zone's names resolve from every instance in one VPC, in every
19
+ * zone the VPC spans, and from no other VPC. A private zone attaches only
20
+ * to VPCs of its own project, and a VPC holds at most one attached zone of
21
+ * a name. An attachment's id is the VPC's id, so a client that knows the
22
+ * zone and the VPC names the attachment without listing. Deleting a VPC
23
+ * deletes its attachments. Attaching a public zone is refused: it answers on
24
+ * the internet, in every VPC alike.
25
+ */
26
+ export class VpcAttachmentClient {
27
+ /**
28
+ * The endpoint the client sends its calls to, which also serves the
29
+ * operations its methods answer with.
30
+ */
31
+ readonly service: Service;
32
+
33
+ /** A client of VpcAttachmentService that sends its calls through `client`. */
34
+ constructor(client: Client) {
35
+ this.service = client.service("dns", false);
36
+ }
37
+
38
+ /** Returns a VPC attachment. */
39
+ async getVpcAttachment(request: GetVpcAttachmentRequest, options?: CallOptions): Promise<VpcAttachment> {
40
+ const p0 = pathValue("name", request.name, "projects/*/hostedZones/*/vpcAttachments/*");
41
+ return this.service.call<VpcAttachment>(
42
+ {
43
+ method: "GET",
44
+ path: `/v1beta1/${p0}`,
45
+ query: query(request, ["name"]),
46
+ idempotent: true,
47
+ },
48
+ options,
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Lists a private zone's VPC attachments, oldest first. With `-` for the
54
+ * zone, lists every zone's in the project, which with `vpc` finds the
55
+ * zones attached to a VPC.
56
+ */
57
+ async listVpcAttachments(request: ListVpcAttachmentsRequest, options?: CallOptions): Promise<ListVpcAttachmentsResponse> {
58
+ const p0 = pathValue("parent", request.parent, "projects/*/hostedZones/*");
59
+ return this.service.call<ListVpcAttachmentsResponse>(
60
+ {
61
+ method: "GET",
62
+ path: `/v1beta1/${p0}/vpcAttachments`,
63
+ query: query(request, ["parent"]),
64
+ idempotent: true,
65
+ },
66
+ options,
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Iterates over everything listVpcAttachments lists from the request's page on,
72
+ * fetching the next page as the loop reaches it. A page that fails ends
73
+ * the iteration with its error.
74
+ */
75
+ async *allVpcAttachments(request: ListVpcAttachmentsRequest, options?: CallOptions): AsyncGenerator<VpcAttachment, void, undefined> {
76
+ for (let page = request; ; ) {
77
+ const response = await this.listVpcAttachments(page, options);
78
+ yield* response.vpcAttachments ?? [];
79
+ if (!response.nextPageToken) return;
80
+ page = { ...page, pageToken: response.nextPageToken };
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Attaches a private zone to a VPC of the zone's project. Refused with
86
+ * `BAD_REQUEST` for a public zone, or for a VPC that isn't in the zone's
87
+ * project, with the same words whichever project it is in. Refused with
88
+ * `CONFLICT` when the VPC holds an attached zone of the same name. A VPC
89
+ * created moments ago may be refused with `SERVICE_UNAVAILABLE`,
90
+ * retryable. The VPC's instances resolve the zone's names once the VPC's
91
+ * hosts serve the zone.
92
+ */
93
+ async createVpcAttachment(request: CreateVpcAttachmentRequest, options?: CallOptions): Promise<VpcAttachment> {
94
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
95
+ const p0 = pathValue("parent", request.parent, "projects/*/hostedZones/*");
96
+ return this.service.call<VpcAttachment>(
97
+ {
98
+ method: "POST",
99
+ path: `/v1beta1/${p0}/vpcAttachments`,
100
+ body: request.vpcAttachment,
101
+ query: query(request, ["parent", "vpcAttachment"]),
102
+ idempotent: true,
103
+ },
104
+ options,
105
+ );
106
+ }
107
+
108
+ /**
109
+ * Detaches a private zone from a VPC. The VPC's instances stop resolving
110
+ * the zone's names once the VPC's hosts drop the zone.
111
+ */
112
+ async deleteVpcAttachment(request: DeleteVpcAttachmentRequest, options?: CallOptions): Promise<Empty> {
113
+ if (!request.requestId) request = { ...request, requestId: newRequestId() };
114
+ const p0 = pathValue("name", request.name, "projects/*/hostedZones/*/vpcAttachments/*");
115
+ return this.service.call<Empty>(
116
+ {
117
+ method: "DELETE",
118
+ path: `/v1beta1/${p0}`,
119
+ query: query(request, ["name"]),
120
+ idempotent: true,
121
+ },
122
+ options,
123
+ );
124
+ }
125
+ }
126
+
127
+ /** A VPC a private zone answers in. */
128
+ export interface VpcAttachment {
129
+ /** The attachment's resource name. Its last segment is the VPC's id. */
130
+ name?: string;
131
+ /**
132
+ * The attachment's URN, the identifier access policies and the audit log
133
+ * use.
134
+ */
135
+ urn?: string;
136
+ /** The VPC the zone answers in, in the zone's project. */
137
+ vpc?: string;
138
+ /** When the zone was attached. */
139
+ createTime?: string;
140
+ }
141
+
142
+ /** The request for GetVpcAttachment. */
143
+ export interface GetVpcAttachmentRequest {
144
+ /** The attachment to return. */
145
+ name?: string;
146
+ }
147
+
148
+ /** The request for ListVpcAttachments. */
149
+ export interface ListVpcAttachmentsRequest {
150
+ /**
151
+ * The private zone whose attachments to list,
152
+ * `projects/{project}/hostedZones/{hosted_zone}`, or `-` for the zone to
153
+ * list every zone's in the project.
154
+ */
155
+ parent?: string;
156
+ /**
157
+ * The most attachments to return; the server clamps it, and 0 means its
158
+ * default.
159
+ */
160
+ pageSize?: number;
161
+ /** A previous response's `nextPageToken`, for the page after it. */
162
+ pageToken?: string;
163
+ /** Only the attachments to this VPC; every VPC's when left empty. */
164
+ vpc?: string;
165
+ }
166
+
167
+ /** The response for ListVpcAttachments. */
168
+ export interface ListVpcAttachmentsResponse {
169
+ /** The attachments on this page. */
170
+ vpcAttachments?: VpcAttachment[];
171
+ /** The token for the next page; empty on the last one. */
172
+ nextPageToken?: string;
173
+ }
174
+
175
+ /** The request for CreateVpcAttachment. */
176
+ export interface CreateVpcAttachmentRequest {
177
+ /**
178
+ * The private zone to attach,
179
+ * `projects/{project}/hostedZones/{hosted_zone}`.
180
+ */
181
+ parent?: string;
182
+ /** The attachment to create: its `vpc`. */
183
+ vpcAttachment?: VpcAttachment;
184
+ /**
185
+ * A UUID; a repeat with the same id within a day returns the attachment
186
+ * the first request created, as it is now, instead of being refused as a
187
+ * conflict.
188
+ */
189
+ requestId?: string;
190
+ }
191
+
192
+ /** The request for DeleteVpcAttachment. */
193
+ export interface DeleteVpcAttachmentRequest {
194
+ /** The attachment to delete. */
195
+ name?: string;
196
+ /**
197
+ * A UUID; a repeat with the same id within a day succeeds as the first
198
+ * did, instead of answering `NOT_FOUND`.
199
+ */
200
+ requestId?: string;
201
+ }