@scaleway/sdk 0.1.0-beta.16 → 0.1.0-beta.18

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.
Files changed (105) hide show
  1. package/dist/api/account/v2/api.gen.js +1 -14
  2. package/dist/api/account/v2/marshalling.gen.js +0 -2
  3. package/dist/api/account/v2alpha1/api.gen.js +1 -11
  4. package/dist/api/account/v2alpha1/marshalling.gen.js +0 -5
  5. package/dist/api/applesilicon/v1alpha1/api.gen.js +1 -22
  6. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +0 -13
  7. package/dist/api/baremetal/v1/api.gen.js +1 -45
  8. package/dist/api/baremetal/v1/api.utils.js +0 -5
  9. package/dist/api/baremetal/v1/content.gen.js +1 -1
  10. package/dist/api/baremetal/v1/marshalling.gen.js +0 -41
  11. package/dist/api/container/v1beta1/api.gen.js +1 -47
  12. package/dist/api/container/v1beta1/content.gen.js +4 -4
  13. package/dist/api/container/v1beta1/marshalling.gen.js +0 -19
  14. package/dist/api/domain/v2beta1/api.gen.js +2 -73
  15. package/dist/api/domain/v2beta1/content.gen.js +1 -1
  16. package/dist/api/domain/v2beta1/marshalling.gen.js +10 -158
  17. package/dist/api/flexibleip/v1alpha1/api.gen.js +1 -18
  18. package/dist/api/flexibleip/v1alpha1/content.gen.js +1 -1
  19. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -7
  20. package/dist/api/function/v1beta1/api.gen.js +1 -66
  21. package/dist/api/function/v1beta1/content.gen.js +6 -6
  22. package/dist/api/function/v1beta1/marshalling.gen.js +2 -56
  23. package/dist/api/iam/v1alpha1/api.gen.js +1 -59
  24. package/dist/api/iam/v1alpha1/marshalling.gen.js +4 -25
  25. package/dist/api/instance/v1/api.gen.js +1 -96
  26. package/dist/api/instance/v1/api.utils.js +24 -49
  27. package/dist/api/instance/v1/content.gen.js +7 -7
  28. package/dist/api/instance/v1/marshalling.gen.js +16 -148
  29. package/dist/api/iot/v1/api.gen.js +1 -52
  30. package/dist/api/iot/v1/marshalling.gen.js +0 -49
  31. package/dist/api/k8s/v1/api.gen.js +1 -34
  32. package/dist/api/k8s/v1/content.gen.js +2 -2
  33. package/dist/api/k8s/v1/marshalling.gen.js +0 -32
  34. package/dist/api/lb/v1/api.gen.js +2 -157
  35. package/dist/api/lb/v1/api.utils.js +0 -6
  36. package/dist/api/lb/v1/content.gen.js +3 -3
  37. package/dist/api/lb/v1/marshalling.gen.js +4 -82
  38. package/dist/api/marketplace/v1/api.gen.js +0 -10
  39. package/dist/api/marketplace/v1/marshalling.gen.js +0 -13
  40. package/dist/api/mnq/v1alpha1/api.gen.js +2 -20
  41. package/dist/api/mnq/v1alpha1/marshalling.gen.js +0 -21
  42. package/dist/api/rdb/v1/api.gen.js +2 -79
  43. package/dist/api/rdb/v1/content.gen.js +3 -3
  44. package/dist/api/rdb/v1/marshalling.gen.js +6 -78
  45. package/dist/api/redis/v1/api.gen.js +2 -33
  46. package/dist/api/redis/v1/marshalling.gen.js +7 -36
  47. package/dist/api/redis/v1alpha1/api.gen.js +1 -32
  48. package/dist/api/redis/v1alpha1/marshalling.gen.js +4 -34
  49. package/dist/api/registry/v1/api.gen.js +1 -25
  50. package/dist/api/registry/v1/content.gen.js +2 -2
  51. package/dist/api/registry/v1/marshalling.gen.js +0 -6
  52. package/dist/api/{transactional_email → tem}/index.js +0 -0
  53. package/dist/api/{transactional_email → tem}/v1alpha1/api.gen.js +6 -27
  54. package/dist/api/tem/v1alpha1/index.js +1 -0
  55. package/dist/api/{transactional_email → tem}/v1alpha1/marshalling.gen.js +0 -12
  56. package/dist/api/test/v1/api.gen.js +1 -16
  57. package/dist/api/test/v1/marshalling.gen.js +0 -3
  58. package/dist/api/vpc/v1/api.gen.js +1 -12
  59. package/dist/api/vpc/v1/marshalling.gen.js +0 -2
  60. package/dist/api/vpcgw/v1/api.gen.js +1 -60
  61. package/dist/api/vpcgw/v1/content.gen.js +1 -1
  62. package/dist/api/vpcgw/v1/marshalling.gen.js +0 -21
  63. package/dist/helpers/json.js +0 -1
  64. package/dist/helpers/marshalling.js +7 -20
  65. package/dist/index.cjs +886 -1858
  66. package/dist/index.d.ts +20 -9
  67. package/dist/index.js +1 -1
  68. package/dist/internal/async/interval-retrier.js +9 -16
  69. package/dist/internal/interceptors/request.js +1 -3
  70. package/dist/internal/logger/console-logger.js +0 -4
  71. package/dist/internal/logger/index.js +3 -5
  72. package/dist/internal/logger/level-resolver.js +0 -3
  73. package/dist/internal/validations/string-validation.js +8 -10
  74. package/dist/scw/api.js +0 -1
  75. package/dist/scw/auth.js +3 -5
  76. package/dist/scw/client-ini-factory.js +14 -9
  77. package/dist/scw/client-ini-profile.js +1 -1
  78. package/dist/scw/client-settings.js +14 -11
  79. package/dist/scw/client.js +2 -3
  80. package/dist/scw/constants.js +1 -1
  81. package/dist/scw/custom-marshalling.js +8 -14
  82. package/dist/scw/errors/error-parser.js +2 -21
  83. package/dist/scw/errors/non-standard/invalid-request-mapper.js +0 -2
  84. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +2 -3
  85. package/dist/scw/errors/scw-error.js +5 -14
  86. package/dist/scw/errors/standard/already-exists-error.js +0 -3
  87. package/dist/scw/errors/standard/denied-authentication-error.js +1 -10
  88. package/dist/scw/errors/standard/invalid-arguments-error.js +1 -10
  89. package/dist/scw/errors/standard/out-of-stock-error.js +0 -3
  90. package/dist/scw/errors/standard/permissions-denied-error.js +1 -4
  91. package/dist/scw/errors/standard/precondition-failed-error.js +1 -7
  92. package/dist/scw/errors/standard/quotas-exceeded-error.js +1 -5
  93. package/dist/scw/errors/standard/resource-expired-error.js +0 -3
  94. package/dist/scw/errors/standard/resource-locked-error.js +0 -3
  95. package/dist/scw/errors/standard/resource-not-found-error.js +0 -3
  96. package/dist/scw/errors/standard/too-many-requests-error.js +3 -16
  97. package/dist/scw/errors/standard/transient-state-error.js +0 -3
  98. package/dist/scw/errors/types.js +0 -3
  99. package/dist/scw/fetch/build-fetcher.js +1 -9
  100. package/dist/scw/fetch/http-dumper.js +4 -7
  101. package/dist/scw/fetch/http-interceptors.js +3 -10
  102. package/dist/scw/fetch/resource-paginator.js +5 -11
  103. package/dist/scw/fetch/response-parser.js +9 -17
  104. package/package.json +2 -2
  105. package/dist/api/transactional_email/v1alpha1/index.js +0 -1
