@scaleway/sdk 2.3.0 → 2.4.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.
- package/dist/api/block/v1alpha1/api.gen.js +2 -2
- package/dist/api/domain/v2beta1/marshalling.gen.js +2 -0
- package/dist/api/iam/v1alpha1/api.gen.js +4 -4
- package/dist/api/iam/v1alpha1/marshalling.gen.js +16 -5
- package/dist/api/instance/v1/marshalling.gen.js +0 -3
- package/dist/api/jobs/v1alpha1/validation-rules.gen.js +8 -2
- package/dist/api/mnq/index.js +2 -4
- package/dist/index.cjs +431 -704
- package/dist/index.d.ts +736 -1061
- package/dist/scw/constants.js +1 -1
- package/package.json +2 -2
- package/dist/api/mnq/v1alpha1/api.gen.js +0 -197
- package/dist/api/mnq/v1alpha1/index.gen.js +0 -4
- package/dist/api/mnq/v1alpha1/marshalling.gen.js +0 -126
package/dist/scw/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Scaleway SDK.",
|
|
6
6
|
"keywords": [
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"bundledDependencies": [
|
|
36
36
|
"@scaleway/random-name"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "fa1757c65ee02addb3038d711a8b5b991bee0802"
|
|
39
39
|
}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { API as API$1 } from '../../../scw/api.js';
|
|
2
|
-
import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
|
|
3
|
-
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
4
|
-
import { unmarshalListNamespacesResponse, marshalCreateNamespaceRequest, unmarshalNamespace, marshalUpdateNamespaceRequest, marshalCreateCredentialRequest, unmarshalCredential, unmarshalListCredentialsResponse, marshalUpdateCredentialRequest } from './marshalling.gen.js';
|
|
5
|
-
|
|
6
|
-
// This file was automatically generated. DO NOT EDIT.
|
|
7
|
-
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
8
|
-
const jsonContentHeaders = {
|
|
9
|
-
'Content-Type': 'application/json; charset=utf-8'
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Messaging and Queuing API.
|
|
14
|
-
*
|
|
15
|
-
* This API allows you to manage Scaleway Messaging and Queueing brokers.
|
|
16
|
-
*/
|
|
17
|
-
class API extends API$1 {
|
|
18
|
-
/** Lists the available regions of the API. */
|
|
19
|
-
static LOCALITIES = ['fr-par'];
|
|
20
|
-
pageOfListNamespaces = (() => {
|
|
21
|
-
var _this = this;
|
|
22
|
-
return function (request) {
|
|
23
|
-
if (request === void 0) {
|
|
24
|
-
request = {};
|
|
25
|
-
}
|
|
26
|
-
return _this.client.fetch({
|
|
27
|
-
method: 'GET',
|
|
28
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/namespaces`,
|
|
29
|
-
urlParams: urlParams(['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId])
|
|
30
|
-
}, unmarshalListNamespacesResponse);
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* List namespaces. List all Messaging and Queuing namespaces in the specified
|
|
36
|
-
* region, for a Scaleway Organization or Project. By default, the namespaces
|
|
37
|
-
* returned in the list are ordered by creation date in ascending order,
|
|
38
|
-
* though this can be modified via the `order_by` field.
|
|
39
|
-
*
|
|
40
|
-
* @param request - The request {@link ListNamespacesRequest}
|
|
41
|
-
* @returns A Promise of ListNamespacesResponse
|
|
42
|
-
*/
|
|
43
|
-
listNamespaces = (() => {
|
|
44
|
-
var _this2 = this;
|
|
45
|
-
return function (request) {
|
|
46
|
-
if (request === void 0) {
|
|
47
|
-
request = {};
|
|
48
|
-
}
|
|
49
|
-
return enrichForPagination('namespaces', _this2.pageOfListNamespaces, request);
|
|
50
|
-
};
|
|
51
|
-
})();
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Create a namespace. Create a Messaging and Queuing namespace, set to the
|
|
55
|
-
* desired protocol.
|
|
56
|
-
*
|
|
57
|
-
* @param request - The request {@link CreateNamespaceRequest}
|
|
58
|
-
* @returns A Promise of Namespace
|
|
59
|
-
*/
|
|
60
|
-
createNamespace = request => this.client.fetch({
|
|
61
|
-
body: JSON.stringify(marshalCreateNamespaceRequest(request, this.client.settings)),
|
|
62
|
-
headers: jsonContentHeaders,
|
|
63
|
-
method: 'POST',
|
|
64
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces`
|
|
65
|
-
}, unmarshalNamespace);
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Update the name of a namespace. Update the name of a Messaging and Queuing
|
|
69
|
-
* namespace, specified by its namespace ID.
|
|
70
|
-
*
|
|
71
|
-
* @param request - The request {@link UpdateNamespaceRequest}
|
|
72
|
-
* @returns A Promise of Namespace
|
|
73
|
-
*/
|
|
74
|
-
updateNamespace = request => this.client.fetch({
|
|
75
|
-
body: JSON.stringify(marshalUpdateNamespaceRequest(request, this.client.settings)),
|
|
76
|
-
headers: jsonContentHeaders,
|
|
77
|
-
method: 'PATCH',
|
|
78
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces`
|
|
79
|
-
}, unmarshalNamespace);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Get a namespace. Retrieve information about an existing Messaging and
|
|
83
|
-
* Queuing namespace, identified by its namespace ID. Its full details,
|
|
84
|
-
* including name, endpoint and protocol, are returned in the response.
|
|
85
|
-
*
|
|
86
|
-
* @param request - The request {@link GetNamespaceRequest}
|
|
87
|
-
* @returns A Promise of Namespace
|
|
88
|
-
*/
|
|
89
|
-
getNamespace = request => this.client.fetch({
|
|
90
|
-
method: 'GET',
|
|
91
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
|
|
92
|
-
}, unmarshalNamespace);
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Delete a namespace. Delete a Messaging and Queuing namespace, specified by
|
|
96
|
-
* its namespace ID. Note that deleting a namespace is irreversible, and any
|
|
97
|
-
* URLs, credentials and queued messages belonging to this namespace will also
|
|
98
|
-
* be deleted.
|
|
99
|
-
*
|
|
100
|
-
* @param request - The request {@link DeleteNamespaceRequest}
|
|
101
|
-
*/
|
|
102
|
-
deleteNamespace = request => this.client.fetch({
|
|
103
|
-
method: 'DELETE',
|
|
104
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Create credentials. Create a set of credentials for a Messaging and Queuing
|
|
109
|
-
* namespace, specified by its namespace ID. If creating credentials for a
|
|
110
|
-
* NATS namespace, the `permissions` object must not be included in the
|
|
111
|
-
* request. If creating credentials for an SQS/SNS namespace, the
|
|
112
|
-
* `permissions` object is required, with all three of its child attributes.
|
|
113
|
-
*
|
|
114
|
-
* @param request - The request {@link CreateCredentialRequest}
|
|
115
|
-
* @returns A Promise of Credential
|
|
116
|
-
*/
|
|
117
|
-
createCredential = request => this.client.fetch({
|
|
118
|
-
body: JSON.stringify(marshalCreateCredentialRequest(request, this.client.settings)),
|
|
119
|
-
headers: jsonContentHeaders,
|
|
120
|
-
method: 'POST',
|
|
121
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/credentials`
|
|
122
|
-
}, unmarshalCredential);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Delete credentials. Delete a set of credentials, specified by their
|
|
126
|
-
* credential ID. Deleting credentials is irreversible and cannot be undone.
|
|
127
|
-
* The credentials can no longer be used to access the namespace.
|
|
128
|
-
*
|
|
129
|
-
* @param request - The request {@link DeleteCredentialRequest}
|
|
130
|
-
*/
|
|
131
|
-
deleteCredential = request => this.client.fetch({
|
|
132
|
-
method: 'DELETE',
|
|
133
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/credentials/${validatePathParam('credentialId', request.credentialId)}`
|
|
134
|
-
});
|
|
135
|
-
pageOfListCredentials = (() => {
|
|
136
|
-
var _this3 = this;
|
|
137
|
-
return function (request) {
|
|
138
|
-
if (request === void 0) {
|
|
139
|
-
request = {};
|
|
140
|
-
}
|
|
141
|
-
return _this3.client.fetch({
|
|
142
|
-
method: 'GET',
|
|
143
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/credentials`,
|
|
144
|
-
urlParams: urlParams(['namespace_id', request.namespaceId], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize])
|
|
145
|
-
}, unmarshalListCredentialsResponse);
|
|
146
|
-
};
|
|
147
|
-
})();
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* List credentials. List existing credentials in the specified region. The
|
|
151
|
-
* response contains only the metadata for the credentials, not the
|
|
152
|
-
* credentials themselves (for this, use **Get Credentials**).
|
|
153
|
-
*
|
|
154
|
-
* @param request - The request {@link ListCredentialsRequest}
|
|
155
|
-
* @returns A Promise of ListCredentialsResponse
|
|
156
|
-
*/
|
|
157
|
-
listCredentials = (() => {
|
|
158
|
-
var _this4 = this;
|
|
159
|
-
return function (request) {
|
|
160
|
-
if (request === void 0) {
|
|
161
|
-
request = {};
|
|
162
|
-
}
|
|
163
|
-
return enrichForPagination('credentials', _this4.pageOfListCredentials, request);
|
|
164
|
-
};
|
|
165
|
-
})();
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Update credentials. Update a set of credentials. You can update the
|
|
169
|
-
* credentials' name, or (in the case of SQS/SNS credentials only) their
|
|
170
|
-
* permissions. To update the name of NATS credentials, do not include the
|
|
171
|
-
* `permissions` object in your request.
|
|
172
|
-
*
|
|
173
|
-
* @param request - The request {@link UpdateCredentialRequest}
|
|
174
|
-
* @returns A Promise of Credential
|
|
175
|
-
*/
|
|
176
|
-
updateCredential = request => this.client.fetch({
|
|
177
|
-
body: JSON.stringify(marshalUpdateCredentialRequest(request, this.client.settings)),
|
|
178
|
-
headers: jsonContentHeaders,
|
|
179
|
-
method: 'PATCH',
|
|
180
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/credentials/${validatePathParam('credentialId', request.credentialId)}`
|
|
181
|
-
}, unmarshalCredential);
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Get credentials. Retrieve an existing set of credentials, identified by the
|
|
185
|
-
* `credential_id`. The credentials themselves, as well as their metadata
|
|
186
|
-
* (protocol, namespace ID etc), are returned in the response.
|
|
187
|
-
*
|
|
188
|
-
* @param request - The request {@link GetCredentialRequest}
|
|
189
|
-
* @returns A Promise of Credential
|
|
190
|
-
*/
|
|
191
|
-
getCredential = request => this.client.fetch({
|
|
192
|
-
method: 'GET',
|
|
193
|
-
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/credentials/${validatePathParam('credentialId', request.credentialId)}`
|
|
194
|
-
}, unmarshalCredential);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export { API };
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js';
|
|
2
|
-
import { isJSONObject } from '../../../helpers/json.js';
|
|
3
|
-
import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
|
|
4
|
-
|
|
5
|
-
// This file was automatically generated. DO NOT EDIT.
|
|
6
|
-
// If you have any remark or suggestion do not hesitate to open an issue.
|
|
7
|
-
const unmarshalNamespace = data => {
|
|
8
|
-
if (!isJSONObject(data)) {
|
|
9
|
-
throw new TypeError(`Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`);
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
createdAt: unmarshalDate(data.created_at),
|
|
13
|
-
endpoint: data.endpoint,
|
|
14
|
-
id: data.id,
|
|
15
|
-
name: data.name,
|
|
16
|
-
projectId: data.project_id,
|
|
17
|
-
protocol: data.protocol,
|
|
18
|
-
region: data.region,
|
|
19
|
-
updatedAt: unmarshalDate(data.updated_at)
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
const unmarshalPermissions = data => {
|
|
23
|
-
if (!isJSONObject(data)) {
|
|
24
|
-
throw new TypeError(`Unmarshalling the type 'Permissions' failed as data isn't a dictionary.`);
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
canManage: data.can_manage,
|
|
28
|
-
canPublish: data.can_publish,
|
|
29
|
-
canReceive: data.can_receive
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
const unmarshalCredentialNATSCredsFile = data => {
|
|
33
|
-
if (!isJSONObject(data)) {
|
|
34
|
-
throw new TypeError(`Unmarshalling the type 'CredentialNATSCredsFile' failed as data isn't a dictionary.`);
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
content: data.content
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
const unmarshalCredentialSQSSNSCreds = data => {
|
|
41
|
-
if (!isJSONObject(data)) {
|
|
42
|
-
throw new TypeError(`Unmarshalling the type 'CredentialSQSSNSCreds' failed as data isn't a dictionary.`);
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
accessKey: data.access_key,
|
|
46
|
-
permissions: data.permissions ? unmarshalPermissions(data.permissions) : undefined,
|
|
47
|
-
secretKey: data.secret_key
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
const unmarshalCredential = data => {
|
|
51
|
-
if (!isJSONObject(data)) {
|
|
52
|
-
throw new TypeError(`Unmarshalling the type 'Credential' failed as data isn't a dictionary.`);
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
id: data.id,
|
|
56
|
-
name: data.name,
|
|
57
|
-
namespaceId: data.namespace_id,
|
|
58
|
-
natsCredentials: data.nats_credentials ? unmarshalCredentialNATSCredsFile(data.nats_credentials) : undefined,
|
|
59
|
-
protocol: data.protocol,
|
|
60
|
-
sqsSnsCredentials: data.sqs_sns_credentials ? unmarshalCredentialSQSSNSCreds(data.sqs_sns_credentials) : undefined
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
const unmarshalCredentialSummarySQSSNSCreds = data => {
|
|
64
|
-
if (!isJSONObject(data)) {
|
|
65
|
-
throw new TypeError(`Unmarshalling the type 'CredentialSummarySQSSNSCreds' failed as data isn't a dictionary.`);
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
accessKey: data.access_key,
|
|
69
|
-
permissions: data.permissions ? unmarshalPermissions(data.permissions) : undefined
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
const unmarshalCredentialSummary = data => {
|
|
73
|
-
if (!isJSONObject(data)) {
|
|
74
|
-
throw new TypeError(`Unmarshalling the type 'CredentialSummary' failed as data isn't a dictionary.`);
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
id: data.id,
|
|
78
|
-
name: data.name,
|
|
79
|
-
namespaceId: data.namespace_id,
|
|
80
|
-
protocol: data.protocol,
|
|
81
|
-
sqsSnsCredentials: data.sqs_sns_credentials ? unmarshalCredentialSummarySQSSNSCreds(data.sqs_sns_credentials) : undefined
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
const unmarshalListCredentialsResponse = data => {
|
|
85
|
-
if (!isJSONObject(data)) {
|
|
86
|
-
throw new TypeError(`Unmarshalling the type 'ListCredentialsResponse' failed as data isn't a dictionary.`);
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
credentials: unmarshalArrayOfObject(data.credentials, unmarshalCredentialSummary),
|
|
90
|
-
totalCount: data.total_count
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
const unmarshalListNamespacesResponse = data => {
|
|
94
|
-
if (!isJSONObject(data)) {
|
|
95
|
-
throw new TypeError(`Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`);
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
namespaces: unmarshalArrayOfObject(data.namespaces, unmarshalNamespace),
|
|
99
|
-
totalCount: data.total_count
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
const marshalPermissions = (request, defaults) => ({
|
|
103
|
-
can_manage: request.canManage,
|
|
104
|
-
can_publish: request.canPublish,
|
|
105
|
-
can_receive: request.canReceive
|
|
106
|
-
});
|
|
107
|
-
const marshalCreateCredentialRequest = (request, defaults) => ({
|
|
108
|
-
name: request.name || randomName('mnq'),
|
|
109
|
-
namespace_id: request.namespaceId,
|
|
110
|
-
permissions: request.permissions !== undefined ? marshalPermissions(request.permissions) : undefined
|
|
111
|
-
});
|
|
112
|
-
const marshalCreateNamespaceRequest = (request, defaults) => ({
|
|
113
|
-
name: request.name || randomName('mnq'),
|
|
114
|
-
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
115
|
-
protocol: request.protocol
|
|
116
|
-
});
|
|
117
|
-
const marshalUpdateCredentialRequest = (request, defaults) => ({
|
|
118
|
-
name: request.name,
|
|
119
|
-
permissions: request.permissions !== undefined ? marshalPermissions(request.permissions) : undefined
|
|
120
|
-
});
|
|
121
|
-
const marshalUpdateNamespaceRequest = (request, defaults) => ({
|
|
122
|
-
name: request.name,
|
|
123
|
-
namespace_id: request.namespaceId
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
export { marshalCreateCredentialRequest, marshalCreateNamespaceRequest, marshalUpdateCredentialRequest, marshalUpdateNamespaceRequest, unmarshalCredential, unmarshalListCredentialsResponse, unmarshalListNamespacesResponse, unmarshalNamespace };
|