@pantechdynamic/sdk 0.3.0 → 0.5.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/CHANGELOG.md +76 -0
- package/README.md +229 -10
- package/dist/index.cjs +1022 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21842 -8459
- package/dist/index.d.ts +21842 -8459
- package/dist/index.js +1014 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -39,6 +39,23 @@ var AuthenticationError = class extends PantechError {
|
|
|
39
39
|
};
|
|
40
40
|
var PaymentRequiredError = class extends PantechError {
|
|
41
41
|
name = "PaymentRequiredError";
|
|
42
|
+
/**
|
|
43
|
+
* For a domain order waiting in `awaiting_payment`: the page where the bank
|
|
44
|
+
* asks the user to confirm the saved-card payment (US dollars only), when it
|
|
45
|
+
* does. Undefined when no confirmation is needed, for a naira order waiting
|
|
46
|
+
* for credit, and for a `402` answer.
|
|
47
|
+
*/
|
|
48
|
+
paymentUrl;
|
|
49
|
+
/** When an unpaid order fails `insufficient_credit` (nothing is charged). */
|
|
50
|
+
paymentExpiresAt;
|
|
51
|
+
/** The order waiting for payment, as the API returned it. */
|
|
52
|
+
order;
|
|
53
|
+
constructor(message, init = {}) {
|
|
54
|
+
super(message, init);
|
|
55
|
+
this.paymentUrl = init.paymentUrl;
|
|
56
|
+
this.paymentExpiresAt = init.paymentExpiresAt;
|
|
57
|
+
this.order = init.order;
|
|
58
|
+
}
|
|
42
59
|
};
|
|
43
60
|
var PermissionDeniedError = class extends PantechError {
|
|
44
61
|
name = "PermissionDeniedError";
|
|
@@ -49,6 +66,9 @@ var NotFoundError = class extends PantechError {
|
|
|
49
66
|
var ConflictError = class extends PantechError {
|
|
50
67
|
name = "ConflictError";
|
|
51
68
|
};
|
|
69
|
+
var PreconditionFailedError = class extends PantechError {
|
|
70
|
+
name = "PreconditionFailedError";
|
|
71
|
+
};
|
|
52
72
|
var ValidationError = class extends PantechError {
|
|
53
73
|
name = "ValidationError";
|
|
54
74
|
};
|
|
@@ -100,12 +120,115 @@ var CloudFailedError = class extends PantechError {
|
|
|
100
120
|
this.resource = resource;
|
|
101
121
|
}
|
|
102
122
|
};
|
|
123
|
+
var DNSFailedError = class extends PantechError {
|
|
124
|
+
name = "DNSFailedError";
|
|
125
|
+
/** `zone` or `record`. */
|
|
126
|
+
kind;
|
|
127
|
+
/** The zone or record set, as the API returned it. */
|
|
128
|
+
resource;
|
|
129
|
+
constructor(message, kind, resource, init = {}) {
|
|
130
|
+
super(message, init);
|
|
131
|
+
this.kind = kind;
|
|
132
|
+
this.resource = resource;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var CertificateFailedError = class extends PantechError {
|
|
136
|
+
name = "CertificateFailedError";
|
|
137
|
+
/** The certificate, as the API returned it. */
|
|
138
|
+
certificate;
|
|
139
|
+
constructor(message, certificate, init = {}) {
|
|
140
|
+
super(message, init);
|
|
141
|
+
this.certificate = certificate;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
103
144
|
var WaitTimeoutError = class extends PantechError {
|
|
104
145
|
name = "WaitTimeoutError";
|
|
105
146
|
};
|
|
106
147
|
var WebhookVerificationError = class extends PantechError {
|
|
107
148
|
name = "WebhookVerificationError";
|
|
108
149
|
};
|
|
150
|
+
var DNS_ERROR_CODES = [
|
|
151
|
+
"DNS_UNAVAILABLE",
|
|
152
|
+
"DNS_ZONE_NOT_FOUND",
|
|
153
|
+
"DNS_RECORD_NOT_FOUND",
|
|
154
|
+
"DNS_ZONE_LIMIT_REACHED",
|
|
155
|
+
"DNS_ZONE_CREATE_LIMIT_REACHED",
|
|
156
|
+
"DNS_RECORD_LIMIT_REACHED",
|
|
157
|
+
"DNS_ZONE_NAME_TAKEN",
|
|
158
|
+
"DNS_ZONE_ACTIVE_ELSEWHERE",
|
|
159
|
+
"DNS_RECORD_EXISTS",
|
|
160
|
+
"DNS_CNAME_CONFLICT",
|
|
161
|
+
"DNS_RECORD_READ_ONLY",
|
|
162
|
+
"DNS_ZONE_SUSPENDED",
|
|
163
|
+
"DNS_ZONE_NOT_WRITABLE",
|
|
164
|
+
"DNS_ZONE_IN_USE_BY_DOMAIN",
|
|
165
|
+
"VERSION_CONFLICT",
|
|
166
|
+
"TOO_MANY_CHANGES",
|
|
167
|
+
"INVALID_ZONE_FILE"
|
|
168
|
+
];
|
|
169
|
+
var DOMAIN_ERROR_CODES = [
|
|
170
|
+
"DOMAINS_UNAVAILABLE",
|
|
171
|
+
"DOMAIN_NOT_FOUND",
|
|
172
|
+
"DOMAIN_ORDER_NOT_FOUND",
|
|
173
|
+
"DOMAIN_LOOKUP_UNAVAILABLE",
|
|
174
|
+
"TLD_NOT_SOLD",
|
|
175
|
+
"DOMAIN_NOT_AVAILABLE",
|
|
176
|
+
"DOMAIN_NOT_TRANSFERABLE",
|
|
177
|
+
"DOMAIN_ALREADY_HELD",
|
|
178
|
+
"DOMAIN_ORDER_IN_FLIGHT",
|
|
179
|
+
"DOMAIN_ORDER_NOT_AWAITING_PAYMENT",
|
|
180
|
+
"DOMAIN_ORDER_LIMIT_REACHED",
|
|
181
|
+
"DOMAIN_NOT_CONFIGURABLE",
|
|
182
|
+
"DOMAIN_LOCKED",
|
|
183
|
+
"DOMAIN_ZONE_MISMATCH"
|
|
184
|
+
];
|
|
185
|
+
var REGISTRY_ERROR_CODES = [
|
|
186
|
+
"REGISTRY_UNAVAILABLE",
|
|
187
|
+
"REGISTRY_NAMESPACE_NOT_SET",
|
|
188
|
+
"REGISTRY_NAMESPACE_TAKEN",
|
|
189
|
+
"REGISTRY_NAMESPACE_LOCKED",
|
|
190
|
+
"INVALID_REGISTRY_NAMESPACE",
|
|
191
|
+
"INVALID_REPOSITORY_NAME",
|
|
192
|
+
"REPOSITORY_NOT_FOUND",
|
|
193
|
+
"TAG_NOT_FOUND",
|
|
194
|
+
"REGISTRY_TOKEN_NOT_FOUND",
|
|
195
|
+
"REPOSITORY_EXISTS",
|
|
196
|
+
"REPOSITORY_LIMIT_REACHED",
|
|
197
|
+
"REGISTRY_STORAGE_LIMIT_REACHED",
|
|
198
|
+
"REGISTRY_TOKEN_LIMIT_REACHED",
|
|
199
|
+
"TAG_IMMUTABLE",
|
|
200
|
+
"REPOSITORY_SUSPENDED"
|
|
201
|
+
];
|
|
202
|
+
var IAM_ERROR_CODES = [
|
|
203
|
+
"ACCESS_DENIED",
|
|
204
|
+
"IAM_TEAM_NOT_FOUND",
|
|
205
|
+
"IAM_POLICY_NOT_FOUND",
|
|
206
|
+
"IAM_ATTACHMENT_NOT_FOUND",
|
|
207
|
+
"IAM_TEAM_NAME_TAKEN",
|
|
208
|
+
"IAM_POLICY_NAME_TAKEN",
|
|
209
|
+
"IAM_TEAM_LIMIT_REACHED",
|
|
210
|
+
"IAM_POLICY_LIMIT_REACHED",
|
|
211
|
+
"IAM_ATTACHMENT_LIMIT_REACHED",
|
|
212
|
+
"IAM_MANAGED_POLICY",
|
|
213
|
+
"IAM_ADMIN_TARGET",
|
|
214
|
+
"INVALID_POLICY",
|
|
215
|
+
"VERSION_CONFLICT"
|
|
216
|
+
];
|
|
217
|
+
var CERTIFICATE_ERROR_CODES = [
|
|
218
|
+
"CERTIFICATES_UNAVAILABLE",
|
|
219
|
+
"CERTIFICATE_NOT_FOUND",
|
|
220
|
+
"CERTIFICATE_LIMIT_REACHED",
|
|
221
|
+
"CERTIFICATE_REQUEST_LIMIT_REACHED",
|
|
222
|
+
"CERTIFICATE_RATE_LIMITED",
|
|
223
|
+
"CERTIFICATE_IN_USE",
|
|
224
|
+
"CERTIFICATE_NOT_EXPORTABLE",
|
|
225
|
+
"CERTIFICATE_NOT_ISSUED",
|
|
226
|
+
"CERTIFICATE_NOT_REVOCABLE",
|
|
227
|
+
"CERTIFICATE_NOT_IMPORTED",
|
|
228
|
+
"CERTIFICATE_NOT_PENDING",
|
|
229
|
+
"CERTIFICATE_NAMES_MISMATCH",
|
|
230
|
+
"CONFLICT"
|
|
231
|
+
];
|
|
109
232
|
function isPantechError(err, code) {
|
|
110
233
|
return err instanceof PantechError && (code === void 0 || err.code === code);
|
|
111
234
|
}
|
|
@@ -117,6 +240,7 @@ var STATUS_TEXT = {
|
|
|
117
240
|
404: "Not found",
|
|
118
241
|
405: "Method not allowed",
|
|
119
242
|
409: "Conflict",
|
|
243
|
+
412: "Precondition failed",
|
|
120
244
|
413: "Request too large",
|
|
121
245
|
415: "Unsupported media type",
|
|
122
246
|
422: "Validation failed",
|
|
@@ -175,6 +299,8 @@ function errorFromResponse(status, headers, bodyText, retryAfterSeconds) {
|
|
|
175
299
|
return new NotFoundError(message, init);
|
|
176
300
|
case status === 409:
|
|
177
301
|
return new ConflictError(message, init);
|
|
302
|
+
case status === 412:
|
|
303
|
+
return new PreconditionFailedError(message, init);
|
|
178
304
|
case status === 422:
|
|
179
305
|
return new ValidationError(message, init);
|
|
180
306
|
case status === 429:
|
|
@@ -201,6 +327,26 @@ async function* paginate(fetchPage, startCursor) {
|
|
|
201
327
|
}
|
|
202
328
|
|
|
203
329
|
// src/resource.ts
|
|
330
|
+
var SECRET_FIELDS = ["secret", "private_key_pem", "secret_access_key"];
|
|
331
|
+
function hideSecrets(value) {
|
|
332
|
+
if (value && typeof value === "object") {
|
|
333
|
+
for (const field of SECRET_FIELDS) {
|
|
334
|
+
if (Object.hasOwn(value, field)) {
|
|
335
|
+
const secret = value[field];
|
|
336
|
+
Object.defineProperty(value, field, { value: secret, enumerable: false, writable: false, configurable: true });
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return value;
|
|
341
|
+
}
|
|
342
|
+
function withIfMatch(options) {
|
|
343
|
+
if (options?.ifMatch === void 0) return options;
|
|
344
|
+
const { ifMatch, ...rest } = options;
|
|
345
|
+
if (!Number.isInteger(ifMatch) || ifMatch < 0) {
|
|
346
|
+
throw new TypeError("ifMatch must be the version you read: a whole number, 0 or more.");
|
|
347
|
+
}
|
|
348
|
+
return { ...rest, headers: { ...rest.headers, "If-Match": String(ifMatch) } };
|
|
349
|
+
}
|
|
204
350
|
var APIResource = class {
|
|
205
351
|
_client;
|
|
206
352
|
constructor(client) {
|
|
@@ -271,13 +417,13 @@ function sleep(ms, signal) {
|
|
|
271
417
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
272
418
|
});
|
|
273
419
|
}
|
|
274
|
-
function path(
|
|
275
|
-
let out =
|
|
420
|
+
function path(strings2, ...ids) {
|
|
421
|
+
let out = strings2[0] ?? "";
|
|
276
422
|
ids.forEach((id, i) => {
|
|
277
423
|
if (typeof id !== "string" || id === "") {
|
|
278
424
|
throw new PantechError("A resource id is required, and it must be a non-empty string.");
|
|
279
425
|
}
|
|
280
|
-
out += encodeURIComponent(id) + (
|
|
426
|
+
out += encodeURIComponent(id) + (strings2[i + 1] ?? "");
|
|
281
427
|
});
|
|
282
428
|
return out;
|
|
283
429
|
}
|
|
@@ -397,6 +543,87 @@ async function poll(read, done, what, options = {}) {
|
|
|
397
543
|
}
|
|
398
544
|
}
|
|
399
545
|
|
|
546
|
+
// src/resources/certificates.ts
|
|
547
|
+
var ISSUE_WAIT_MS = 10 * 6e4;
|
|
548
|
+
var READY = /* @__PURE__ */ new Set(["issued", "renewing"]);
|
|
549
|
+
var FINISHED = /* @__PURE__ */ new Set(["failed", "revoked", "expired"]);
|
|
550
|
+
var Certificates = class extends APIResource {
|
|
551
|
+
/** One page of your certificates, newest first. Filter with `q` (any name), `status` or `kind`. */
|
|
552
|
+
list(params = {}, options) {
|
|
553
|
+
return this._get("/certificates", params, options);
|
|
554
|
+
}
|
|
555
|
+
listAll(params = {}, options) {
|
|
556
|
+
return this._listAll("/certificates", params, options);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Requests a certificate for 1 to 100 names. Names in your Pantech DNS
|
|
560
|
+
* zones are validated for you; for the others add each `validations[]`
|
|
561
|
+
* CNAME once. Follow it with `wait`.
|
|
562
|
+
*/
|
|
563
|
+
request(body, options) {
|
|
564
|
+
return this._post("/certificates", body, options);
|
|
565
|
+
}
|
|
566
|
+
/** Imports a certificate and its private key. An expired or mismatched one is refused. */
|
|
567
|
+
import(body, options) {
|
|
568
|
+
return this._post("/certificates/import", body, options);
|
|
569
|
+
}
|
|
570
|
+
get(certificateId, options) {
|
|
571
|
+
return this._get(path`/certificates/${certificateId}`, void 0, options);
|
|
572
|
+
}
|
|
573
|
+
update(certificateId, body, options) {
|
|
574
|
+
return this._patch(path`/certificates/${certificateId}`, body, options);
|
|
575
|
+
}
|
|
576
|
+
/** Checks the CNAMEs of a certificate waiting for validation within seconds. */
|
|
577
|
+
verify(certificateId, options) {
|
|
578
|
+
return this._post(path`/certificates/${certificateId}/verify`, void 0, options);
|
|
579
|
+
}
|
|
580
|
+
/** Replaces an imported certificate with a new one for the same names. */
|
|
581
|
+
reimport(certificateId, body, options) {
|
|
582
|
+
return this._post(path`/certificates/${certificateId}/reimport`, body, options);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* The certificate, its chain and its private key, for a certificate created
|
|
586
|
+
* with `exportable: true`. Needs the `delete` scope; every owner and admin is
|
|
587
|
+
* emailed. `private_key_pem` is non-enumerable: read it explicitly.
|
|
588
|
+
*/
|
|
589
|
+
async export(certificateId, options) {
|
|
590
|
+
return hideSecrets(
|
|
591
|
+
await this._post(path`/certificates/${certificateId}/export`, void 0, options)
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
/** Asks the CA to revoke it (`reason`: `unspecified` or `key_compromise`). Refused while it is in use. */
|
|
595
|
+
revoke(certificateId, body = {}, options) {
|
|
596
|
+
return this._post(path`/certificates/${certificateId}/revoke`, body, options);
|
|
597
|
+
}
|
|
598
|
+
/** Deletes it. Refused while a Pantech service uses it. */
|
|
599
|
+
delete(certificateId, options) {
|
|
600
|
+
return this._delete(path`/certificates/${certificateId}`, options);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Polls the certificate until it is `issued` (resolves with it) or it
|
|
604
|
+
* `failed`, was revoked or expired (rejects with CertificateFailedError).
|
|
605
|
+
* Default timeout 10 minutes, polling every 5 seconds; a name validated by
|
|
606
|
+
* CNAME waits until you add it, up to 72 hours, so pass a longer `timeoutMs`.
|
|
607
|
+
*/
|
|
608
|
+
wait(certificateId, options = {}) {
|
|
609
|
+
return poll(
|
|
610
|
+
() => this.get(certificateId, { signal: options.signal }),
|
|
611
|
+
(c) => {
|
|
612
|
+
if (FINISHED.has(c.status)) {
|
|
613
|
+
const code = c.failure_code ?? c.status;
|
|
614
|
+
const detail = code === c.status ? "" : ` (${code})`;
|
|
615
|
+
throw new CertificateFailedError(`Certificate ${c.id} (${c.names[0] ?? ""}) is ${c.status}${detail}.`, c, {
|
|
616
|
+
code
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
return READY.has(c.status);
|
|
620
|
+
},
|
|
621
|
+
`Certificate ${certificateId}`,
|
|
622
|
+
{ timeoutMs: ISSUE_WAIT_MS, pollIntervalMs: 5e3, ...options }
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
|
|
400
627
|
// src/orders.ts
|
|
401
628
|
var orderId = (ref) => typeof ref === "string" ? ref : ref.order_id;
|
|
402
629
|
async function waitForOrder(client, read, what, options = {}) {
|
|
@@ -514,12 +741,416 @@ var DatabaseOrders = class extends APIResource {
|
|
|
514
741
|
}
|
|
515
742
|
};
|
|
516
743
|
|
|
744
|
+
// src/resources/dns.ts
|
|
745
|
+
var RECORD_WAIT_MS = 5 * 6e4;
|
|
746
|
+
var ZONE_WAIT_MS = 5 * 6e4;
|
|
747
|
+
var DNS = class extends APIResource {
|
|
748
|
+
/** Hosted zones, with the name servers to delegate your domain to. */
|
|
749
|
+
zones = new DNSZones(this._client);
|
|
750
|
+
/** Record sets of a zone: one name and type each, with a TTL and values. */
|
|
751
|
+
records = new DNSRecords(this._client);
|
|
752
|
+
};
|
|
753
|
+
var DNSZones = class extends APIResource {
|
|
754
|
+
/** One page of your zones, newest first. Filter with `q` (name contains) or `status`. */
|
|
755
|
+
list(params = {}, options) {
|
|
756
|
+
return this._get("/dns/zones", params, options);
|
|
757
|
+
}
|
|
758
|
+
listAll(params = {}, options) {
|
|
759
|
+
return this._listAll("/dns/zones", params, options);
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Hosts a zone. It is `pending`, then `awaiting_delegation` with its own
|
|
763
|
+
* two `name_servers` to set at your registrar, then `active` once the
|
|
764
|
+
* registry delegates to exactly those. Undelegated for 14 days, it is
|
|
765
|
+
* removed. The first 5 zones are free: see `quote`.
|
|
766
|
+
*/
|
|
767
|
+
create(body, options) {
|
|
768
|
+
return this._post("/dns/zones", body, options);
|
|
769
|
+
}
|
|
770
|
+
/** The free zone allowance, and the monthly price of each further zone in your currency (before VAT). */
|
|
771
|
+
quote(options) {
|
|
772
|
+
return this._get("/dns/zones/quote", void 0, options);
|
|
773
|
+
}
|
|
774
|
+
get(zoneId, options) {
|
|
775
|
+
return this._get(path`/dns/zones/${zoneId}`, void 0, options);
|
|
776
|
+
}
|
|
777
|
+
/** Changes the zone's description. */
|
|
778
|
+
update(zoneId, body, options) {
|
|
779
|
+
return this._patch(path`/dns/zones/${zoneId}`, body, options);
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Stops answering for the zone at once and removes its records. Refused
|
|
783
|
+
* with `DNS_ZONE_IN_USE_BY_DOMAIN` while a Pantech domain delegates to it.
|
|
784
|
+
*/
|
|
785
|
+
delete(zoneId, options) {
|
|
786
|
+
return this._delete(path`/dns/zones/${zoneId}`, options);
|
|
787
|
+
}
|
|
788
|
+
/** Checks the zone's delegation within seconds instead of at the next scheduled check. */
|
|
789
|
+
verify(zoneId, options) {
|
|
790
|
+
return this._post(path`/dns/zones/${zoneId}/verify`, void 0, options);
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Polls a new zone until it has its name servers: `awaiting_delegation`
|
|
794
|
+
* (set them at your registrar) or `active`. Rejects with DNSFailedError if
|
|
795
|
+
* it fails or is being deleted. Default timeout 5 minutes, polling every 3
|
|
796
|
+
* seconds. It does not wait for delegation, which is up to your registrar.
|
|
797
|
+
*/
|
|
798
|
+
wait(zoneId, options = {}) {
|
|
799
|
+
return poll(
|
|
800
|
+
() => this.get(zoneId, { signal: options.signal }),
|
|
801
|
+
(z) => {
|
|
802
|
+
if (z.status === "failed" || z.status === "deleting" || z.status === "deleted") {
|
|
803
|
+
const code = z.failure_code ?? z.status;
|
|
804
|
+
throw new DNSFailedError(`DNS zone ${z.id} (${z.name}) is ${z.status} (${code}).`, "zone", z, { code });
|
|
805
|
+
}
|
|
806
|
+
return z.status === "awaiting_delegation" || z.status === "active";
|
|
807
|
+
},
|
|
808
|
+
`DNS zone ${zoneId}`,
|
|
809
|
+
{ timeoutMs: ZONE_WAIT_MS, pollIntervalMs: 3e3, ...options }
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
/** The zone's record sets as a BIND zone file. */
|
|
813
|
+
exportZoneFile(zoneId, options) {
|
|
814
|
+
return this._request("GET", path`/dns/zones/${zoneId}/export`, { responseType: "text" }, options);
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Creates and updates record sets from a BIND zone file (at most 1000
|
|
818
|
+
* changes). With `replace: true`, record sets the file lacks are deleted too.
|
|
819
|
+
*/
|
|
820
|
+
importZoneFile(zoneId, body, options) {
|
|
821
|
+
return this._post(path`/dns/zones/${zoneId}/import`, body, options);
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
var DNSRecords = class extends APIResource {
|
|
825
|
+
/** One page of a zone's record sets, by name then type. Filter with `name`, `q` or `type`. */
|
|
826
|
+
list(zoneId, params = {}, options) {
|
|
827
|
+
return this._get(path`/dns/zones/${zoneId}/records`, params, options);
|
|
828
|
+
}
|
|
829
|
+
listAll(zoneId, params = {}, options) {
|
|
830
|
+
return this._listAll(path`/dns/zones/${zoneId}/records`, params, options);
|
|
831
|
+
}
|
|
832
|
+
/** Adds a record set, `pending` until it answers. Follow it with `wait`. */
|
|
833
|
+
create(zoneId, body, options) {
|
|
834
|
+
return this._post(path`/dns/zones/${zoneId}/records`, body, options);
|
|
835
|
+
}
|
|
836
|
+
get(zoneId, recordId, options) {
|
|
837
|
+
return this._get(path`/dns/zones/${zoneId}/records/${recordId}`, void 0, options);
|
|
838
|
+
}
|
|
839
|
+
/** Changes the TTL, values or comment. Pass `{ ifMatch: record.version }` to refuse a lost update. */
|
|
840
|
+
update(zoneId, recordId, body, options) {
|
|
841
|
+
return this._patch(path`/dns/zones/${zoneId}/records/${recordId}`, body, withIfMatch(options));
|
|
842
|
+
}
|
|
843
|
+
/** Removes the record set. Pass `{ ifMatch: record.version }` to refuse it if the record changed. */
|
|
844
|
+
delete(zoneId, recordId, options) {
|
|
845
|
+
return this._delete(path`/dns/zones/${zoneId}/records/${recordId}`, withIfMatch(options));
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Up to 1000 creates, updates and deletes, all or nothing. A change's
|
|
849
|
+
* `version` refuses it with `412 VERSION_CONFLICT` if the record moved on.
|
|
850
|
+
*/
|
|
851
|
+
batch(zoneId, body, options) {
|
|
852
|
+
return this._post(path`/dns/zones/${zoneId}/records/batch`, body, options);
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Polls the record set until it is `active` (resolves with it) or its
|
|
856
|
+
* change failed (rejects with DNSFailedError). Default timeout 5
|
|
857
|
+
* minutes, polling every 3 seconds.
|
|
858
|
+
*/
|
|
859
|
+
wait(zoneId, recordId, options = {}) {
|
|
860
|
+
return poll(
|
|
861
|
+
() => this.get(zoneId, recordId, { signal: options.signal }),
|
|
862
|
+
(r) => {
|
|
863
|
+
if (r.status === "failed") {
|
|
864
|
+
const code = r.failure_code ?? void 0;
|
|
865
|
+
throw new DNSFailedError(
|
|
866
|
+
`DNS record ${r.id} (${r.fqdn} ${r.type}) failed${code ? ` (${code})` : ""}. The previous values still answer.`,
|
|
867
|
+
"record",
|
|
868
|
+
r,
|
|
869
|
+
{ code }
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
return r.status === "active";
|
|
873
|
+
},
|
|
874
|
+
`DNS record ${recordId}`,
|
|
875
|
+
{ timeoutMs: RECORD_WAIT_MS, pollIntervalMs: 3e3, ...options }
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
// src/resources/domains.ts
|
|
881
|
+
var ORDER_WAIT_MS = 15 * 6e4;
|
|
882
|
+
var domainOrderId = (ref) => typeof ref === "string" ? ref : ref.order.id;
|
|
883
|
+
var Domains = class extends APIResource {
|
|
884
|
+
/** Registrations, renewals and transfers. */
|
|
885
|
+
orders = new DomainOrders(this._client);
|
|
886
|
+
/** Every TLD for sale to your organization, priced per year in minor units of its currency. */
|
|
887
|
+
listTlds(options) {
|
|
888
|
+
return this._get("/domains/tlds", void 0, options);
|
|
889
|
+
}
|
|
890
|
+
/** Checks a name across the TLDs for sale, plus suggestions, each with its price. */
|
|
891
|
+
search(params, options) {
|
|
892
|
+
return this._get("/domains/search", params, options);
|
|
893
|
+
}
|
|
894
|
+
/** Whether the registry lets the domain move to Pantech now, and what it costs. */
|
|
895
|
+
checkTransfer(params, options) {
|
|
896
|
+
return this._get("/domains/transfer-check", params, options);
|
|
897
|
+
}
|
|
898
|
+
list(params = {}, options) {
|
|
899
|
+
return this._get("/domains", params, options);
|
|
900
|
+
}
|
|
901
|
+
listAll(params = {}, options) {
|
|
902
|
+
return this._listAll("/domains", params, options);
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Buys the domain for `years` (1 to 10), paid from your credit first; a
|
|
906
|
+
* failed order is refunded. `accept_terms` must be true: the registrant has
|
|
907
|
+
* accepted the Domain Registration Agreement
|
|
908
|
+
* (https://pantechdynamics.com/legal/domain-registration). Follow the order with
|
|
909
|
+
* `orders.wait(result)`.
|
|
910
|
+
*/
|
|
911
|
+
register(body, options) {
|
|
912
|
+
return this._post("/domains", body, options);
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Moves a domain to Pantech with its auth code, adding `years` to its term.
|
|
916
|
+
* `accept_terms` must be true, as for `register`. Follow it with `orders.wait`.
|
|
917
|
+
*/
|
|
918
|
+
transfer(body, options) {
|
|
919
|
+
return this._post("/domains/transfers", body, options);
|
|
920
|
+
}
|
|
921
|
+
get(domainId, options) {
|
|
922
|
+
return this._get(path`/domains/${domainId}`, void 0, options);
|
|
923
|
+
}
|
|
924
|
+
/** Turns auto-renew, the transfer lock or privacy on or off. */
|
|
925
|
+
update(domainId, body, options) {
|
|
926
|
+
return this._patch(path`/domains/${domainId}`, body, options);
|
|
927
|
+
}
|
|
928
|
+
/** Points the domain at its Pantech DNS zone, or at up to 6 custom name servers. */
|
|
929
|
+
setNameServers(domainId, body, options) {
|
|
930
|
+
return this._put(path`/domains/${domainId}/name-servers`, body, options);
|
|
931
|
+
}
|
|
932
|
+
/** The registrant contact. Owners and admins only. */
|
|
933
|
+
getContact(domainId, options) {
|
|
934
|
+
return this._get(path`/domains/${domainId}/contact`, void 0, options);
|
|
935
|
+
}
|
|
936
|
+
/** Replaces the registrant contact; applied at the registry in the background. */
|
|
937
|
+
updateContact(domainId, body, options) {
|
|
938
|
+
return this._put(path`/domains/${domainId}/contact`, body, options);
|
|
939
|
+
}
|
|
940
|
+
/** Adds `years` (default 1) to the domain's term, paid from your credit first. */
|
|
941
|
+
renew(domainId, body = {}, options) {
|
|
942
|
+
return this._post(path`/domains/${domainId}/renew`, body, options);
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Asks for the code that moves the domain to another registrar. Needs the
|
|
946
|
+
* `delete` scope, and the transfer lock off. Read it with `getAuthCode`.
|
|
947
|
+
*/
|
|
948
|
+
requestAuthCode(domainId, options) {
|
|
949
|
+
return this._post(path`/domains/${domainId}/auth-code`, void 0, options);
|
|
950
|
+
}
|
|
951
|
+
/** The auth code once it has arrived, or `{ status: "pending" }` while it is on its way. */
|
|
952
|
+
getAuthCode(domainId, options) {
|
|
953
|
+
return this._get(path`/domains/${domainId}/auth-code`, void 0, options);
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
var DomainOrders = class extends APIResource {
|
|
957
|
+
/** A domain's registrations, renewals and transfers, newest first. */
|
|
958
|
+
list(domainId, options) {
|
|
959
|
+
return this._get(path`/domains/${domainId}/orders`, void 0, options);
|
|
960
|
+
}
|
|
961
|
+
get(orderId2, options) {
|
|
962
|
+
return this._get(path`/domain-orders/${orderId2}`, void 0, options);
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Makes an order waiting in `awaiting_payment` try its payment again now,
|
|
966
|
+
* and wait another hour: in US dollars the saved card is charged the
|
|
967
|
+
* difference once more (after a decline, or once a new card is saved); in
|
|
968
|
+
* naira the credit just added is taken. The call charges nothing itself
|
|
969
|
+
* and an order is never charged twice, so repeating it is safe. Resolves
|
|
970
|
+
* with the order (`202`); follow it with `wait(order, { waitForPayment: true })`.
|
|
971
|
+
* Rejects with ConflictError `DOMAIN_ORDER_NOT_AWAITING_PAYMENT` when the
|
|
972
|
+
* order is not waiting for a payment or its window has ended.
|
|
973
|
+
*/
|
|
974
|
+
retryPayment(orderId2, options) {
|
|
975
|
+
return this._post(path`/domain-orders/${orderId2}/retry-payment`, void 0, options);
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Polls the order until it `succeeded` (resolves with it) or `failed`
|
|
979
|
+
* (rejects with OrderFailedError; any amount taken is returned to your
|
|
980
|
+
* credit). An order your credit does not cover waits in `awaiting_payment`
|
|
981
|
+
* for an hour (in US dollars the saved card is charged the difference; in
|
|
982
|
+
* naira the user adds credit): it rejects with PaymentRequiredError carrying
|
|
983
|
+
* `paymentExpiresAt`, and `paymentUrl` only when the bank asks the user to
|
|
984
|
+
* confirm the payment; wait again with `{ waitForPayment: true }`, or call
|
|
985
|
+
* `retryPayment` to try again at once. An order not paid in time fails
|
|
986
|
+
* `insufficient_credit` and nothing is charged. Default timeout 15 minutes,
|
|
987
|
+
* polling every 5 seconds. A transfer can take days: pass a longer
|
|
988
|
+
* `timeoutMs`, or check the order later.
|
|
989
|
+
*/
|
|
990
|
+
wait(ref, options = {}) {
|
|
991
|
+
const id = domainOrderId(ref);
|
|
992
|
+
const { waitForPayment, ...waitOptions } = options;
|
|
993
|
+
return poll(
|
|
994
|
+
() => this.get(id, { signal: options.signal }),
|
|
995
|
+
(o) => {
|
|
996
|
+
if (o.status === "awaiting_payment" && !waitForPayment) {
|
|
997
|
+
throw new PaymentRequiredError(
|
|
998
|
+
`Domain order ${o.id} is waiting for a payment: your credit does not cover it.${o.payment_url ? " The bank asks the user to confirm the card payment at paymentUrl." : ""} It must be paid${o.payment_expires_at ? ` before ${o.payment_expires_at}` : " within the hour"}; the order goes on by itself once it is, and retryPayment tries again at once.`,
|
|
999
|
+
{
|
|
1000
|
+
status: 402,
|
|
1001
|
+
code: "AWAITING_PAYMENT",
|
|
1002
|
+
paymentUrl: o.payment_url ?? void 0,
|
|
1003
|
+
paymentExpiresAt: o.payment_expires_at ?? void 0,
|
|
1004
|
+
order: o
|
|
1005
|
+
}
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
if (o.status === "failed") {
|
|
1009
|
+
const code = o.failure_code ?? "failed";
|
|
1010
|
+
throw new OrderFailedError(
|
|
1011
|
+
`Domain order ${o.id} failed (${code}).${o.refunded ? " The amount was returned to your credit." : ""}`,
|
|
1012
|
+
o,
|
|
1013
|
+
{ code }
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
return o.status === "succeeded";
|
|
1017
|
+
},
|
|
1018
|
+
`Domain order ${id}`,
|
|
1019
|
+
{ timeoutMs: ORDER_WAIT_MS, pollIntervalMs: 5e3, ...waitOptions }
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
// src/resources/iam.ts
|
|
1025
|
+
var IAM = class extends APIResource {
|
|
1026
|
+
/** The actions a policy statement can name. */
|
|
1027
|
+
actions = new IAMActions(this._client);
|
|
1028
|
+
/** Whether members may read everything, or only what their policies allow. */
|
|
1029
|
+
settings = new IAMSettings(this._client);
|
|
1030
|
+
/** The organization's members, with their teams and how many policies apply to each. */
|
|
1031
|
+
members = new IAMMembers(this._client);
|
|
1032
|
+
/** Teams of members that policies are attached to. */
|
|
1033
|
+
teams = new IAMTeams(this._client);
|
|
1034
|
+
/** Statements that allow or deny actions, attached to members or teams. */
|
|
1035
|
+
policies = new IAMPolicies(this._client);
|
|
1036
|
+
/** A member's role, teams and every policy that applies to them, with the team that brought it. */
|
|
1037
|
+
effectiveAccess(userId, options) {
|
|
1038
|
+
return this._get(path`/iam/members/${userId}/effective-access`, void 0, options);
|
|
1039
|
+
}
|
|
1040
|
+
/** Whether a member may do an action (on a resource, from an address, with MFA), and which policy decided. */
|
|
1041
|
+
simulate(body, options) {
|
|
1042
|
+
return this._post("/iam/simulate", body, options);
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
var IAMActions = class extends APIResource {
|
|
1046
|
+
/** Every action, e.g. `instances:Stop`, with its description and whether it is a read. */
|
|
1047
|
+
list(options) {
|
|
1048
|
+
return this._get("/iam/actions", void 0, options);
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
var IAMMembers = class extends APIResource {
|
|
1052
|
+
/** One page of members, by when they joined. Filter with `q` (email or name). */
|
|
1053
|
+
list(params = {}, options) {
|
|
1054
|
+
return this._get("/iam/members", params, options);
|
|
1055
|
+
}
|
|
1056
|
+
listAll(params = {}, options) {
|
|
1057
|
+
return this._listAll("/iam/members", params, options);
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
var IAMSettings = class extends APIResource {
|
|
1061
|
+
get(options) {
|
|
1062
|
+
return this._get("/iam/settings", void 0, options);
|
|
1063
|
+
}
|
|
1064
|
+
/** Changes `member_baseline` (`read` or `none`). Owners only. Pass `{ ifMatch: settings.version }` to refuse a lost update. */
|
|
1065
|
+
update(body, options) {
|
|
1066
|
+
return this._put("/iam/settings", body, withIfMatch(options));
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
var IAMTeams = class extends APIResource {
|
|
1070
|
+
/** Members of a team. */
|
|
1071
|
+
members = new IAMTeamMembers(this._client);
|
|
1072
|
+
list(params = {}, options) {
|
|
1073
|
+
return this._get("/iam/teams", params, options);
|
|
1074
|
+
}
|
|
1075
|
+
listAll(params = {}, options) {
|
|
1076
|
+
return this._listAll("/iam/teams", params, options);
|
|
1077
|
+
}
|
|
1078
|
+
create(body, options) {
|
|
1079
|
+
return this._post("/iam/teams", body, options);
|
|
1080
|
+
}
|
|
1081
|
+
get(teamId, options) {
|
|
1082
|
+
return this._get(path`/iam/teams/${teamId}`, void 0, options);
|
|
1083
|
+
}
|
|
1084
|
+
update(teamId, body, options) {
|
|
1085
|
+
return this._patch(path`/iam/teams/${teamId}`, body, options);
|
|
1086
|
+
}
|
|
1087
|
+
/** Deletes the team; its members lose what its policies gave them. */
|
|
1088
|
+
delete(teamId, options) {
|
|
1089
|
+
return this._delete(path`/iam/teams/${teamId}`, options);
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
var IAMTeamMembers = class extends APIResource {
|
|
1093
|
+
list(teamId, params = {}, options) {
|
|
1094
|
+
return this._get(path`/iam/teams/${teamId}/members`, params, options);
|
|
1095
|
+
}
|
|
1096
|
+
listAll(teamId, params = {}, options) {
|
|
1097
|
+
return this._listAll(path`/iam/teams/${teamId}/members`, params, options);
|
|
1098
|
+
}
|
|
1099
|
+
/** Adds an organization member to the team. Only owners may add an admin. */
|
|
1100
|
+
add(teamId, userId, options) {
|
|
1101
|
+
return this._request("PUT", path`/iam/teams/${teamId}/members/${userId}`, {}, options);
|
|
1102
|
+
}
|
|
1103
|
+
remove(teamId, userId, options) {
|
|
1104
|
+
return this._delete(path`/iam/teams/${teamId}/members/${userId}`, options);
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
var IAMPolicies = class extends APIResource {
|
|
1108
|
+
/** The members and teams a policy is attached to. */
|
|
1109
|
+
attachments = new IAMPolicyAttachments(this._client);
|
|
1110
|
+
/** Your policies and Pantech's managed ones; `{ managed: false }` for yours only. */
|
|
1111
|
+
list(params = {}, options) {
|
|
1112
|
+
return this._get("/iam/policies", params, options);
|
|
1113
|
+
}
|
|
1114
|
+
listAll(params = {}, options) {
|
|
1115
|
+
return this._listAll("/iam/policies", params, options);
|
|
1116
|
+
}
|
|
1117
|
+
/** Creates a policy of 1 to 20 statements. It does nothing until it is attached. */
|
|
1118
|
+
create(body, options) {
|
|
1119
|
+
return this._post("/iam/policies", body, options);
|
|
1120
|
+
}
|
|
1121
|
+
get(policyId, options) {
|
|
1122
|
+
return this._get(path`/iam/policies/${policyId}`, void 0, options);
|
|
1123
|
+
}
|
|
1124
|
+
/** Replaces the name, description and statements. Pass `{ ifMatch: policy.version }` to refuse a lost update. */
|
|
1125
|
+
update(policyId, body, options) {
|
|
1126
|
+
return this._put(path`/iam/policies/${policyId}`, body, withIfMatch(options));
|
|
1127
|
+
}
|
|
1128
|
+
/** Deletes the policy and detaches it everywhere. Pantech's managed policies cannot be deleted. */
|
|
1129
|
+
delete(policyId, options) {
|
|
1130
|
+
return this._delete(path`/iam/policies/${policyId}`, options);
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
var IAMPolicyAttachments = class extends APIResource {
|
|
1134
|
+
list(policyId, options) {
|
|
1135
|
+
return this._get(path`/iam/policies/${policyId}/attachments`, void 0, options);
|
|
1136
|
+
}
|
|
1137
|
+
/** Attaches the policy to a member (`usr_…`) or a team (`team_…`). */
|
|
1138
|
+
attach(policyId, body, options) {
|
|
1139
|
+
return this._post(path`/iam/policies/${policyId}/attachments`, body, options);
|
|
1140
|
+
}
|
|
1141
|
+
detach(policyId, principalType, principalId, options) {
|
|
1142
|
+
return this._delete(path`/iam/policies/${policyId}/attachments/${principalType}/${principalId}`, options);
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
|
|
517
1146
|
// src/resources/instances.ts
|
|
518
1147
|
var Instances = class extends APIResource {
|
|
519
1148
|
/** Snapshots of an instance's root disk. */
|
|
520
1149
|
snapshots = new InstanceSnapshots(this._client);
|
|
521
1150
|
/** Short-lived SSH access grants through the browser terminal relay. */
|
|
522
1151
|
sshAccess = new InstanceSshAccess(this._client);
|
|
1152
|
+
/** Dynamic IP: a public outbound address that rotates on a schedule or on demand. */
|
|
1153
|
+
dynamicIp = new InstanceDynamicIp(this._client);
|
|
523
1154
|
/** One page of your instances. */
|
|
524
1155
|
list(params = {}, options) {
|
|
525
1156
|
return this._get("/instances", params, options);
|
|
@@ -627,6 +1258,24 @@ var InstanceSshAccess = class extends APIResource {
|
|
|
627
1258
|
return this._delete(path`/instances/${instanceId}/ssh-access/${grantId}`, options);
|
|
628
1259
|
}
|
|
629
1260
|
};
|
|
1261
|
+
var InstanceDynamicIp = class extends APIResource {
|
|
1262
|
+
/** Whether the instance has a dynamic IP, its schedule, current address and recent changes. */
|
|
1263
|
+
get(instanceId, options) {
|
|
1264
|
+
return this._get(path`/instances/${instanceId}/address-rotation`, void 0, options);
|
|
1265
|
+
}
|
|
1266
|
+
/** Turns on or changes dynamic IP settings for the instance. */
|
|
1267
|
+
set(instanceId, body, options) {
|
|
1268
|
+
return this._put(path`/instances/${instanceId}/address-rotation`, body, options);
|
|
1269
|
+
}
|
|
1270
|
+
/** Turns off dynamic IP for the instance and stops its surcharge. */
|
|
1271
|
+
disable(instanceId, options) {
|
|
1272
|
+
return this._delete(path`/instances/${instanceId}/address-rotation`, options);
|
|
1273
|
+
}
|
|
1274
|
+
/** Gives the instance a new dynamic IP now, outside its schedule. Sent once: the API does not replay it. */
|
|
1275
|
+
rotate(instanceId, options) {
|
|
1276
|
+
return this._post(path`/instances/${instanceId}/address-rotation/rotate`, void 0, options, { noRetry: true });
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
630
1279
|
var InstanceOrders = class extends APIResource {
|
|
631
1280
|
list(params = {}, options) {
|
|
632
1281
|
return this._get("/instance-orders", params, options);
|
|
@@ -980,6 +1629,192 @@ var FirewallRules = class extends APIResource {
|
|
|
980
1629
|
}
|
|
981
1630
|
};
|
|
982
1631
|
|
|
1632
|
+
// src/resources/object-storage.ts
|
|
1633
|
+
var ObjectStorage = class extends APIResource {
|
|
1634
|
+
/** S3 access keys for your organization. */
|
|
1635
|
+
keys = new ObjectStorageKeys(this._client);
|
|
1636
|
+
/** Whether object storage is available, with endpoints and regional pricing. */
|
|
1637
|
+
getStatus(options) {
|
|
1638
|
+
return this._get("/object-storage", void 0, options);
|
|
1639
|
+
}
|
|
1640
|
+
/** Hourly object storage traffic and operations for your organization. */
|
|
1641
|
+
getUsage(params = {}, options) {
|
|
1642
|
+
return this._get("/object-storage/usage", params, options);
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
var ObjectStorageKeys = class extends APIResource {
|
|
1646
|
+
/** Lists your S3 access keys without their secrets. */
|
|
1647
|
+
list(params = {}, options) {
|
|
1648
|
+
return this._get("/object-storage/keys", params, options);
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Creates an S3 access key. Its `secret_access_key` is returned once and
|
|
1652
|
+
* never replayed; it is non-enumerable so `console.log` and `JSON.stringify`
|
|
1653
|
+
* leave it out while `key.secret_access_key` reads it.
|
|
1654
|
+
*/
|
|
1655
|
+
async create(body, options) {
|
|
1656
|
+
return hideSecrets(
|
|
1657
|
+
await this._post("/object-storage/keys", body, options, { noRetry: true })
|
|
1658
|
+
);
|
|
1659
|
+
}
|
|
1660
|
+
/** Revokes an S3 access key at once. */
|
|
1661
|
+
revoke(storageKeyId, options) {
|
|
1662
|
+
return this._delete(path`/object-storage/keys/${storageKeyId}`, options);
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
var Buckets = class extends APIResource {
|
|
1666
|
+
/** Objects and folders inside a bucket. */
|
|
1667
|
+
objects = new BucketObjects(this._client);
|
|
1668
|
+
/** Multipart uploads for large objects. */
|
|
1669
|
+
multipart = new BucketMultipart(this._client);
|
|
1670
|
+
/** Lists every bucket in your organization. */
|
|
1671
|
+
list(options) {
|
|
1672
|
+
return this._get("/buckets", void 0, options);
|
|
1673
|
+
}
|
|
1674
|
+
/** Creates a new bucket. */
|
|
1675
|
+
create(body, options) {
|
|
1676
|
+
return this._post("/buckets", body, options);
|
|
1677
|
+
}
|
|
1678
|
+
/** Gets one bucket's settings and endpoints. */
|
|
1679
|
+
get(bucketId, options) {
|
|
1680
|
+
return this._get(path`/buckets/${bucketId}`, void 0, options);
|
|
1681
|
+
}
|
|
1682
|
+
/** Updates a bucket's versioning, access policy, or public prefixes. */
|
|
1683
|
+
update(bucketId, body, options) {
|
|
1684
|
+
return this._patch(path`/buckets/${bucketId}`, body, options);
|
|
1685
|
+
}
|
|
1686
|
+
/** Deletes a bucket. Pass `{ force: true }` to empty it before removal. */
|
|
1687
|
+
delete(bucketId, params = {}, options) {
|
|
1688
|
+
return this._request("DELETE", path`/buckets/${bucketId}`, { query: params }, options);
|
|
1689
|
+
}
|
|
1690
|
+
/** Live total size and object count of a bucket. */
|
|
1691
|
+
stats(bucketId, options) {
|
|
1692
|
+
return this._get(path`/buckets/${bucketId}/stats`, void 0, options);
|
|
1693
|
+
}
|
|
1694
|
+
/** Deletes all objects, versions, and active multipart uploads in a bucket. Sent once: not retried on error. */
|
|
1695
|
+
empty(bucketId, options) {
|
|
1696
|
+
return this._post(path`/buckets/${bucketId}/empty`, void 0, options, { noRetry: true });
|
|
1697
|
+
}
|
|
1698
|
+
/** Reads the bucket's CORS rules. */
|
|
1699
|
+
getCors(bucketId, options) {
|
|
1700
|
+
return this._get(path`/buckets/${bucketId}/cors`, void 0, options);
|
|
1701
|
+
}
|
|
1702
|
+
/** Replaces the bucket's CORS rules (an empty list clears them). */
|
|
1703
|
+
setCors(bucketId, body, options) {
|
|
1704
|
+
return this._put(path`/buckets/${bucketId}/cors`, body, options);
|
|
1705
|
+
}
|
|
1706
|
+
/** Reads the bucket's lifecycle rules. */
|
|
1707
|
+
getLifecycle(bucketId, options) {
|
|
1708
|
+
return this._get(path`/buckets/${bucketId}/lifecycle`, void 0, options);
|
|
1709
|
+
}
|
|
1710
|
+
/** Replaces the bucket's lifecycle rules (an empty list clears them). */
|
|
1711
|
+
setLifecycle(bucketId, body, options) {
|
|
1712
|
+
return this._put(path`/buckets/${bucketId}/lifecycle`, body, options);
|
|
1713
|
+
}
|
|
1714
|
+
/** Reads the bucket's tags. */
|
|
1715
|
+
getTags(bucketId, options) {
|
|
1716
|
+
return this._get(path`/buckets/${bucketId}/tags`, void 0, options);
|
|
1717
|
+
}
|
|
1718
|
+
/** Replaces the bucket's tags (an empty list clears them). */
|
|
1719
|
+
setTags(bucketId, body, options) {
|
|
1720
|
+
return this._put(path`/buckets/${bucketId}/tags`, body, options);
|
|
1721
|
+
}
|
|
1722
|
+
/** Reads the bucket's default object lock configuration. */
|
|
1723
|
+
getObjectLock(bucketId, options) {
|
|
1724
|
+
return this._get(path`/buckets/${bucketId}/object-lock`, void 0, options);
|
|
1725
|
+
}
|
|
1726
|
+
/** Updates the bucket's default object lock configuration. */
|
|
1727
|
+
setObjectLock(bucketId, body, options) {
|
|
1728
|
+
return this._put(path`/buckets/${bucketId}/object-lock`, body, options);
|
|
1729
|
+
}
|
|
1730
|
+
};
|
|
1731
|
+
var BucketObjects = class extends APIResource {
|
|
1732
|
+
/** Lists folders and objects under a prefix, searches across the bucket, or lists object versions. */
|
|
1733
|
+
list(bucketId, params = {}, options) {
|
|
1734
|
+
return this._get(path`/buckets/${bucketId}/objects`, params, options);
|
|
1735
|
+
}
|
|
1736
|
+
/** Reads metadata, headers, tags, lock status, and public visibility of one object. */
|
|
1737
|
+
getMeta(bucketId, params, options) {
|
|
1738
|
+
return this._get(path`/buckets/${bucketId}/objects/meta`, params, options);
|
|
1739
|
+
}
|
|
1740
|
+
/** Downloads an object's raw bytes as an `ArrayBuffer`. */
|
|
1741
|
+
download(bucketId, params, options) {
|
|
1742
|
+
return this._request(
|
|
1743
|
+
"GET",
|
|
1744
|
+
path`/buckets/${bucketId}/objects/download`,
|
|
1745
|
+
{ query: params, responseType: "arrayBuffer" },
|
|
1746
|
+
options
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
/** Mints a short-lived signed download URL when direct transfers are enabled. */
|
|
1750
|
+
presignDownload(bucketId, body, options) {
|
|
1751
|
+
return this._post(path`/buckets/${bucketId}/objects/download-url`, body, options);
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Streams an object upload into the bucket as raw bytes. Sets
|
|
1755
|
+
* `Content-Type: application/octet-stream` unless `options.headers` sets a
|
|
1756
|
+
* custom `Content-Type`.
|
|
1757
|
+
*/
|
|
1758
|
+
upload(bucketId, params, body, options) {
|
|
1759
|
+
return this._request("PUT", path`/buckets/${bucketId}/objects/upload`, { query: params, rawBody: body }, options);
|
|
1760
|
+
}
|
|
1761
|
+
/** Mints a short-lived signed upload URL when direct transfers are enabled. */
|
|
1762
|
+
presignUpload(bucketId, body, options) {
|
|
1763
|
+
return this._post(path`/buckets/${bucketId}/objects/upload-url`, body, options);
|
|
1764
|
+
}
|
|
1765
|
+
/** Creates a folder marker object ending with `/`. */
|
|
1766
|
+
createFolder(bucketId, body, options) {
|
|
1767
|
+
return this._post(path`/buckets/${bucketId}/objects/folder`, body, options);
|
|
1768
|
+
}
|
|
1769
|
+
/** Copies, renames, or updates metadata of an object inside the bucket. */
|
|
1770
|
+
copy(bucketId, body, options) {
|
|
1771
|
+
return this._post(path`/buckets/${bucketId}/objects/copy`, body, options);
|
|
1772
|
+
}
|
|
1773
|
+
/** Deletes one or more objects or versions, or deletes a folder prefix recursively. */
|
|
1774
|
+
delete(bucketId, body, options) {
|
|
1775
|
+
return this._post(path`/buckets/${bucketId}/objects/delete`, body, options);
|
|
1776
|
+
}
|
|
1777
|
+
/** Replaces tags on an object or object version. */
|
|
1778
|
+
setTags(bucketId, body, options) {
|
|
1779
|
+
return this._put(path`/buckets/${bucketId}/objects/tags`, body, options);
|
|
1780
|
+
}
|
|
1781
|
+
/** Sets retention or legal hold on an object or object version. */
|
|
1782
|
+
setLock(bucketId, body, options) {
|
|
1783
|
+
return this._put(path`/buckets/${bucketId}/objects/lock`, body, options);
|
|
1784
|
+
}
|
|
1785
|
+
/** Sets whether a specific object is publicly readable and returns its `public_url`. */
|
|
1786
|
+
setVisibility(bucketId, body, options) {
|
|
1787
|
+
return this._put(path`/buckets/${bucketId}/objects/visibility`, body, options);
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
var BucketMultipart = class extends APIResource {
|
|
1791
|
+
/** Starts a multipart upload session for a large object. Sent once: not retried on error. */
|
|
1792
|
+
start(bucketId, body, options) {
|
|
1793
|
+
return this._post(path`/buckets/${bucketId}/objects/multipart/start`, body, options, { noRetry: true });
|
|
1794
|
+
}
|
|
1795
|
+
/** Mints a short-lived signed upload URL for one part of an active multipart upload. */
|
|
1796
|
+
signPart(bucketId, body, options) {
|
|
1797
|
+
return this._post(path`/buckets/${bucketId}/objects/multipart/sign-part`, body, options);
|
|
1798
|
+
}
|
|
1799
|
+
/** Uploads one part of an active multipart upload as raw bytes. */
|
|
1800
|
+
uploadPart(bucketId, params, body, options) {
|
|
1801
|
+
return this._request(
|
|
1802
|
+
"PUT",
|
|
1803
|
+
path`/buckets/${bucketId}/objects/multipart/part`,
|
|
1804
|
+
{ query: params, rawBody: body },
|
|
1805
|
+
options
|
|
1806
|
+
);
|
|
1807
|
+
}
|
|
1808
|
+
/** Completes a multipart upload from its uploaded part ETags. Sent once: not retried on error. */
|
|
1809
|
+
complete(bucketId, body, options) {
|
|
1810
|
+
return this._post(path`/buckets/${bucketId}/objects/multipart/complete`, body, options, { noRetry: true });
|
|
1811
|
+
}
|
|
1812
|
+
/** Aborts an active multipart upload and discards uploaded parts. */
|
|
1813
|
+
abort(bucketId, body, options) {
|
|
1814
|
+
return this._post(path`/buckets/${bucketId}/objects/multipart/abort`, body, options);
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
|
|
983
1818
|
// src/resources/operations.ts
|
|
984
1819
|
function operationId(ref) {
|
|
985
1820
|
const id = typeof ref === "string" ? ref : ref.operation_id;
|
|
@@ -1133,6 +1968,89 @@ var PortForwardingRules = class extends APIResource {
|
|
|
1133
1968
|
}
|
|
1134
1969
|
};
|
|
1135
1970
|
|
|
1971
|
+
// src/resources/registry.ts
|
|
1972
|
+
var Registry = class extends APIResource {
|
|
1973
|
+
/** Your organization's namespace, which every image name starts with. */
|
|
1974
|
+
namespace = new RegistryNamespaces(this._client);
|
|
1975
|
+
/** Repositories in your namespace. */
|
|
1976
|
+
repositories = new RegistryRepositories(this._client);
|
|
1977
|
+
/** Tags of a repository, and the images they point at. */
|
|
1978
|
+
tags = new RegistryTags(this._client);
|
|
1979
|
+
/** Registry-only credentials for CI and clusters. */
|
|
1980
|
+
tokens = new RegistryTokens(this._client);
|
|
1981
|
+
};
|
|
1982
|
+
var RegistryNamespaces = class extends APIResource {
|
|
1983
|
+
/** The namespace with its usage and limits. Rejects with `404 REGISTRY_NAMESPACE_NOT_SET` until one is claimed. */
|
|
1984
|
+
get(options) {
|
|
1985
|
+
return this._get("/registry", void 0, options);
|
|
1986
|
+
}
|
|
1987
|
+
/** Claims the namespace, or changes it or `create_on_push`. The name is fixed once a repository exists. */
|
|
1988
|
+
set(body, options) {
|
|
1989
|
+
return this._put("/registry", body, options);
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
var RegistryRepositories = class extends APIResource {
|
|
1993
|
+
list(params = {}, options) {
|
|
1994
|
+
return this._get("/registry/repositories", params, options);
|
|
1995
|
+
}
|
|
1996
|
+
listAll(params = {}, options) {
|
|
1997
|
+
return this._listAll("/registry/repositories", params, options);
|
|
1998
|
+
}
|
|
1999
|
+
/** Creates a repository, private unless `visibility` is `public`. */
|
|
2000
|
+
create(body, options) {
|
|
2001
|
+
return this._post("/registry/repositories", body, options);
|
|
2002
|
+
}
|
|
2003
|
+
get(repositoryId, options) {
|
|
2004
|
+
return this._get(path`/registry/repositories/${repositoryId}`, void 0, options);
|
|
2005
|
+
}
|
|
2006
|
+
/** Changes the description, visibility, tag immutability or retention policy. */
|
|
2007
|
+
update(repositoryId, body, options) {
|
|
2008
|
+
return this._patch(path`/registry/repositories/${repositoryId}`, body, options);
|
|
2009
|
+
}
|
|
2010
|
+
/** Deletes the repository and every image in it. */
|
|
2011
|
+
delete(repositoryId, options) {
|
|
2012
|
+
return this._delete(path`/registry/repositories/${repositoryId}`, options);
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
var RegistryTags = class extends APIResource {
|
|
2016
|
+
/** A repository's tags, newest push first. */
|
|
2017
|
+
list(repositoryId, params = {}, options) {
|
|
2018
|
+
return this._get(path`/registry/repositories/${repositoryId}/tags`, params, options);
|
|
2019
|
+
}
|
|
2020
|
+
listAll(repositoryId, params = {}, options) {
|
|
2021
|
+
return this._listAll(path`/registry/repositories/${repositoryId}/tags`, params, options);
|
|
2022
|
+
}
|
|
2023
|
+
get(repositoryId, tag, options) {
|
|
2024
|
+
return this._get(path`/registry/repositories/${repositoryId}/tags/${tag}`, void 0, options);
|
|
2025
|
+
}
|
|
2026
|
+
/** Removes the tag. Rejected with `409 TAG_IMMUTABLE` in a repository with immutable tags. */
|
|
2027
|
+
delete(repositoryId, tag, options) {
|
|
2028
|
+
return this._delete(path`/registry/repositories/${repositoryId}/tags/${tag}`, options);
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
var RegistryTokens = class extends APIResource {
|
|
2032
|
+
/** Your registry tokens, without their secrets. */
|
|
2033
|
+
list(params = {}, options) {
|
|
2034
|
+
return this._get("/registry/tokens", params, options);
|
|
2035
|
+
}
|
|
2036
|
+
listAll(params = {}, options) {
|
|
2037
|
+
return this._listAll("/registry/tokens", params, options);
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Creates a token for `docker login`: `pull`, or `push` (which includes
|
|
2041
|
+
* pull), for every repository or only `repositories`. Its `secret` is in
|
|
2042
|
+
* this response alone. It is non-enumerable: `token.secret` reads it, but
|
|
2043
|
+
* console.log and JSON.stringify leave it out.
|
|
2044
|
+
*/
|
|
2045
|
+
async create(body, options) {
|
|
2046
|
+
return hideSecrets(await this._post("/registry/tokens", body, options));
|
|
2047
|
+
}
|
|
2048
|
+
/** Revokes the token: logins stop at once, and access already granted ends within 5 minutes. */
|
|
2049
|
+
delete(tokenId, options) {
|
|
2050
|
+
return this._delete(path`/registry/tokens/${tokenId}`, options);
|
|
2051
|
+
}
|
|
2052
|
+
};
|
|
2053
|
+
|
|
1136
2054
|
// src/resources/security-groups.ts
|
|
1137
2055
|
var SecurityGroups = class extends APIResource {
|
|
1138
2056
|
list(params = {}, options) {
|
|
@@ -1327,7 +2245,7 @@ var WebhookDeliveries = class extends APIResource {
|
|
|
1327
2245
|
};
|
|
1328
2246
|
|
|
1329
2247
|
// src/version.ts
|
|
1330
|
-
var VERSION = "0.
|
|
2248
|
+
var VERSION = "0.5.0";
|
|
1331
2249
|
|
|
1332
2250
|
// src/client.ts
|
|
1333
2251
|
var DEFAULT_BASE_URL = "https://api.pantechdynamics.com/public/v1";
|
|
@@ -1335,6 +2253,12 @@ var DEFAULT_TIMEOUT_MS = 6e4;
|
|
|
1335
2253
|
var DEFAULT_MAX_RETRIES = 3;
|
|
1336
2254
|
var MAX_RETRY_AFTER_MS = 6e4;
|
|
1337
2255
|
var RETRY_STATUSES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
2256
|
+
var ACCEPT = {
|
|
2257
|
+
json: "application/json",
|
|
2258
|
+
arrayBuffer: "application/octet-stream",
|
|
2259
|
+
text: "text/dns, text/plain;q=0.9",
|
|
2260
|
+
response: "application/json"
|
|
2261
|
+
};
|
|
1338
2262
|
var Pantech = class {
|
|
1339
2263
|
baseURL;
|
|
1340
2264
|
maxRetries;
|
|
@@ -1374,6 +2298,20 @@ var Pantech = class {
|
|
|
1374
2298
|
webhooks;
|
|
1375
2299
|
/** Move from another cloud: connections, scans and migration plans. */
|
|
1376
2300
|
migrate;
|
|
2301
|
+
/** Pantech DNS: hosted zones and their records, on Pantech's own name servers. */
|
|
2302
|
+
dns;
|
|
2303
|
+
/** Domains: search, register, transfer in, renew and configure. */
|
|
2304
|
+
domains;
|
|
2305
|
+
/** The private container registry: namespace, repositories, tags and registry tokens. */
|
|
2306
|
+
registry;
|
|
2307
|
+
/** Teams and access policies: who may do what, on which resources. */
|
|
2308
|
+
iam;
|
|
2309
|
+
/** TLS certificates Pantech issues and renews, or ones you import. */
|
|
2310
|
+
certificates;
|
|
2311
|
+
/** S3-compatible object storage: status, usage and access keys. */
|
|
2312
|
+
objectStorage;
|
|
2313
|
+
/** Object storage buckets, objects, multipart uploads and bucket rules. */
|
|
2314
|
+
buckets;
|
|
1377
2315
|
operations;
|
|
1378
2316
|
constructor(options = {}) {
|
|
1379
2317
|
const apiKey = options.apiKey ?? readEnv("PANTECH_API_KEY");
|
|
@@ -1416,6 +2354,13 @@ var Pantech = class {
|
|
|
1416
2354
|
this.sshKeys = new SshKeys(this);
|
|
1417
2355
|
this.webhooks = new Webhooks(this);
|
|
1418
2356
|
this.migrate = new Migrate(this);
|
|
2357
|
+
this.dns = new DNS(this);
|
|
2358
|
+
this.domains = new Domains(this);
|
|
2359
|
+
this.registry = new Registry(this);
|
|
2360
|
+
this.iam = new IAM(this);
|
|
2361
|
+
this.certificates = new Certificates(this);
|
|
2362
|
+
this.objectStorage = new ObjectStorage(this);
|
|
2363
|
+
this.buckets = new Buckets(this);
|
|
1419
2364
|
}
|
|
1420
2365
|
/**
|
|
1421
2366
|
* Sends one request and returns its decoded body (undefined for an empty
|
|
@@ -1427,12 +2372,17 @@ var Pantech = class {
|
|
|
1427
2372
|
const isWrite = req.method !== "GET";
|
|
1428
2373
|
const headers = {
|
|
1429
2374
|
...this.#headers,
|
|
1430
|
-
Accept: req.responseType
|
|
2375
|
+
Accept: ACCEPT[req.responseType ?? "json"],
|
|
1431
2376
|
...options.headers,
|
|
1432
2377
|
Authorization: `Bearer ${this.#apiKey}`
|
|
1433
2378
|
};
|
|
1434
2379
|
let payload;
|
|
1435
|
-
if (req.
|
|
2380
|
+
if (req.rawBody !== void 0) {
|
|
2381
|
+
payload = req.rawBody;
|
|
2382
|
+
if (!hasHeader(headers, "content-type")) {
|
|
2383
|
+
headers["Content-Type"] = "application/octet-stream";
|
|
2384
|
+
}
|
|
2385
|
+
} else if (req.body !== void 0) {
|
|
1436
2386
|
payload = JSON.stringify(req.body);
|
|
1437
2387
|
headers["Content-Type"] = "application/json";
|
|
1438
2388
|
}
|
|
@@ -1490,6 +2440,9 @@ var Pantech = class {
|
|
|
1490
2440
|
}
|
|
1491
2441
|
}
|
|
1492
2442
|
};
|
|
2443
|
+
function hasHeader(headers, name) {
|
|
2444
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === name);
|
|
2445
|
+
}
|
|
1493
2446
|
function queryString(query) {
|
|
1494
2447
|
if (!query) return "";
|
|
1495
2448
|
const params = new URLSearchParams();
|
|
@@ -1503,6 +2456,7 @@ function queryString(query) {
|
|
|
1503
2456
|
async function readBody(res, type) {
|
|
1504
2457
|
if (type === "response") return res;
|
|
1505
2458
|
if (type === "arrayBuffer") return res.arrayBuffer();
|
|
2459
|
+
if (type === "text") return res.text();
|
|
1506
2460
|
const text = await res.text();
|
|
1507
2461
|
if (res.status === 204 || text === "") return void 0;
|
|
1508
2462
|
try {
|
|
@@ -1558,6 +2512,59 @@ function linkSignal(parent, timeout) {
|
|
|
1558
2512
|
};
|
|
1559
2513
|
}
|
|
1560
2514
|
|
|
2515
|
+
// src/iam.ts
|
|
2516
|
+
var SID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
2517
|
+
var MAX_ITEMS = 50;
|
|
2518
|
+
var MAX_SOURCE_IPS = 20;
|
|
2519
|
+
var MANAGED_POLICY_IDS = [
|
|
2520
|
+
"pol_pantech_read_only",
|
|
2521
|
+
"pol_pantech_developer",
|
|
2522
|
+
"pol_pantech_network_admin",
|
|
2523
|
+
"pol_pantech_database_admin",
|
|
2524
|
+
"pol_pantech_dns_manager",
|
|
2525
|
+
"pol_pantech_domain_manager",
|
|
2526
|
+
"pol_pantech_registry_push",
|
|
2527
|
+
"pol_pantech_registry_pull",
|
|
2528
|
+
"pol_pantech_billing_manager",
|
|
2529
|
+
"pol_pantech_support",
|
|
2530
|
+
"pol_pantech_deny_delete",
|
|
2531
|
+
"pol_pantech_require_mfa_for_writes"
|
|
2532
|
+
];
|
|
2533
|
+
function strings(name, values, limit) {
|
|
2534
|
+
if (!Array.isArray(values)) throw new TypeError(`${name} must be an array of strings.`);
|
|
2535
|
+
if (values.length === 0) throw new RangeError(`${name} needs at least one entry.`);
|
|
2536
|
+
if (values.length > limit) throw new RangeError(`${name} takes at most ${limit} entries, got ${values.length}.`);
|
|
2537
|
+
for (const v of values) {
|
|
2538
|
+
if (typeof v !== "string" || v === "") throw new TypeError(`${name} entries must be non-empty strings.`);
|
|
2539
|
+
}
|
|
2540
|
+
return [...values];
|
|
2541
|
+
}
|
|
2542
|
+
function statement(effect, actions, resources = ["*"], options = {}) {
|
|
2543
|
+
if (effect !== "allow" && effect !== "deny") throw new TypeError(`effect must be "allow" or "deny".`);
|
|
2544
|
+
const out = {
|
|
2545
|
+
effect,
|
|
2546
|
+
actions: strings("actions", actions, MAX_ITEMS),
|
|
2547
|
+
resources: strings("resources", resources, MAX_ITEMS)
|
|
2548
|
+
};
|
|
2549
|
+
if (options.sid !== void 0) {
|
|
2550
|
+
if (!SID.test(options.sid)) throw new RangeError("sid must be 1 to 64 letters, digits, '_' or '-'.");
|
|
2551
|
+
out.sid = options.sid;
|
|
2552
|
+
}
|
|
2553
|
+
const conditions = {};
|
|
2554
|
+
if (options.sourceIp !== void 0) conditions.source_ip = strings("sourceIp", options.sourceIp, MAX_SOURCE_IPS);
|
|
2555
|
+
if (options.mfa !== void 0) conditions.mfa = options.mfa;
|
|
2556
|
+
if (Object.keys(conditions).length > 0) out.conditions = conditions;
|
|
2557
|
+
return out;
|
|
2558
|
+
}
|
|
2559
|
+
var iam = {
|
|
2560
|
+
/** An `allow` statement: `iam.allow(["instances:Start"], ["name:staging-*"])`. */
|
|
2561
|
+
allow: (actions, resources, options) => statement("allow", actions, resources, options),
|
|
2562
|
+
/** A `deny` statement, which wins over every allow: `iam.deny(["*:Delete"])`. */
|
|
2563
|
+
deny: (actions, resources, options) => statement("deny", actions, resources, options),
|
|
2564
|
+
statement,
|
|
2565
|
+
MANAGED_POLICY_IDS
|
|
2566
|
+
};
|
|
2567
|
+
|
|
1561
2568
|
// src/webhooks.ts
|
|
1562
2569
|
var WEBHOOK_SIGNATURE_HEADER = "Pantech-Signature";
|
|
1563
2570
|
var DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
|
|
@@ -1635,10 +2642,16 @@ exports.APIConnectionError = APIConnectionError;
|
|
|
1635
2642
|
exports.APITimeoutError = APITimeoutError;
|
|
1636
2643
|
exports.AuthenticationError = AuthenticationError;
|
|
1637
2644
|
exports.BadRequestError = BadRequestError;
|
|
2645
|
+
exports.CERTIFICATE_ERROR_CODES = CERTIFICATE_ERROR_CODES;
|
|
2646
|
+
exports.CertificateFailedError = CertificateFailedError;
|
|
1638
2647
|
exports.CloudFailedError = CloudFailedError;
|
|
1639
2648
|
exports.ConflictError = ConflictError;
|
|
1640
2649
|
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL;
|
|
1641
2650
|
exports.DEFAULT_WEBHOOK_TOLERANCE_SECONDS = DEFAULT_WEBHOOK_TOLERANCE_SECONDS;
|
|
2651
|
+
exports.DNSFailedError = DNSFailedError;
|
|
2652
|
+
exports.DNS_ERROR_CODES = DNS_ERROR_CODES;
|
|
2653
|
+
exports.DOMAIN_ERROR_CODES = DOMAIN_ERROR_CODES;
|
|
2654
|
+
exports.IAM_ERROR_CODES = IAM_ERROR_CODES;
|
|
1642
2655
|
exports.InternalServerError = InternalServerError;
|
|
1643
2656
|
exports.NotFoundError = NotFoundError;
|
|
1644
2657
|
exports.OperationFailedError = OperationFailedError;
|
|
@@ -1647,12 +2660,15 @@ exports.Pantech = Pantech;
|
|
|
1647
2660
|
exports.PantechError = PantechError;
|
|
1648
2661
|
exports.PaymentRequiredError = PaymentRequiredError;
|
|
1649
2662
|
exports.PermissionDeniedError = PermissionDeniedError;
|
|
2663
|
+
exports.PreconditionFailedError = PreconditionFailedError;
|
|
2664
|
+
exports.REGISTRY_ERROR_CODES = REGISTRY_ERROR_CODES;
|
|
1650
2665
|
exports.RateLimitError = RateLimitError;
|
|
1651
2666
|
exports.VERSION = VERSION;
|
|
1652
2667
|
exports.ValidationError = ValidationError;
|
|
1653
2668
|
exports.WEBHOOK_SIGNATURE_HEADER = WEBHOOK_SIGNATURE_HEADER;
|
|
1654
2669
|
exports.WaitTimeoutError = WaitTimeoutError;
|
|
1655
2670
|
exports.WebhookVerificationError = WebhookVerificationError;
|
|
2671
|
+
exports.iam = iam;
|
|
1656
2672
|
exports.isPantechError = isPantechError;
|
|
1657
2673
|
exports.paginate = paginate;
|
|
1658
2674
|
exports.signWebhook = signWebhook;
|