@scaleway/sdk 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,135 @@
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js';
2
+ import { isJSONObject } from '../../../helpers/json.js';
3
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
4
+
5
+ // This file was automatically generated. DO NOT EDIT.
6
+ // If you have any remark or suggestion do not hesitate to open an issue.
7
+ const unmarshalSubnet = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'Subnet' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ createdAt: unmarshalDate(data.created_at),
13
+ id: data.id,
14
+ subnet: data.subnet,
15
+ updatedAt: unmarshalDate(data.updated_at)
16
+ };
17
+ };
18
+ const unmarshalPrivateNetwork = data => {
19
+ if (!isJSONObject(data)) {
20
+ throw new TypeError(`Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`);
21
+ }
22
+ return {
23
+ createdAt: unmarshalDate(data.created_at),
24
+ id: data.id,
25
+ name: data.name,
26
+ organizationId: data.organization_id,
27
+ projectId: data.project_id,
28
+ region: data.region,
29
+ subnets: unmarshalArrayOfObject(data.subnets, unmarshalSubnet),
30
+ tags: data.tags,
31
+ updatedAt: unmarshalDate(data.updated_at),
32
+ vpcId: data.vpc_id
33
+ };
34
+ };
35
+ const unmarshalVPC = data => {
36
+ if (!isJSONObject(data)) {
37
+ throw new TypeError(`Unmarshalling the type 'VPC' failed as data isn't a dictionary.`);
38
+ }
39
+ return {
40
+ createdAt: unmarshalDate(data.created_at),
41
+ id: data.id,
42
+ isDefault: data.is_default,
43
+ name: data.name,
44
+ organizationId: data.organization_id,
45
+ projectId: data.project_id,
46
+ region: data.region,
47
+ tags: data.tags,
48
+ updatedAt: unmarshalDate(data.updated_at)
49
+ };
50
+ };
51
+ const unmarshalAddSubnetsResponse = data => {
52
+ if (!isJSONObject(data)) {
53
+ throw new TypeError(`Unmarshalling the type 'AddSubnetsResponse' failed as data isn't a dictionary.`);
54
+ }
55
+ return {
56
+ subnets: data.subnets
57
+ };
58
+ };
59
+ const unmarshalDeleteSubnetsResponse = data => {
60
+ if (!isJSONObject(data)) {
61
+ throw new TypeError(`Unmarshalling the type 'DeleteSubnetsResponse' failed as data isn't a dictionary.`);
62
+ }
63
+ return {
64
+ subnets: data.subnets
65
+ };
66
+ };
67
+ const unmarshalListPrivateNetworksResponse = data => {
68
+ if (!isJSONObject(data)) {
69
+ throw new TypeError(`Unmarshalling the type 'ListPrivateNetworksResponse' failed as data isn't a dictionary.`);
70
+ }
71
+ return {
72
+ privateNetworks: unmarshalArrayOfObject(data.private_networks, unmarshalPrivateNetwork),
73
+ totalCount: data.total_count
74
+ };
75
+ };
76
+ const unmarshalListVPCsResponse = data => {
77
+ if (!isJSONObject(data)) {
78
+ throw new TypeError(`Unmarshalling the type 'ListVPCsResponse' failed as data isn't a dictionary.`);
79
+ }
80
+ return {
81
+ totalCount: data.total_count,
82
+ vpcs: unmarshalArrayOfObject(data.vpcs, unmarshalVPC)
83
+ };
84
+ };
85
+ const unmarshalSetSubnetsResponse = data => {
86
+ if (!isJSONObject(data)) {
87
+ throw new TypeError(`Unmarshalling the type 'SetSubnetsResponse' failed as data isn't a dictionary.`);
88
+ }
89
+ return {
90
+ subnets: data.subnets
91
+ };
92
+ };
93
+ const marshalAddSubnetsRequest = (request, defaults) => ({
94
+ subnets: request.subnets
95
+ });
96
+ const marshalCreatePrivateNetworkRequest = (request, defaults) => ({
97
+ name: request.name || randomName('pn'),
98
+ project_id: request.projectId ?? defaults.defaultProjectId,
99
+ subnets: request.subnets,
100
+ tags: request.tags,
101
+ vpc_id: request.vpcId
102
+ });
103
+ const marshalCreateVPCRequest = (request, defaults) => ({
104
+ name: request.name || randomName('vpc'),
105
+ project_id: request.projectId ?? defaults.defaultProjectId,
106
+ tags: request.tags
107
+ });
108
+ const marshalDeleteSubnetsRequest = (request, defaults) => ({
109
+ subnets: request.subnets
110
+ });
111
+ const marshalMigrateZonalPrivateNetworksRequest = (request, defaults) => ({
112
+ private_network_ids: request.privateNetworkIds,
113
+ ...resolveOneOf([{
114
+ default: defaults.defaultProjectId,
115
+ param: 'project_id',
116
+ value: request.projectId
117
+ }, {
118
+ default: defaults.defaultOrganizationId,
119
+ param: 'organization_id',
120
+ value: request.organizationId
121
+ }])
122
+ });
123
+ const marshalSetSubnetsRequest = (request, defaults) => ({
124
+ subnets: request.subnets
125
+ });
126
+ const marshalUpdatePrivateNetworkRequest = (request, defaults) => ({
127
+ name: request.name,
128
+ tags: request.tags
129
+ });
130
+ const marshalUpdateVPCRequest = (request, defaults) => ({
131
+ name: request.name,
132
+ tags: request.tags
133
+ });
134
+
135
+ export { marshalAddSubnetsRequest, marshalCreatePrivateNetworkRequest, marshalCreateVPCRequest, marshalDeleteSubnetsRequest, marshalMigrateZonalPrivateNetworksRequest, marshalSetSubnetsRequest, marshalUpdatePrivateNetworkRequest, marshalUpdateVPCRequest, unmarshalAddSubnetsResponse, unmarshalDeleteSubnetsResponse, unmarshalListPrivateNetworksResponse, unmarshalListVPCsResponse, unmarshalPrivateNetwork, unmarshalSetSubnetsResponse, unmarshalVPC };