@scaleway/sdk-interlink 1.0.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.
@@ -0,0 +1,26 @@
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.marshalUpdateLinkRequest = marshalling_gen.marshalUpdateLinkRequest;
15
+ exports.marshalUpdateRoutingPolicyRequest = marshalling_gen.marshalUpdateRoutingPolicyRequest;
16
+ exports.unmarshalDedicatedConnection = marshalling_gen.unmarshalDedicatedConnection;
17
+ exports.unmarshalLink = marshalling_gen.unmarshalLink;
18
+ exports.unmarshalListDedicatedConnectionsResponse = marshalling_gen.unmarshalListDedicatedConnectionsResponse;
19
+ exports.unmarshalListLinksResponse = marshalling_gen.unmarshalListLinksResponse;
20
+ exports.unmarshalListPartnersResponse = marshalling_gen.unmarshalListPartnersResponse;
21
+ exports.unmarshalListPopsResponse = marshalling_gen.unmarshalListPopsResponse;
22
+ exports.unmarshalListRoutingPoliciesResponse = marshalling_gen.unmarshalListRoutingPoliciesResponse;
23
+ exports.unmarshalPartner = marshalling_gen.unmarshalPartner;
24
+ exports.unmarshalPop = marshalling_gen.unmarshalPop;
25
+ exports.unmarshalRoutingPolicy = marshalling_gen.unmarshalRoutingPolicy;
26
+ exports.ValidationRules = validationRules_gen;
@@ -0,0 +1,5 @@
1
+ export { API } from './api.gen';
2
+ export * from './content.gen';
3
+ export * from './marshalling.gen';
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, UpdateLinkRequest, UpdateRoutingPolicyRequest, } from './types.gen';
5
+ export * as ValidationRules from './validation-rules.gen';
@@ -0,0 +1,26 @@
1
+ import { API } from "./api.gen.js";
2
+ import { DEDICATED_CONNECTION_TRANSIENT_STATUSES, LINK_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { marshalAttachRoutingPolicyRequest, marshalAttachVpcRequest, marshalCreateLinkRequest, marshalCreateRoutingPolicyRequest, marshalUpdateLinkRequest, marshalUpdateRoutingPolicyRequest, unmarshalDedicatedConnection, unmarshalLink, unmarshalListDedicatedConnectionsResponse, unmarshalListLinksResponse, unmarshalListPartnersResponse, unmarshalListPopsResponse, unmarshalListRoutingPoliciesResponse, unmarshalPartner, unmarshalPop, unmarshalRoutingPolicy } from "./marshalling.gen.js";
4
+ import * as validationRules_gen from "./validation-rules.gen.js";
5
+ export {
6
+ API,
7
+ DEDICATED_CONNECTION_TRANSIENT_STATUSES,
8
+ LINK_TRANSIENT_STATUSES,
9
+ validationRules_gen as ValidationRules,
10
+ marshalAttachRoutingPolicyRequest,
11
+ marshalAttachVpcRequest,
12
+ marshalCreateLinkRequest,
13
+ marshalCreateRoutingPolicyRequest,
14
+ marshalUpdateLinkRequest,
15
+ marshalUpdateRoutingPolicyRequest,
16
+ unmarshalDedicatedConnection,
17
+ unmarshalLink,
18
+ unmarshalListDedicatedConnectionsResponse,
19
+ unmarshalListLinksResponse,
20
+ unmarshalListPartnersResponse,
21
+ unmarshalListPopsResponse,
22
+ unmarshalListRoutingPoliciesResponse,
23
+ unmarshalPartner,
24
+ unmarshalPop,
25
+ unmarshalRoutingPolicy
26
+ };
@@ -0,0 +1,254 @@
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
+ scwBgpConfig: data.scw_bgp_config ? unmarshalBgpConfig(data.scw_bgp_config) : void 0,
82
+ self: data.self ? unmarshalSelfHost(data.self) : void 0,
83
+ status: data.status,
84
+ tags: data.tags,
85
+ updatedAt: sdkClient.unmarshalDate(data.updated_at),
86
+ vlan: data.vlan,
87
+ vpcId: data.vpc_id
88
+ };
89
+ };
90
+ const unmarshalPartner = (data) => {
91
+ if (!sdkClient.isJSONObject(data)) {
92
+ throw new TypeError(
93
+ `Unmarshalling the type 'Partner' failed as data isn't a dictionary.`
94
+ );
95
+ }
96
+ return {
97
+ contactEmail: data.contact_email,
98
+ createdAt: sdkClient.unmarshalDate(data.created_at),
99
+ id: data.id,
100
+ logoUrl: data.logo_url,
101
+ name: data.name,
102
+ portalUrl: data.portal_url,
103
+ updatedAt: sdkClient.unmarshalDate(data.updated_at)
104
+ };
105
+ };
106
+ const unmarshalPop = (data) => {
107
+ if (!sdkClient.isJSONObject(data)) {
108
+ throw new TypeError(
109
+ `Unmarshalling the type 'Pop' failed as data isn't a dictionary.`
110
+ );
111
+ }
112
+ return {
113
+ address: data.address,
114
+ availableLinkBandwidthsMbps: data.available_link_bandwidths_mbps,
115
+ city: data.city,
116
+ hostingProviderName: data.hosting_provider_name,
117
+ id: data.id,
118
+ logoUrl: data.logo_url,
119
+ name: data.name,
120
+ region: data.region
121
+ };
122
+ };
123
+ const unmarshalRoutingPolicy = (data) => {
124
+ if (!sdkClient.isJSONObject(data)) {
125
+ throw new TypeError(
126
+ `Unmarshalling the type 'RoutingPolicy' failed as data isn't a dictionary.`
127
+ );
128
+ }
129
+ return {
130
+ createdAt: sdkClient.unmarshalDate(data.created_at),
131
+ id: data.id,
132
+ name: data.name,
133
+ organizationId: data.organization_id,
134
+ prefixFilterIn: data.prefix_filter_in,
135
+ prefixFilterOut: data.prefix_filter_out,
136
+ projectId: data.project_id,
137
+ region: data.region,
138
+ tags: data.tags,
139
+ updatedAt: sdkClient.unmarshalDate(data.updated_at)
140
+ };
141
+ };
142
+ const unmarshalListDedicatedConnectionsResponse = (data) => {
143
+ if (!sdkClient.isJSONObject(data)) {
144
+ throw new TypeError(
145
+ `Unmarshalling the type 'ListDedicatedConnectionsResponse' failed as data isn't a dictionary.`
146
+ );
147
+ }
148
+ return {
149
+ connections: sdkClient.unmarshalArrayOfObject(
150
+ data.connections,
151
+ unmarshalDedicatedConnection
152
+ ),
153
+ totalCount: data.total_count
154
+ };
155
+ };
156
+ const unmarshalListLinksResponse = (data) => {
157
+ if (!sdkClient.isJSONObject(data)) {
158
+ throw new TypeError(
159
+ `Unmarshalling the type 'ListLinksResponse' failed as data isn't a dictionary.`
160
+ );
161
+ }
162
+ return {
163
+ links: sdkClient.unmarshalArrayOfObject(data.links, unmarshalLink),
164
+ totalCount: data.total_count
165
+ };
166
+ };
167
+ const unmarshalListPartnersResponse = (data) => {
168
+ if (!sdkClient.isJSONObject(data)) {
169
+ throw new TypeError(
170
+ `Unmarshalling the type 'ListPartnersResponse' failed as data isn't a dictionary.`
171
+ );
172
+ }
173
+ return {
174
+ partners: sdkClient.unmarshalArrayOfObject(data.partners, unmarshalPartner),
175
+ totalCount: data.total_count
176
+ };
177
+ };
178
+ const unmarshalListPopsResponse = (data) => {
179
+ if (!sdkClient.isJSONObject(data)) {
180
+ throw new TypeError(
181
+ `Unmarshalling the type 'ListPopsResponse' failed as data isn't a dictionary.`
182
+ );
183
+ }
184
+ return {
185
+ pops: sdkClient.unmarshalArrayOfObject(data.pops, unmarshalPop),
186
+ totalCount: data.total_count
187
+ };
188
+ };
189
+ const unmarshalListRoutingPoliciesResponse = (data) => {
190
+ if (!sdkClient.isJSONObject(data)) {
191
+ throw new TypeError(
192
+ `Unmarshalling the type 'ListRoutingPoliciesResponse' failed as data isn't a dictionary.`
193
+ );
194
+ }
195
+ return {
196
+ routingPolicies: sdkClient.unmarshalArrayOfObject(
197
+ data.routing_policies,
198
+ unmarshalRoutingPolicy
199
+ ),
200
+ totalCount: data.total_count
201
+ };
202
+ };
203
+ const marshalAttachRoutingPolicyRequest = (request, defaults) => ({
204
+ routing_policy_id: request.routingPolicyId
205
+ });
206
+ const marshalAttachVpcRequest = (request, defaults) => ({
207
+ vpc_id: request.vpcId
208
+ });
209
+ const marshalCreateLinkRequest = (request, defaults) => ({
210
+ bandwidth_mbps: request.bandwidthMbps,
211
+ name: request.name,
212
+ peer_asn: request.peerAsn,
213
+ pop_id: request.popId,
214
+ project_id: request.projectId ?? defaults.defaultProjectId,
215
+ tags: request.tags,
216
+ ...sdkClient.resolveOneOf([
217
+ { param: "connection_id", value: request.connectionId },
218
+ { param: "partner_id", value: request.partnerId }
219
+ ])
220
+ });
221
+ const marshalCreateRoutingPolicyRequest = (request, defaults) => ({
222
+ name: request.name,
223
+ prefix_filter_in: request.prefixFilterIn,
224
+ prefix_filter_out: request.prefixFilterOut,
225
+ project_id: request.projectId ?? defaults.defaultProjectId,
226
+ tags: request.tags
227
+ });
228
+ const marshalUpdateLinkRequest = (request, defaults) => ({
229
+ name: request.name,
230
+ peer_asn: request.peerAsn,
231
+ tags: request.tags
232
+ });
233
+ const marshalUpdateRoutingPolicyRequest = (request, defaults) => ({
234
+ name: request.name,
235
+ prefix_filter_in: request.prefixFilterIn,
236
+ prefix_filter_out: request.prefixFilterOut,
237
+ tags: request.tags
238
+ });
239
+ exports.marshalAttachRoutingPolicyRequest = marshalAttachRoutingPolicyRequest;
240
+ exports.marshalAttachVpcRequest = marshalAttachVpcRequest;
241
+ exports.marshalCreateLinkRequest = marshalCreateLinkRequest;
242
+ exports.marshalCreateRoutingPolicyRequest = marshalCreateRoutingPolicyRequest;
243
+ exports.marshalUpdateLinkRequest = marshalUpdateLinkRequest;
244
+ exports.marshalUpdateRoutingPolicyRequest = marshalUpdateRoutingPolicyRequest;
245
+ exports.unmarshalDedicatedConnection = unmarshalDedicatedConnection;
246
+ exports.unmarshalLink = unmarshalLink;
247
+ exports.unmarshalListDedicatedConnectionsResponse = unmarshalListDedicatedConnectionsResponse;
248
+ exports.unmarshalListLinksResponse = unmarshalListLinksResponse;
249
+ exports.unmarshalListPartnersResponse = unmarshalListPartnersResponse;
250
+ exports.unmarshalListPopsResponse = unmarshalListPopsResponse;
251
+ exports.unmarshalListRoutingPoliciesResponse = unmarshalListRoutingPoliciesResponse;
252
+ exports.unmarshalPartner = unmarshalPartner;
253
+ exports.unmarshalPop = unmarshalPop;
254
+ exports.unmarshalRoutingPolicy = unmarshalRoutingPolicy;
@@ -0,0 +1,18 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { AttachRoutingPolicyRequest, AttachVpcRequest, CreateLinkRequest, CreateRoutingPolicyRequest, DedicatedConnection, Link, ListDedicatedConnectionsResponse, ListLinksResponse, ListPartnersResponse, ListPopsResponse, ListRoutingPoliciesResponse, Partner, Pop, RoutingPolicy, UpdateLinkRequest, UpdateRoutingPolicyRequest } from './types.gen';
3
+ export declare const unmarshalDedicatedConnection: (data: unknown) => DedicatedConnection;
4
+ export declare const unmarshalLink: (data: unknown) => Link;
5
+ export declare const unmarshalPartner: (data: unknown) => Partner;
6
+ export declare const unmarshalPop: (data: unknown) => Pop;
7
+ export declare const unmarshalRoutingPolicy: (data: unknown) => RoutingPolicy;
8
+ export declare const unmarshalListDedicatedConnectionsResponse: (data: unknown) => ListDedicatedConnectionsResponse;
9
+ export declare const unmarshalListLinksResponse: (data: unknown) => ListLinksResponse;
10
+ export declare const unmarshalListPartnersResponse: (data: unknown) => ListPartnersResponse;
11
+ export declare const unmarshalListPopsResponse: (data: unknown) => ListPopsResponse;
12
+ export declare const unmarshalListRoutingPoliciesResponse: (data: unknown) => ListRoutingPoliciesResponse;
13
+ export declare const marshalAttachRoutingPolicyRequest: (request: AttachRoutingPolicyRequest, defaults: DefaultValues) => Record<string, unknown>;
14
+ export declare const marshalAttachVpcRequest: (request: AttachVpcRequest, defaults: DefaultValues) => Record<string, unknown>;
15
+ export declare const marshalCreateLinkRequest: (request: CreateLinkRequest, defaults: DefaultValues) => Record<string, unknown>;
16
+ export declare const marshalCreateRoutingPolicyRequest: (request: CreateRoutingPolicyRequest, defaults: DefaultValues) => Record<string, unknown>;
17
+ export declare const marshalUpdateLinkRequest: (request: UpdateLinkRequest, defaults: DefaultValues) => Record<string, unknown>;
18
+ export declare const marshalUpdateRoutingPolicyRequest: (request: UpdateRoutingPolicyRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,254 @@
1
+ import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
2
+ const unmarshalDedicatedConnection = (data) => {
3
+ if (!isJSONObject(data)) {
4
+ throw new TypeError(
5
+ `Unmarshalling the type 'DedicatedConnection' failed as data isn't a dictionary.`
6
+ );
7
+ }
8
+ return {
9
+ availableLinkBandwidths: data.available_link_bandwidths,
10
+ bandwidthMbps: data.bandwidth_mbps,
11
+ createdAt: unmarshalDate(data.created_at),
12
+ demarcationInfo: data.demarcation_info,
13
+ id: data.id,
14
+ name: data.name,
15
+ organizationId: data.organization_id,
16
+ popId: data.pop_id,
17
+ projectId: data.project_id,
18
+ region: data.region,
19
+ status: data.status,
20
+ tags: data.tags,
21
+ updatedAt: unmarshalDate(data.updated_at)
22
+ };
23
+ };
24
+ const unmarshalBgpConfig = (data) => {
25
+ if (!isJSONObject(data)) {
26
+ throw new TypeError(
27
+ `Unmarshalling the type 'BgpConfig' failed as data isn't a dictionary.`
28
+ );
29
+ }
30
+ return {
31
+ asn: data.asn,
32
+ ipv4: data.ipv4,
33
+ ipv6: data.ipv6
34
+ };
35
+ };
36
+ const unmarshalPartnerHost = (data) => {
37
+ if (!isJSONObject(data)) {
38
+ throw new TypeError(
39
+ `Unmarshalling the type 'PartnerHost' failed as data isn't a dictionary.`
40
+ );
41
+ }
42
+ return {
43
+ disapprovedReason: data.disapproved_reason,
44
+ pairingKey: data.pairing_key,
45
+ partnerId: data.partner_id
46
+ };
47
+ };
48
+ const unmarshalSelfHost = (data) => {
49
+ if (!isJSONObject(data)) {
50
+ throw new TypeError(
51
+ `Unmarshalling the type 'SelfHost' failed as data isn't a dictionary.`
52
+ );
53
+ }
54
+ return {
55
+ connectionId: data.connection_id
56
+ };
57
+ };
58
+ const unmarshalLink = (data) => {
59
+ if (!isJSONObject(data)) {
60
+ throw new TypeError(
61
+ `Unmarshalling the type 'Link' failed as data isn't a dictionary.`
62
+ );
63
+ }
64
+ return {
65
+ bandwidthMbps: data.bandwidth_mbps,
66
+ bgpV4Status: data.bgp_v4_status,
67
+ bgpV6Status: data.bgp_v6_status,
68
+ createdAt: unmarshalDate(data.created_at),
69
+ enableRoutePropagation: data.enable_route_propagation,
70
+ id: data.id,
71
+ name: data.name,
72
+ organizationId: data.organization_id,
73
+ partner: data.partner ? unmarshalPartnerHost(data.partner) : void 0,
74
+ peerBgpConfig: data.peer_bgp_config ? unmarshalBgpConfig(data.peer_bgp_config) : void 0,
75
+ popId: data.pop_id,
76
+ projectId: data.project_id,
77
+ region: data.region,
78
+ routingPolicyId: data.routing_policy_id,
79
+ scwBgpConfig: data.scw_bgp_config ? unmarshalBgpConfig(data.scw_bgp_config) : void 0,
80
+ self: data.self ? unmarshalSelfHost(data.self) : void 0,
81
+ status: data.status,
82
+ tags: data.tags,
83
+ updatedAt: unmarshalDate(data.updated_at),
84
+ vlan: data.vlan,
85
+ vpcId: data.vpc_id
86
+ };
87
+ };
88
+ const unmarshalPartner = (data) => {
89
+ if (!isJSONObject(data)) {
90
+ throw new TypeError(
91
+ `Unmarshalling the type 'Partner' failed as data isn't a dictionary.`
92
+ );
93
+ }
94
+ return {
95
+ contactEmail: data.contact_email,
96
+ createdAt: unmarshalDate(data.created_at),
97
+ id: data.id,
98
+ logoUrl: data.logo_url,
99
+ name: data.name,
100
+ portalUrl: data.portal_url,
101
+ updatedAt: unmarshalDate(data.updated_at)
102
+ };
103
+ };
104
+ const unmarshalPop = (data) => {
105
+ if (!isJSONObject(data)) {
106
+ throw new TypeError(
107
+ `Unmarshalling the type 'Pop' failed as data isn't a dictionary.`
108
+ );
109
+ }
110
+ return {
111
+ address: data.address,
112
+ availableLinkBandwidthsMbps: data.available_link_bandwidths_mbps,
113
+ city: data.city,
114
+ hostingProviderName: data.hosting_provider_name,
115
+ id: data.id,
116
+ logoUrl: data.logo_url,
117
+ name: data.name,
118
+ region: data.region
119
+ };
120
+ };
121
+ const unmarshalRoutingPolicy = (data) => {
122
+ if (!isJSONObject(data)) {
123
+ throw new TypeError(
124
+ `Unmarshalling the type 'RoutingPolicy' failed as data isn't a dictionary.`
125
+ );
126
+ }
127
+ return {
128
+ createdAt: unmarshalDate(data.created_at),
129
+ id: data.id,
130
+ name: data.name,
131
+ organizationId: data.organization_id,
132
+ prefixFilterIn: data.prefix_filter_in,
133
+ prefixFilterOut: data.prefix_filter_out,
134
+ projectId: data.project_id,
135
+ region: data.region,
136
+ tags: data.tags,
137
+ updatedAt: unmarshalDate(data.updated_at)
138
+ };
139
+ };
140
+ const unmarshalListDedicatedConnectionsResponse = (data) => {
141
+ if (!isJSONObject(data)) {
142
+ throw new TypeError(
143
+ `Unmarshalling the type 'ListDedicatedConnectionsResponse' failed as data isn't a dictionary.`
144
+ );
145
+ }
146
+ return {
147
+ connections: unmarshalArrayOfObject(
148
+ data.connections,
149
+ unmarshalDedicatedConnection
150
+ ),
151
+ totalCount: data.total_count
152
+ };
153
+ };
154
+ const unmarshalListLinksResponse = (data) => {
155
+ if (!isJSONObject(data)) {
156
+ throw new TypeError(
157
+ `Unmarshalling the type 'ListLinksResponse' failed as data isn't a dictionary.`
158
+ );
159
+ }
160
+ return {
161
+ links: unmarshalArrayOfObject(data.links, unmarshalLink),
162
+ totalCount: data.total_count
163
+ };
164
+ };
165
+ const unmarshalListPartnersResponse = (data) => {
166
+ if (!isJSONObject(data)) {
167
+ throw new TypeError(
168
+ `Unmarshalling the type 'ListPartnersResponse' failed as data isn't a dictionary.`
169
+ );
170
+ }
171
+ return {
172
+ partners: unmarshalArrayOfObject(data.partners, unmarshalPartner),
173
+ totalCount: data.total_count
174
+ };
175
+ };
176
+ const unmarshalListPopsResponse = (data) => {
177
+ if (!isJSONObject(data)) {
178
+ throw new TypeError(
179
+ `Unmarshalling the type 'ListPopsResponse' failed as data isn't a dictionary.`
180
+ );
181
+ }
182
+ return {
183
+ pops: unmarshalArrayOfObject(data.pops, unmarshalPop),
184
+ totalCount: data.total_count
185
+ };
186
+ };
187
+ const unmarshalListRoutingPoliciesResponse = (data) => {
188
+ if (!isJSONObject(data)) {
189
+ throw new TypeError(
190
+ `Unmarshalling the type 'ListRoutingPoliciesResponse' failed as data isn't a dictionary.`
191
+ );
192
+ }
193
+ return {
194
+ routingPolicies: unmarshalArrayOfObject(
195
+ data.routing_policies,
196
+ unmarshalRoutingPolicy
197
+ ),
198
+ totalCount: data.total_count
199
+ };
200
+ };
201
+ const marshalAttachRoutingPolicyRequest = (request, defaults) => ({
202
+ routing_policy_id: request.routingPolicyId
203
+ });
204
+ const marshalAttachVpcRequest = (request, defaults) => ({
205
+ vpc_id: request.vpcId
206
+ });
207
+ const marshalCreateLinkRequest = (request, defaults) => ({
208
+ bandwidth_mbps: request.bandwidthMbps,
209
+ name: request.name,
210
+ peer_asn: request.peerAsn,
211
+ pop_id: request.popId,
212
+ project_id: request.projectId ?? defaults.defaultProjectId,
213
+ tags: request.tags,
214
+ ...resolveOneOf([
215
+ { param: "connection_id", value: request.connectionId },
216
+ { param: "partner_id", value: request.partnerId }
217
+ ])
218
+ });
219
+ const marshalCreateRoutingPolicyRequest = (request, defaults) => ({
220
+ name: request.name,
221
+ prefix_filter_in: request.prefixFilterIn,
222
+ prefix_filter_out: request.prefixFilterOut,
223
+ project_id: request.projectId ?? defaults.defaultProjectId,
224
+ tags: request.tags
225
+ });
226
+ const marshalUpdateLinkRequest = (request, defaults) => ({
227
+ name: request.name,
228
+ peer_asn: request.peerAsn,
229
+ tags: request.tags
230
+ });
231
+ const marshalUpdateRoutingPolicyRequest = (request, defaults) => ({
232
+ name: request.name,
233
+ prefix_filter_in: request.prefixFilterIn,
234
+ prefix_filter_out: request.prefixFilterOut,
235
+ tags: request.tags
236
+ });
237
+ export {
238
+ marshalAttachRoutingPolicyRequest,
239
+ marshalAttachVpcRequest,
240
+ marshalCreateLinkRequest,
241
+ marshalCreateRoutingPolicyRequest,
242
+ marshalUpdateLinkRequest,
243
+ marshalUpdateRoutingPolicyRequest,
244
+ unmarshalDedicatedConnection,
245
+ unmarshalLink,
246
+ unmarshalListDedicatedConnectionsResponse,
247
+ unmarshalListLinksResponse,
248
+ unmarshalListPartnersResponse,
249
+ unmarshalListPopsResponse,
250
+ unmarshalListRoutingPoliciesResponse,
251
+ unmarshalPartner,
252
+ unmarshalPop,
253
+ unmarshalRoutingPolicy
254
+ };