@@ -7,73 +7,61 @@ import { marshalCreateProjectRequest, unmarshalProject, unmarshalListProjectsRes
7
7
  const jsonContentHeaders = {
8
8
  'Content-Type': 'application/json; charset=utf-8'
9
9
  };
10
+
10
11
  /**
11
12
  * Account API.
12
13
  *
13
14
  * This API allows you to manage projects.
14
15
  */
15
-
16
16
  class AccountV2GenAPI extends API {
17
17
  constructor() {
18
18
  var _this;
19
-
20
19
  super(...arguments);
21
20
  _this = this;
22
-
23
21
  this.createProject = request => this.client.fetch({
24
22
  body: JSON.stringify(marshalCreateProjectRequest(request, this.client.settings)),
25
23
  headers: jsonContentHeaders,
26
24
  method: 'POST',
27
25
  path: `/account/v2/projects`
28
26
  }, unmarshalProject);
29
-
30
27
  this.pageOfListProjects = function (request) {
31
28
  if (request === void 0) {
32
29
  request = {};
33
30
  }
34
-
35
31
  return _this.client.fetch({
36
32
  method: 'GET',
37
33
  path: `/account/v2/projects`,
38
34
  urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_ids', request.projectIds])
39
35
  }, unmarshalListProjectsResponse);
40
36
  };
41
-
42
37
  this.listProjects = function (request) {
43
38
  if (request === void 0) {
44
39
  request = {};
45
40
  }
46
-
47
41
  return enrichForPagination('projects', _this.pageOfListProjects, request);
48
42
  };
49
-
50
43
  this.getProject = function (request) {
51
44
  if (request === void 0) {
52
45
  request = {};
53
46
  }
54
-
55
47
  return _this.client.fetch({
56
48
  method: 'GET',
57
49
  path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? _this.client.settings.defaultProjectId)}`
58
50
  }, unmarshalProject);
59
51
  };
60
-
61
52
  this.deleteProject = function (request) {
62
53
  if (request === void 0) {
63
54
  request = {};
64
55
  }
65
-
66
56
  return _this.client.fetch({
67
57
  method: 'DELETE',
68
58
  path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? _this.client.settings.defaultProjectId)}`
69
59
  });
70
60
  };
71
-
72
61
  this.updateProject = function (request) {
73
62
  if (request === void 0) {
74
63
  request = {};
75
64
  }
76
-
77
65
  return _this.client.fetch({
78
66
  body: JSON.stringify(marshalUpdateProjectRequest(request, _this.client.settings)),
79
67
  headers: jsonContentHeaders,
@@ -82,7 +70,6 @@ class AccountV2GenAPI extends API {
82
70
  }, unmarshalProject);
83
71
  };
84
72
  }
85
-
86
73
  }
