@distilled.cloud/ovh 0.0.0 → 1.0.0-rc.9

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.
Files changed (192) hide show
  1. package/LICENSE +201 -0
  2. package/lib/credentials.d.ts +38 -0
  3. package/lib/credentials.d.ts.map +1 -0
  4. package/lib/credentials.js +54 -0
  5. package/lib/credentials.js.map +1 -0
  6. package/lib/errors.d.ts +36 -0
  7. package/lib/errors.d.ts.map +1 -0
  8. package/lib/errors.js +26 -0
  9. package/lib/errors.js.map +1 -0
  10. package/lib/index.d.ts +22 -0
  11. package/lib/index.d.ts.map +1 -0
  12. package/lib/index.js +22 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/pagination.d.ts +8 -0
  15. package/lib/pagination.d.ts.map +1 -0
  16. package/lib/pagination.js +8 -0
  17. package/lib/pagination.js.map +1 -0
  18. package/lib/protocol.d.ts +18 -0
  19. package/lib/protocol.d.ts.map +1 -0
  20. package/lib/protocol.js +60 -0
  21. package/lib/protocol.js.map +1 -0
  22. package/lib/retry.d.ts +32 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +32 -0
  25. package/lib/retry.js.map +1 -0
  26. package/lib/services/baremetal.d.ts +3551 -0
  27. package/lib/services/baremetal.d.ts.map +1 -0
  28. package/lib/services/baremetal.js +4200 -0
  29. package/lib/services/baremetal.js.map +1 -0
  30. package/lib/services/cloud.d.ts +26011 -0
  31. package/lib/services/cloud.d.ts.map +1 -0
  32. package/lib/services/cloud.js +31119 -0
  33. package/lib/services/cloud.js.map +1 -0
  34. package/lib/services/cloud_v2.d.ts +5642 -0
  35. package/lib/services/cloud_v2.d.ts.map +1 -0
  36. package/lib/services/cloud_v2.js +5760 -0
  37. package/lib/services/cloud_v2.js.map +1 -0
  38. package/lib/services/dedicatedceph.d.ts +747 -0
  39. package/lib/services/dedicatedceph.d.ts.map +1 -0
  40. package/lib/services/dedicatedceph.js +962 -0
  41. package/lib/services/dedicatedceph.js.map +1 -0
  42. package/lib/services/dedicatednasha.d.ts +755 -0
  43. package/lib/services/dedicatednasha.d.ts.map +1 -0
  44. package/lib/services/dedicatednasha.js +967 -0
  45. package/lib/services/dedicatednasha.js.map +1 -0
  46. package/lib/services/domain.d.ts +2995 -0
  47. package/lib/services/domain.d.ts.map +1 -0
  48. package/lib/services/domain.js +3080 -0
  49. package/lib/services/domain.js.map +1 -0
  50. package/lib/services/emaildomain.d.ts +1913 -0
  51. package/lib/services/emaildomain.d.ts.map +1 -0
  52. package/lib/services/emaildomain.js +2550 -0
  53. package/lib/services/emaildomain.js.map +1 -0
  54. package/lib/services/emailmxplan.d.ts +1012 -0
  55. package/lib/services/emailmxplan.d.ts.map +1 -0
  56. package/lib/services/emailmxplan.js +1155 -0
  57. package/lib/services/emailmxplan.js.map +1 -0
  58. package/lib/services/emailpro.d.ts +1287 -0
  59. package/lib/services/emailpro.d.ts.map +1 -0
  60. package/lib/services/emailpro.js +1471 -0
  61. package/lib/services/emailpro.js.map +1 -0
  62. package/lib/services/hostingprivatedatabase.d.ts +1402 -0
  63. package/lib/services/hostingprivatedatabase.d.ts.map +1 -0
  64. package/lib/services/hostingprivatedatabase.js +1833 -0
  65. package/lib/services/hostingprivatedatabase.js.map +1 -0
  66. package/lib/services/iam.d.ts +829 -0
  67. package/lib/services/iam.d.ts.map +1 -0
  68. package/lib/services/iam.js +793 -0
  69. package/lib/services/iam.js.map +1 -0
  70. package/lib/services/index.d.ts +31 -0
  71. package/lib/services/index.d.ts.map +1 -0
  72. package/lib/services/index.js +32 -0
  73. package/lib/services/index.js.map +1 -0
  74. package/lib/services/ip.d.ts +1417 -0
  75. package/lib/services/ip.d.ts.map +1 -0
  76. package/lib/services/ip.js +1691 -0
  77. package/lib/services/ip.js.map +1 -0
  78. package/lib/services/iploadbalancing.d.ts +3059 -0
  79. package/lib/services/iploadbalancing.d.ts.map +1 -0
  80. package/lib/services/iploadbalancing.js +3554 -0
  81. package/lib/services/iploadbalancing.js.map +1 -0
  82. package/lib/services/ldp.d.ts +2492 -0
  83. package/lib/services/ldp.d.ts.map +1 -0
  84. package/lib/services/ldp.js +3072 -0
  85. package/lib/services/ldp.js.map +1 -0
  86. package/lib/services/me.d.ts +7511 -0
  87. package/lib/services/me.d.ts.map +1 -0
  88. package/lib/services/me.js +8878 -0
  89. package/lib/services/me.js.map +1 -0
  90. package/lib/services/overthebox.d.ts +981 -0
  91. package/lib/services/overthebox.d.ts.map +1 -0
  92. package/lib/services/overthebox.js +1122 -0
  93. package/lib/services/overthebox.js.map +1 -0
  94. package/lib/services/ovhcloudconnect.d.ts +1123 -0
  95. package/lib/services/ovhcloudconnect.d.ts.map +1 -0
  96. package/lib/services/ovhcloudconnect.js +1353 -0
  97. package/lib/services/ovhcloudconnect.js.map +1 -0
  98. package/lib/services/packxdsl.d.ts +1583 -0
  99. package/lib/services/packxdsl.d.ts.map +1 -0
  100. package/lib/services/packxdsl.js +1791 -0
  101. package/lib/services/packxdsl.js.map +1 -0
  102. package/lib/services/sms.d.ts +2602 -0
  103. package/lib/services/sms.d.ts.map +1 -0
  104. package/lib/services/sms.js +2995 -0
  105. package/lib/services/sms.js.map +1 -0
  106. package/lib/services/sslgateway.d.ts +493 -0
  107. package/lib/services/sslgateway.d.ts.map +1 -0
  108. package/lib/services/sslgateway.js +569 -0
  109. package/lib/services/sslgateway.js.map +1 -0
  110. package/lib/services/storagenetapp.d.ts +859 -0
  111. package/lib/services/storagenetapp.d.ts.map +1 -0
  112. package/lib/services/storagenetapp.js +1022 -0
  113. package/lib/services/storagenetapp.js.map +1 -0
  114. package/lib/services/support.d.ts +233 -0
  115. package/lib/services/support.d.ts.map +1 -0
  116. package/lib/services/support.js +237 -0
  117. package/lib/services/support.js.map +1 -0
  118. package/lib/services/telephony.d.ts +10825 -0
  119. package/lib/services/telephony.d.ts.map +1 -0
  120. package/lib/services/telephony.js +14894 -0
  121. package/lib/services/telephony.js.map +1 -0
  122. package/lib/services/vmwareclouddirectorbackup.d.ts +784 -0
  123. package/lib/services/vmwareclouddirectorbackup.d.ts.map +1 -0
  124. package/lib/services/vmwareclouddirectorbackup.js +842 -0
  125. package/lib/services/vmwareclouddirectorbackup.js.map +1 -0
  126. package/lib/services/vmwareclouddirectororganization.d.ts +784 -0
  127. package/lib/services/vmwareclouddirectororganization.d.ts.map +1 -0
  128. package/lib/services/vmwareclouddirectororganization.js +842 -0
  129. package/lib/services/vmwareclouddirectororganization.js.map +1 -0
  130. package/lib/services/vps.d.ts +1579 -0
  131. package/lib/services/vps.d.ts.map +1 -0
  132. package/lib/services/vps.js +1914 -0
  133. package/lib/services/vps.js.map +1 -0
  134. package/lib/services/vrack.d.ts +1204 -0
  135. package/lib/services/vrack.d.ts.map +1 -0
  136. package/lib/services/vrack.js +1627 -0
  137. package/lib/services/vrack.js.map +1 -0
  138. package/lib/services/vrackservices.d.ts +394 -0
  139. package/lib/services/vrackservices.d.ts.map +1 -0
  140. package/lib/services/vrackservices.js +355 -0
  141. package/lib/services/vrackservices.js.map +1 -0
  142. package/lib/services/webhosting.d.ts +3986 -0
  143. package/lib/services/webhosting.d.ts.map +1 -0
  144. package/lib/services/webhosting.js +4527 -0
  145. package/lib/services/webhosting.js.map +1 -0
  146. package/lib/services/xdsl.d.ts +3433 -0
  147. package/lib/services/xdsl.d.ts.map +1 -0
  148. package/lib/services/xdsl.js +3682 -0
  149. package/lib/services/xdsl.js.map +1 -0
  150. package/lib/traits.d.ts +11 -0
  151. package/lib/traits.d.ts.map +1 -0
  152. package/lib/traits.js +11 -0
  153. package/lib/traits.js.map +1 -0
  154. package/package.json +77 -6
  155. package/src/credentials.ts +77 -0
  156. package/src/errors.ts +50 -0
  157. package/src/index.ts +21 -0
  158. package/src/pagination.ts +7 -0
  159. package/src/protocol.ts +86 -0
  160. package/src/retry.ts +54 -0
  161. package/src/services/baremetal.ts +10954 -0
  162. package/src/services/cloud.ts +75508 -0
  163. package/src/services/cloud_v2.ts +14751 -0
  164. package/src/services/dedicatedceph.ts +2233 -0
  165. package/src/services/dedicatednasha.ts +2269 -0
  166. package/src/services/domain.ts +7998 -0
  167. package/src/services/emaildomain.ts +5751 -0
  168. package/src/services/emailmxplan.ts +2764 -0
  169. package/src/services/emailpro.ts +3519 -0
  170. package/src/services/hostingprivatedatabase.ts +4218 -0
  171. package/src/services/iam.ts +2060 -0
  172. package/src/services/index.ts +31 -0
  173. package/src/services/ip.ts +4462 -0
  174. package/src/services/iploadbalancing.ts +8422 -0
  175. package/src/services/ldp.ts +7274 -0
  176. package/src/services/me.ts +21720 -0
  177. package/src/services/overthebox.ts +2693 -0
  178. package/src/services/ovhcloudconnect.ts +3226 -0
  179. package/src/services/packxdsl.ts +4623 -0
  180. package/src/services/sms.ts +7255 -0
  181. package/src/services/sslgateway.ts +1408 -0
  182. package/src/services/storagenetapp.ts +2433 -0
  183. package/src/services/support.ts +598 -0
  184. package/src/services/telephony.ts +32941 -0
  185. package/src/services/vmwareclouddirectorbackup.ts +2171 -0
  186. package/src/services/vmwareclouddirectororganization.ts +2171 -0
  187. package/src/services/vps.ts +5134 -0
  188. package/src/services/vrack.ts +3730 -0
  189. package/src/services/vrackservices.ts +939 -0
  190. package/src/services/webhosting.ts +11290 -0
  191. package/src/services/xdsl.ts +9278 -0
  192. package/src/traits.ts +44 -0
