@scaleway/sdk-interlink 1.3.0 → 2.1.1

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/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-interlink
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-interlink.svg)](https://www.npmjs.com/package/@scaleway/sdk-interlink)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-interlink.svg)](https://www.npmjs.com/package/@scaleway/sdk-interlink)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-interlink.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Interlink API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-interlink @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-interlink @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-interlink @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Interlink } from '@scaleway/sdk-interlink'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Interlink.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Interlink } from '@scaleway/sdk-interlink'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Interlink.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Interlink API Documentation](https://www.scaleway.com/en/developers/api/interlink/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -1,5 +1,5 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
3
  import type { AttachRoutingPolicyRequest, AttachVpcRequest, CreateLinkRequest, CreateRoutingPolicyRequest, DedicatedConnection, DeleteLinkRequest, DeleteRoutingPolicyRequest, DetachRoutingPolicyRequest, DetachVpcRequest, DisableRoutePropagationRequest, EnableRoutePropagationRequest, GetDedicatedConnectionRequest, GetLinkRequest, GetPartnerRequest, GetPopRequest, GetRoutingPolicyRequest, Link, ListDedicatedConnectionsRequest, ListDedicatedConnectionsResponse, ListLinksRequest, ListLinksResponse, ListPartnersRequest, ListPartnersResponse, ListPopsRequest, ListPopsResponse, ListRoutingPoliciesRequest, ListRoutingPoliciesResponse, Partner, Pop, RoutingPolicy, SetRoutingPolicyRequest, UpdateLinkRequest, UpdateRoutingPolicyRequest } from './types.gen.js';
4
4
  /**
5
5
  * InterLink API.
@@ -10,7 +10,11 @@ class API extends API$1 {
10
10
  * type ∈ {'zone','region','global','unspecified'}
11
11
  */
12
12
  static LOCALITY = toApiLocality({
13
- regions: ["fr-par", "nl-ams", "pl-waw"]
13
+ regions: [
14
+ "fr-par",
15
+ "nl-ams",
16
+ "pl-waw"
17
+ ]
14
18
  });
15
19
  pageOfListDedicatedConnections = (request = {}) => this.client.fetch(
16
20
  {
@@ -22,10 +26,7 @@ class API extends API$1 {
22
26
  ["order_by", request.orderBy],
23
27
  ["organization_id", request.organizationId],
24
28
  ["page", request.page],
25
- [
26
- "page_size",
27
- request.pageSize ?? this.client.settings.defaultPageSize
28
- ],
29
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
29
30
  ["pop_id", request.popId],
30
31
  ["project_id", request.projectId],
31
32
  ["status", request.status],
@@ -40,11 +41,7 @@ class API extends API$1 {
40
41
  * @param request - The request {@link ListDedicatedConnectionsRequest}
41
42
  * @returns A Promise of ListDedicatedConnectionsResponse
42
43
  */
43
- listDedicatedConnections = (request = {}) => enrichForPagination(
44
- "connections",
45
- this.pageOfListDedicatedConnections,
46
- request
47
- );
44
+ listDedicatedConnections = (request = {}) => enrichForPagination("connections", this.pageOfListDedicatedConnections, request);
48
45
  /**
49
46
  * Get a dedicated connection. For self-hosted users, get a dedicated physical connection corresponding to the given ID. The response object includes information such as the connection's name, status and total bandwidth.
50
47
  *
@@ -66,11 +63,7 @@ class API extends API$1 {
66
63
  * @returns A Promise of DedicatedConnection
67
64
  */
68
65
  waitForDedicatedConnection = (request, options) => waitForResource(
69
- options?.stop ?? ((res) => Promise.resolve(
70
- !DEDICATED_CONNECTION_TRANSIENT_STATUSES.includes(
71
- res.status
72
- )
73
- )),
66
+ options?.stop ?? ((res) => Promise.resolve(!DEDICATED_CONNECTION_TRANSIENT_STATUSES.includes(res.status))),
74
67
  this.getDedicatedConnection,
75
68
  request,
76
69
  options
@@ -82,10 +75,7 @@ class API extends API$1 {
82
75
  urlParams: urlParams(
83
76
  ["order_by", request.orderBy],
84
77
  ["page", request.page],
85
- [
86
- "page_size",
87
- request.pageSize ?? this.client.settings.defaultPageSize
88
- ],
78
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
89
79
  ["pop_ids", request.popIds]
90
80
  )
91
81
  },
@@ -122,10 +112,7 @@ class API extends API$1 {
122
112
  ["name", request.name],
123
113
  ["order_by", request.orderBy],
124
114
  ["page", request.page],
125
- [
126
- "page_size",
127
- request.pageSize ?? this.client.settings.defaultPageSize
128
- ],
115
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
129
116
  ["partner_id", request.partnerId]
130
117
  )
131
118
  },
@@ -165,10 +152,7 @@ class API extends API$1 {
165
152
  ["order_by", request.orderBy],
166
153
  ["organization_id", request.organizationId],
167
154
  ["page", request.page],
168
- [
169
- "page_size",
170
- request.pageSize ?? this.client.settings.defaultPageSize
171
- ],
155
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
172
156
  ["pairing_key", request.pairingKey],
173
157
  ["partner_id", request.partnerId],
174
158
  ["pop_id", request.popId],
@@ -209,9 +193,7 @@ class API extends API$1 {
209
193
  * @returns A Promise of Link
210
194
  */
211
195
  waitForLink = (request, options) => waitForResource(
212
- options?.stop ?? ((res) => Promise.resolve(
213
- !LINK_TRANSIENT_STATUSES.includes(res.status)
214
- )),
196
+ options?.stop ?? ((res) => Promise.resolve(!LINK_TRANSIENT_STATUSES.includes(res.status))),
215
197
  this.getLink,
216
198
  request,
217
199
  options
@@ -386,10 +368,7 @@ class API extends API$1 {
386
368
  ["order_by", request.orderBy],
387
369
  ["organization_id", request.organizationId],
388
370
  ["page", request.page],
389
- [
390
- "page_size",
391
- request.pageSize ?? this.client.settings.defaultPageSize
392
- ],
371
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
393
372
  ["project_id", request.projectId],
394
373
  ["tags", request.tags]
395
374
  )
@@ -402,11 +381,7 @@ class API extends API$1 {
402
381
  * @param request - The request {@link ListRoutingPoliciesRequest}
403
382
  * @returns A Promise of ListRoutingPoliciesResponse
404
383
  */
405
- listRoutingPolicies = (request = {}) => enrichForPagination(
406
- "routingPolicies",
407
- this.pageOfListRoutingPolicies,
408
- request
409
- );
384
+ listRoutingPolicies = (request = {}) => enrichForPagination("routingPolicies", this.pageOfListRoutingPolicies, request);
410
385
  /**
411
386
  * Get routing policy. Get a routing policy for the given routing policy ID. The response object gives information including the policy's name, tags and prefix filters.
412
387
  *
@@ -459,10 +434,12 @@ class API extends API$1 {
459
434
  *
460
435
  * @param request - The request {@link DeleteRoutingPolicyRequest}
461
436
  */
462
- deleteRoutingPolicy = (request) => this.client.fetch({
463
- method: "DELETE",
464
- path: `/interlink/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${validatePathParam("routingPolicyId", request.routingPolicyId)}`
465
- });
437
+ deleteRoutingPolicy = (request) => this.client.fetch(
438
+ {
439
+ method: "DELETE",
440
+ path: `/interlink/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${validatePathParam("routingPolicyId", request.routingPolicyId)}`
441
+ }
442
+ );
466
443
  }
467
444
  export {
468
445
  API
@@ -1,5 +1,9 @@
1
- const DEDICATED_CONNECTION_TRANSIENT_STATUSES = ["configuring"];
2
- const LINK_TRANSIENT_STATUSES = ["configuring"];
1
+ const DEDICATED_CONNECTION_TRANSIENT_STATUSES = [
2
+ "configuring"
3
+ ];
4
+ const LINK_TRANSIENT_STATUSES = [
5
+ "configuring"
6
+ ];
3
7
  export {
4
8
  DEDICATED_CONNECTION_TRANSIENT_STATUSES,
5
9
  LINK_TRANSIENT_STATUSES
@@ -1,5 +1,5 @@
1
- export { API } from './api.gen.js';
1
+ export { API, } from './api.gen.js';
2
2
  export * from './content.gen.js';
3
3
  export * from './marshalling.gen.js';
4
- export type { AttachRoutingPolicyRequest, AttachVpcRequest, BgpConfig, BgpStatus, CreateLinkRequest, CreateRoutingPolicyRequest, DedicatedConnection, DedicatedConnectionStatus, DeleteLinkRequest, DeleteRoutingPolicyRequest, DetachRoutingPolicyRequest, DetachVpcRequest, DisableRoutePropagationRequest, EnableRoutePropagationRequest, GetDedicatedConnectionRequest, GetLinkRequest, GetPartnerRequest, GetPopRequest, GetRoutingPolicyRequest, Link, LinkKind, LinkStatus, ListDedicatedConnectionsRequest, ListDedicatedConnectionsRequestOrderBy, ListDedicatedConnectionsResponse, ListLinksRequest, ListLinksRequestOrderBy, ListLinksResponse, ListPartnersRequest, ListPartnersRequestOrderBy, ListPartnersResponse, ListPopsRequest, ListPopsRequestOrderBy, ListPopsResponse, ListRoutingPoliciesRequest, ListRoutingPoliciesRequestOrderBy, ListRoutingPoliciesResponse, Partner, PartnerHost, Pop, RoutingPolicy, SelfHost, SetRoutingPolicyRequest, UpdateLinkRequest, UpdateRoutingPolicyRequest, } from './types.gen.js';
4
+ export type { AttachRoutingPolicyRequest, AttachVpcRequest, BgpConfig, BgpStatus, CreateLinkRequest, CreateRoutingPolicyRequest, DedicatedConnection, DedicatedConnectionStatus, DeleteLinkRequest, DeleteRoutingPolicyRequest, DetachRoutingPolicyRequest, DetachVpcRequest, DisableRoutePropagationRequest, EnableRoutePropagationRequest, GetDedicatedConnectionRequest, GetLinkRequest, GetPartnerRequest, GetPopRequest, GetRoutingPolicyRequest, Link, LinkKind, LinkStatus, ListDedicatedConnectionsRequest, ListDedicatedConnectionsRequestOrderBy, ListDedicatedConnectionsResponse, ListLinksRequest, ListLinksRequestOrderBy, ListLinksResponse, ListPartnersRequest, ListPartnersRequestOrderBy, ListPartnersResponse, ListPopsRequest, ListPopsRequestOrderBy, ListPopsResponse, ListRoutingPoliciesRequest, ListRoutingPoliciesRequestOrderBy, ListRoutingPoliciesResponse, Partner, PartnerHost, Pop, Range, RoutingPolicy, SelfHost, SetRoutingPolicyRequest, UpdateLinkRequest, UpdateRoutingPolicyRequest, } from './types.gen.js';
5
5
  export * as ValidationRules from './validation-rules.gen.js';
@@ -1,4 +1,15 @@
1
1
  import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
+ const unmarshalRange = (data) => {
3
+ if (!isJSONObject(data)) {
4
+ throw new TypeError(
5
+ `Unmarshalling the type 'Range' failed as data isn't a dictionary.`
6
+ );
7
+ }
8
+ return {
9
+ end: data.end,
10
+ start: data.start
11
+ };
12
+ };
2
13
  const unmarshalDedicatedConnection = (data) => {
3
14
  if (!isJSONObject(data)) {
4
15
  throw new TypeError(
@@ -18,7 +29,8 @@ const unmarshalDedicatedConnection = (data) => {
18
29
  region: data.region,
19
30
  status: data.status,
20
31
  tags: data.tags,
21
- updatedAt: unmarshalDate(data.updated_at)
32
+ updatedAt: unmarshalDate(data.updated_at),
33
+ vlanRange: data.vlan_range ? unmarshalRange(data.vlan_range) : void 0
22
34
  };
23
35
  };
24
36
  const unmarshalBgpConfig = (data) => {
@@ -148,10 +160,7 @@ const unmarshalListDedicatedConnectionsResponse = (data) => {
148
160
  );
149
161
  }
150
162
  return {
151
- connections: unmarshalArrayOfObject(
152
- data.connections,
153
- unmarshalDedicatedConnection
154
- ),
163
+ connections: unmarshalArrayOfObject(data.connections, unmarshalDedicatedConnection),
155
164
  totalCount: data.total_count
156
165
  };
157
166
  };
@@ -195,10 +204,7 @@ const unmarshalListRoutingPoliciesResponse = (data) => {
195
204
  );
196
205
  }
197
206
  return {
198
- routingPolicies: unmarshalArrayOfObject(
199
- data.routing_policies,
200
- unmarshalRoutingPolicy
201
- ),
207
+ routingPolicies: unmarshalArrayOfObject(data.routing_policies, unmarshalRoutingPolicy),
202
208
  totalCount: data.total_count
203
209
  };
204
210
  };
@@ -219,8 +225,14 @@ const marshalCreateLinkRequest = (request, defaults) => ({
219
225
  tags: request.tags,
220
226
  vlan: request.vlan,
221
227
  ...resolveOneOf([
222
- { param: "connection_id", value: request.connectionId },
223
- { param: "partner_id", value: request.partnerId }
228
+ {
229
+ param: "connection_id",
230
+ value: request.connectionId
231
+ },
232
+ {
233
+ param: "partner_id",
234
+ value: request.partnerId
235
+ }
224
236
  ])
225
237
  });
226
238
  const marshalCreateRoutingPolicyRequest = (request, defaults) => ({
@@ -22,6 +22,10 @@ export interface BgpConfig {
22
22
  */
23
23
  ipv6: string;
24
24
  }
25
+ export interface Range {
26
+ start: number;
27
+ end: number;
28
+ }
25
29
  export interface PartnerHost {
26
30
  /**
27
31
  * ID of the partner facilitating the link.
@@ -91,6 +95,10 @@ export interface DedicatedConnection {
91
95
  * Demarcation details required by the data center to set up the supporting Cross Connect. This generally includes the physical space in the facility, the cabinet or rack the connection should land in, the patch panel to go in, the port designation, and the media type.
92
96
  */
93
97
  demarcationInfo?: string;
98
+ /**
99
+ * Range in which to pick vlan for self-hosted links on this dedicated connection. Both start & end are included. Any range defined here must be itself included in the greater allowed range of vlans from 1500 to 3899 (this range is hardware dependent and can change over time, but actual range will be enforced).
100
+ */
101
+ vlanRange?: Range;
94
102
  /**
95
103
  * Region of the dedicated connection.
96
104
  */
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-interlink",
3
- "version": "1.3.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK interlink",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/interlink"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.19.4"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
29
  "@scaleway/random-name": "5.1.2",
33
- "@scaleway/sdk-std": "1.1.0"
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.2"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.2"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1beta1/index.gen.cjs");
4
- exports.Interlinkv1beta1 = index_gen;
@@ -1,469 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const content_gen = require("./content.gen.cjs");
5
- const marshalling_gen = require("./marshalling.gen.cjs");
6
- const jsonContentHeaders = {
7
- "Content-Type": "application/json; charset=utf-8"
8
- };
9
- class API extends sdkClient.API {
10
- /**
11
- * Locality of this API.
12
- * type ∈ {'zone','region','global','unspecified'}
13
- */
14
- static LOCALITY = sdkClient.toApiLocality({
15
- regions: ["fr-par", "nl-ams", "pl-waw"]
16
- });
17
- pageOfListDedicatedConnections = (request = {}) => this.client.fetch(
18
- {
19
- method: "GET",
20
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/dedicated-connections`,
21
- urlParams: sdkClient.urlParams(
22
- ["bandwidth_mbps", request.bandwidthMbps],
23
- ["name", request.name],
24
- ["order_by", request.orderBy],
25
- ["organization_id", request.organizationId],
26
- ["page", request.page],
27
- [
28
- "page_size",
29
- request.pageSize ?? this.client.settings.defaultPageSize
30
- ],
31
- ["pop_id", request.popId],
32
- ["project_id", request.projectId],
33
- ["status", request.status],
34
- ["tags", request.tags]
35
- )
36
- },
37
- marshalling_gen.unmarshalListDedicatedConnectionsResponse
38
- );
39
- /**
40
- * List dedicated connections. For self-hosted users, list their dedicated physical connections in a given region. By default, the connections returned in the list are ordered by name in ascending order, though this can be modified via the `order_by` field.
41
- *
42
- * @param request - The request {@link ListDedicatedConnectionsRequest}
43
- * @returns A Promise of ListDedicatedConnectionsResponse
44
- */
45
- listDedicatedConnections = (request = {}) => sdkClient.enrichForPagination(
46
- "connections",
47
- this.pageOfListDedicatedConnections,
48
- request
49
- );
50
- /**
51
- * Get a dedicated connection. For self-hosted users, get a dedicated physical connection corresponding to the given ID. The response object includes information such as the connection's name, status and total bandwidth.
52
- *
53
- * @param request - The request {@link GetDedicatedConnectionRequest}
54
- * @returns A Promise of DedicatedConnection
55
- */
56
- getDedicatedConnection = (request) => this.client.fetch(
57
- {
58
- method: "GET",
59
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/dedicated-connections/${sdkClient.validatePathParam("connectionId", request.connectionId)}`
60
- },
61
- marshalling_gen.unmarshalDedicatedConnection
62
- );
63
- /**
64
- * Waits for {@link DedicatedConnection} to be in a final state.
65
- *
66
- * @param request - The request {@link GetDedicatedConnectionRequest}
67
- * @param options - The waiting options
68
- * @returns A Promise of DedicatedConnection
69
- */
70
- waitForDedicatedConnection = (request, options) => sdkClient.waitForResource(
71
- options?.stop ?? ((res) => Promise.resolve(
72
- !content_gen.DEDICATED_CONNECTION_TRANSIENT_STATUSES.includes(
73
- res.status
74
- )
75
- )),
76
- this.getDedicatedConnection,
77
- request,
78
- options
79
- );
80
- pageOfListPartners = (request = {}) => this.client.fetch(
81
- {
82
- method: "GET",
83
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/partners`,
84
- urlParams: sdkClient.urlParams(
85
- ["order_by", request.orderBy],
86
- ["page", request.page],
87
- [
88
- "page_size",
89
- request.pageSize ?? this.client.settings.defaultPageSize
90
- ],
91
- ["pop_ids", request.popIds]
92
- )
93
- },
94
- marshalling_gen.unmarshalListPartnersResponse
95
- );
96
- /**
97
- * List available partners. List all available partners. By default, the partners returned in the list are ordered by name in ascending order, though this can be modified via the `order_by` field.
98
- *
99
- * @param request - The request {@link ListPartnersRequest}
100
- * @returns A Promise of ListPartnersResponse
101
- */
102
- listPartners = (request = {}) => sdkClient.enrichForPagination("partners", this.pageOfListPartners, request);
103
- /**
104
- * Get a partner. Get a partner for the given partner IP. The response object includes information such as the partner's name, email address and portal URL.
105
- *
106
- * @param request - The request {@link GetPartnerRequest}
107
- * @returns A Promise of Partner
108
- */
109
- getPartner = (request) => this.client.fetch(
110
- {
111
- method: "GET",
112
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/partners/${sdkClient.validatePathParam("partnerId", request.partnerId)}`
113
- },
114
- marshalling_gen.unmarshalPartner
115
- );
116
- pageOfListPops = (request = {}) => this.client.fetch(
117
- {
118
- method: "GET",
119
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pops`,
120
- urlParams: sdkClient.urlParams(
121
- ["dedicated_available", request.dedicatedAvailable],
122
- ["hosting_provider_name", request.hostingProviderName],
123
- ["link_bandwidth_mbps", request.linkBandwidthMbps],
124
- ["name", request.name],
125
- ["order_by", request.orderBy],
126
- ["page", request.page],
127
- [
128
- "page_size",
129
- request.pageSize ?? this.client.settings.defaultPageSize
130
- ],
131
- ["partner_id", request.partnerId]
132
- )
133
- },
134
- marshalling_gen.unmarshalListPopsResponse
135
- );
136
- /**
137
- * List PoPs. List all available PoPs (locations) for a given region. By default, the results are returned in ascending alphabetical order by name.
138
- *
139
- * @param request - The request {@link ListPopsRequest}
140
- * @returns A Promise of ListPopsResponse
141
- */
142
- listPops = (request = {}) => sdkClient.enrichForPagination("pops", this.pageOfListPops, request);
143
- /**
144
- * Get a PoP. Get a PoP for the given PoP ID. The response object includes the PoP's name and information about its physical location.
145
- *
146
- * @param request - The request {@link GetPopRequest}
147
- * @returns A Promise of Pop
148
- */
149
- getPop = (request) => this.client.fetch(
150
- {
151
- method: "GET",
152
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/pops/${sdkClient.validatePathParam("popId", request.popId)}`
153
- },
154
- marshalling_gen.unmarshalPop
155
- );
156
- pageOfListLinks = (request = {}) => this.client.fetch(
157
- {
158
- method: "GET",
159
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links`,
160
- urlParams: sdkClient.urlParams(
161
- ["bandwidth_mbps", request.bandwidthMbps],
162
- ["bgp_v4_status", request.bgpV4Status],
163
- ["bgp_v6_status", request.bgpV6Status],
164
- ["connection_id", request.connectionId],
165
- ["kind", request.kind],
166
- ["name", request.name],
167
- ["order_by", request.orderBy],
168
- ["organization_id", request.organizationId],
169
- ["page", request.page],
170
- [
171
- "page_size",
172
- request.pageSize ?? this.client.settings.defaultPageSize
173
- ],
174
- ["pairing_key", request.pairingKey],
175
- ["partner_id", request.partnerId],
176
- ["pop_id", request.popId],
177
- ["project_id", request.projectId],
178
- ["routing_policy_id", request.routingPolicyId],
179
- ["status", request.status],
180
- ["tags", request.tags],
181
- ["vpc_id", request.vpcId]
182
- )
183
- },
184
- marshalling_gen.unmarshalListLinksResponse
185
- );
186
- /**
187
- * List links. List all your links (InterLink connections). A number of filters are available, including Project ID, name, tags and status.
188
- *
189
- * @param request - The request {@link ListLinksRequest}
190
- * @returns A Promise of ListLinksResponse
191
- */
192
- listLinks = (request = {}) => sdkClient.enrichForPagination("links", this.pageOfListLinks, request);
193
- /**
194
- * Get a link. Get a link (InterLink session / logical InterLink resource) for the given link ID. The response object includes information about the link's various configuration details.
195
- *
196
- * @param request - The request {@link GetLinkRequest}
197
- * @returns A Promise of Link
198
- */
199
- getLink = (request) => this.client.fetch(
200
- {
201
- method: "GET",
202
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}`
203
- },
204
- marshalling_gen.unmarshalLink
205
- );
206
- /**
207
- * Waits for {@link Link} to be in a final state.
208
- *
209
- * @param request - The request {@link GetLinkRequest}
210
- * @param options - The waiting options
211
- * @returns A Promise of Link
212
- */
213
- waitForLink = (request, options) => sdkClient.waitForResource(
214
- options?.stop ?? ((res) => Promise.resolve(
215
- !content_gen.LINK_TRANSIENT_STATUSES.includes(res.status)
216
- )),
217
- this.getLink,
218
- request,
219
- options
220
- );
221
- /**
222
- * Create a link. Create a link (InterLink session / logical InterLink resource) in a given PoP, specifying its various configuration details. Links can either be hosted (facilitated by partners' shared physical connections) or self-hosted (for users who have purchased a dedicated physical connection).
223
- *
224
- * @param request - The request {@link CreateLinkRequest}
225
- * @returns A Promise of Link
226
- */
227
- createLink = (request) => this.client.fetch(
228
- {
229
- body: JSON.stringify(
230
- marshalling_gen.marshalCreateLinkRequest(request, this.client.settings)
231
- ),
232
- headers: jsonContentHeaders,
233
- method: "POST",
234
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links`
235
- },
236
- marshalling_gen.unmarshalLink
237
- );
238
- /**
239
- * Update a link. Update an existing link, specified by its link ID. Only its name and tags can be updated.
240
- *
241
- * @param request - The request {@link UpdateLinkRequest}
242
- * @returns A Promise of Link
243
- */
244
- updateLink = (request) => this.client.fetch(
245
- {
246
- body: JSON.stringify(
247
- marshalling_gen.marshalUpdateLinkRequest(request, this.client.settings)
248
- ),
249
- headers: jsonContentHeaders,
250
- method: "PATCH",
251
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}`
252
- },
253
- marshalling_gen.unmarshalLink
254
- );
255
- /**
256
- * Delete a link. Delete an existing link, specified by its link ID. Note that as well as deleting the link here on the Scaleway side, it is also necessary to request deletion from the partner on their side. Only when this action has been carried out on both sides will the resource be completely deleted.
257
- *
258
- * @param request - The request {@link DeleteLinkRequest}
259
- * @returns A Promise of Link
260
- */
261
- deleteLink = (request) => this.client.fetch(
262
- {
263
- method: "DELETE",
264
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}`
265
- },
266
- marshalling_gen.unmarshalLink
267
- );
268
- /**
269
- * Attach a VPC. Attach a VPC to an existing link. This facilitates communication between the resources in your Scaleway VPC, and your on-premises infrastructure.
270
- *
271
- * @param request - The request {@link AttachVpcRequest}
272
- * @returns A Promise of Link
273
- */
274
- attachVpc = (request) => this.client.fetch(
275
- {
276
- body: JSON.stringify(
277
- marshalling_gen.marshalAttachVpcRequest(request, this.client.settings)
278
- ),
279
- headers: jsonContentHeaders,
280
- method: "POST",
281
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}/attach-vpc`
282
- },
283
- marshalling_gen.unmarshalLink
284
- );
285
- /**
286
- * Detach a VPC. Detach a VPC from an existing link.
287
- *
288
- * @param request - The request {@link DetachVpcRequest}
289
- * @returns A Promise of Link
290
- */
291
- detachVpc = (request) => this.client.fetch(
292
- {
293
- body: "{}",
294
- headers: jsonContentHeaders,
295
- method: "POST",
296
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}/detach-vpc`
297
- },
298
- marshalling_gen.unmarshalLink
299
- );
300
- /**
301
- * Attach a routing policy. Attach a routing policy to an existing link. As all routes across the link are blocked by default, you must attach a routing policy to set IP prefix filters for allowed routes, facilitating traffic flow.
302
- *
303
- * @param request - The request {@link AttachRoutingPolicyRequest}
304
- * @returns A Promise of Link
305
- */
306
- attachRoutingPolicy = (request) => this.client.fetch(
307
- {
308
- body: JSON.stringify(
309
- marshalling_gen.marshalAttachRoutingPolicyRequest(request, this.client.settings)
310
- ),
311
- headers: jsonContentHeaders,
312
- method: "POST",
313
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}/attach-routing-policy`
314
- },
315
- marshalling_gen.unmarshalLink
316
- );
317
- /**
318
- * Detach a routing policy. Detach a routing policy from an existing link. Without a routing policy, all routes across the link are blocked by default.
319
- *
320
- * @param request - The request {@link DetachRoutingPolicyRequest}
321
- * @returns A Promise of Link
322
- */
323
- detachRoutingPolicy = (request) => this.client.fetch(
324
- {
325
- body: JSON.stringify(
326
- marshalling_gen.marshalDetachRoutingPolicyRequest(request, this.client.settings)
327
- ),
328
- headers: jsonContentHeaders,
329
- method: "POST",
330
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}/detach-routing-policy`
331
- },
332
- marshalling_gen.unmarshalLink
333
- );
334
- /**
335
- * Set a routing policy. Replace a routing policy from an existing link. This is useful when route propagation is enabled because it changes the routing policy "in place", without blocking all routes like a attach / detach would do.
336
- *
337
- * @param request - The request {@link SetRoutingPolicyRequest}
338
- * @returns A Promise of Link
339
- */
340
- setRoutingPolicy = (request) => this.client.fetch(
341
- {
342
- body: JSON.stringify(
343
- marshalling_gen.marshalSetRoutingPolicyRequest(request, this.client.settings)
344
- ),
345
- headers: jsonContentHeaders,
346
- method: "POST",
347
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}/set-routing-policy`
348
- },
349
- marshalling_gen.unmarshalLink
350
- );
351
- /**
352
- * Enable route propagation. Enable all allowed prefixes (defined in a routing policy) to be announced in the BGP session. This allows traffic to flow between the attached VPC and the on-premises infrastructure along the announced routes. Note that by default, even when route propagation is enabled, all routes are blocked. It is essential to attach a routing policy to define the ranges of routes to announce.
353
- *
354
- * @param request - The request {@link EnableRoutePropagationRequest}
355
- * @returns A Promise of Link
356
- */
357
- enableRoutePropagation = (request) => this.client.fetch(
358
- {
359
- body: "{}",
360
- headers: jsonContentHeaders,
361
- method: "POST",
362
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}/enable-route-propagation`
363
- },
364
- marshalling_gen.unmarshalLink
365
- );
366
- /**
367
- * Disable route propagation. Prevent any prefixes from being announced in the BGP session. Traffic will not be able to flow over the InterLink until route propagation is re-enabled.
368
- *
369
- * @param request - The request {@link DisableRoutePropagationRequest}
370
- * @returns A Promise of Link
371
- */
372
- disableRoutePropagation = (request) => this.client.fetch(
373
- {
374
- body: "{}",
375
- headers: jsonContentHeaders,
376
- method: "POST",
377
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/links/${sdkClient.validatePathParam("linkId", request.linkId)}/disable-route-propagation`
378
- },
379
- marshalling_gen.unmarshalLink
380
- );
381
- pageOfListRoutingPolicies = (request = {}) => this.client.fetch(
382
- {
383
- method: "GET",
384
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies`,
385
- urlParams: sdkClient.urlParams(
386
- ["ipv6", request.ipv6],
387
- ["name", request.name],
388
- ["order_by", request.orderBy],
389
- ["organization_id", request.organizationId],
390
- ["page", request.page],
391
- [
392
- "page_size",
393
- request.pageSize ?? this.client.settings.defaultPageSize
394
- ],
395
- ["project_id", request.projectId],
396
- ["tags", request.tags]
397
- )
398
- },
399
- marshalling_gen.unmarshalListRoutingPoliciesResponse
400
- );
401
- /**
402
- * List routing policies. List all routing policies in a given region. A routing policy can be attached to one or multiple links (InterLink connections).
403
- *
404
- * @param request - The request {@link ListRoutingPoliciesRequest}
405
- * @returns A Promise of ListRoutingPoliciesResponse
406
- */
407
- listRoutingPolicies = (request = {}) => sdkClient.enrichForPagination(
408
- "routingPolicies",
409
- this.pageOfListRoutingPolicies,
410
- request
411
- );
412
- /**
413
- * Get routing policy. Get a routing policy for the given routing policy ID. The response object gives information including the policy's name, tags and prefix filters.
414
- *
415
- * @param request - The request {@link GetRoutingPolicyRequest}
416
- * @returns A Promise of RoutingPolicy
417
- */
418
- getRoutingPolicy = (request) => this.client.fetch(
419
- {
420
- method: "GET",
421
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${sdkClient.validatePathParam("routingPolicyId", request.routingPolicyId)}`
422
- },
423
- marshalling_gen.unmarshalRoutingPolicy
424
- );
425
- /**
426
- * Create a routing policy. Create a routing policy. Routing policies allow you to set IP prefix filters to define the incoming route announcements to accept from the peer, and the outgoing routes to announce to the peer.
427
- *
428
- * @param request - The request {@link CreateRoutingPolicyRequest}
429
- * @returns A Promise of RoutingPolicy
430
- */
431
- createRoutingPolicy = (request) => this.client.fetch(
432
- {
433
- body: JSON.stringify(
434
- marshalling_gen.marshalCreateRoutingPolicyRequest(request, this.client.settings)
435
- ),
436
- headers: jsonContentHeaders,
437
- method: "POST",
438
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies`
439
- },
440
- marshalling_gen.unmarshalRoutingPolicy
441
- );
442
- /**
443
- * Update a routing policy. Update an existing routing policy, specified by its routing policy ID. Its name, tags and incoming/outgoing prefix filters can be updated.
444
- *
445
- * @param request - The request {@link UpdateRoutingPolicyRequest}
446
- * @returns A Promise of RoutingPolicy
447
- */
448
- updateRoutingPolicy = (request) => this.client.fetch(
449
- {
450
- body: JSON.stringify(
451
- marshalling_gen.marshalUpdateRoutingPolicyRequest(request, this.client.settings)
452
- ),
453
- headers: jsonContentHeaders,
454
- method: "PATCH",
455
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${sdkClient.validatePathParam("routingPolicyId", request.routingPolicyId)}`
456
- },
457
- marshalling_gen.unmarshalRoutingPolicy
458
- );
459
- /**
460
- * Delete a routing policy. Delete an existing routing policy, specified by its routing policy ID.
461
- *
462
- * @param request - The request {@link DeleteRoutingPolicyRequest}
463
- */
464
- deleteRoutingPolicy = (request) => this.client.fetch({
465
- method: "DELETE",
466
- path: `/interlink/v1beta1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/routing-policies/${sdkClient.validatePathParam("routingPolicyId", request.routingPolicyId)}`
467
- });
468
- }
469
- exports.API = API;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const DEDICATED_CONNECTION_TRANSIENT_STATUSES = ["configuring"];
4
- const LINK_TRANSIENT_STATUSES = ["configuring"];
5
- exports.DEDICATED_CONNECTION_TRANSIENT_STATUSES = DEDICATED_CONNECTION_TRANSIENT_STATUSES;
6
- exports.LINK_TRANSIENT_STATUSES = LINK_TRANSIENT_STATUSES;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const api_gen = require("./api.gen.cjs");
4
- const content_gen = require("./content.gen.cjs");
5
- const marshalling_gen = require("./marshalling.gen.cjs");
6
- const validationRules_gen = require("./validation-rules.gen.cjs");
7
- exports.API = api_gen.API;
8
- exports.DEDICATED_CONNECTION_TRANSIENT_STATUSES = content_gen.DEDICATED_CONNECTION_TRANSIENT_STATUSES;
9
- exports.LINK_TRANSIENT_STATUSES = content_gen.LINK_TRANSIENT_STATUSES;
10
- exports.marshalAttachRoutingPolicyRequest = marshalling_gen.marshalAttachRoutingPolicyRequest;
11
- exports.marshalAttachVpcRequest = marshalling_gen.marshalAttachVpcRequest;
12
- exports.marshalCreateLinkRequest = marshalling_gen.marshalCreateLinkRequest;
13
- exports.marshalCreateRoutingPolicyRequest = marshalling_gen.marshalCreateRoutingPolicyRequest;
14
- exports.marshalDetachRoutingPolicyRequest = marshalling_gen.marshalDetachRoutingPolicyRequest;
15
- exports.marshalSetRoutingPolicyRequest = marshalling_gen.marshalSetRoutingPolicyRequest;
16
- exports.marshalUpdateLinkRequest = marshalling_gen.marshalUpdateLinkRequest;
17
- exports.marshalUpdateRoutingPolicyRequest = marshalling_gen.marshalUpdateRoutingPolicyRequest;
18
- exports.unmarshalDedicatedConnection = marshalling_gen.unmarshalDedicatedConnection;
19
- exports.unmarshalLink = marshalling_gen.unmarshalLink;
20
- exports.unmarshalListDedicatedConnectionsResponse = marshalling_gen.unmarshalListDedicatedConnectionsResponse;
21
- exports.unmarshalListLinksResponse = marshalling_gen.unmarshalListLinksResponse;
22
- exports.unmarshalListPartnersResponse = marshalling_gen.unmarshalListPartnersResponse;
23
- exports.unmarshalListPopsResponse = marshalling_gen.unmarshalListPopsResponse;
24
- exports.unmarshalListRoutingPoliciesResponse = marshalling_gen.unmarshalListRoutingPoliciesResponse;
25
- exports.unmarshalPartner = marshalling_gen.unmarshalPartner;
26
- exports.unmarshalPop = marshalling_gen.unmarshalPop;
27
- exports.unmarshalRoutingPolicy = marshalling_gen.unmarshalRoutingPolicy;
28
- exports.ValidationRules = validationRules_gen;
@@ -1,270 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const unmarshalDedicatedConnection = (data) => {
5
- if (!sdkClient.isJSONObject(data)) {
6
- throw new TypeError(
7
- `Unmarshalling the type 'DedicatedConnection' failed as data isn't a dictionary.`
8
- );
9
- }
10
- return {
11
- availableLinkBandwidths: data.available_link_bandwidths,
12
- bandwidthMbps: data.bandwidth_mbps,
13
- createdAt: sdkClient.unmarshalDate(data.created_at),
14
- demarcationInfo: data.demarcation_info,
15
- id: data.id,
16
- name: data.name,
17
- organizationId: data.organization_id,
18
- popId: data.pop_id,
19
- projectId: data.project_id,
20
- region: data.region,
21
- status: data.status,
22
- tags: data.tags,
23
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
24
- };
25
- };
26
- const unmarshalBgpConfig = (data) => {
27
- if (!sdkClient.isJSONObject(data)) {
28
- throw new TypeError(
29
- `Unmarshalling the type 'BgpConfig' failed as data isn't a dictionary.`
30
- );
31
- }
32
- return {
33
- asn: data.asn,
34
- ipv4: data.ipv4,
35
- ipv6: data.ipv6
36
- };
37
- };
38
- const unmarshalPartnerHost = (data) => {
39
- if (!sdkClient.isJSONObject(data)) {
40
- throw new TypeError(
41
- `Unmarshalling the type 'PartnerHost' failed as data isn't a dictionary.`
42
- );
43
- }
44
- return {
45
- disapprovedReason: data.disapproved_reason,
46
- pairingKey: data.pairing_key,
47
- partnerId: data.partner_id
48
- };
49
- };
50
- const unmarshalSelfHost = (data) => {
51
- if (!sdkClient.isJSONObject(data)) {
52
- throw new TypeError(
53
- `Unmarshalling the type 'SelfHost' failed as data isn't a dictionary.`
54
- );
55
- }
56
- return {
57
- connectionId: data.connection_id
58
- };
59
- };
60
- const unmarshalLink = (data) => {
61
- if (!sdkClient.isJSONObject(data)) {
62
- throw new TypeError(
63
- `Unmarshalling the type 'Link' failed as data isn't a dictionary.`
64
- );
65
- }
66
- return {
67
- bandwidthMbps: data.bandwidth_mbps,
68
- bgpV4Status: data.bgp_v4_status,
69
- bgpV6Status: data.bgp_v6_status,
70
- createdAt: sdkClient.unmarshalDate(data.created_at),
71
- enableRoutePropagation: data.enable_route_propagation,
72
- id: data.id,
73
- name: data.name,
74
- organizationId: data.organization_id,
75
- partner: data.partner ? unmarshalPartnerHost(data.partner) : void 0,
76
- peerBgpConfig: data.peer_bgp_config ? unmarshalBgpConfig(data.peer_bgp_config) : void 0,
77
- popId: data.pop_id,
78
- projectId: data.project_id,
79
- region: data.region,
80
- routingPolicyId: data.routing_policy_id,
81
- routingPolicyV4Id: data.routing_policy_v4_id,
82
- routingPolicyV6Id: data.routing_policy_v6_id,
83
- scwBgpConfig: data.scw_bgp_config ? unmarshalBgpConfig(data.scw_bgp_config) : void 0,
84
- self: data.self ? unmarshalSelfHost(data.self) : void 0,
85
- status: data.status,
86
- tags: data.tags,
87
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
88
- vlan: data.vlan,
89
- vpcId: data.vpc_id
90
- };
91
- };
92
- const unmarshalPartner = (data) => {
93
- if (!sdkClient.isJSONObject(data)) {
94
- throw new TypeError(
95
- `Unmarshalling the type 'Partner' failed as data isn't a dictionary.`
96
- );
97
- }
98
- return {
99
- contactEmail: data.contact_email,
100
- createdAt: sdkClient.unmarshalDate(data.created_at),
101
- id: data.id,
102
- logoUrl: data.logo_url,
103
- name: data.name,
104
- portalUrl: data.portal_url,
105
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
106
- };
107
- };
108
- const unmarshalPop = (data) => {
109
- if (!sdkClient.isJSONObject(data)) {
110
- throw new TypeError(
111
- `Unmarshalling the type 'Pop' failed as data isn't a dictionary.`
112
- );
113
- }
114
- return {
115
- address: data.address,
116
- availableLinkBandwidthsMbps: data.available_link_bandwidths_mbps,
117
- city: data.city,
118
- displayName: data.display_name,
119
- hostingProviderName: data.hosting_provider_name,
120
- id: data.id,
121
- logoUrl: data.logo_url,
122
- name: data.name,
123
- region: data.region
124
- };
125
- };
126
- const unmarshalRoutingPolicy = (data) => {
127
- if (!sdkClient.isJSONObject(data)) {
128
- throw new TypeError(
129
- `Unmarshalling the type 'RoutingPolicy' failed as data isn't a dictionary.`
130
- );
131
- }
132
- return {
133
- createdAt: sdkClient.unmarshalDate(data.created_at),
134
- id: data.id,
135
- isIpv6: data.is_ipv6,
136
- name: data.name,
137
- organizationId: data.organization_id,
138
- prefixFilterIn: data.prefix_filter_in,
139
- prefixFilterOut: data.prefix_filter_out,
140
- projectId: data.project_id,
141
- region: data.region,
142
- tags: data.tags,
143
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
144
- };
145
- };
146
- const unmarshalListDedicatedConnectionsResponse = (data) => {
147
- if (!sdkClient.isJSONObject(data)) {
148
- throw new TypeError(
149
- `Unmarshalling the type 'ListDedicatedConnectionsResponse' failed as data isn't a dictionary.`
150
- );
151
- }
152
- return {
153
- connections: sdkClient.unmarshalArrayOfObject(
154
- data.connections,
155
- unmarshalDedicatedConnection
156
- ),
157
- totalCount: data.total_count
158
- };
159
- };
160
- const unmarshalListLinksResponse = (data) => {
161
- if (!sdkClient.isJSONObject(data)) {
162
- throw new TypeError(
163
- `Unmarshalling the type 'ListLinksResponse' failed as data isn't a dictionary.`
164
- );
165
- }
166
- return {
167
- links: sdkClient.unmarshalArrayOfObject(data.links, unmarshalLink),
168
- totalCount: data.total_count
169
- };
170
- };
171
- const unmarshalListPartnersResponse = (data) => {
172
- if (!sdkClient.isJSONObject(data)) {
173
- throw new TypeError(
174
- `Unmarshalling the type 'ListPartnersResponse' failed as data isn't a dictionary.`
175
- );
176
- }
177
- return {
178
- partners: sdkClient.unmarshalArrayOfObject(data.partners, unmarshalPartner),
179
- totalCount: data.total_count
180
- };
181
- };
182
- const unmarshalListPopsResponse = (data) => {
183
- if (!sdkClient.isJSONObject(data)) {
184
- throw new TypeError(
185
- `Unmarshalling the type 'ListPopsResponse' failed as data isn't a dictionary.`
186
- );
187
- }
188
- return {
189
- pops: sdkClient.unmarshalArrayOfObject(data.pops, unmarshalPop),
190
- totalCount: data.total_count
191
- };
192
- };
193
- const unmarshalListRoutingPoliciesResponse = (data) => {
194
- if (!sdkClient.isJSONObject(data)) {
195
- throw new TypeError(
196
- `Unmarshalling the type 'ListRoutingPoliciesResponse' failed as data isn't a dictionary.`
197
- );
198
- }
199
- return {
200
- routingPolicies: sdkClient.unmarshalArrayOfObject(
201
- data.routing_policies,
202
- unmarshalRoutingPolicy
203
- ),
204
- totalCount: data.total_count
205
- };
206
- };
207
- const marshalAttachRoutingPolicyRequest = (request, defaults) => ({
208
- routing_policy_id: request.routingPolicyId
209
- });
210
- const marshalAttachVpcRequest = (request, defaults) => ({
211
- vpc_id: request.vpcId
212
- });
213
- const marshalCreateLinkRequest = (request, defaults) => ({
214
- bandwidth_mbps: request.bandwidthMbps,
215
- name: request.name,
216
- peer_asn: request.peerAsn,
217
- pop_id: request.popId,
218
- project_id: request.projectId ?? defaults.defaultProjectId,
219
- routing_policy_v4_id: request.routingPolicyV4Id,
220
- routing_policy_v6_id: request.routingPolicyV6Id,
221
- tags: request.tags,
222
- vlan: request.vlan,
223
- ...sdkClient.resolveOneOf([
224
- { param: "connection_id", value: request.connectionId },
225
- { param: "partner_id", value: request.partnerId }
226
- ])
227
- });
228
- const marshalCreateRoutingPolicyRequest = (request, defaults) => ({
229
- is_ipv6: request.isIpv6,
230
- name: request.name,
231
- prefix_filter_in: request.prefixFilterIn,
232
- prefix_filter_out: request.prefixFilterOut,
233
- project_id: request.projectId ?? defaults.defaultProjectId,
234
- tags: request.tags
235
- });
236
- const marshalDetachRoutingPolicyRequest = (request, defaults) => ({
237
- routing_policy_id: request.routingPolicyId
238
- });
239
- const marshalSetRoutingPolicyRequest = (request, defaults) => ({
240
- routing_policy_id: request.routingPolicyId
241
- });
242
- const marshalUpdateLinkRequest = (request, defaults) => ({
243
- name: request.name,
244
- peer_asn: request.peerAsn,
245
- tags: request.tags
246
- });
247
- const marshalUpdateRoutingPolicyRequest = (request, defaults) => ({
248
- name: request.name,
249
- prefix_filter_in: request.prefixFilterIn,
250
- prefix_filter_out: request.prefixFilterOut,
251
- tags: request.tags
252
- });
253
- exports.marshalAttachRoutingPolicyRequest = marshalAttachRoutingPolicyRequest;
254
- exports.marshalAttachVpcRequest = marshalAttachVpcRequest;
255
- exports.marshalCreateLinkRequest = marshalCreateLinkRequest;
256
- exports.marshalCreateRoutingPolicyRequest = marshalCreateRoutingPolicyRequest;
257
- exports.marshalDetachRoutingPolicyRequest = marshalDetachRoutingPolicyRequest;
258
- exports.marshalSetRoutingPolicyRequest = marshalSetRoutingPolicyRequest;
259
- exports.marshalUpdateLinkRequest = marshalUpdateLinkRequest;
260
- exports.marshalUpdateRoutingPolicyRequest = marshalUpdateRoutingPolicyRequest;
261
- exports.unmarshalDedicatedConnection = unmarshalDedicatedConnection;
262
- exports.unmarshalLink = unmarshalLink;
263
- exports.unmarshalListDedicatedConnectionsResponse = unmarshalListDedicatedConnectionsResponse;
264
- exports.unmarshalListLinksResponse = unmarshalListLinksResponse;
265
- exports.unmarshalListPartnersResponse = unmarshalListPartnersResponse;
266
- exports.unmarshalListPopsResponse = unmarshalListPopsResponse;
267
- exports.unmarshalListRoutingPoliciesResponse = unmarshalListRoutingPoliciesResponse;
268
- exports.unmarshalPartner = unmarshalPartner;
269
- exports.unmarshalPop = unmarshalPop;
270
- exports.unmarshalRoutingPolicy = unmarshalRoutingPolicy;
@@ -1,135 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const BgpConfig = {
4
- asn: {
5
- greaterThanOrEqual: 1,
6
- lessThanOrEqual: 65534
7
- }
8
- };
9
- const CreateLinkRequest = {
10
- bandwidthMbps: {
11
- greaterThanOrEqual: 1,
12
- lessThanOrEqual: 1e8
13
- },
14
- name: {
15
- maxLength: 255,
16
- minLength: 1
17
- },
18
- peerAsn: {
19
- greaterThanOrEqual: 1,
20
- lessThanOrEqual: 65534
21
- }
22
- };
23
- const CreateRoutingPolicyRequest = {
24
- name: {
25
- maxLength: 255,
26
- minLength: 1
27
- }
28
- };
29
- const Link = {
30
- name: {
31
- minLength: 1
32
- }
33
- };
34
- const ListDedicatedConnectionsRequest = {
35
- page: {
36
- greaterThanOrEqual: 1
37
- },
38
- pageSize: {
39
- greaterThanOrEqual: 1,
40
- lessThanOrEqual: 1e3
41
- }
42
- };
43
- const ListLinksRequest = {
44
- page: {
45
- greaterThanOrEqual: 1
46
- },
47
- pageSize: {
48
- greaterThanOrEqual: 1,
49
- lessThanOrEqual: 1e3
50
- }
51
- };
52
- const ListPartnersRequest = {
53
- page: {
54
- greaterThanOrEqual: 1
55
- },
56
- pageSize: {
57
- greaterThanOrEqual: 1,
58
- lessThanOrEqual: 1e3
59
- }
60
- };
61
- const ListPopsRequest = {
62
- page: {
63
- greaterThanOrEqual: 1
64
- },
65
- pageSize: {
66
- greaterThanOrEqual: 1,
67
- lessThanOrEqual: 1e3
68
- }
69
- };
70
- const ListRoutingPoliciesRequest = {
71
- page: {
72
- greaterThanOrEqual: 1
73
- },
74
- pageSize: {
75
- greaterThanOrEqual: 1,
76
- lessThanOrEqual: 1e3
77
- }
78
- };
79
- const Partner = {
80
- name: {
81
- minLength: 1
82
- }
83
- };
84
- const Pop = {
85
- address: {
86
- minLength: 1
87
- },
88
- city: {
89
- minLength: 1
90
- },
91
- displayName: {
92
- minLength: 1
93
- },
94
- hostingProviderName: {
95
- minLength: 1
96
- },
97
- name: {
98
- minLength: 1
99
- }
100
- };
101
- const RoutingPolicy = {
102
- name: {
103
- minLength: 1
104
- }
105
- };
106
- const UpdateLinkRequest = {
107
- name: {
108
- maxLength: 255,
109
- minLength: 1
110
- },
111
- peerAsn: {
112
- greaterThanOrEqual: 1,
113
- lessThanOrEqual: 65534
114
- }
115
- };
116
- const UpdateRoutingPolicyRequest = {
117
- name: {
118
- maxLength: 255,
119
- minLength: 1
120
- }
121
- };
122
- exports.BgpConfig = BgpConfig;
123
- exports.CreateLinkRequest = CreateLinkRequest;
124
- exports.CreateRoutingPolicyRequest = CreateRoutingPolicyRequest;
125
- exports.Link = Link;
126
- exports.ListDedicatedConnectionsRequest = ListDedicatedConnectionsRequest;
127
- exports.ListLinksRequest = ListLinksRequest;
128
- exports.ListPartnersRequest = ListPartnersRequest;
129
- exports.ListPopsRequest = ListPopsRequest;
130
- exports.ListRoutingPoliciesRequest = ListRoutingPoliciesRequest;
131
- exports.Partner = Partner;
132
- exports.Pop = Pop;
133
- exports.RoutingPolicy = RoutingPolicy;
134
- exports.UpdateLinkRequest = UpdateLinkRequest;
135
- exports.UpdateRoutingPolicyRequest = UpdateRoutingPolicyRequest;