87
74
 
88
75
  export { AccountV2GenAPI };
@@ -6,7 +6,6 @@ const unmarshalProject = data => {
6
6
  if (!isJSONObject(data)) {
7
7
  throw new TypeError(`Unmarshalling the type 'Project' failed as data isn't a dictionary.`);
8
8
  }
9
-
10
9
  return {
11
10
  createdAt: unmarshalDate(data.created_at),
12
11
  description: data.description,
@@ -20,7 +19,6 @@ const unmarshalListProjectsResponse = data => {
20
19
  if (!isJSONObject(data)) {
21
20
  throw new TypeError(`Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`);
22
21
  }
23
-
24
22
  return {
25
23
  projects: unmarshalArrayOfObject(data.projects, unmarshalProject),
26
24
  totalCount: data.total_count
@@ -7,60 +7,50 @@ import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHK
7
7
  const jsonContentHeaders = {
8
8
  'Content-Type': 'application/json; charset=utf-8'
9
9
  };
10
- /** Account API. */
11
10
 
11
+ /** Account API. */
12
12
  class AccountV2Alpha1GenAPI extends API {
13
13
  constructor() {
14
14
  var _this;
15
-
16
15
  super(...arguments);
17
16
  _this = this;
18
-
19
17
  this.pageOfListSSHKeys = function (request) {
20
18
  if (request === void 0) {
21
19
  request = {};
22
20
  }
23
-
24
21
  return _this.client.fetch({
25
22
  method: 'GET',
26
23
  path: `/account/v2alpha1/ssh-keys`,
27
24
  urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
28
25
  }, unmarshalListSSHKeysResponse);
29
26
  };
30
-
31
27
  this.listSSHKeys = function (request) {
32
28
  if (request === void 0) {
33
29
  request = {};
34
30
  }
35
-
36
31
  return enrichForPagination('sshKeys', _this.pageOfListSSHKeys, request);
37
32
  };
38
-
39
33
  this.createSSHKey = request => this.client.fetch({
40
34
  body: JSON.stringify(marshalCreateSSHKeyRequest(request, this.client.settings)),
41
35
  headers: jsonContentHeaders,
42
36
  method: 'POST',
43
37
  path: `/account/v2alpha1/ssh-keys`
44
38
  }, unmarshalSSHKey);
45
-
46
39
  this.getSSHKey = request => this.client.fetch({
47
40
  method: 'GET',
48
41
  path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
49
42
  }, unmarshalSSHKey);
50
-
51
43
  this.updateSSHKey = request => this.client.fetch({
52
44
  body: JSON.stringify(marshalUpdateSSHKeyRequest(request, this.client.settings)),
53
45
  headers: jsonContentHeaders,
54
46
  method: 'PATCH',
55
47
  path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
56
48
  }, unmarshalSSHKey);
57
-
58
49
  this.deleteSSHKey = request => this.client.fetch({
59
50
  method: 'DELETE',
60
51
  path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
61
52
  });
62
53
  }
63
-
64
54
  }
65
55
 
66
56
  export { AccountV2Alpha1GenAPI };
@@ -2,24 +2,20 @@ import { isJSONObject } from '../../../helpers/json.js';
2
2
  import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
3
 
4
4
  // This file was automatically generated. DO NOT EDIT.
5
-
6
5
  const unmarshalSSHKeyCreationInfo = data => {
7
6
  if (!isJSONObject(data)) {
8
7
  throw new TypeError(`Unmarshalling the type 'SSHKeyCreationInfo' failed as data isn't a dictionary.`);
9
8
  }
10
-
11
9
  return {
12
10
  address: data.address,
13
11
  countryCode: data.country_code,
14
12
  userAgent: data.user_agent
15
13
  };
16
14
  };
17
-
18
15
  const unmarshalSSHKey = data => {
19
16
  if (!isJSONObject(data)) {
20
17
  throw new TypeError(`Unmarshalling the type 'SSHKey' failed as data isn't a dictionary.`);
21
18
  }
22
-
23
19
  return {
24
20
  createdAt: unmarshalDate(data.created_at),
25
21
  creationInfo: data.creation_info ? unmarshalSSHKeyCreationInfo(data.creation_info) : undefined,
@@ -36,7 +32,6 @@ const unmarshalListSSHKeysResponse = data => {
36
32
  if (!isJSONObject(data)) {
37
33
  throw new TypeError(`Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`);
38
34
  }
39
-
40
35
  return {
41
36
  sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
42
37
  totalCount: data.total_count
@@ -9,6 +9,7 @@ import { unmarshalListServerTypesResponse, unmarshalServerType, marshalCreateSer
9
9
  const jsonContentHeaders = {
10
10
  'Content-Type': 'application/json; charset=utf-8'
11
11
  };
12
+
12
13
  /**
13
14
  * Apple silicon.
14
15
  *
@@ -29,108 +30,87 @@ const jsonContentHeaders = {
29
30
  * Cisco in the U.S. and other countries and is used by Apple under license.
30
31
  * Scaleway is not affiliated with Apple Inc.
31
32
  */
32
-
33
33
  class ApplesiliconV1Alpha1GenAPI extends API {
34
34
  constructor() {
35
35
  var _this;
36
-
37
36
  super(...arguments);
38
37
  _this = this;
39
-
40
38
  this.listServerTypes = function (request) {
41
39
  if (request === void 0) {
42
40
  request = {};
43
41
  }
44
-
45
42
  return _this.client.fetch({
46
43
  method: 'GET',
47
44
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/server-types`
48
45
  }, unmarshalListServerTypesResponse);
49
46
  };
50
-
51
47
  this.getServerType = request => this.client.fetch({
52
48
  method: 'GET',
53
49
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/server-type/${validatePathParam('serverType', request.serverType)}`
54
50
  }, unmarshalServerType);
55
-
56
51
  this.createServer = request => this.client.fetch({
57
52
  body: JSON.stringify(marshalCreateServerRequest(request, this.client.settings)),
58
53
  headers: jsonContentHeaders,
59
54
  method: 'POST',
60
55
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
61
56
  }, unmarshalServer);
62
-
63
57
  this.pageOfListServers = function (request) {
64
58
  if (request === void 0) {
65
59
  request = {};
66
60
  }
67
-
68
61
  return _this.client.fetch({
69
62
  method: 'GET',
70
63
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/servers`,
71
64
  urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
72
65
  }, unmarshalListServersResponse);
73
66
  };
74
-
75
67
  this.listServers = function (request) {
76
68
  if (request === void 0) {
77
69
  request = {};
78
70
  }
79
-
80
71
  return enrichForPagination('servers', _this.pageOfListServers, request);
81
72
  };
82
-
83
73
  this.pageOfListOS = function (request) {
84
74
  if (request === void 0) {
85
75
  request = {};
86
76
  }
87
-
88
77
  return _this.client.fetch({
89
78
  method: 'GET',
90
79
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/os`,
91
80
  urlParams: urlParams(['name', request.name], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['server_type', request.serverType])
92
81
  }, unmarshalListOSResponse);
93
82
  };
94
-
95
83
  this.listOS = function (request) {
96
84
  if (request === void 0) {
97
85
  request = {};
98
86
  }
99
-
100
87
  return enrichForPagination('os', _this.pageOfListOS, request);
101
88
  };
102
-
103
89
  this.getOS = request => this.client.fetch({
104
90
  method: 'GET',
105
91
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
106
92
  }, unmarshalOS);
107
-
108
93
  this.getServer = request => this.client.fetch({
109
94
  method: 'GET',
110
95
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
111
96
  }, unmarshalServer);
112
-
113
97
  this.waitForServer = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), this.getServer, request, options);
114
-
115
98
  this.updateServer = request => this.client.fetch({
116
99
  body: JSON.stringify(marshalUpdateServerRequest(request, this.client.settings)),
117
100
  headers: jsonContentHeaders,
118
101
  method: 'PATCH',
119
102
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
120
103
  }, unmarshalServer);
121
-
122
104
  this.deleteServer = request => this.client.fetch({
123
105
  method: 'DELETE',
124
106
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
125
107
  });
126
-
127
108
  this.rebootServer = request => this.client.fetch({
128
109
  body: '{}',
129
110
  headers: jsonContentHeaders,
130
111
  method: 'POST',
131
112
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
132
113
  }, unmarshalServer);
133
-
134
114
  this.reinstallServer = request => this.client.fetch({
135
115
  body: '{}',
136
116
  headers: jsonContentHeaders,
@@ -138,7 +118,6 @@ class ApplesiliconV1Alpha1GenAPI extends API {
138
118
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reinstall`
139
119
  }, unmarshalServer);
140
120
  }
141
-
142
121
  }
143
122
  ApplesiliconV1Alpha1GenAPI.LOCALITIES = ['fr-par-3'];
144
123
 
@@ -3,45 +3,37 @@ import { isJSONObject } from '../../../helpers/json.js';
3
3
  import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
4
4
 
5
5
  // This file was automatically generated. DO NOT EDIT.
6
-
7
6
  const unmarshalServerTypeCPU = data => {
8
7
  if (!isJSONObject(data)) {
9
8
  throw new TypeError(`Unmarshalling the type 'ServerTypeCPU' failed as data isn't a dictionary.`);
10
9
  }
11
-
12
10
  return {
13
11
  coreCount: data.core_count,
14
12
  name: data.name
15
13
  };
16
14
  };
17
-
18
15
  const unmarshalServerTypeDisk = data => {
19
16
  if (!isJSONObject(data)) {
20
17
  throw new TypeError(`Unmarshalling the type 'ServerTypeDisk' failed as data isn't a dictionary.`);
21
18
  }
22
-
23
19
  return {
24
20
  capacity: data.capacity,
25
21
  type: data.type
26
22
  };
27
23
  };
28
-
29
24
  const unmarshalServerTypeMemory = data => {
30
25
  if (!isJSONObject(data)) {
31
26
  throw new TypeError(`Unmarshalling the type 'ServerTypeMemory' failed as data isn't a dictionary.`);
32
27
  }
33
-
34
28
  return {
35
29
  capacity: data.capacity,
36
30
  type: data.type
37
31
  };
38
32
  };
39
-
40
33
  const unmarshalOS = data => {
41
34
  if (!isJSONObject(data)) {
42
35
  throw new TypeError(`Unmarshalling the type 'OS' failed as data isn't a dictionary.`);
43
36
  }
44
-
45
37
  return {
46
38
  compatibleServerTypes: data.compatible_server_types,
47
39
  id: data.id,
@@ -54,7 +46,6 @@ const unmarshalServer = data => {
54
46
  if (!isJSONObject(data)) {
55
47
  throw new TypeError(`Unmarshalling the type 'Server' failed as data isn't a dictionary.`);
56
48
  }
57
-
58
49
  return {
59
50
  createdAt: unmarshalDate(data.created_at),
60
51
  deletableAt: unmarshalDate(data.deletable_at),
@@ -74,7 +65,6 @@ const unmarshalServerType = data => {
74
65
  if (!isJSONObject(data)) {
75
66
  throw new TypeError(`Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`);
76
67
  }
77
-
78
68
  return {
79
69
  cpu: data.cpu ? unmarshalServerTypeCPU(data.cpu) : undefined,
80
70
  disk: data.disk ? unmarshalServerTypeDisk(data.disk) : undefined,
@@ -88,7 +78,6 @@ const unmarshalListOSResponse = data => {
88
78
  if (!isJSONObject(data)) {
89
79
  throw new TypeError(`Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`);
90
80
  }
91
-
92
81
  return {
93
82
  os: unmarshalArrayOfObject(data.os, unmarshalOS),
94
83
  totalCount: data.total_count
@@ -98,7 +87,6 @@ const unmarshalListServerTypesResponse = data => {
98
87
  if (!isJSONObject(data)) {
99
88
  throw new TypeError(`Unmarshalling the type 'ListServerTypesResponse' failed as data isn't a dictionary.`);
100
89
  }
101
-
102
90
  return {
103
91
  serverTypes: unmarshalArrayOfObject(data.server_types, unmarshalServerType)
104
92
  };
@@ -107,7 +95,6 @@ const unmarshalListServersResponse = data => {
107
95
  if (!isJSONObject(data)) {
108
96
  throw new TypeError(`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`);
109
97
  }
110
-
111
98
  return {
112
99
  servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
113
100
  totalCount: data.total_count
@@ -9,245 +9,201 @@ import { unmarshalListServersResponse, unmarshalServer, marshalCreateServerReque
9
9
  const jsonContentHeaders = {
10
10
  'Content-Type': 'application/json; charset=utf-8'
11
11
  };
12
+
12
13
  /**
13
14
  * Elastic metal API.
14
15
  *
15
16
  * This API allows to manage your Bare metal server.
16
17
  */
17
-
18
18
  class BaremetalV1GenAPI extends API {
19
19
  constructor() {
20
20
  var _this;
21
-
22
21
  super(...arguments);
23
22
  _this = this;
24
-
25
23
  this.pageOfListServers = function (request) {
26
24
  if (request === void 0) {
27
25
  request = {};
28
26
  }
29
-
30
27
  return _this.client.fetch({
31
28
  method: 'GET',
32
29
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/servers`,
33
30
  urlParams: urlParams(['name', request.name], ['option_id', request.optionId], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId], ['status', request.status], ['tags', request.tags])
34
31
  }, unmarshalListServersResponse);
35
32
  };
36
-
37
33
  this.listServers = function (request) {
38
34
  if (request === void 0) {
39
35
  request = {};
40
36
  }
41
-
42
37
  return enrichForPagination('servers', _this.pageOfListServers, request);
43
38
  };
44
-
45
39
  this.getServer = request => this.client.fetch({
46
40
  method: 'GET',
47
41
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
48
42
  }, unmarshalServer);
49
-
50
43
  this.waitForServer = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), this.getServer, request, options);
51
-
52
44
  this.createServer = request => this.client.fetch({
53
45
  body: JSON.stringify(marshalCreateServerRequest(request, this.client.settings)),
54
46
  headers: jsonContentHeaders,
55
47
  method: 'POST',
56
48
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
57
49
  }, unmarshalServer);
58
-
59
50
  this.updateServer = request => this.client.fetch({
60
51
  body: JSON.stringify(marshalUpdateServerRequest(request, this.client.settings)),
61
52
  headers: jsonContentHeaders,
62
53
  method: 'PATCH',
63
54
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
64
55
  }, unmarshalServer);
65
-
66
56
  this.installServer = request => this.client.fetch({
67
57
  body: JSON.stringify(marshalInstallServerRequest(request, this.client.settings)),
68
58
  headers: jsonContentHeaders,
69
59
  method: 'POST',
70
60
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/install`
71
61
  }, unmarshalServer);
72
-
73
62
  this.getServerMetrics = request => this.client.fetch({
74
63
  method: 'GET',
75
64
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/metrics`
76
65
  }, unmarshalGetServerMetricsResponse);
77
-
78
66
  this.deleteServer = request => this.client.fetch({
79
67
  method: 'DELETE',
80
68
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
81
69
  }, unmarshalServer);
82
-
83
70
  this.rebootServer = request => this.client.fetch({
84
71
  body: JSON.stringify(marshalRebootServerRequest(request, this.client.settings)),
85
72
  headers: jsonContentHeaders,
86
73
  method: 'POST',
87
74
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
88
75
  }, unmarshalServer);
89
-
90
76
  this.startServer = request => this.client.fetch({
91
77
  body: JSON.stringify(marshalStartServerRequest(request, this.client.settings)),
92
78
  headers: jsonContentHeaders,
93
79
  method: 'POST',
94
80
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/start`
95
81
  }, unmarshalServer);
96
-
97
82
  this.stopServer = request => this.client.fetch({
98
83
  body: '{}',
99
84
  headers: jsonContentHeaders,
100
85
  method: 'POST',
101
86
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/stop`
102
87
  }, unmarshalServer);
103
-
104
88
  this.pageOfListServerEvents = request => this.client.fetch({
105
89
  method: 'GET',
106
90
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/events`,
107
91
  urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
108
92
  }, unmarshalListServerEventsResponse);
109
-
110
93
  this.listServerEvents = request => enrichForPagination('events', this.pageOfListServerEvents, request);
111
-
112
94
  this.startBMCAccess = request => this.client.fetch({
113
95
  body: JSON.stringify(marshalStartBMCAccessRequest(request, this.client.settings)),
114
96
  headers: jsonContentHeaders,
115
97
  method: 'POST',
116
98
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
117
99
  }, unmarshalBMCAccess);
118
-
119
100
  this.getBMCAccess = request => this.client.fetch({
120
101
  method: 'GET',
121
102
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
122
103
  }, unmarshalBMCAccess);
123
-
124
104
  this.stopBMCAccess = request => this.client.fetch({
125
105
  method: 'DELETE',
126
106
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
127
107
  });
128
-
129
108
  this.updateIP = request => this.client.fetch({
130
109
  body: JSON.stringify(marshalUpdateIPRequest(request, this.client.settings)),
131
110
  headers: jsonContentHeaders,
132
111
  method: 'PATCH',
133
112
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/ips/${validatePathParam('ipId', request.ipId)}`
134
113
  }, unmarshalIP);
135
-
136
114
  this.addOptionServer = request => this.client.fetch({
137
115
  body: JSON.stringify(marshalAddOptionServerRequest(request, this.client.settings)),
138
116
  headers: jsonContentHeaders,
139
117
  method: 'POST',
140
118
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
141
119
  }, unmarshalServer);
142
-
143
120
  this.deleteOptionServer = request => this.client.fetch({
144
121
  method: 'DELETE',
145
122
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
146
123
  }, unmarshalServer);
147
-
148
124
  this.pageOfListOffers = function (request) {
149
125
  if (request === void 0) {
150
126
  request = {};
151
127
  }
152
-
153
128
  return _this.client.fetch({
154
129
  method: 'GET',
155
130
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/offers`,
156
131
  urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['subscription_period', request.subscriptionPeriod ?? 'unknown_subscription_period'])
157
132
  }, unmarshalListOffersResponse);
158
133
  };
159
-
160
134
  this.listOffers = function (request) {
161
135
  if (request === void 0) {
162
136
  request = {};
163
137
  }
164
-
165
138
  return enrichForPagination('offers', _this.pageOfListOffers, request);
166
139
  };
167
-
168
140
  this.getOffer = request => this.client.fetch({
169
141
  method: 'GET',
170
142
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/offers/${validatePathParam('offerId', request.offerId)}`
171
143
  }, unmarshalOffer);
172
-
173
144
  this.getOption = request => this.client.fetch({
174
145
  method: 'GET',
175
146
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/options/${validatePathParam('optionId', request.optionId)}`
176
147
  }, unmarshalOption);
177
-
178
148
  this.pageOfListOptions = function (request) {
179
149
  if (request === void 0) {
180
150
  request = {};
181
151
  }
182
-
183
152
  return _this.client.fetch({
184
153
  method: 'GET',
185
154
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/options`,
186
155
  urlParams: urlParams(['name', request.name], ['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
187
156
  }, unmarshalListOptionsResponse);
188
157
  };
189
-
190
158
  this.listOptions = function (request) {
191
159
  if (request === void 0) {
192
160
  request = {};
193
161
  }
194
-
195
162
  return enrichForPagination('options', _this.pageOfListOptions, request);
196
163
  };
197
-
198
164
  this.pageOfListSettings = function (request) {
199
165
  if (request === void 0) {
200
166
  request = {};
201
167
  }
202
-
203
168
  return _this.client.fetch({
204
169
  method: 'GET',
205
170
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/settings`,
206
171
  urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
207
172
  }, unmarshalListSettingsResponse);
208
173
  };
209
-
210
174
  this.listSettings = function (request) {
211
175
  if (request === void 0) {
212
176
  request = {};
213
177
  }
214
-
215
178
  return enrichForPagination('settings', _this.pageOfListSettings, request);
216
179
  };
217
-
218
180
  this.updateSetting = request => this.client.fetch({
219
181
  body: JSON.stringify(marshalUpdateSettingRequest(request, this.client.settings)),
220
182
  headers: jsonContentHeaders,
221
183
  method: 'PATCH',
222
184
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/settings/${validatePathParam('settingId', request.settingId)}`
223
185
  }, unmarshalSetting);
224
-
225
186
  this.pageOfListOS = function (request) {
226
187
  if (request === void 0) {
227
188
  request = {};
228
189
  }
229
-
230
190
  return _this.client.fetch({
231
191
  method: 'GET',
232
192
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/os`,
233
193
  urlParams: urlParams(['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
234
194
  }, unmarshalListOSResponse);
235
195
  };
236
-
237
196
  this.listOS = function (request) {
238
197
  if (request === void 0) {
239
198
  request = {};
240
199
  }
241
-
242
200
  return enrichForPagination('os', _this.pageOfListOS, request);
243
201
  };
244
-
245
202
  this.getOS = request => this.client.fetch({
246
203
  method: 'GET',
247
204
  path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
248
205
  }, unmarshalOS);
249
206
  }
250
-
251
207
  }
252
208
  BaremetalV1GenAPI.LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1'];
253
209