@scaleway/sdk-vpcgw 2.8.2 → 2.10.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,191 @@
1
+ import { isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
+ import randomName from "@scaleway/random-name";
3
+ //#region src/v2/marshalling.gen.ts
4
+ const unmarshalGatewayNetwork = (data) => {
5
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary.`);
6
+ return {
7
+ createdAt: unmarshalDate(data.created_at),
8
+ gatewayId: data.gateway_id,
9
+ id: data.id,
10
+ ipamIpId: data.ipam_ip_id,
11
+ macAddress: data.mac_address,
12
+ masqueradeEnabled: data.masquerade_enabled,
13
+ privateNetworkId: data.private_network_id,
14
+ pushDefaultRoute: data.push_default_route,
15
+ status: data.status,
16
+ updatedAt: unmarshalDate(data.updated_at),
17
+ zone: data.zone
18
+ };
19
+ };
20
+ const unmarshalIP = (data) => {
21
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'IP' failed as data isn't a dictionary.`);
22
+ return {
23
+ address: data.address,
24
+ createdAt: unmarshalDate(data.created_at),
25
+ gatewayId: data.gateway_id,
26
+ id: data.id,
27
+ organizationId: data.organization_id,
28
+ projectId: data.project_id,
29
+ reverse: data.reverse,
30
+ tags: data.tags,
31
+ updatedAt: unmarshalDate(data.updated_at),
32
+ zone: data.zone
33
+ };
34
+ };
35
+ const unmarshalGateway = (data) => {
36
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Gateway' failed as data isn't a dictionary.`);
37
+ return {
38
+ bandwidth: data.bandwidth,
39
+ bastionAllowedIps: data.bastion_allowed_ips,
40
+ bastionEnabled: data.bastion_enabled,
41
+ bastionPort: data.bastion_port,
42
+ canUpgradeTo: data.can_upgrade_to,
43
+ createdAt: unmarshalDate(data.created_at),
44
+ gatewayNetworks: unmarshalArrayOfObject(data.gateway_networks, unmarshalGatewayNetwork),
45
+ id: data.id,
46
+ ipv4: data.ipv4 ? unmarshalIP(data.ipv4) : void 0,
47
+ isLegacy: data.is_legacy,
48
+ name: data.name,
49
+ organizationId: data.organization_id,
50
+ projectId: data.project_id,
51
+ smtpEnabled: data.smtp_enabled,
52
+ status: data.status,
53
+ tags: data.tags,
54
+ type: data.type,
55
+ updatedAt: unmarshalDate(data.updated_at),
56
+ version: data.version,
57
+ zone: data.zone
58
+ };
59
+ };
60
+ const unmarshalPatRule = (data) => {
61
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PatRule' failed as data isn't a dictionary.`);
62
+ return {
63
+ createdAt: unmarshalDate(data.created_at),
64
+ gatewayId: data.gateway_id,
65
+ id: data.id,
66
+ privateIp: data.private_ip,
67
+ privatePort: data.private_port,
68
+ protocol: data.protocol,
69
+ publicPort: data.public_port,
70
+ updatedAt: unmarshalDate(data.updated_at),
71
+ zone: data.zone
72
+ };
73
+ };
74
+ const unmarshalAddBastionAllowedIPsResponse = (data) => {
75
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AddBastionAllowedIPsResponse' failed as data isn't a dictionary.`);
76
+ return { ipRanges: data.ip_ranges };
77
+ };
78
+ const unmarshalListGatewayNetworksResponse = (data) => {
79
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary.`);
80
+ return {
81
+ gatewayNetworks: unmarshalArrayOfObject(data.gateway_networks, unmarshalGatewayNetwork),
82
+ totalCount: data.total_count
83
+ };
84
+ };
85
+ const unmarshalGatewayType = (data) => {
86
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GatewayType' failed as data isn't a dictionary.`);
87
+ return {
88
+ bandwidth: data.bandwidth,
89
+ name: data.name,
90
+ zone: data.zone
91
+ };
92
+ };
93
+ const unmarshalListGatewayTypesResponse = (data) => {
94
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary.`);
95
+ return { types: unmarshalArrayOfObject(data.types, unmarshalGatewayType) };
96
+ };
97
+ const unmarshalListGatewaysResponse = (data) => {
98
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary.`);
99
+ return {
100
+ gateways: unmarshalArrayOfObject(data.gateways, unmarshalGateway),
101
+ totalCount: data.total_count
102
+ };
103
+ };
104
+ const unmarshalListIPsResponse = (data) => {
105
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`);
106
+ return {
107
+ ips: unmarshalArrayOfObject(data.ips, unmarshalIP),
108
+ totalCount: data.total_count
109
+ };
110
+ };
111
+ const unmarshalListPatRulesResponse = (data) => {
112
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListPatRulesResponse' failed as data isn't a dictionary.`);
113
+ return {
114
+ patRules: unmarshalArrayOfObject(data.pat_rules, unmarshalPatRule),
115
+ totalCount: data.total_count
116
+ };
117
+ };
118
+ const unmarshalSetBastionAllowedIPsResponse = (data) => {
119
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetBastionAllowedIPsResponse' failed as data isn't a dictionary.`);
120
+ return { ipRanges: data.ip_ranges };
121
+ };
122
+ const unmarshalSetPatRulesResponse = (data) => {
123
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetPatRulesResponse' failed as data isn't a dictionary.`);
124
+ return { patRules: unmarshalArrayOfObject(data.pat_rules, unmarshalPatRule) };
125
+ };
126
+ const marshalAddBastionAllowedIPsRequest = (request, defaults) => ({ ip_range: request.ipRange });
127
+ const marshalCreateGatewayNetworkRequest = (request, defaults) => ({
128
+ enable_masquerade: request.enableMasquerade,
129
+ gateway_id: request.gatewayId,
130
+ ipam_ip_id: request.ipamIpId,
131
+ private_network_id: request.privateNetworkId,
132
+ push_default_route: request.pushDefaultRoute
133
+ });
134
+ const marshalCreateGatewayRequest = (request, defaults) => ({
135
+ bastion_port: request.bastionPort,
136
+ enable_bastion: request.enableBastion,
137
+ enable_smtp: request.enableSmtp,
138
+ ip_id: request.ipId,
139
+ name: request.name || randomName("gw"),
140
+ project_id: request.projectId ?? defaults.defaultProjectId,
141
+ tags: request.tags,
142
+ type: request.type
143
+ });
144
+ const marshalCreateIPRequest = (request, defaults) => ({
145
+ project_id: request.projectId ?? defaults.defaultProjectId,
146
+ tags: request.tags
147
+ });
148
+ const marshalCreatePatRuleRequest = (request, defaults) => ({
149
+ gateway_id: request.gatewayId,
150
+ private_ip: request.privateIp,
151
+ private_port: request.privatePort,
152
+ protocol: request.protocol,
153
+ public_port: request.publicPort
154
+ });
155
+ const marshalSetBastionAllowedIPsRequest = (request, defaults) => ({ ip_ranges: request.ipRanges });
156
+ const marshalSetPatRulesRequestRule = (request, defaults) => ({
157
+ private_ip: request.privateIp,
158
+ private_port: request.privatePort,
159
+ protocol: request.protocol,
160
+ public_port: request.publicPort
161
+ });
162
+ const marshalSetPatRulesRequest = (request, defaults) => ({
163
+ gateway_id: request.gatewayId,
164
+ pat_rules: request.patRules.map((elt) => marshalSetPatRulesRequestRule(elt, defaults))
165
+ });
166
+ const marshalUpdateGatewayNetworkRequest = (request, defaults) => ({
167
+ enable_masquerade: request.enableMasquerade,
168
+ ipam_ip_id: request.ipamIpId,
169
+ push_default_route: request.pushDefaultRoute
170
+ });
171
+ const marshalUpdateGatewayRequest = (request, defaults) => ({
172
+ bastion_port: request.bastionPort,
173
+ enable_bastion: request.enableBastion,
174
+ enable_smtp: request.enableSmtp,
175
+ name: request.name,
176
+ tags: request.tags
177
+ });
178
+ const marshalUpdateIPRequest = (request, defaults) => ({
179
+ gateway_id: request.gatewayId,
180
+ reverse: request.reverse,
181
+ tags: request.tags
182
+ });
183
+ const marshalUpdatePatRuleRequest = (request, defaults) => ({
184
+ private_ip: request.privateIp,
185
+ private_port: request.privatePort,
186
+ protocol: request.protocol,
187
+ public_port: request.publicPort
188
+ });
189
+ const marshalUpgradeGatewayRequest = (request, defaults) => ({ type: request.type });
190
+ //#endregion
191
+ export { marshalAddBastionAllowedIPsRequest, marshalCreateGatewayNetworkRequest, marshalCreateGatewayRequest, marshalCreateIPRequest, marshalCreatePatRuleRequest, marshalSetBastionAllowedIPsRequest, marshalSetPatRulesRequest, marshalUpdateGatewayNetworkRequest, marshalUpdateGatewayRequest, marshalUpdateIPRequest, marshalUpdatePatRuleRequest, marshalUpgradeGatewayRequest, unmarshalAddBastionAllowedIPsResponse, unmarshalGateway, unmarshalGatewayNetwork, unmarshalIP, unmarshalListGatewayNetworksResponse, unmarshalListGatewayTypesResponse, unmarshalListGatewaysResponse, unmarshalListIPsResponse, unmarshalListPatRulesResponse, unmarshalPatRule, unmarshalSetBastionAllowedIPsResponse, unmarshalSetPatRulesResponse };
@@ -0,0 +1,101 @@
1
+ export declare const queriesMetadata: {
2
+ readonly namespace: 'vpcgw';
3
+ readonly version: 'v2';
4
+ readonly folderName: 'vpcgwv2';
5
+ readonly services: readonly [{
6
+ readonly apiClass: 'API';
7
+ readonly methods: readonly [{
8
+ readonly methodName: 'listGateways';
9
+ readonly protoName: 'ListGateways';
10
+ readonly paramsType: 'ListGatewaysRequest';
11
+ readonly returnType: 'ListGatewaysResponse';
12
+ readonly isList: true;
13
+ readonly paginationType: 'offset';
14
+ readonly pageParamKey: 'page';
15
+ readonly listItemType: 'Gateway';
16
+ readonly isPrivate: false;
17
+ readonly description: '"';
18
+ }, {
19
+ readonly methodName: 'getGateway';
20
+ readonly protoName: 'GetGateway';
21
+ readonly paramsType: 'GetGatewayRequest';
22
+ readonly returnType: 'Gateway';
23
+ readonly isList: false;
24
+ readonly paginationType: 'none';
25
+ readonly isPrivate: false;
26
+ readonly description: '"';
27
+ readonly hasWaiter: true;
28
+ }, {
29
+ readonly methodName: 'listGatewayNetworks';
30
+ readonly protoName: 'ListGatewayNetworks';
31
+ readonly paramsType: 'ListGatewayNetworksRequest';
32
+ readonly returnType: 'ListGatewayNetworksResponse';
33
+ readonly isList: true;
34
+ readonly paginationType: 'offset';
35
+ readonly pageParamKey: 'page';
36
+ readonly listItemType: 'GatewayNetwork';
37
+ readonly isPrivate: false;
38
+ readonly description: '"';
39
+ }, {
40
+ readonly methodName: 'getGatewayNetwork';
41
+ readonly protoName: 'GetGatewayNetwork';
42
+ readonly paramsType: 'GetGatewayNetworkRequest';
43
+ readonly returnType: 'GatewayNetwork';
44
+ readonly isList: false;
45
+ readonly paginationType: 'none';
46
+ readonly isPrivate: false;
47
+ readonly description: '"';
48
+ readonly hasWaiter: true;
49
+ }, {
50
+ readonly methodName: 'listPatRules';
51
+ readonly protoName: 'ListPatRules';
52
+ readonly paramsType: 'ListPatRulesRequest';
53
+ readonly returnType: 'ListPatRulesResponse';
54
+ readonly isList: true;
55
+ readonly paginationType: 'offset';
56
+ readonly pageParamKey: 'page';
57
+ readonly listItemType: 'PatRule';
58
+ readonly isPrivate: false;
59
+ readonly description: '"';
60
+ }, {
61
+ readonly methodName: 'getPatRule';
62
+ readonly protoName: 'GetPatRule';
63
+ readonly paramsType: 'GetPatRuleRequest';
64
+ readonly returnType: 'PatRule';
65
+ readonly isList: false;
66
+ readonly paginationType: 'none';
67
+ readonly isPrivate: false;
68
+ readonly description: '"';
69
+ }, {
70
+ readonly methodName: 'listGatewayTypes';
71
+ readonly protoName: 'ListGatewayTypes';
72
+ readonly paramsType: 'ListGatewayTypesRequest';
73
+ readonly returnType: 'ListGatewayTypesResponse';
74
+ readonly isList: false;
75
+ readonly paginationType: 'none';
76
+ readonly isPrivate: false;
77
+ readonly description: '"';
78
+ }, {
79
+ readonly methodName: 'listIPs';
80
+ readonly protoName: 'ListIPs';
81
+ readonly paramsType: 'ListIPsRequest';
82
+ readonly returnType: 'ListIPsResponse';
83
+ readonly isList: true;
84
+ readonly paginationType: 'offset';
85
+ readonly pageParamKey: 'page';
86
+ readonly listItemType: 'IP';
87
+ readonly isPrivate: false;
88
+ readonly description: '"';
89
+ }, {
90
+ readonly methodName: 'getIP';
91
+ readonly protoName: 'GetIP';
92
+ readonly paramsType: 'GetIPRequest';
93
+ readonly returnType: 'IP';
94
+ readonly isList: false;
95
+ readonly paginationType: 'none';
96
+ readonly isPrivate: false;
97
+ readonly description: '"';
98
+ }];
99
+ }];
100
+ };
101
+ export type QueriesMetadata = typeof queriesMetadata;
@@ -0,0 +1,113 @@
1
+ //#region src/v2/metadata.gen.ts
2
+ const queriesMetadata = {
3
+ namespace: "vpcgw",
4
+ version: "v2",
5
+ folderName: "vpcgwv2",
6
+ services: [{
7
+ apiClass: "API",
8
+ methods: [
9
+ {
10
+ methodName: "listGateways",
11
+ protoName: "ListGateways",
12
+ paramsType: "ListGatewaysRequest",
13
+ returnType: "ListGatewaysResponse",
14
+ isList: true,
15
+ paginationType: "offset",
16
+ pageParamKey: "page",
17
+ listItemType: "Gateway",
18
+ isPrivate: false,
19
+ description: "\""
20
+ },
21
+ {
22
+ methodName: "getGateway",
23
+ protoName: "GetGateway",
24
+ paramsType: "GetGatewayRequest",
25
+ returnType: "Gateway",
26
+ isList: false,
27
+ paginationType: "none",
28
+ isPrivate: false,
29
+ description: "\"",
30
+ hasWaiter: true
31
+ },
32
+ {
33
+ methodName: "listGatewayNetworks",
34
+ protoName: "ListGatewayNetworks",
35
+ paramsType: "ListGatewayNetworksRequest",
36
+ returnType: "ListGatewayNetworksResponse",
37
+ isList: true,
38
+ paginationType: "offset",
39
+ pageParamKey: "page",
40
+ listItemType: "GatewayNetwork",
41
+ isPrivate: false,
42
+ description: "\""
43
+ },
44
+ {
45
+ methodName: "getGatewayNetwork",
46
+ protoName: "GetGatewayNetwork",
47
+ paramsType: "GetGatewayNetworkRequest",
48
+ returnType: "GatewayNetwork",
49
+ isList: false,
50
+ paginationType: "none",
51
+ isPrivate: false,
52
+ description: "\"",
53
+ hasWaiter: true
54
+ },
55
+ {
56
+ methodName: "listPatRules",
57
+ protoName: "ListPatRules",
58
+ paramsType: "ListPatRulesRequest",
59
+ returnType: "ListPatRulesResponse",
60
+ isList: true,
61
+ paginationType: "offset",
62
+ pageParamKey: "page",
63
+ listItemType: "PatRule",
64
+ isPrivate: false,
65
+ description: "\""
66
+ },
67
+ {
68
+ methodName: "getPatRule",
69
+ protoName: "GetPatRule",
70
+ paramsType: "GetPatRuleRequest",
71
+ returnType: "PatRule",
72
+ isList: false,
73
+ paginationType: "none",
74
+ isPrivate: false,
75
+ description: "\""
76
+ },
77
+ {
78
+ methodName: "listGatewayTypes",
79
+ protoName: "ListGatewayTypes",
80
+ paramsType: "ListGatewayTypesRequest",
81
+ returnType: "ListGatewayTypesResponse",
82
+ isList: false,
83
+ paginationType: "none",
84
+ isPrivate: false,
85
+ description: "\""
86
+ },
87
+ {
88
+ methodName: "listIPs",
89
+ protoName: "ListIPs",
90
+ paramsType: "ListIPsRequest",
91
+ returnType: "ListIPsResponse",
92
+ isList: true,
93
+ paginationType: "offset",
94
+ pageParamKey: "page",
95
+ listItemType: "IP",
96
+ isPrivate: false,
97
+ description: "\""
98
+ },
99
+ {
100
+ methodName: "getIP",
101
+ protoName: "GetIP",
102
+ paramsType: "GetIPRequest",
103
+ returnType: "IP",
104
+ isList: false,
105
+ paginationType: "none",
106
+ isPrivate: false,
107
+ description: "\""
108
+ }
109
+ ]
110
+ }]
111
+ };
112
+ //#endregion
113
+ export { queriesMetadata };