package/src/errors.ts ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * OVH-specific error types.
3
+ *
4
+ * Re-exports the common HTTP errors from core and adds the OVH fallback
5
+ * errors. Note the generated service modules additionally define their own
6
+ * per-status matcher classes (BadRequest/NotFound/…) for the statuses each
7
+ * operation declares — those share `_tag`s with the core classes here, so
8
+ * `catchTag` works against either.
9
+ */
10
+ export {
11
+ BadGateway,
12
+ BadRequest,
13
+ Conflict,
14
+ ConfigError,
15
+ Forbidden,
16
+ GatewayTimeout,
17
+ InternalServerError,
18
+ Locked,
19
+ NotFound,
20
+ ServiceUnavailable,
21
+ TooManyRequests,
22
+ Unauthorized,
23
+ UnprocessableEntity,
24
+ HTTP_STATUS_MAP,
25
+ DEFAULT_ERRORS,
26
+ API_ERRORS,
27
+ } from "@distilled.cloud/core/errors";
28
+ export type { DefaultErrors } from "@distilled.cloud/core/errors";
29
+
30
+ import * as Schema from "effect/Schema";
31
+ import * as Category from "@distilled.cloud/core/category";
32
+
33
+ /** Unknown OVH error — returned when nothing else matches the failure. */
34
+ export class UnknownOvhError extends Schema.TaggedError<UnknownOvhError>()(
35
+ "UnknownOvhError",
36
+ {
37
+ code: Schema.optional(Schema.String),
38
+ message: Schema.optional(Schema.String),
39
+ body: Schema.Unknown,
40
+ },
41
+ ).pipe(Category.withServerError) {}
42
+
43
+ /** Schema parse error wrapper. */
44
+ export class OvhParseError extends Schema.TaggedError<OvhParseError>()(
45
+ "OvhParseError",
46
+ {
47
+ body: Schema.Unknown,
48
+ cause: Schema.Unknown,
49
+ },
50
+ ).pipe(Category.withParseError) {}
package/src/index.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @distilled.cloud/ovh — OVHcloud API SDK for Effect.
3
+ *
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy models
5
+ * in `.generated-specs` (written by `scripts/convert.ts` from the OpenAPI
6
+ * specs). Everything else in this folder is hand-written.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import * as Ovh from "@distilled.cloud/ovh";
11
+ *
12
+ * const servers = yield* Ovh.Services.vps.getVps({});
13
+ * ```
14
+ */
15
+ export * from "./credentials.ts";
16
+ export * from "./errors.ts";
17
+ export * as T from "./traits.ts";
18
+ export { OvhProtocol, type OvhOpError, type OvhOpContext } from "./protocol.ts";
19
+ export { paginateCursor } from "./pagination.ts";
20
+ export * as Retry from "./retry.ts";
21
+ export * as Services from "./services/index.ts";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * OVH pagination — hand-written.
3
+ *
4
+ * Generated operations that the converter stamps as cursor-paginated pass
5
+ * core's {@link paginateCursor} strategy to `API.makePaginated`.
6
+ */
7
+ export { paginateCursor } from "@distilled.cloud/core/pagination";
@@ -0,0 +1,86 @@
1
+ /**
2
+ * OvhProtocol — hand-written.
3
+ *
4
+ * OVH speaks bearer-authenticated JSON REST (no response envelope), so the
5
+ * whole protocol is one `makeRestProtocol` call from `core/protocol-rest`:
6
+ *
7
+ * request: credentials → `Authorization: Bearer <access_token>` + base URL
8
+ * (default https://eu.api.ovh.com/1.0), resolved from the calling
9
+ * fiber on every request
10
+ *
11
+ * response: 2xx JSON is the payload (sensitive members delivered as
12
+ * `Redacted`); non-2xx `{ message, errorCode? | class? }` bodies
13
+ * map to the operation's typed error classes by status, then the
14
+ * shared HTTP-status classes, then {@link UnknownOvhError}.
15
+ */
16
+ import * as Effect from "effect/Effect";
17
+ import type * as Layer from "effect/Layer";
18
+ import * as Redacted from "effect/Redacted";
19
+ import type * as HttpClient from "effect/unstable/http/HttpClient";
20
+ import type * as HttpClientError from "effect/unstable/http/HttpClientError";
21
+ import type * as API from "@distilled.cloud/core/api";
22
+ import {
23
+ makeRestProtocol,
24
+ type RestErrorEnvelope,
25
+ } from "@distilled.cloud/core/protocol-rest";
26
+ import type { API_ERRORS, ConfigError } from "@distilled.cloud/core/errors";
27
+ import { Credentials, type Config } from "./credentials.ts";
28
+ import { UnknownOvhError } from "./errors.ts";
29
+
30
+ /**
31
+ * Error channel shared by every generated OVH operation. Generated service
32
+ * files annotate operations with `API.OperationMethod<I, O, OvhOpError,
33
+ * OvhOpContext>` explicitly so the compiler never infers these back out of
34
+ * the schema generics.
35
+ */
36
+ export type OvhOpError =
37
+ | InstanceType<(typeof API_ERRORS)[number]>
38
+ | UnknownOvhError
39
+ | ConfigError
40
+ | HttpClientError.HttpClientError;
41
+
42
+ /** Context (requirements) shared by every generated OVH operation. */
43
+ export type OvhOpContext = Credentials | HttpClient.HttpClient;
44
+
45
+ /**
46
+ * OVH error bodies are `{ message, errorCode? }` or `{ class, message }`.
47
+ */
48
+ const errorEnvelope = (body: unknown): RestErrorEnvelope | undefined => {
49
+ if (body === null || typeof body !== "object") return undefined;
50
+ const b = body as Record<string, unknown>;
51
+ const message = typeof b.message === "string" ? b.message : undefined;
52
+ const code =
53
+ typeof b.errorCode === "string" || typeof b.errorCode === "number"
54
+ ? b.errorCode
55
+ : typeof b.class === "string"
56
+ ? b.class
57
+ : typeof b.code === "string" || typeof b.code === "number"
58
+ ? b.code
59
+ : undefined;
60
+ return { code, message };
61
+ };
62
+
63
+ export const OvhProtocol: Layer.Layer<API.Protocol> = makeRestProtocol<Config>({
64
+ // The Credentials service holds an effect — resolving it here (per
65
+ // request, on the calling fiber) picks up context-provided credentials.
66
+ credentials: Effect.gen(function* () {
67
+ const resolve = yield* Credentials;
68
+ return yield* resolve;
69
+ }),
70
+ baseUrl: (creds) => creds.apiBaseUrl,
71
+ headers: (creds) => ({
72
+ Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
73
+ }),
74
+ errorEnvelope,
75
+ unknownError: ({ code, message, body }) =>
76
+ new UnknownOvhError({
77
+ code:
78
+ typeof code === "string"
79
+ ? code
80
+ : code !== undefined
81
+ ? String(code)
82
+ : undefined,
83
+ message,
84
+ body,
85
+ }),
86
+ });
package/src/retry.ts ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * OVH retry configuration.
3
+ *
4
+ * Defines the per-SDK `Retry` Context.Service tag that generated operations
5
+ * wire into `API.make`. Callers can install a blanket retry policy at the
6
+ * layer level and have every OVH API call below it pick it up:
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import * as Ovh from "@distilled.cloud/ovh";
11
+ *
12
+ * myEffect.pipe(Ovh.Retry.transient);
13
+ * Effect.provide(myEffect, Layer.succeed(Ovh.Retry.Retry, customPolicy));
14
+ * ```
15
+ */
16
+ import * as Context from "effect/Context";
17
+ import * as Effect from "effect/Effect";
18
+ import * as Layer from "effect/Layer";
19
+ import {
20
+ type Policy,
21
+ throttlingFactory,
22
+ transientFactory,
23
+ } from "@distilled.cloud/core/retry";
24
+
25
+ export {
26
+ type Options,
27
+ type Factory,
28
+ type Policy,
29
+ makeDefault,
30
+ jittered,
31
+ capped,
32
+ throttlingOptions,
33
+ transientOptions,
34
+ throttlingFactory,
35
+ transientFactory,
36
+ } from "@distilled.cloud/core/retry";
37
+
38
+ /** Context tag for configuring retry behavior of OVH API calls. */
39
+ export class Retry extends Context.Service<Retry, Policy>()("OvhRetry") {}
40
+
41
+ /** Provides a custom retry policy to every OVH API call below it. */
42
+ export const policy = (optionsOrFactory: Policy) =>
43
+ Effect.provide(Layer.succeed(Retry, optionsOrFactory));
44
+
45
+ /** Disables all automatic retries. */
46
+ export const none = Effect.provide(
47
+ Layer.succeed(Retry, { while: () => false }),
48
+ );
49
+
50
+ /** Apply the throttling retry policy (retries throttling errors indefinitely). */
51
+ export const throttling = policy(throttlingFactory);
52
+
53
+ /** Apply the transient retry policy (retries all transient errors indefinitely). */
54
+ export const transient = policy(transientFactory);