@scaleway/sdk-ipam 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.
package/LICENSE ADDED
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ https://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2019 Scaleway.
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ https://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index_gen = require("./v1/index.gen.cjs");
4
+ exports.Ipamv1 = index_gen;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file is automatically generated
3
+ * PLEASE DO NOT EDIT HERE
4
+ */
5
+ export * as Ipamv1 from './v1/index.gen';
@@ -0,0 +1,4 @@
1
+ import * as index_gen from "./v1/index.gen.js";
2
+ export {
3
+ index_gen as Ipamv1
4
+ };
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sdkClient = require("@scaleway/sdk-client");
4
+ const marshalling_gen = require("./marshalling.gen.cjs");
5
+ const jsonContentHeaders = {
6
+ "Content-Type": "application/json; charset=utf-8"
7
+ };
8
+ class API extends sdkClient.API {
9
+ /** Lists the available regions of the API. */
10
+ static LOCALITIES = [
11
+ "fr-par",
12
+ "nl-ams",
13
+ "pl-waw"
14
+ ];
15
+ /**
16
+ * Reserve a new IP. Reserve a new IP from the specified source. Currently IPs can only be reserved from a Private Network.
17
+ *
18
+ * @param request - The request {@link BookIPRequest}
19
+ * @returns A Promise of IP
20
+ */
21
+ bookIP = (request) => this.client.fetch(
22
+ {
23
+ body: JSON.stringify(
24
+ marshalling_gen.marshalBookIPRequest(request, this.client.settings)
25
+ ),
26
+ headers: jsonContentHeaders,
27
+ method: "POST",
28
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips`
29
+ },
30
+ marshalling_gen.unmarshalIP
31
+ );
32
+ /**
33
+ * Release an IP. Release an IP not currently attached to a resource, and returns it to the available IP pool.
34
+ *
35
+ * @param request - The request {@link ReleaseIPRequest}
36
+ */
37
+ releaseIP = (request) => this.client.fetch({
38
+ body: "{}",
39
+ headers: jsonContentHeaders,
40
+ method: "DELETE",
41
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}`
42
+ });
43
+ releaseIPSet = (request = {}) => this.client.fetch({
44
+ body: JSON.stringify(
45
+ marshalling_gen.marshalReleaseIPSetRequest(request, this.client.settings)
46
+ ),
47
+ headers: jsonContentHeaders,
48
+ method: "POST",
49
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ip-sets/release`
50
+ });
51
+ /**
52
+ * Get an IP. Retrieve details of an existing IP, specified by its IP ID.
53
+ *
54
+ * @param request - The request {@link GetIPRequest}
55
+ * @returns A Promise of IP
56
+ */
57
+ getIP = (request) => this.client.fetch(
58
+ {
59
+ method: "GET",
60
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}`
61
+ },
62
+ marshalling_gen.unmarshalIP
63
+ );
64
+ /**
65
+ * Update an IP. Update parameters including tags of the specified IP.
66
+ *
67
+ * @param request - The request {@link UpdateIPRequest}
68
+ * @returns A Promise of IP
69
+ */
70
+ updateIP = (request) => this.client.fetch(
71
+ {
72
+ body: JSON.stringify(
73
+ marshalling_gen.marshalUpdateIPRequest(request, this.client.settings)
74
+ ),
75
+ headers: jsonContentHeaders,
76
+ method: "PATCH",
77
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}`
78
+ },
79
+ marshalling_gen.unmarshalIP
80
+ );
81
+ pageOfListIPs = (request = {}) => this.client.fetch(
82
+ {
83
+ method: "GET",
84
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips`,
85
+ urlParams: sdkClient.urlParams(
86
+ ["attached", request.attached],
87
+ ["ip_ids", request.ipIds],
88
+ ["is_ipv6", request.isIpv6],
89
+ ["mac_address", request.macAddress],
90
+ ["order_by", request.orderBy],
91
+ ["organization_id", request.organizationId],
92
+ ["page", request.page],
93
+ [
94
+ "page_size",
95
+ request.pageSize ?? this.client.settings.defaultPageSize
96
+ ],
97
+ ["project_id", request.projectId],
98
+ ["resource_id", request.resourceId],
99
+ ["resource_ids", request.resourceIds],
100
+ ["resource_name", request.resourceName],
101
+ ["resource_type", request.resourceType],
102
+ ["resource_types", request.resourceTypes],
103
+ ["tags", request.tags],
104
+ ["vpc_id", request.vpcId],
105
+ ...Object.entries(
106
+ sdkClient.resolveOneOf([
107
+ { param: "zonal", value: request.zonal },
108
+ { param: "private_network_id", value: request.privateNetworkId },
109
+ { param: "subnet_id", value: request.subnetId }
110
+ ])
111
+ )
112
+ )
113
+ },
114
+ marshalling_gen.unmarshalListIPsResponse
115
+ );
116
+ /**
117
+ * List existing IPs. List existing IPs in the specified region using various filters. For example, you can filter for IPs within a specified Private Network, or for public IPs within a specified Project. By default, the IPs returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.
118
+ *
119
+ * @param request - The request {@link ListIPsRequest}
120
+ * @returns A Promise of ListIPsResponse
121
+ */
122
+ listIPs = (request = {}) => sdkClient.enrichForPagination("ips", this.pageOfListIPs, request);
123
+ /**
124
+ * Attach IP to custom resource. Attach an existing reserved IP from a Private Network subnet to a custom, named resource via its MAC address. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for attaching IP addresses to standard Scaleway resources as it will fail - see the relevant product API for an equivalent method.
125
+ *
126
+ * @param request - The request {@link AttachIPRequest}
127
+ * @returns A Promise of IP
128
+ */
129
+ attachIP = (request) => this.client.fetch(
130
+ {
131
+ body: JSON.stringify(
132
+ marshalling_gen.marshalAttachIPRequest(request, this.client.settings)
133
+ ),
134
+ headers: jsonContentHeaders,
135
+ method: "POST",
136
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}/attach`
137
+ },
138
+ marshalling_gen.unmarshalIP
139
+ );
140
+ /**
141
+ * Detach IP from a custom resource. Detach a private IP from a custom resource. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for detaching IP addresses from standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method.
142
+ *
143
+ * @param request - The request {@link DetachIPRequest}
144
+ * @returns A Promise of IP
145
+ */
146
+ detachIP = (request) => this.client.fetch(
147
+ {
148
+ body: JSON.stringify(
149
+ marshalling_gen.marshalDetachIPRequest(request, this.client.settings)
150
+ ),
151
+ headers: jsonContentHeaders,
152
+ method: "POST",
153
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}/detach`
154
+ },
155
+ marshalling_gen.unmarshalIP
156
+ );
157
+ /**
158
+ * Move IP to a custom resource. Move an existing reserved private IP from one custom resource (e.g. a virtual machine hosted on an Elastic Metal server) to another custom resource. This will detach it from the first resource, and attach it to the second. Do not use this method for moving IP addresses between standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method.
159
+ *
160
+ * @param request - The request {@link MoveIPRequest}
161
+ * @returns A Promise of IP
162
+ */
163
+ moveIP = (request) => this.client.fetch(
164
+ {
165
+ body: JSON.stringify(
166
+ marshalling_gen.marshalMoveIPRequest(request, this.client.settings)
167
+ ),
168
+ headers: jsonContentHeaders,
169
+ method: "POST",
170
+ path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}/move`
171
+ },
172
+ marshalling_gen.unmarshalIP
173
+ );
174
+ }
175
+ exports.API = API;
@@ -0,0 +1,72 @@
1
+ import { API as ParentAPI } from '@scaleway/sdk-client';
2
+ import type { Region as ScwRegion } from '@scaleway/sdk-client';
3
+ import type { AttachIPRequest, BookIPRequest, DetachIPRequest, GetIPRequest, IP, ListIPsRequest, ListIPsResponse, MoveIPRequest, ReleaseIPRequest, ReleaseIPSetRequest, UpdateIPRequest } from './types.gen';
4
+ /**
5
+ * IPAM API.
6
+
7
+ This API allows you to manage your Scaleway IP addresses with our IP Address Management tool.
8
+ */
9
+ export declare class API extends ParentAPI {
10
+ /** Lists the available regions of the API. */
11
+ static readonly LOCALITIES: ScwRegion[];
12
+ /**
13
+ * Reserve a new IP. Reserve a new IP from the specified source. Currently IPs can only be reserved from a Private Network.
14
+ *
15
+ * @param request - The request {@link BookIPRequest}
16
+ * @returns A Promise of IP
17
+ */
18
+ bookIP: (request: Readonly<BookIPRequest>) => Promise<IP>;
19
+ /**
20
+ * Release an IP. Release an IP not currently attached to a resource, and returns it to the available IP pool.
21
+ *
22
+ * @param request - The request {@link ReleaseIPRequest}
23
+ */
24
+ releaseIP: (request: Readonly<ReleaseIPRequest>) => Promise<void>;
25
+ releaseIPSet: (request?: Readonly<ReleaseIPSetRequest>) => Promise<void>;
26
+ /**
27
+ * Get an IP. Retrieve details of an existing IP, specified by its IP ID.
28
+ *
29
+ * @param request - The request {@link GetIPRequest}
30
+ * @returns A Promise of IP
31
+ */
32
+ getIP: (request: Readonly<GetIPRequest>) => Promise<IP>;
33
+ /**
34
+ * Update an IP. Update parameters including tags of the specified IP.
35
+ *
36
+ * @param request - The request {@link UpdateIPRequest}
37
+ * @returns A Promise of IP
38
+ */
39
+ updateIP: (request: Readonly<UpdateIPRequest>) => Promise<IP>;
40
+ protected pageOfListIPs: (request?: Readonly<ListIPsRequest>) => Promise<ListIPsResponse>;
41
+ /**
42
+ * List existing IPs. List existing IPs in the specified region using various filters. For example, you can filter for IPs within a specified Private Network, or for public IPs within a specified Project. By default, the IPs returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.
43
+ *
44
+ * @param request - The request {@link ListIPsRequest}
45
+ * @returns A Promise of ListIPsResponse
46
+ */
47
+ listIPs: (request?: Readonly<ListIPsRequest>) => Promise<ListIPsResponse> & {
48
+ all: () => Promise<IP[]>;
49
+ [Symbol.asyncIterator]: () => AsyncGenerator<IP[], void, void>;
50
+ };
51
+ /**
52
+ * Attach IP to custom resource. Attach an existing reserved IP from a Private Network subnet to a custom, named resource via its MAC address. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for attaching IP addresses to standard Scaleway resources as it will fail - see the relevant product API for an equivalent method.
53
+ *
54
+ * @param request - The request {@link AttachIPRequest}
55
+ * @returns A Promise of IP
56
+ */
57
+ attachIP: (request: Readonly<AttachIPRequest>) => Promise<IP>;
58
+ /**
59
+ * Detach IP from a custom resource. Detach a private IP from a custom resource. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for detaching IP addresses from standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method.
60
+ *
61
+ * @param request - The request {@link DetachIPRequest}
62
+ * @returns A Promise of IP
63
+ */
64
+ detachIP: (request: Readonly<DetachIPRequest>) => Promise<IP>;
65
+ /**
66
+ * Move IP to a custom resource. Move an existing reserved private IP from one custom resource (e.g. a virtual machine hosted on an Elastic Metal server) to another custom resource. This will detach it from the first resource, and attach it to the second. Do not use this method for moving IP addresses between standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method.
67
+ *
68
+ * @param request - The request {@link MoveIPRequest}
69
+ * @returns A Promise of IP
70
+ */
71
+ moveIP: (request: Readonly<MoveIPRequest>) => Promise<IP>;
72
+ }
@@ -0,0 +1,175 @@
1
+ import { API as API$1, validatePathParam, urlParams, resolveOneOf, enrichForPagination } from "@scaleway/sdk-client";
2
+ import { marshalBookIPRequest, unmarshalIP, marshalReleaseIPSetRequest, marshalUpdateIPRequest, unmarshalListIPsResponse, marshalAttachIPRequest, marshalDetachIPRequest, marshalMoveIPRequest } from "./marshalling.gen.js";
3
+ const jsonContentHeaders = {
4
+ "Content-Type": "application/json; charset=utf-8"
5
+ };
6
+ class API extends API$1 {
7
+ /** Lists the available regions of the API. */
8
+ static LOCALITIES = [
9
+ "fr-par",
10
+ "nl-ams",
11
+ "pl-waw"
12
+ ];
13
+ /**
14
+ * Reserve a new IP. Reserve a new IP from the specified source. Currently IPs can only be reserved from a Private Network.
15
+ *
16
+ * @param request - The request {@link BookIPRequest}
17
+ * @returns A Promise of IP
18
+ */
19
+ bookIP = (request) => this.client.fetch(
20
+ {
21
+ body: JSON.stringify(
22
+ marshalBookIPRequest(request, this.client.settings)
23
+ ),
24
+ headers: jsonContentHeaders,
25
+ method: "POST",
26
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips`
27
+ },
28
+ unmarshalIP
29
+ );
30
+ /**
31
+ * Release an IP. Release an IP not currently attached to a resource, and returns it to the available IP pool.
32
+ *
33
+ * @param request - The request {@link ReleaseIPRequest}
34
+ */
35
+ releaseIP = (request) => this.client.fetch({
36
+ body: "{}",
37
+ headers: jsonContentHeaders,
38
+ method: "DELETE",
39
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}`
40
+ });
41
+ releaseIPSet = (request = {}) => this.client.fetch({
42
+ body: JSON.stringify(
43
+ marshalReleaseIPSetRequest(request, this.client.settings)
44
+ ),
45
+ headers: jsonContentHeaders,
46
+ method: "POST",
47
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ip-sets/release`
48
+ });
49
+ /**
50
+ * Get an IP. Retrieve details of an existing IP, specified by its IP ID.
51
+ *
52
+ * @param request - The request {@link GetIPRequest}
53
+ * @returns A Promise of IP
54
+ */
55
+ getIP = (request) => this.client.fetch(
56
+ {
57
+ method: "GET",
58
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}`
59
+ },
60
+ unmarshalIP
61
+ );
62
+ /**
63
+ * Update an IP. Update parameters including tags of the specified IP.
64
+ *
65
+ * @param request - The request {@link UpdateIPRequest}
66
+ * @returns A Promise of IP
67
+ */
68
+ updateIP = (request) => this.client.fetch(
69
+ {
70
+ body: JSON.stringify(
71
+ marshalUpdateIPRequest(request, this.client.settings)
72
+ ),
73
+ headers: jsonContentHeaders,
74
+ method: "PATCH",
75
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}`
76
+ },
77
+ unmarshalIP
78
+ );
79
+ pageOfListIPs = (request = {}) => this.client.fetch(
80
+ {
81
+ method: "GET",
82
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips`,
83
+ urlParams: urlParams(
84
+ ["attached", request.attached],
85
+ ["ip_ids", request.ipIds],
86
+ ["is_ipv6", request.isIpv6],
87
+ ["mac_address", request.macAddress],
88
+ ["order_by", request.orderBy],
89
+ ["organization_id", request.organizationId],
90
+ ["page", request.page],
91
+ [
92
+ "page_size",
93
+ request.pageSize ?? this.client.settings.defaultPageSize
94
+ ],
95
+ ["project_id", request.projectId],
96
+ ["resource_id", request.resourceId],
97
+ ["resource_ids", request.resourceIds],
98
+ ["resource_name", request.resourceName],
99
+ ["resource_type", request.resourceType],
100
+ ["resource_types", request.resourceTypes],
101
+ ["tags", request.tags],
102
+ ["vpc_id", request.vpcId],
103
+ ...Object.entries(
104
+ resolveOneOf([
105
+ { param: "zonal", value: request.zonal },
106
+ { param: "private_network_id", value: request.privateNetworkId },
107
+ { param: "subnet_id", value: request.subnetId }
108
+ ])
109
+ )
110
+ )
111
+ },
112
+ unmarshalListIPsResponse
113
+ );
114
+ /**
115
+ * List existing IPs. List existing IPs in the specified region using various filters. For example, you can filter for IPs within a specified Private Network, or for public IPs within a specified Project. By default, the IPs returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.
116
+ *
117
+ * @param request - The request {@link ListIPsRequest}
118
+ * @returns A Promise of ListIPsResponse
119
+ */
120
+ listIPs = (request = {}) => enrichForPagination("ips", this.pageOfListIPs, request);
121
+ /**
122
+ * Attach IP to custom resource. Attach an existing reserved IP from a Private Network subnet to a custom, named resource via its MAC address. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for attaching IP addresses to standard Scaleway resources as it will fail - see the relevant product API for an equivalent method.
123
+ *
124
+ * @param request - The request {@link AttachIPRequest}
125
+ * @returns A Promise of IP
126
+ */
127
+ attachIP = (request) => this.client.fetch(
128
+ {
129
+ body: JSON.stringify(
130
+ marshalAttachIPRequest(request, this.client.settings)
131
+ ),
132
+ headers: jsonContentHeaders,
133
+ method: "POST",
134
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}/attach`
135
+ },
136
+ unmarshalIP
137
+ );
138
+ /**
139
+ * Detach IP from a custom resource. Detach a private IP from a custom resource. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for detaching IP addresses from standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method.
140
+ *
141
+ * @param request - The request {@link DetachIPRequest}
142
+ * @returns A Promise of IP
143
+ */
144
+ detachIP = (request) => this.client.fetch(
145
+ {
146
+ body: JSON.stringify(
147
+ marshalDetachIPRequest(request, this.client.settings)
148
+ ),
149
+ headers: jsonContentHeaders,
150
+ method: "POST",
151
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}/detach`
152
+ },
153
+ unmarshalIP
154
+ );
155
+ /**
156
+ * Move IP to a custom resource. Move an existing reserved private IP from one custom resource (e.g. a virtual machine hosted on an Elastic Metal server) to another custom resource. This will detach it from the first resource, and attach it to the second. Do not use this method for moving IP addresses between standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method.
157
+ *
158
+ * @param request - The request {@link MoveIPRequest}
159
+ * @returns A Promise of IP
160
+ */
161
+ moveIP = (request) => this.client.fetch(
162
+ {
163
+ body: JSON.stringify(
164
+ marshalMoveIPRequest(request, this.client.settings)
165
+ ),
166
+ headers: jsonContentHeaders,
167
+ method: "POST",
168
+ path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}/move`
169
+ },
170
+ unmarshalIP
171
+ );
172
+ }
173
+ export {
174
+ API
175
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const api_gen = require("./api.gen.cjs");
4
+ const marshalling_gen = require("./marshalling.gen.cjs");
5
+ const validationRules_gen = require("./validation-rules.gen.cjs");
6
+ exports.API = api_gen.API;
7
+ exports.marshalAttachIPRequest = marshalling_gen.marshalAttachIPRequest;
8
+ exports.marshalBookIPRequest = marshalling_gen.marshalBookIPRequest;
9
+ exports.marshalDetachIPRequest = marshalling_gen.marshalDetachIPRequest;
10
+ exports.marshalMoveIPRequest = marshalling_gen.marshalMoveIPRequest;
11
+ exports.marshalReleaseIPSetRequest = marshalling_gen.marshalReleaseIPSetRequest;
12
+ exports.marshalUpdateIPRequest = marshalling_gen.marshalUpdateIPRequest;
13
+ exports.unmarshalIP = marshalling_gen.unmarshalIP;
14
+ exports.unmarshalListIPsResponse = marshalling_gen.unmarshalListIPsResponse;
15
+ exports.ValidationRules = validationRules_gen;
@@ -0,0 +1,4 @@
1
+ export { API } from './api.gen';
2
+ export * from './marshalling.gen';
3
+ export type { AttachIPRequest, BookIPRequest, CustomResource, DetachIPRequest, GetIPRequest, IP, ListIPsRequest, ListIPsRequestOrderBy, ListIPsResponse, MoveIPRequest, ReleaseIPRequest, ReleaseIPSetRequest, Resource, ResourceType, Reverse, Source, UpdateIPRequest, } from './types.gen';
4
+ export * as ValidationRules from './validation-rules.gen';
@@ -0,0 +1,15 @@
1
+ import { API } from "./api.gen.js";
2
+ import { marshalAttachIPRequest, marshalBookIPRequest, marshalDetachIPRequest, marshalMoveIPRequest, marshalReleaseIPSetRequest, marshalUpdateIPRequest, unmarshalIP, unmarshalListIPsResponse } from "./marshalling.gen.js";
3
+ import * as validationRules_gen from "./validation-rules.gen.js";
4
+ export {
5
+ API,
6
+ validationRules_gen as ValidationRules,
7
+ marshalAttachIPRequest,
8
+ marshalBookIPRequest,
9
+ marshalDetachIPRequest,
10
+ marshalMoveIPRequest,
11
+ marshalReleaseIPSetRequest,
12
+ marshalUpdateIPRequest,
13
+ unmarshalIP,
14
+ unmarshalListIPsResponse
15
+ };
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sdkClient = require("@scaleway/sdk-client");
4
+ const unmarshalResource = (data) => {
5
+ if (!sdkClient.isJSONObject(data)) {
6
+ throw new TypeError(
7
+ `Unmarshalling the type 'Resource' failed as data isn't a dictionary.`
8
+ );
9
+ }
10
+ return {
11
+ id: data.id,
12
+ macAddress: data.mac_address,
13
+ name: data.name,
14
+ type: data.type
15
+ };
16
+ };
17
+ const unmarshalReverse = (data) => {
18
+ if (!sdkClient.isJSONObject(data)) {
19
+ throw new TypeError(
20
+ `Unmarshalling the type 'Reverse' failed as data isn't a dictionary.`
21
+ );
22
+ }
23
+ return {
24
+ address: data.address,
25
+ hostname: data.hostname
26
+ };
27
+ };
28
+ const unmarshalSource = (data) => {
29
+ if (!sdkClient.isJSONObject(data)) {
30
+ throw new TypeError(
31
+ `Unmarshalling the type 'Source' failed as data isn't a dictionary.`
32
+ );
33
+ }
34
+ return {
35
+ privateNetworkId: data.private_network_id,
36
+ subnetId: data.subnet_id,
37
+ zonal: data.zonal
38
+ };
39
+ };
40
+ const unmarshalIP = (data) => {
41
+ if (!sdkClient.isJSONObject(data)) {
42
+ throw new TypeError(
43
+ `Unmarshalling the type 'IP' failed as data isn't a dictionary.`
44
+ );
45
+ }
46
+ return {
47
+ address: data.address,
48
+ createdAt: sdkClient.unmarshalDate(data.created_at),
49
+ id: data.id,
50
+ isIpv6: data.is_ipv6,
51
+ projectId: data.project_id,
52
+ region: data.region,
53
+ resource: data.resource ? unmarshalResource(data.resource) : void 0,
54
+ reverses: sdkClient.unmarshalArrayOfObject(data.reverses, unmarshalReverse),
55
+ source: data.source ? unmarshalSource(data.source) : void 0,
56
+ tags: data.tags,
57
+ updatedAt: sdkClient.unmarshalDate(data.updated_at),
58
+ zone: data.zone
59
+ };
60
+ };
61
+ const unmarshalListIPsResponse = (data) => {
62
+ if (!sdkClient.isJSONObject(data)) {
63
+ throw new TypeError(
64
+ `Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`
65
+ );
66
+ }
67
+ return {
68
+ ips: sdkClient.unmarshalArrayOfObject(data.ips, unmarshalIP),
69
+ totalCount: data.total_count
70
+ };
71
+ };
72
+ const marshalCustomResource = (request, defaults) => ({
73
+ mac_address: request.macAddress,
74
+ name: request.name
75
+ });
76
+ const marshalAttachIPRequest = (request, defaults) => ({
77
+ resource: marshalCustomResource(request.resource)
78
+ });
79
+ const marshalSource = (request, defaults) => ({
80
+ ...sdkClient.resolveOneOf([
81
+ { param: "zonal", value: request.zonal },
82
+ { param: "private_network_id", value: request.privateNetworkId },
83
+ { param: "subnet_id", value: request.subnetId }
84
+ ])
85
+ });
86
+ const marshalBookIPRequest = (request, defaults) => ({
87
+ address: request.address,
88
+ is_ipv6: request.isIpv6,
89
+ project_id: request.projectId ?? defaults.defaultProjectId,
90
+ resource: request.resource !== void 0 ? marshalCustomResource(request.resource) : void 0,
91
+ source: marshalSource(request.source),
92
+ tags: request.tags
93
+ });
94
+ const marshalDetachIPRequest = (request, defaults) => ({
95
+ resource: marshalCustomResource(request.resource)
96
+ });
97
+ const marshalMoveIPRequest = (request, defaults) => ({
98
+ from_resource: marshalCustomResource(request.fromResource),
99
+ to_resource: request.toResource !== void 0 ? marshalCustomResource(request.toResource) : void 0
100
+ });
101
+ const marshalReleaseIPSetRequest = (request, defaults) => ({
102
+ ip_ids: request.ipIds
103
+ });
104
+ const marshalReverse = (request, defaults) => ({
105
+ address: request.address,
106
+ hostname: request.hostname
107
+ });
108
+ const marshalUpdateIPRequest = (request, defaults) => ({
109
+ reverses: request.reverses !== void 0 ? request.reverses.map((elt) => marshalReverse(elt)) : void 0,
110
+ tags: request.tags
111
+ });
112
+ exports.marshalAttachIPRequest = marshalAttachIPRequest;
113
+ exports.marshalBookIPRequest = marshalBookIPRequest;
114
+ exports.marshalDetachIPRequest = marshalDetachIPRequest;
115
+ exports.marshalMoveIPRequest = marshalMoveIPRequest;
116
+ exports.marshalReleaseIPSetRequest = marshalReleaseIPSetRequest;
117
+ exports.marshalUpdateIPRequest = marshalUpdateIPRequest;
118
+ exports.unmarshalIP = unmarshalIP;
119
+ exports.unmarshalListIPsResponse = unmarshalListIPsResponse;
@@ -0,0 +1,10 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { AttachIPRequest, BookIPRequest, DetachIPRequest, IP, ListIPsResponse, MoveIPRequest, ReleaseIPSetRequest, UpdateIPRequest } from './types.gen';
3
+ export declare const unmarshalIP: (data: unknown) => IP;
4
+ export declare const unmarshalListIPsResponse: (data: unknown) => ListIPsResponse;
5
+ export declare const marshalAttachIPRequest: (request: AttachIPRequest, defaults: DefaultValues) => Record<string, unknown>;
6
+ export declare const marshalBookIPRequest: (request: BookIPRequest, defaults: DefaultValues) => Record<string, unknown>;
7
+ export declare const marshalDetachIPRequest: (request: DetachIPRequest, defaults: DefaultValues) => Record<string, unknown>;
8
+ export declare const marshalMoveIPRequest: (request: MoveIPRequest, defaults: DefaultValues) => Record<string, unknown>;
9
+ export declare const marshalReleaseIPSetRequest: (request: ReleaseIPSetRequest, defaults: DefaultValues) => Record<string, unknown>;
10
+ export declare const marshalUpdateIPRequest: (request: UpdateIPRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,119 @@
1
+ import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
2
+ const unmarshalResource = (data) => {
3
+ if (!isJSONObject(data)) {
4
+ throw new TypeError(
5
+ `Unmarshalling the type 'Resource' failed as data isn't a dictionary.`
6
+ );
7
+ }
8
+ return {
9
+ id: data.id,
10
+ macAddress: data.mac_address,
11
+ name: data.name,
12
+ type: data.type
13
+ };
14
+ };
15
+ const unmarshalReverse = (data) => {
16
+ if (!isJSONObject(data)) {
17
+ throw new TypeError(
18
+ `Unmarshalling the type 'Reverse' failed as data isn't a dictionary.`
19
+ );
20
+ }
21
+ return {
22
+ address: data.address,
23
+ hostname: data.hostname
24
+ };
25
+ };
26
+ const unmarshalSource = (data) => {
27
+ if (!isJSONObject(data)) {
28
+ throw new TypeError(
29
+ `Unmarshalling the type 'Source' failed as data isn't a dictionary.`
30
+ );
31
+ }
32
+ return {
33
+ privateNetworkId: data.private_network_id,
34
+ subnetId: data.subnet_id,
35
+ zonal: data.zonal
36
+ };
37
+ };
38
+ const unmarshalIP = (data) => {
39
+ if (!isJSONObject(data)) {
40
+ throw new TypeError(
41
+ `Unmarshalling the type 'IP' failed as data isn't a dictionary.`
42
+ );
43
+ }
44
+ return {
45
+ address: data.address,
46
+ createdAt: unmarshalDate(data.created_at),
47
+ id: data.id,
48
+ isIpv6: data.is_ipv6,
49
+ projectId: data.project_id,
50
+ region: data.region,
51
+ resource: data.resource ? unmarshalResource(data.resource) : void 0,
52
+ reverses: unmarshalArrayOfObject(data.reverses, unmarshalReverse),
53
+ source: data.source ? unmarshalSource(data.source) : void 0,
54
+ tags: data.tags,
55
+ updatedAt: unmarshalDate(data.updated_at),
56
+ zone: data.zone
57
+ };
58
+ };
59
+ const unmarshalListIPsResponse = (data) => {
60
+ if (!isJSONObject(data)) {
61
+ throw new TypeError(
62
+ `Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`
63
+ );
64
+ }
65
+ return {
66
+ ips: unmarshalArrayOfObject(data.ips, unmarshalIP),
67
+ totalCount: data.total_count
68
+ };
69
+ };
70
+ const marshalCustomResource = (request, defaults) => ({
71
+ mac_address: request.macAddress,
72
+ name: request.name
73
+ });
74
+ const marshalAttachIPRequest = (request, defaults) => ({
75
+ resource: marshalCustomResource(request.resource)
76
+ });
77
+ const marshalSource = (request, defaults) => ({
78
+ ...resolveOneOf([
79
+ { param: "zonal", value: request.zonal },
80
+ { param: "private_network_id", value: request.privateNetworkId },
81
+ { param: "subnet_id", value: request.subnetId }
82
+ ])
83
+ });
84
+ const marshalBookIPRequest = (request, defaults) => ({
85
+ address: request.address,
86
+ is_ipv6: request.isIpv6,
87
+ project_id: request.projectId ?? defaults.defaultProjectId,
88
+ resource: request.resource !== void 0 ? marshalCustomResource(request.resource) : void 0,
89
+ source: marshalSource(request.source),
90
+ tags: request.tags
91
+ });
92
+ const marshalDetachIPRequest = (request, defaults) => ({
93
+ resource: marshalCustomResource(request.resource)
94
+ });
95
+ const marshalMoveIPRequest = (request, defaults) => ({
96
+ from_resource: marshalCustomResource(request.fromResource),
97
+ to_resource: request.toResource !== void 0 ? marshalCustomResource(request.toResource) : void 0
98
+ });
99
+ const marshalReleaseIPSetRequest = (request, defaults) => ({
100
+ ip_ids: request.ipIds
101
+ });
102
+ const marshalReverse = (request, defaults) => ({
103
+ address: request.address,
104
+ hostname: request.hostname
105
+ });
106
+ const marshalUpdateIPRequest = (request, defaults) => ({
107
+ reverses: request.reverses !== void 0 ? request.reverses.map((elt) => marshalReverse(elt)) : void 0,
108
+ tags: request.tags
109
+ });
110
+ export {
111
+ marshalAttachIPRequest,
112
+ marshalBookIPRequest,
113
+ marshalDetachIPRequest,
114
+ marshalMoveIPRequest,
115
+ marshalReleaseIPSetRequest,
116
+ marshalUpdateIPRequest,
117
+ unmarshalIP,
118
+ unmarshalListIPsResponse
119
+ };
@@ -0,0 +1,324 @@
1
+ import type { Region as ScwRegion, Zone as ScwZone } from '@scaleway/sdk-client';
2
+ export type ListIPsRequestOrderBy = 'created_at_desc' | 'created_at_asc' | 'updated_at_desc' | 'updated_at_asc' | 'attached_at_desc' | 'attached_at_asc';
3
+ export type ResourceType = 'unknown_type' | 'custom' | 'instance_server' | 'instance_ip' | 'instance_private_nic' | 'lb_server' | 'fip_ip' | 'vpc_gateway' | 'vpc_gateway_network' | 'k8s_node' | 'k8s_cluster' | 'rdb_instance' | 'redis_cluster' | 'baremetal_server' | 'baremetal_private_nic' | 'llm_deployment' | 'mgdb_instance' | 'apple_silicon_server' | 'apple_silicon_private_nic' | 'serverless_container' | 'serverless_function' | 'vpn_gateway';
4
+ export interface Resource {
5
+ /**
6
+ * Type of resource the IP is attached to.
7
+ */
8
+ type: ResourceType;
9
+ /**
10
+ * ID of the resource the IP is attached to.
11
+ */
12
+ id: string;
13
+ /**
14
+ * MAC of the resource the IP is attached to.
15
+ */
16
+ macAddress?: string;
17
+ /**
18
+ * When the IP is in a Private Network, then a DNS record is available to resolve the resource name to this IP.
19
+ */
20
+ name?: string;
21
+ }
22
+ export interface Reverse {
23
+ /**
24
+ * Reverse domain name.
25
+ */
26
+ hostname: string;
27
+ /**
28
+ * IP corresponding to the hostname.
29
+ */
30
+ address?: string;
31
+ }
32
+ export interface Source {
33
+ /**
34
+ * This source is global.
35
+ *
36
+ * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' could be set.
37
+ */
38
+ zonal?: string;
39
+ /**
40
+ * This source is specific.
41
+ *
42
+ * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' could be set.
43
+ */
44
+ privateNetworkId?: string;
45
+ /**
46
+ * This source is specific.
47
+ *
48
+ * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' could be set.
49
+ */
50
+ subnetId?: string;
51
+ }
52
+ export interface CustomResource {
53
+ /**
54
+ * MAC address of the custom resource.
55
+ */
56
+ macAddress: string;
57
+ /**
58
+ * When the resource is in a Private Network, a DNS record is available to resolve the resource name.
59
+ */
60
+ name?: string;
61
+ }
62
+ export interface IP {
63
+ /**
64
+ * IP ID.
65
+ */
66
+ id: string;
67
+ /**
68
+ * IPv4 or IPv6 address in CIDR notation.
69
+ */
70
+ address: string;
71
+ /**
72
+ * Scaleway Project the IP belongs to.
73
+ */
74
+ projectId: string;
75
+ /**
76
+ * Defines whether the IP is an IPv6 (false = IPv4).
77
+ */
78
+ isIpv6: boolean;
79
+ /**
80
+ * Date the IP was reserved.
81
+ */
82
+ createdAt?: Date;
83
+ /**
84
+ * Date the IP was last modified.
85
+ */
86
+ updatedAt?: Date;
87
+ /**
88
+ * Source pool where the IP was reserved in.
89
+ */
90
+ source?: Source;
91
+ /**
92
+ * Resource which the IP is attached to.
93
+ */
94
+ resource?: Resource;
95
+ /**
96
+ * Tags for the IP.
97
+ */
98
+ tags: string[];
99
+ /**
100
+ * Array of reverses associated with the IP.
101
+ */
102
+ reverses: Reverse[];
103
+ /**
104
+ * Region of the IP.
105
+ */
106
+ region: ScwRegion;
107
+ /**
108
+ * Zone of the IP, if zonal.
109
+ */
110
+ zone?: ScwZone;
111
+ }
112
+ export type AttachIPRequest = {
113
+ /**
114
+ * Region to target. If none is passed will use default region from the config.
115
+ */
116
+ region?: ScwRegion;
117
+ /**
118
+ * IP ID.
119
+ */
120
+ ipId: string;
121
+ /**
122
+ * Custom resource to be attached to the IP.
123
+ */
124
+ resource: CustomResource;
125
+ };
126
+ export type BookIPRequest = {
127
+ /**
128
+ * Region to target. If none is passed will use default region from the config.
129
+ */
130
+ region?: ScwRegion;
131
+ /**
132
+ * When creating an IP in a Private Network, the Project must match the Private Network's Project.
133
+ */
134
+ projectId?: string;
135
+ /**
136
+ * Source in which to reserve the IP. Not all sources are available for reservation.
137
+ */
138
+ source: Source;
139
+ /**
140
+ * Request an IPv6 instead of an IPv4.
141
+ */
142
+ isIpv6: boolean;
143
+ /**
144
+ * The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already reserved, then the call will fail.
145
+ */
146
+ address?: string;
147
+ /**
148
+ * Tags for the IP.
149
+ */
150
+ tags?: string[];
151
+ /**
152
+ * Custom resource to attach to the IP being reserved. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method.
153
+ */
154
+ resource?: CustomResource;
155
+ };
156
+ export type DetachIPRequest = {
157
+ /**
158
+ * Region to target. If none is passed will use default region from the config.
159
+ */
160
+ region?: ScwRegion;
161
+ /**
162
+ * IP ID.
163
+ */
164
+ ipId: string;
165
+ /**
166
+ * Custom resource currently attached to the IP.
167
+ */
168
+ resource: CustomResource;
169
+ };
170
+ export type GetIPRequest = {
171
+ /**
172
+ * Region to target. If none is passed will use default region from the config.
173
+ */
174
+ region?: ScwRegion;
175
+ /**
176
+ * IP ID.
177
+ */
178
+ ipId: string;
179
+ };
180
+ export type ListIPsRequest = {
181
+ /**
182
+ * Region to target. If none is passed will use default region from the config.
183
+ */
184
+ region?: ScwRegion;
185
+ /**
186
+ * Sort order of the returned IPs.
187
+ */
188
+ orderBy?: ListIPsRequestOrderBy;
189
+ /**
190
+ * Page number to return, from the paginated results.
191
+ */
192
+ page?: number;
193
+ /**
194
+ * Maximum number of IPs to return per page.
195
+ */
196
+ pageSize?: number;
197
+ /**
198
+ * Project ID to filter for. Only IPs belonging to this Project will be returned.
199
+ */
200
+ projectId?: string;
201
+ /**
202
+ * Zone to filter for. Only IPs that are zonal, and in this zone, will be returned.
203
+ *
204
+ * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' could be set.
205
+ */
206
+ zonal?: string;
207
+ /**
208
+ * Only IPs that are private, and in this Private Network, will be returned.
209
+ *
210
+ * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' could be set.
211
+ */
212
+ privateNetworkId?: string;
213
+ /**
214
+ * Only IPs inside this exact subnet will be returned.
215
+ *
216
+ * One-of ('source'): at most one of 'zonal', 'privateNetworkId', 'subnetId' could be set.
217
+ */
218
+ subnetId?: string;
219
+ /**
220
+ * Only IPs owned by resources in this VPC will be returned.
221
+ */
222
+ vpcId?: string;
223
+ /**
224
+ * Defines whether to filter only for IPs which are attached to a resource.
225
+ */
226
+ attached?: boolean;
227
+ /**
228
+ * Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
229
+ */
230
+ resourceName?: string;
231
+ /**
232
+ * Resource ID to filter for. Only IPs attached to this resource will be returned.
233
+ */
234
+ resourceId?: string;
235
+ /**
236
+ * Resource IDs to filter for. Only IPs attached to at least one of these resources will be returned.
237
+ */
238
+ resourceIds?: string[];
239
+ /**
240
+ * Resource type to filter for. Only IPs attached to this type of resource will be returned.
241
+ */
242
+ resourceType?: ResourceType;
243
+ /**
244
+ * Resource types to filter for. Only IPs attached to these types of resources will be returned.
245
+ */
246
+ resourceTypes?: ResourceType[];
247
+ /**
248
+ * MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned.
249
+ */
250
+ macAddress?: string;
251
+ /**
252
+ * Tags to filter for, only IPs with one or more matching tags will be returned.
253
+ */
254
+ tags?: string[];
255
+ /**
256
+ * Organization ID to filter for. Only IPs belonging to this Organization will be returned.
257
+ */
258
+ organizationId?: string;
259
+ /**
260
+ * Defines whether to filter only for IPv4s or IPv6s.
261
+ */
262
+ isIpv6?: boolean;
263
+ /**
264
+ * IP IDs to filter for. Only IPs with these UUIDs will be returned.
265
+ */
266
+ ipIds?: string[];
267
+ };
268
+ export interface ListIPsResponse {
269
+ totalCount: number;
270
+ ips: IP[];
271
+ }
272
+ export type MoveIPRequest = {
273
+ /**
274
+ * Region to target. If none is passed will use default region from the config.
275
+ */
276
+ region?: ScwRegion;
277
+ /**
278
+ * IP ID.
279
+ */
280
+ ipId: string;
281
+ /**
282
+ * Custom resource currently attached to the IP.
283
+ */
284
+ fromResource: CustomResource;
285
+ /**
286
+ * Custom resource to be attached to the IP.
287
+ */
288
+ toResource?: CustomResource;
289
+ };
290
+ export type ReleaseIPRequest = {
291
+ /**
292
+ * Region to target. If none is passed will use default region from the config.
293
+ */
294
+ region?: ScwRegion;
295
+ /**
296
+ * IP ID.
297
+ */
298
+ ipId: string;
299
+ };
300
+ export type ReleaseIPSetRequest = {
301
+ /**
302
+ * Region to target. If none is passed will use default region from the config.
303
+ */
304
+ region?: ScwRegion;
305
+ ipIds?: string[];
306
+ };
307
+ export type UpdateIPRequest = {
308
+ /**
309
+ * Region to target. If none is passed will use default region from the config.
310
+ */
311
+ region?: ScwRegion;
312
+ /**
313
+ * IP ID.
314
+ */
315
+ ipId: string;
316
+ /**
317
+ * Tags for the IP.
318
+ */
319
+ tags?: string[];
320
+ /**
321
+ * Array of reverse domain names associated with an IP in the subnet of the current IP.
322
+ */
323
+ reverses?: Reverse[];
324
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const ListIPsRequest = {
4
+ resourceName: {
5
+ maxLength: 63,
6
+ minLength: 2
7
+ }
8
+ };
9
+ exports.ListIPsRequest = ListIPsRequest;
@@ -0,0 +1,6 @@
1
+ export declare const ListIPsRequest: {
2
+ resourceName: {
3
+ maxLength: number;
4
+ minLength: number;
5
+ };
6
+ };
@@ -0,0 +1,9 @@
1
+ const ListIPsRequest = {
2
+ resourceName: {
3
+ maxLength: 63,
4
+ minLength: 2
5
+ }
6
+ };
7
+ export {
8
+ ListIPsRequest
9
+ };
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@scaleway/sdk-ipam",
3
+ "version": "1.0.1",
4
+ "description": "Scaleway SDK ipam",
5
+ "types": "dist/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "type": "module",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.gen.d.ts",
13
+ "import": "./dist/index.gen.js",
14
+ "require": "./dist/index.gen.cjs",
15
+ "default": "./dist/index.gen.js"
16
+ },
17
+ "./*": {
18
+ "types": "./dist/*/index.gen.d.ts",
19
+ "import": "./dist/*/index.gen.js",
20
+ "require": "./dist/*/index.gen.cjs",
21
+ "default": "./dist/*/index.gen.js"
22
+ }
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "directory": "packages_generated/ipam"
27
+ },
28
+ "engines": {
29
+ "node": ">=20.18.3"
30
+ },
31
+ "dependencies": {
32
+ "@scaleway/random-name": "5.1.1",
33
+ "@scaleway/sdk-std": "1.0.1"
34
+ },
35
+ "peerDependencies": {
36
+ "@scaleway/sdk-client": "^1.2.1"
37
+ },
38
+ "devDependencies": {
39
+ "@scaleway/sdk-client": "^1.2.1"
40
+ },
41
+ "bundledDependencies": [
42
+ "@scaleway/random-name"
43
+ ],
44
+ "scripts": {
45
+ "package:check": "pnpm publint",
46
+ "typecheck": "tsc --noEmit",
47
+ "type:generate": "tsc --declaration -p tsconfig.build.json",
48
+ "build": "vite build --config vite.config.ts && pnpm run type:generate",
49
+ "build:profile": "npx vite-bundle-visualizer -c vite.config.ts"
50
+ }
51
+ }