@scaleway/sdk-ipam 1.5.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -0
- package/dist/v1/api.gen.d.ts +1 -1
- package/dist/v1/api.gen.js +42 -27
- package/dist/v1/index.gen.d.ts +1 -1
- package/dist/v1/marshalling.gen.js +16 -4
- package/dist/v1/types.gen.d.ts +1 -1
- package/package.json +6 -9
- package/dist/index.gen.cjs +0 -4
- package/dist/v1/api.gen.cjs +0 -177
- package/dist/v1/index.gen.cjs +0 -15
- package/dist/v1/marshalling.gen.cjs +0 -121
- package/dist/v1/validation-rules.gen.cjs +0 -9
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @scaleway/sdk-ipam
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@scaleway/sdk-ipam)
|
|
4
|
+
[](https://www.npmjs.com/package/@scaleway/sdk-ipam)
|
|
5
|
+
[](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
|
|
6
|
+
|
|
7
|
+
Scaleway SDK for Ipam API.
|
|
8
|
+
|
|
9
|
+
> **Note**
|
|
10
|
+
> This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @scaleway/sdk-ipam @scaleway/sdk-client
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or with pnpm:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add @scaleway/sdk-ipam @scaleway/sdk-client
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or with yarn:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add @scaleway/sdk-ipam @scaleway/sdk-client
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Getting Started
|
|
31
|
+
|
|
32
|
+
You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
|
|
33
|
+
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { createClient } from '@scaleway/sdk-client'
|
|
38
|
+
import { Ipam } from '@scaleway/sdk-ipam'
|
|
39
|
+
|
|
40
|
+
const client = createClient({
|
|
41
|
+
accessKey: 'SCWXXXXXXXXXXXXXXXXX',
|
|
42
|
+
secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
43
|
+
defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
44
|
+
defaultRegion: 'fr-par',
|
|
45
|
+
defaultZone: 'fr-par-1',
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const api = new Ipam.v1.API(client)
|
|
49
|
+
|
|
50
|
+
// Use the API
|
|
51
|
+
// Example: await api.listServers()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Using Configuration Loader
|
|
55
|
+
|
|
56
|
+
For a simpler setup, you can load credentials from the configuration file or environment variables:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createClient } from '@scaleway/sdk-client'
|
|
60
|
+
import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
|
|
61
|
+
import { Ipam } from '@scaleway/sdk-ipam'
|
|
62
|
+
|
|
63
|
+
const profile = loadProfileFromConfigurationFile()
|
|
64
|
+
const client = createClient(profile)
|
|
65
|
+
const api = new Ipam.v1.API(client)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
- 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
|
|
71
|
+
- 🌐 [Scaleway Ipam API Documentation](https://www.scaleway.com/en/developers/api/ipam/)
|
|
72
|
+
- 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
|
|
73
|
+
- 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- ✅ Full TypeScript support with complete type definitions
|
|
78
|
+
- ✅ Promise-based API
|
|
79
|
+
- ✅ Automatic pagination helpers
|
|
80
|
+
- ✅ Built-in error handling
|
|
81
|
+
- ✅ Compatible with Node.js ≥ 20
|
|
82
|
+
|
|
83
|
+
## Support
|
|
84
|
+
|
|
85
|
+
We love feedback! Feel free to reach us on:
|
|
86
|
+
- [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
|
|
87
|
+
- [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
|
|
96
|
+
|
package/dist/v1/api.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
1
|
import type { ApiLocality } from '@scaleway/sdk-client';
|
|
2
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
3
3
|
import type { AttachIPRequest, BookIPRequest, DetachIPRequest, GetIPRequest, IP, ListIPsRequest, ListIPsResponse, MoveIPRequest, ReleaseIPRequest, ReleaseIPSetRequest, UpdateIPRequest } from './types.gen.js';
|
|
4
4
|
/**
|
|
5
5
|
* IPAM API.
|
package/dist/v1/api.gen.js
CHANGED
|
@@ -9,7 +9,11 @@ class API extends API$1 {
|
|
|
9
9
|
* type ∈ {'zone','region','global','unspecified'}
|
|
10
10
|
*/
|
|
11
11
|
static LOCALITY = toApiLocality({
|
|
12
|
-
regions: [
|
|
12
|
+
regions: [
|
|
13
|
+
"fr-par",
|
|
14
|
+
"nl-ams",
|
|
15
|
+
"pl-waw"
|
|
16
|
+
]
|
|
13
17
|
});
|
|
14
18
|
/**
|
|
15
19
|
* Reserve a new IP. Reserve a new IP from the specified source. Currently IPs can only be reserved from a Private Network.
|
|
@@ -33,20 +37,24 @@ class API extends API$1 {
|
|
|
33
37
|
*
|
|
34
38
|
* @param request - The request {@link ReleaseIPRequest}
|
|
35
39
|
*/
|
|
36
|
-
releaseIP = (request) => this.client.fetch(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
releaseIP = (request) => this.client.fetch(
|
|
41
|
+
{
|
|
42
|
+
body: "{}",
|
|
43
|
+
headers: jsonContentHeaders,
|
|
44
|
+
method: "DELETE",
|
|
45
|
+
path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${validatePathParam("ipId", request.ipId)}`
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
releaseIPSet = (request = {}) => this.client.fetch(
|
|
49
|
+
{
|
|
50
|
+
body: JSON.stringify(
|
|
51
|
+
marshalReleaseIPSetRequest(request, this.client.settings)
|
|
52
|
+
),
|
|
53
|
+
headers: jsonContentHeaders,
|
|
54
|
+
method: "POST",
|
|
55
|
+
path: `/ipam/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ip-sets/release`
|
|
56
|
+
}
|
|
57
|
+
);
|
|
50
58
|
/**
|
|
51
59
|
* Get an IP. Retrieve details of an existing IP, specified by its IP ID.
|
|
52
60
|
*
|
|
@@ -89,10 +97,7 @@ class API extends API$1 {
|
|
|
89
97
|
["order_by", request.orderBy],
|
|
90
98
|
["organization_id", request.organizationId],
|
|
91
99
|
["page", request.page],
|
|
92
|
-
[
|
|
93
|
-
"page_size",
|
|
94
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
95
|
-
],
|
|
100
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
|
|
96
101
|
["project_id", request.projectId],
|
|
97
102
|
["resource_id", request.resourceId],
|
|
98
103
|
["resource_ids", request.resourceIds],
|
|
@@ -101,14 +106,24 @@ class API extends API$1 {
|
|
|
101
106
|
["resource_types", request.resourceTypes],
|
|
102
107
|
["tags", request.tags],
|
|
103
108
|
["vpc_id", request.vpcId],
|
|
104
|
-
...Object.entries(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
...Object.entries(resolveOneOf([
|
|
110
|
+
{
|
|
111
|
+
param: "zonal",
|
|
112
|
+
value: request.zonal
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
param: "private_network_id",
|
|
116
|
+
value: request.privateNetworkId
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
param: "subnet_id",
|
|
120
|
+
value: request.subnetId
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
param: "source_vpc_id",
|
|
124
|
+
value: request.sourceVpcId
|
|
125
|
+
}
|
|
126
|
+
]))
|
|
112
127
|
)
|
|
113
128
|
},
|
|
114
129
|
unmarshalListIPsResponse
|
package/dist/v1/index.gen.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { API } from './api.gen.js';
|
|
1
|
+
export { API, } from './api.gen.js';
|
|
2
2
|
export * from './marshalling.gen.js';
|
|
3
3
|
export type { AttachIPRequest, BookIPRequest, CustomResource, DetachIPRequest, GetIPRequest, IP, ListIPsRequest, ListIPsRequestOrderBy, ListIPsResponse, MoveIPRequest, ReleaseIPRequest, ReleaseIPSetRequest, Resource, ResourceType, Reverse, Source, UpdateIPRequest, } from './types.gen.js';
|
|
4
4
|
export * as ValidationRules from './validation-rules.gen.js';
|
|
@@ -77,10 +77,22 @@ const marshalAttachIPRequest = (request, defaults) => ({
|
|
|
77
77
|
});
|
|
78
78
|
const marshalSource = (request, defaults) => ({
|
|
79
79
|
...resolveOneOf([
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
{
|
|
81
|
+
param: "zonal",
|
|
82
|
+
value: request.zonal
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
param: "private_network_id",
|
|
86
|
+
value: request.privateNetworkId
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
param: "subnet_id",
|
|
90
|
+
value: request.subnetId
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
param: "vpc_id",
|
|
94
|
+
value: request.vpcId
|
|
95
|
+
}
|
|
84
96
|
])
|
|
85
97
|
});
|
|
86
98
|
const marshalBookIPRequest = (request, defaults) => ({
|
package/dist/v1/types.gen.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Region as ScwRegion, Zone as ScwZone } from '@scaleway/sdk-client';
|
|
2
2
|
export type ListIPsRequestOrderBy = 'created_at_desc' | 'created_at_asc' | 'updated_at_desc' | 'updated_at_asc' | 'attached_at_desc' | 'attached_at_asc' | 'ip_address_desc' | 'ip_address_asc' | 'mac_address_desc' | 'mac_address_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' | 'ddl_datalab' | 'kafka_cluster' | 'bgp_endpoint' | 'scbl_sedb_cluster';
|
|
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' | 'ddl_datalab' | 'kafka_cluster' | 'bgp_endpoint' | 'scbl_sedb_cluster' | 'dtwh_deployment' | 'sedb_cluster' | 'msgq_cluster';
|
|
4
4
|
export interface Resource {
|
|
5
5
|
/**
|
|
6
6
|
* Type of resource the IP is attached to.
|
package/package.json
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/sdk-ipam",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Scaleway SDK ipam",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
7
|
+
"README.md",
|
|
7
8
|
"dist"
|
|
8
9
|
],
|
|
9
10
|
"type": "module",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/index.gen.d.ts",
|
|
13
|
-
"import": "./dist/index.gen.js",
|
|
14
|
-
"require": "./dist/index.gen.cjs",
|
|
15
14
|
"default": "./dist/index.gen.js"
|
|
16
15
|
},
|
|
17
16
|
"./*": {
|
|
18
17
|
"types": "./dist/*/index.gen.d.ts",
|
|
19
|
-
"import": "./dist/*/index.gen.js",
|
|
20
|
-
"require": "./dist/*/index.gen.cjs",
|
|
21
18
|
"default": "./dist/*/index.gen.js"
|
|
22
19
|
}
|
|
23
20
|
},
|
|
@@ -26,17 +23,17 @@
|
|
|
26
23
|
"directory": "packages_generated/ipam"
|
|
27
24
|
},
|
|
28
25
|
"engines": {
|
|
29
|
-
"node": ">=20.19.
|
|
26
|
+
"node": ">=20.19.6"
|
|
30
27
|
},
|
|
31
28
|
"dependencies": {
|
|
32
29
|
"@scaleway/random-name": "5.1.2",
|
|
33
|
-
"@scaleway/sdk-std": "1.
|
|
30
|
+
"@scaleway/sdk-std": "2.1.0"
|
|
34
31
|
},
|
|
35
32
|
"peerDependencies": {
|
|
36
|
-
"@scaleway/sdk-client": "^1.
|
|
33
|
+
"@scaleway/sdk-client": "^2.1.0"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|
|
39
|
-
"@scaleway/sdk-client": "^1.
|
|
36
|
+
"@scaleway/sdk-client": "^2.1.0"
|
|
40
37
|
},
|
|
41
38
|
"scripts": {
|
|
42
39
|
"package:check": "pnpm publint",
|
package/dist/index.gen.cjs
DELETED
package/dist/v1/api.gen.cjs
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
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
|
-
/**
|
|
10
|
-
* Locality of this API.
|
|
11
|
-
* type ∈ {'zone','region','global','unspecified'}
|
|
12
|
-
*/
|
|
13
|
-
static LOCALITY = sdkClient.toApiLocality({
|
|
14
|
-
regions: ["fr-par", "nl-ams", "pl-waw"]
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* Reserve a new IP. Reserve a new IP from the specified source. Currently IPs can only be reserved from a Private Network.
|
|
18
|
-
*
|
|
19
|
-
* @param request - The request {@link BookIPRequest}
|
|
20
|
-
* @returns A Promise of IP
|
|
21
|
-
*/
|
|
22
|
-
bookIP = (request) => this.client.fetch(
|
|
23
|
-
{
|
|
24
|
-
body: JSON.stringify(
|
|
25
|
-
marshalling_gen.marshalBookIPRequest(request, this.client.settings)
|
|
26
|
-
),
|
|
27
|
-
headers: jsonContentHeaders,
|
|
28
|
-
method: "POST",
|
|
29
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips`
|
|
30
|
-
},
|
|
31
|
-
marshalling_gen.unmarshalIP
|
|
32
|
-
);
|
|
33
|
-
/**
|
|
34
|
-
* Release an IP. Release an IP not currently attached to a resource, and returns it to the available IP pool.
|
|
35
|
-
*
|
|
36
|
-
* @param request - The request {@link ReleaseIPRequest}
|
|
37
|
-
*/
|
|
38
|
-
releaseIP = (request) => this.client.fetch({
|
|
39
|
-
body: "{}",
|
|
40
|
-
headers: jsonContentHeaders,
|
|
41
|
-
method: "DELETE",
|
|
42
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}`
|
|
43
|
-
});
|
|
44
|
-
releaseIPSet = (request = {}) => this.client.fetch({
|
|
45
|
-
body: JSON.stringify(
|
|
46
|
-
marshalling_gen.marshalReleaseIPSetRequest(request, this.client.settings)
|
|
47
|
-
),
|
|
48
|
-
headers: jsonContentHeaders,
|
|
49
|
-
method: "POST",
|
|
50
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ip-sets/release`
|
|
51
|
-
});
|
|
52
|
-
/**
|
|
53
|
-
* Get an IP. Retrieve details of an existing IP, specified by its IP ID.
|
|
54
|
-
*
|
|
55
|
-
* @param request - The request {@link GetIPRequest}
|
|
56
|
-
* @returns A Promise of IP
|
|
57
|
-
*/
|
|
58
|
-
getIP = (request) => this.client.fetch(
|
|
59
|
-
{
|
|
60
|
-
method: "GET",
|
|
61
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}`
|
|
62
|
-
},
|
|
63
|
-
marshalling_gen.unmarshalIP
|
|
64
|
-
);
|
|
65
|
-
/**
|
|
66
|
-
* Update an IP. Update parameters including tags of the specified IP.
|
|
67
|
-
*
|
|
68
|
-
* @param request - The request {@link UpdateIPRequest}
|
|
69
|
-
* @returns A Promise of IP
|
|
70
|
-
*/
|
|
71
|
-
updateIP = (request) => this.client.fetch(
|
|
72
|
-
{
|
|
73
|
-
body: JSON.stringify(
|
|
74
|
-
marshalling_gen.marshalUpdateIPRequest(request, this.client.settings)
|
|
75
|
-
),
|
|
76
|
-
headers: jsonContentHeaders,
|
|
77
|
-
method: "PATCH",
|
|
78
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}`
|
|
79
|
-
},
|
|
80
|
-
marshalling_gen.unmarshalIP
|
|
81
|
-
);
|
|
82
|
-
pageOfListIPs = (request = {}) => this.client.fetch(
|
|
83
|
-
{
|
|
84
|
-
method: "GET",
|
|
85
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips`,
|
|
86
|
-
urlParams: sdkClient.urlParams(
|
|
87
|
-
["attached", request.attached],
|
|
88
|
-
["ip_ids", request.ipIds],
|
|
89
|
-
["is_ipv6", request.isIpv6],
|
|
90
|
-
["mac_address", request.macAddress],
|
|
91
|
-
["order_by", request.orderBy],
|
|
92
|
-
["organization_id", request.organizationId],
|
|
93
|
-
["page", request.page],
|
|
94
|
-
[
|
|
95
|
-
"page_size",
|
|
96
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
97
|
-
],
|
|
98
|
-
["project_id", request.projectId],
|
|
99
|
-
["resource_id", request.resourceId],
|
|
100
|
-
["resource_ids", request.resourceIds],
|
|
101
|
-
["resource_name", request.resourceName],
|
|
102
|
-
["resource_type", request.resourceType],
|
|
103
|
-
["resource_types", request.resourceTypes],
|
|
104
|
-
["tags", request.tags],
|
|
105
|
-
["vpc_id", request.vpcId],
|
|
106
|
-
...Object.entries(
|
|
107
|
-
sdkClient.resolveOneOf([
|
|
108
|
-
{ param: "zonal", value: request.zonal },
|
|
109
|
-
{ param: "private_network_id", value: request.privateNetworkId },
|
|
110
|
-
{ param: "subnet_id", value: request.subnetId },
|
|
111
|
-
{ param: "source_vpc_id", value: request.sourceVpcId }
|
|
112
|
-
])
|
|
113
|
-
)
|
|
114
|
-
)
|
|
115
|
-
},
|
|
116
|
-
marshalling_gen.unmarshalListIPsResponse
|
|
117
|
-
);
|
|
118
|
-
/**
|
|
119
|
-
* 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.
|
|
120
|
-
*
|
|
121
|
-
* @param request - The request {@link ListIPsRequest}
|
|
122
|
-
* @returns A Promise of ListIPsResponse
|
|
123
|
-
*/
|
|
124
|
-
listIPs = (request = {}) => sdkClient.enrichForPagination("ips", this.pageOfListIPs, request);
|
|
125
|
-
/**
|
|
126
|
-
* 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.
|
|
127
|
-
*
|
|
128
|
-
* @param request - The request {@link AttachIPRequest}
|
|
129
|
-
* @returns A Promise of IP
|
|
130
|
-
*/
|
|
131
|
-
attachIP = (request) => this.client.fetch(
|
|
132
|
-
{
|
|
133
|
-
body: JSON.stringify(
|
|
134
|
-
marshalling_gen.marshalAttachIPRequest(request, this.client.settings)
|
|
135
|
-
),
|
|
136
|
-
headers: jsonContentHeaders,
|
|
137
|
-
method: "POST",
|
|
138
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}/attach`
|
|
139
|
-
},
|
|
140
|
-
marshalling_gen.unmarshalIP
|
|
141
|
-
);
|
|
142
|
-
/**
|
|
143
|
-
* 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.
|
|
144
|
-
*
|
|
145
|
-
* @param request - The request {@link DetachIPRequest}
|
|
146
|
-
* @returns A Promise of IP
|
|
147
|
-
*/
|
|
148
|
-
detachIP = (request) => this.client.fetch(
|
|
149
|
-
{
|
|
150
|
-
body: JSON.stringify(
|
|
151
|
-
marshalling_gen.marshalDetachIPRequest(request, this.client.settings)
|
|
152
|
-
),
|
|
153
|
-
headers: jsonContentHeaders,
|
|
154
|
-
method: "POST",
|
|
155
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}/detach`
|
|
156
|
-
},
|
|
157
|
-
marshalling_gen.unmarshalIP
|
|
158
|
-
);
|
|
159
|
-
/**
|
|
160
|
-
* 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.
|
|
161
|
-
*
|
|
162
|
-
* @param request - The request {@link MoveIPRequest}
|
|
163
|
-
* @returns A Promise of IP
|
|
164
|
-
*/
|
|
165
|
-
moveIP = (request) => this.client.fetch(
|
|
166
|
-
{
|
|
167
|
-
body: JSON.stringify(
|
|
168
|
-
marshalling_gen.marshalMoveIPRequest(request, this.client.settings)
|
|
169
|
-
),
|
|
170
|
-
headers: jsonContentHeaders,
|
|
171
|
-
method: "POST",
|
|
172
|
-
path: `/ipam/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/ips/${sdkClient.validatePathParam("ipId", request.ipId)}/move`
|
|
173
|
-
},
|
|
174
|
-
marshalling_gen.unmarshalIP
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
exports.API = API;
|
package/dist/v1/index.gen.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
@@ -1,121 +0,0 @@
|
|
|
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
|
-
vpcId: data.vpc_id,
|
|
38
|
-
zonal: data.zonal
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
const unmarshalIP = (data) => {
|
|
42
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
43
|
-
throw new TypeError(
|
|
44
|
-
`Unmarshalling the type 'IP' failed as data isn't a dictionary.`
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
address: data.address,
|
|
49
|
-
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
50
|
-
id: data.id,
|
|
51
|
-
isIpv6: data.is_ipv6,
|
|
52
|
-
projectId: data.project_id,
|
|
53
|
-
region: data.region,
|
|
54
|
-
resource: data.resource ? unmarshalResource(data.resource) : void 0,
|
|
55
|
-
reverses: sdkClient.unmarshalArrayOfObject(data.reverses, unmarshalReverse),
|
|
56
|
-
source: data.source ? unmarshalSource(data.source) : void 0,
|
|
57
|
-
tags: data.tags,
|
|
58
|
-
updatedAt: sdkClient.unmarshalDate(data.updated_at),
|
|
59
|
-
zone: data.zone
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
const unmarshalListIPsResponse = (data) => {
|
|
63
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
64
|
-
throw new TypeError(
|
|
65
|
-
`Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
ips: sdkClient.unmarshalArrayOfObject(data.ips, unmarshalIP),
|
|
70
|
-
totalCount: data.total_count
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const marshalCustomResource = (request, defaults) => ({
|
|
74
|
-
mac_address: request.macAddress,
|
|
75
|
-
name: request.name
|
|
76
|
-
});
|
|
77
|
-
const marshalAttachIPRequest = (request, defaults) => ({
|
|
78
|
-
resource: marshalCustomResource(request.resource)
|
|
79
|
-
});
|
|
80
|
-
const marshalSource = (request, defaults) => ({
|
|
81
|
-
...sdkClient.resolveOneOf([
|
|
82
|
-
{ param: "zonal", value: request.zonal },
|
|
83
|
-
{ param: "private_network_id", value: request.privateNetworkId },
|
|
84
|
-
{ param: "subnet_id", value: request.subnetId },
|
|
85
|
-
{ param: "vpc_id", value: request.vpcId }
|
|
86
|
-
])
|
|
87
|
-
});
|
|
88
|
-
const marshalBookIPRequest = (request, defaults) => ({
|
|
89
|
-
address: request.address,
|
|
90
|
-
is_ipv6: request.isIpv6,
|
|
91
|
-
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
92
|
-
resource: request.resource !== void 0 ? marshalCustomResource(request.resource) : void 0,
|
|
93
|
-
source: marshalSource(request.source),
|
|
94
|
-
tags: request.tags
|
|
95
|
-
});
|
|
96
|
-
const marshalDetachIPRequest = (request, defaults) => ({
|
|
97
|
-
resource: marshalCustomResource(request.resource)
|
|
98
|
-
});
|
|
99
|
-
const marshalMoveIPRequest = (request, defaults) => ({
|
|
100
|
-
from_resource: marshalCustomResource(request.fromResource),
|
|
101
|
-
to_resource: request.toResource !== void 0 ? marshalCustomResource(request.toResource) : void 0
|
|
102
|
-
});
|
|
103
|
-
const marshalReleaseIPSetRequest = (request, defaults) => ({
|
|
104
|
-
ip_ids: request.ipIds
|
|
105
|
-
});
|
|
106
|
-
const marshalReverse = (request, defaults) => ({
|
|
107
|
-
address: request.address,
|
|
108
|
-
hostname: request.hostname
|
|
109
|
-
});
|
|
110
|
-
const marshalUpdateIPRequest = (request, defaults) => ({
|
|
111
|
-
reverses: request.reverses !== void 0 ? request.reverses.map((elt) => marshalReverse(elt)) : void 0,
|
|
112
|
-
tags: request.tags
|
|
113
|
-
});
|
|
114
|
-
exports.marshalAttachIPRequest = marshalAttachIPRequest;
|
|
115
|
-
exports.marshalBookIPRequest = marshalBookIPRequest;
|
|
116
|
-
exports.marshalDetachIPRequest = marshalDetachIPRequest;
|
|
117
|
-
exports.marshalMoveIPRequest = marshalMoveIPRequest;
|
|
118
|
-
exports.marshalReleaseIPSetRequest = marshalReleaseIPSetRequest;
|
|
119
|
-
exports.marshalUpdateIPRequest = marshalUpdateIPRequest;
|
|
120
|
-
exports.unmarshalIP = unmarshalIP;
|
|
121
|
-
exports.unmarshalListIPsResponse = unmarshalListIPsResponse;
|