@nutanix-scratch/multidomain-js-client 4.2.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.
Files changed (137) hide show
  1. package/LICENSE.txt +202 -0
  2. package/README.md +224 -0
  3. package/dist/Ntnx-Multidomain-js-client-prod.js +1 -0
  4. package/dist/Ntnx-Multidomain-js-client.js +713 -0
  5. package/dist/es/ApiClient.d.ts +194 -0
  6. package/dist/es/ApiClient.js +1449 -0
  7. package/dist/es/Paginable.d.ts +95 -0
  8. package/dist/es/Paginable.js +248 -0
  9. package/dist/es/apis/externalrepositories-endpoints.d.ts +84 -0
  10. package/dist/es/apis/externalrepositories-endpoints.js +267 -0
  11. package/dist/es/index.d.ts +60 -0
  12. package/dist/es/index.js +236 -0
  13. package/dist/es/models/common/v1/config/FQDN.d.ts +47 -0
  14. package/dist/es/models/common/v1/config/FQDN.js +238 -0
  15. package/dist/es/models/common/v1/config/Flag.d.ts +58 -0
  16. package/dist/es/models/common/v1/config/Flag.js +278 -0
  17. package/dist/es/models/common/v1/config/IPAddressOrFQDN.d.ts +70 -0
  18. package/dist/es/models/common/v1/config/IPAddressOrFQDN.js +313 -0
  19. package/dist/es/models/common/v1/config/IPv4Address.d.ts +70 -0
  20. package/dist/es/models/common/v1/config/IPv4Address.js +288 -0
  21. package/dist/es/models/common/v1/config/IPv6Address.d.ts +70 -0
  22. package/dist/es/models/common/v1/config/IPv6Address.js +288 -0
  23. package/dist/es/models/common/v1/config/KVPair.d.ts +65 -0
  24. package/dist/es/models/common/v1/config/KVPair.js +333 -0
  25. package/dist/es/models/common/v1/config/MapOfStringWrapper.d.ts +53 -0
  26. package/dist/es/models/common/v1/config/MapOfStringWrapper.js +236 -0
  27. package/dist/es/models/common/v1/config/Message.d.ts +79 -0
  28. package/dist/es/models/common/v1/config/Message.js +341 -0
  29. package/dist/es/models/common/v1/config/MessageSeverity.d.ts +19 -0
  30. package/dist/es/models/common/v1/config/MessageSeverity.js +89 -0
  31. package/dist/es/models/common/v1/config/TenantAwareModel.d.ts +47 -0
  32. package/dist/es/models/common/v1/config/TenantAwareModel.js +235 -0
  33. package/dist/es/models/common/v1/response/ApiLink.d.ts +58 -0
  34. package/dist/es/models/common/v1/response/ApiLink.js +271 -0
  35. package/dist/es/models/common/v1/response/ApiResponseMetadata.d.ts +95 -0
  36. package/dist/es/models/common/v1/response/ApiResponseMetadata.js +419 -0
  37. package/dist/es/models/common/v1/response/ExternalizableAbstractModel.d.ts +34 -0
  38. package/dist/es/models/common/v1/response/ExternalizableAbstractModel.js +262 -0
  39. package/dist/es/models/multidomain/v4/config/CreateExternalRepositoryApiResponse.d.ts +58 -0
  40. package/dist/es/models/multidomain/v4/config/CreateExternalRepositoryApiResponse.js +288 -0
  41. package/dist/es/models/multidomain/v4/config/DeleteExternalRepositoryApiResponse.d.ts +58 -0
  42. package/dist/es/models/multidomain/v4/config/DeleteExternalRepositoryApiResponse.js +288 -0
  43. package/dist/es/models/multidomain/v4/config/ExternalRepository.d.ts +59 -0
  44. package/dist/es/models/multidomain/v4/config/ExternalRepository.js +328 -0
  45. package/dist/es/models/multidomain/v4/config/GetExternalRepositoryApiResponse.d.ts +58 -0
  46. package/dist/es/models/multidomain/v4/config/GetExternalRepositoryApiResponse.js +288 -0
  47. package/dist/es/models/multidomain/v4/config/ListExternalRepositoriesApiResponse.d.ts +58 -0
  48. package/dist/es/models/multidomain/v4/config/ListExternalRepositoriesApiResponse.js +310 -0
  49. package/dist/es/models/multidomain/v4/config/NFSServerAddress.d.ts +71 -0
  50. package/dist/es/models/multidomain/v4/config/NFSServerAddress.js +279 -0
  51. package/dist/es/models/multidomain/v4/config/NfsRepository.d.ts +73 -0
  52. package/dist/es/models/multidomain/v4/config/NfsRepository.js +299 -0
  53. package/dist/es/models/multidomain/v4/config/UpdateExternalRepositoryApiResponse.d.ts +58 -0
  54. package/dist/es/models/multidomain/v4/config/UpdateExternalRepositoryApiResponse.js +288 -0
  55. package/dist/es/models/multidomain/v4/error/AppMessage.d.ts +107 -0
  56. package/dist/es/models/multidomain/v4/error/AppMessage.js +415 -0
  57. package/dist/es/models/multidomain/v4/error/ErrorResponse.d.ts +47 -0
  58. package/dist/es/models/multidomain/v4/error/ErrorResponse.js +277 -0
  59. package/dist/es/models/multidomain/v4/error/SchemaValidationError.d.ts +92 -0
  60. package/dist/es/models/multidomain/v4/error/SchemaValidationError.js +389 -0
  61. package/dist/es/models/multidomain/v4/error/SchemaValidationErrorMessage.d.ts +69 -0
  62. package/dist/es/models/multidomain/v4/error/SchemaValidationErrorMessage.js +307 -0
  63. package/dist/es/models/prism/v4/config/TaskReference.d.ts +47 -0
  64. package/dist/es/models/prism/v4/config/TaskReference.js +242 -0
  65. package/dist/es/models/validation/ValidationError.d.ts +13 -0
  66. package/dist/es/models/validation/ValidationError.js +44 -0
  67. package/dist/es/models/validation/ValidationScopes.d.ts +9 -0
  68. package/dist/es/models/validation/ValidationScopes.js +38 -0
  69. package/dist/es/utils/ValidationUtils.d.ts +13 -0
  70. package/dist/es/utils/ValidationUtils.js +55 -0
  71. package/dist/lib/ApiClient.d.ts +194 -0
  72. package/dist/lib/ApiClient.js +1449 -0
  73. package/dist/lib/Paginable.d.ts +95 -0
  74. package/dist/lib/Paginable.js +248 -0
  75. package/dist/lib/apis/externalrepositories-endpoints.d.ts +84 -0
  76. package/dist/lib/apis/externalrepositories-endpoints.js +267 -0
  77. package/dist/lib/index.d.ts +60 -0
  78. package/dist/lib/index.js +236 -0
  79. package/dist/lib/models/common/v1/config/FQDN.d.ts +47 -0
  80. package/dist/lib/models/common/v1/config/FQDN.js +238 -0
  81. package/dist/lib/models/common/v1/config/Flag.d.ts +58 -0
  82. package/dist/lib/models/common/v1/config/Flag.js +278 -0
  83. package/dist/lib/models/common/v1/config/IPAddressOrFQDN.d.ts +70 -0
  84. package/dist/lib/models/common/v1/config/IPAddressOrFQDN.js +313 -0
  85. package/dist/lib/models/common/v1/config/IPv4Address.d.ts +70 -0
  86. package/dist/lib/models/common/v1/config/IPv4Address.js +288 -0
  87. package/dist/lib/models/common/v1/config/IPv6Address.d.ts +70 -0
  88. package/dist/lib/models/common/v1/config/IPv6Address.js +288 -0
  89. package/dist/lib/models/common/v1/config/KVPair.d.ts +65 -0
  90. package/dist/lib/models/common/v1/config/KVPair.js +333 -0
  91. package/dist/lib/models/common/v1/config/MapOfStringWrapper.d.ts +53 -0
  92. package/dist/lib/models/common/v1/config/MapOfStringWrapper.js +236 -0
  93. package/dist/lib/models/common/v1/config/Message.d.ts +79 -0
  94. package/dist/lib/models/common/v1/config/Message.js +341 -0
  95. package/dist/lib/models/common/v1/config/MessageSeverity.d.ts +19 -0
  96. package/dist/lib/models/common/v1/config/MessageSeverity.js +89 -0
  97. package/dist/lib/models/common/v1/config/TenantAwareModel.d.ts +47 -0
  98. package/dist/lib/models/common/v1/config/TenantAwareModel.js +235 -0
  99. package/dist/lib/models/common/v1/response/ApiLink.d.ts +58 -0
  100. package/dist/lib/models/common/v1/response/ApiLink.js +271 -0
  101. package/dist/lib/models/common/v1/response/ApiResponseMetadata.d.ts +95 -0
  102. package/dist/lib/models/common/v1/response/ApiResponseMetadata.js +419 -0
  103. package/dist/lib/models/common/v1/response/ExternalizableAbstractModel.d.ts +34 -0
  104. package/dist/lib/models/common/v1/response/ExternalizableAbstractModel.js +262 -0
  105. package/dist/lib/models/multidomain/v4/config/CreateExternalRepositoryApiResponse.d.ts +58 -0
  106. package/dist/lib/models/multidomain/v4/config/CreateExternalRepositoryApiResponse.js +288 -0
  107. package/dist/lib/models/multidomain/v4/config/DeleteExternalRepositoryApiResponse.d.ts +58 -0
  108. package/dist/lib/models/multidomain/v4/config/DeleteExternalRepositoryApiResponse.js +288 -0
  109. package/dist/lib/models/multidomain/v4/config/ExternalRepository.d.ts +59 -0
  110. package/dist/lib/models/multidomain/v4/config/ExternalRepository.js +328 -0
  111. package/dist/lib/models/multidomain/v4/config/GetExternalRepositoryApiResponse.d.ts +58 -0
  112. package/dist/lib/models/multidomain/v4/config/GetExternalRepositoryApiResponse.js +288 -0
  113. package/dist/lib/models/multidomain/v4/config/ListExternalRepositoriesApiResponse.d.ts +58 -0
  114. package/dist/lib/models/multidomain/v4/config/ListExternalRepositoriesApiResponse.js +310 -0
  115. package/dist/lib/models/multidomain/v4/config/NFSServerAddress.d.ts +71 -0
  116. package/dist/lib/models/multidomain/v4/config/NFSServerAddress.js +279 -0
  117. package/dist/lib/models/multidomain/v4/config/NfsRepository.d.ts +73 -0
  118. package/dist/lib/models/multidomain/v4/config/NfsRepository.js +299 -0
  119. package/dist/lib/models/multidomain/v4/config/UpdateExternalRepositoryApiResponse.d.ts +58 -0
  120. package/dist/lib/models/multidomain/v4/config/UpdateExternalRepositoryApiResponse.js +288 -0
  121. package/dist/lib/models/multidomain/v4/error/AppMessage.d.ts +107 -0
  122. package/dist/lib/models/multidomain/v4/error/AppMessage.js +415 -0
  123. package/dist/lib/models/multidomain/v4/error/ErrorResponse.d.ts +47 -0
  124. package/dist/lib/models/multidomain/v4/error/ErrorResponse.js +277 -0
  125. package/dist/lib/models/multidomain/v4/error/SchemaValidationError.d.ts +92 -0
  126. package/dist/lib/models/multidomain/v4/error/SchemaValidationError.js +389 -0
  127. package/dist/lib/models/multidomain/v4/error/SchemaValidationErrorMessage.d.ts +69 -0
  128. package/dist/lib/models/multidomain/v4/error/SchemaValidationErrorMessage.js +307 -0
  129. package/dist/lib/models/prism/v4/config/TaskReference.d.ts +47 -0
  130. package/dist/lib/models/prism/v4/config/TaskReference.js +242 -0
  131. package/dist/lib/models/validation/ValidationError.d.ts +13 -0
  132. package/dist/lib/models/validation/ValidationError.js +44 -0
  133. package/dist/lib/models/validation/ValidationScopes.d.ts +9 -0
  134. package/dist/lib/models/validation/ValidationScopes.js +38 -0
  135. package/dist/lib/utils/ValidationUtils.d.ts +13 -0
  136. package/dist/lib/utils/ValidationUtils.js +55 -0
  137. package/package.json +53 -0
@@ -0,0 +1,333 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _MapOfStringWrapper = _interopRequireDefault(require("./MapOfStringWrapper"));
8
+ var _ValidationScopes = _interopRequireDefault(require("../../../validation/ValidationScopes"));
9
+ var _ValidationUtils = _interopRequireDefault(require("../../../../utils/ValidationUtils"));
10
+ var _ValidationError = _interopRequireDefault(require("../../../validation/ValidationError"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
13
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
14
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } /*
15
+ * Nutanix Multidomain Versioned APIs
16
+ *
17
+ * OpenAPI spec version: 4.2.1
18
+ *
19
+ * NOTE: This class is auto generated by the Open API Dev Platform.
20
+ *
21
+ * Open API Dev Platform Codegen version: 17.5.0.10128-RELEASE
22
+ *
23
+ * Do not edit the class manually.
24
+ *
25
+ */
26
+ /**
27
+ * The KVPair model module.
28
+ * @module Ntnx/KVPair
29
+ * @version 4.2.1
30
+ * @class KVPair
31
+ */
32
+ var _KVPair_brand = /*#__PURE__*/new WeakSet();
33
+ class KVPair {
34
+ /**
35
+ * Constructs a new <code>KVPair</code>.
36
+ * A map describing a set of keys and their corresponding values.
37
+ * @alias module:Ntnx/KVPair
38
+ */
39
+ constructor() {
40
+ /*
41
+ * toJson method for a map type which supports map with primitive keys and values of object types
42
+ * @param {Object} obj
43
+ * @returns {Object|Map} Returns a new transofrmed Map by calling toJson on the values if applicable.
44
+ * Otherwise, just returns the input object.
45
+ */
46
+ _classPrivateMethodInitSpec(this, _KVPair_brand);
47
+ this.$objectType = "common.v1.config.KVPair";
48
+ /** @type {object<string, any>} */
49
+ this.$reserved = {
50
+ '$fv': "v1.r0"
51
+ };
52
+ /** @type {object<string, any>} */
53
+ this.$unknownFields = {};
54
+ }
55
+
56
+ /**
57
+ * Constructs a <code>KVPair</code> from a plain JavaScript object, optionally creating a new instance.
58
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
59
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
60
+ * @param {module:Ntnx/KVPair} obj Optional instance to populate.
61
+ * @param callFromChild {Boolean} Flag to recognise calling instance
62
+ * @return {module:Ntnx/KVPair} The populated <code>KVPair</code> instance.
63
+ */
64
+ static constructFromObject(data, obj = null, callFromChild = false) {
65
+ let items, item, i, itemArr, discriminator;
66
+ if (data) {
67
+ obj = obj || new KVPair();
68
+ if (data.hasOwnProperty('name') && data.name !== null && data.name !== undefined) {
69
+ obj.setName(data['name']);
70
+ }
71
+ if (data.hasOwnProperty('value') && data.value !== null && data.value !== undefined) {
72
+ if (Array.isArray(data['value'])) {
73
+ if (data['value'].length === 0) {
74
+ obj.setValue([]);
75
+ } else {
76
+ itemArr = [];
77
+ items = data['value'];
78
+ if (items[0].hasOwnProperty('$objectType')) {
79
+ discriminator = items[0]['$objectType'];
80
+ } else {
81
+ discriminator = typeof items[0];
82
+ }
83
+ for (i = 0; i < items.length; i++) {
84
+ switch (discriminator) {
85
+ case 'string':
86
+ itemArr.push(items[i]);
87
+ break;
88
+ case 'common.v1.config.MapOfStringWrapper':
89
+ item = _MapOfStringWrapper.default.constructFromObject(items[i], undefined);
90
+ itemArr.push(item);
91
+ break;
92
+ case 'integer':
93
+ itemArr.push(items[i]);
94
+ break;
95
+ case 'number':
96
+ itemArr.push(items[i]);
97
+ break;
98
+ default:
99
+ throw "Unknown list of type " + discriminator + " in data";
100
+ }
101
+ }
102
+ obj.setValue(itemArr);
103
+ }
104
+ } else {
105
+ if (data['value'].hasOwnProperty('$objectType')) {
106
+ discriminator = data['value']['$objectType'];
107
+ } else {
108
+ discriminator = typeof data['value'];
109
+ }
110
+ switch (discriminator) {
111
+ case 'string':
112
+ obj.setValue(data['value']);
113
+ break;
114
+ case 'boolean':
115
+ obj.setValue(data['value']);
116
+ break;
117
+ case 'number':
118
+ obj.setValue(data['value']);
119
+ break;
120
+ case 'object':
121
+ obj.setValue(new Map(Object.entries(data['value'])));
122
+ break;
123
+ default:
124
+ throw "Unknown datatype " + discriminator + " in data";
125
+ }
126
+ }
127
+ }
128
+ if (data.hasOwnProperty('$reserved')) {
129
+ obj.$reserved = data['$reserved'];
130
+ }
131
+ if (data.hasOwnProperty('$objectType')) {
132
+ obj.$objectType = data['$objectType'];
133
+ }
134
+ if (data.hasOwnProperty('$unknownFields')) {
135
+ obj.$unknownFields = data['$unknownFields'];
136
+ }
137
+ if (!callFromChild) {
138
+ obj.$unknownFields = {
139
+ ...data.$unknownFields
140
+ };
141
+ for (const property in data) {
142
+ // Check if the `property` is not already present in `obj` keys, either in snake_case or camelCase,
143
+ // as the model's fields are generated in camelCase, but the server might return snake_case (e.g., due to standards like OIDC).
144
+ // Also, ensure the `property` does not start with '$' and end with 'ItemDiscriminator'.
145
+ // If all conditions are true, add the `property` from `data` to `obj.$unknownFields` as an unknown field.
146
+ if (!Object.keys(obj).includes(property) && !Object.keys(obj).includes(this.snakeToCamel(property)) && !(property[0] === "$" && property.endsWith("ItemDiscriminator"))) {
147
+ obj.$unknownFields[property] = data[property];
148
+ }
149
+ }
150
+ }
151
+ }
152
+ return obj;
153
+ }
154
+
155
+ /**
156
+ * Converts a given snake_case string to camelCase.
157
+ * @param {string} snakeStr - The input string in snake_case format.
158
+ * @returns {string} - The converted string in camelCase format.
159
+ */
160
+ static snakeToCamel(snakeStr) {
161
+ return snakeStr.replace(/(_\w)/g, match => match[1].toUpperCase());
162
+ }
163
+
164
+ /**
165
+ * Returns The key of the key-value pair.
166
+ * @return {string}
167
+ */
168
+ getName() {
169
+ return this.name;
170
+ }
171
+
172
+ /**
173
+ * Sets The key of the key-value pair.
174
+ * @param {string} name The key of the key-value pair.
175
+ */
176
+ setName(name) {
177
+ this.name = name;
178
+ }
179
+
180
+ /**
181
+ * Returns The value associated with the key for this key-value pair
182
+ * @return {string | Number | boolean | string[] | Object<string, string> | MapOfStringWrapper[] | integer[]}
183
+ */
184
+ getValue() {
185
+ return this.value;
186
+ }
187
+
188
+ /**
189
+ * Sets The value associated with the key for this key-value pair
190
+ * @param {string | Number | boolean | string[] | Object<string, string> | MapOfStringWrapper[] | integer[]} value The value associated with the key for this key-value pair
191
+ */
192
+ setValue(value) {
193
+ this.value = value;
194
+ }
195
+ get$Reserved() {
196
+ return this.$reserved;
197
+ }
198
+ get$ObjectType() {
199
+ return this.$objectType;
200
+ }
201
+ get$UnknownFields() {
202
+ return this.$unknownFields;
203
+ }
204
+ toJson(forMutation) {
205
+ if (forMutation === false) {
206
+ return {
207
+ ...(typeof this.getName() !== 'undefined' && this.getName() !== null ? {
208
+ 'name': this.getName()
209
+ } : {}),
210
+ ...(typeof this.getValue() !== 'undefined' && this.getValue() !== null ? {
211
+ 'value': typeof this.getValue().toJson !== "undefined" ? this.getValue().toJson(false) : Array.isArray(this.getValue()) ? this.getValue().map(item => typeof item.toJson !== "undefined" ? item.toJson(false) : item) : _assertClassBrand(_KVPair_brand, this, _toJsonMapType).call(this, this.getValue(), false)
212
+ } : {}),
213
+ '$reserved': this.get$Reserved(),
214
+ '$objectType': this.get$ObjectType(),
215
+ ...(typeof this.get$UnknownFields() !== 'undefined' && this.get$UnknownFields() !== null ? this.get$UnknownFields() : {}),
216
+ '$unknownFields': {}
217
+ };
218
+ }
219
+ return {
220
+ ...(typeof this.getName() !== 'undefined' && this.getName() !== null ? {
221
+ 'name': this.getName()
222
+ } : {}),
223
+ ...(typeof this.getValue() !== 'undefined' && this.getValue() !== null ? {
224
+ 'value': typeof this.getValue().toJson !== "undefined" ? this.getValue().toJson() : Array.isArray(this.getValue()) ? this.getValue().map(item => typeof item.toJson !== "undefined" ? item.toJson() : item) : _assertClassBrand(_KVPair_brand, this, _toJsonMapType).call(this, this.getValue())
225
+ } : {}),
226
+ '$reserved': this.get$Reserved(),
227
+ '$objectType': this.get$ObjectType(),
228
+ ...(typeof this.get$UnknownFields() !== 'undefined' && this.get$UnknownFields() !== null ? this.get$UnknownFields() : {}),
229
+ '$unknownFields': {}
230
+ };
231
+ }
232
+ validate(scope, properties) {
233
+ let propList = [];
234
+ if (arguments.length === 0 || arguments.length === 1 && arguments[0] instanceof _ValidationScopes.default) {
235
+ //cases validate() and validate(scope)
236
+ propList = [];
237
+ } else if (arguments.length === 1) {
238
+ //case validate(properties)
239
+ propList = arguments[0];
240
+ scope = null;
241
+ } else {
242
+ //case validate(scope, properties)
243
+ propList = arguments[1];
244
+ }
245
+ let res = [];
246
+ let err = null;
247
+ propList.forEach(property => {
248
+ err = this.validateProperty(property, scope);
249
+ if (err) {
250
+ res.push(err);
251
+ }
252
+ });
253
+ return new Promise(function (resolve, reject) {
254
+ if (res.length !== 0) {
255
+ reject(err);
256
+ } else {
257
+ resolve();
258
+ }
259
+ });
260
+ }
261
+ validateProperty(scope, property) {
262
+ if (property === "name") {
263
+ if (typeof this.name === 'undefined' || this.name === null) {
264
+ return new _ValidationError.default("name", "undefined or null");
265
+ }
266
+ if (!_ValidationUtils.default.validateMaxLength(this.name, 128)) {
267
+ return new _ValidationError.default("name", "does not satisfy required maxLength constraint: 128");
268
+ }
269
+ if (!_ValidationUtils.default.validateMinLength(this.name, 3)) {
270
+ return new _ValidationError.default("name", "does not satisfy required minLength constraint: 3");
271
+ }
272
+ }
273
+ if (property === "value") {
274
+ if (typeof this.value === 'undefined' || this.value === null) {
275
+ return new _ValidationError.default("value", "undefined or null");
276
+ }
277
+ }
278
+ if (property === "$reserved") {
279
+ if (typeof this.$reserved === 'undefined' || this.$reserved === null) {
280
+ return new _ValidationError.default("$reserved", "undefined or null");
281
+ }
282
+ }
283
+ if (property === "$objectType") {
284
+ if (typeof this.$objectType === 'undefined' || this.$objectType === null) {
285
+ return new _ValidationError.default("$objectType", "undefined or null");
286
+ }
287
+ }
288
+ if (property === "$unknownFields") {
289
+ if (typeof this.$unknownFields === 'undefined' || this.$unknownFields === null) {
290
+ return new _ValidationError.default("$unknownFields", "undefined or null");
291
+ }
292
+ }
293
+ return new _ValidationError.default(property, "no such property exists");
294
+ }
295
+ }
296
+
297
+ /**
298
+ * The key of the key-value pair.
299
+ * @memberof KVPair
300
+ */
301
+ exports.default = KVPair;
302
+ function _toJsonMapType(obj, forMutation) {
303
+ if (obj instanceof Map) {
304
+ return Object.fromEntries(Array.from(obj, ([k, v]) => [k, typeof v.toJson !== "undefined" ? v.toJson(forMutation) : v]));
305
+ } else if (typeof obj === 'object' && obj != null && obj.constructor === Object) {
306
+ return Object.fromEntries(Array.from(Object.entries(obj), entry => {
307
+ return [entry[0], typeof entry[1].toJson !== "undefined" ? entry[1].toJson(forMutation) : entry[1]];
308
+ }));
309
+ }
310
+ return obj;
311
+ }
312
+ /*
313
+ * toJson method for a date type which serializes a Date object to proper Date or DateTime formatting
314
+ * @param {Object} obj Object to serialize
315
+ * @param {boolean} isDateOnly Boolean variable to identify Date or DateTime format for serialization
316
+ * @returns {Object|string} Returns serialized date object or original input object
317
+ */
318
+ function _handleDateType(obj, isDateOnly) {
319
+ if (obj instanceof Date && isDateOnly !== undefined) {
320
+ return isDateOnly ? obj.toISOString().slice(0, 10) : obj.toISOString();
321
+ }
322
+ return obj;
323
+ }
324
+ KVPair.prototype.name = undefined;
325
+
326
+ /**
327
+ * The value associated with the key for this key-value pair
328
+ * @memberof KVPair
329
+ */
330
+ KVPair.prototype.value = undefined;
331
+ KVPair.prototype.$reserved = undefined;
332
+ KVPair.prototype.$objectType = undefined;
333
+ KVPair.prototype.$unknownFields = undefined;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The MapOfStringWrapper model module.
3
+ * @module Ntnx/MapOfStringWrapper
4
+ * @version 4.2.1
5
+ * @class MapOfStringWrapper
6
+ */
7
+ export default class MapOfStringWrapper {
8
+ /**
9
+ * Constructs a <code>MapOfStringWrapper</code> from a plain JavaScript object, optionally creating a new instance.
10
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
11
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
12
+ * @param {module:Ntnx/MapOfStringWrapper} obj Optional instance to populate.
13
+ * @param callFromChild {Boolean} Flag to recognise calling instance
14
+ * @return {module:Ntnx/MapOfStringWrapper} The populated <code>MapOfStringWrapper</code> instance.
15
+ */
16
+ static constructFromObject(data: any, obj?: any, callFromChild?: boolean): any;
17
+ /**
18
+ * Converts a given snake_case string to camelCase.
19
+ * @param {string} snakeStr - The input string in snake_case format.
20
+ * @returns {string} - The converted string in camelCase format.
21
+ */
22
+ static snakeToCamel(snakeStr: string): string;
23
+ $objectType: string;
24
+ /** @type {object<string, any>} */
25
+ $reserved: object;
26
+ /** @type {object<string, any>} */
27
+ $unknownFields: object;
28
+ /**
29
+ * Returns A map with string keys and values.
30
+ * @return {Object<string, string>}
31
+ */
32
+ getMap(): {
33
+ [x: string]: string;
34
+ };
35
+ /**
36
+ * Sets A map with string keys and values.
37
+ * @param {Object<string, string>} map A map with string keys and values.
38
+ */
39
+ setMap(map: {
40
+ [x: string]: string;
41
+ }): void;
42
+ map: {
43
+ [x: string]: string;
44
+ };
45
+ get$Reserved(): any;
46
+ get$ObjectType(): string;
47
+ get$UnknownFields(): any;
48
+ toJson(forMutation: any): any;
49
+ validate(scope: any, properties: any, ...args: any[]): Promise<any>;
50
+ validateProperty(scope: any, property: any): ValidationError;
51
+ #private;
52
+ }
53
+ import ValidationError from "../../../validation/ValidationError";
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ValidationScopes = _interopRequireDefault(require("../../../validation/ValidationScopes"));
8
+ var _ValidationUtils = _interopRequireDefault(require("../../../../utils/ValidationUtils"));
9
+ var _ValidationError = _interopRequireDefault(require("../../../validation/ValidationError"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
12
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
13
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } /*
14
+ * Nutanix Multidomain Versioned APIs
15
+ *
16
+ * OpenAPI spec version: 4.2.1
17
+ *
18
+ * NOTE: This class is auto generated by the Open API Dev Platform.
19
+ *
20
+ * Open API Dev Platform Codegen version: 17.5.0.10128-RELEASE
21
+ *
22
+ * Do not edit the class manually.
23
+ *
24
+ */
25
+ /**
26
+ * The MapOfStringWrapper model module.
27
+ * @module Ntnx/MapOfStringWrapper
28
+ * @version 4.2.1
29
+ * @class MapOfStringWrapper
30
+ */
31
+ var _MapOfStringWrapper_brand = /*#__PURE__*/new WeakSet();
32
+ class MapOfStringWrapper {
33
+ /**
34
+ * Constructs a new <code>MapOfStringWrapper</code>.
35
+ * A wrapper schema containing a map with string keys and values.
36
+ * @alias module:Ntnx/MapOfStringWrapper
37
+ */
38
+ constructor() {
39
+ /*
40
+ * toJson method for a map type which supports map with primitive keys and values of object types
41
+ * @param {Object} obj
42
+ * @returns {Object|Map} Returns a new transofrmed Map by calling toJson on the values if applicable.
43
+ * Otherwise, just returns the input object.
44
+ */
45
+ _classPrivateMethodInitSpec(this, _MapOfStringWrapper_brand);
46
+ this.$objectType = "common.v1.config.MapOfStringWrapper";
47
+ /** @type {object<string, any>} */
48
+ this.$reserved = {
49
+ '$fv': "v1.r0"
50
+ };
51
+ /** @type {object<string, any>} */
52
+ this.$unknownFields = {};
53
+ }
54
+
55
+ /**
56
+ * Constructs a <code>MapOfStringWrapper</code> from a plain JavaScript object, optionally creating a new instance.
57
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
58
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
59
+ * @param {module:Ntnx/MapOfStringWrapper} obj Optional instance to populate.
60
+ * @param callFromChild {Boolean} Flag to recognise calling instance
61
+ * @return {module:Ntnx/MapOfStringWrapper} The populated <code>MapOfStringWrapper</code> instance.
62
+ */
63
+ static constructFromObject(data, obj = null, callFromChild = false) {
64
+ let items, item, i, itemArr, discriminator;
65
+ if (data) {
66
+ obj = obj || new MapOfStringWrapper();
67
+ if (data.hasOwnProperty('map') && data.map !== null && data.map !== undefined) {
68
+ obj.setMap(data['map']);
69
+ }
70
+ if (data.hasOwnProperty('$reserved')) {
71
+ obj.$reserved = data['$reserved'];
72
+ }
73
+ if (data.hasOwnProperty('$objectType')) {
74
+ obj.$objectType = data['$objectType'];
75
+ }
76
+ if (data.hasOwnProperty('$unknownFields')) {
77
+ obj.$unknownFields = data['$unknownFields'];
78
+ }
79
+ if (!callFromChild) {
80
+ obj.$unknownFields = {
81
+ ...data.$unknownFields
82
+ };
83
+ for (const property in data) {
84
+ // Check if the `property` is not already present in `obj` keys, either in snake_case or camelCase,
85
+ // as the model's fields are generated in camelCase, but the server might return snake_case (e.g., due to standards like OIDC).
86
+ // Also, ensure the `property` does not start with '$' and end with 'ItemDiscriminator'.
87
+ // If all conditions are true, add the `property` from `data` to `obj.$unknownFields` as an unknown field.
88
+ if (!Object.keys(obj).includes(property) && !Object.keys(obj).includes(this.snakeToCamel(property)) && !(property[0] === "$" && property.endsWith("ItemDiscriminator"))) {
89
+ obj.$unknownFields[property] = data[property];
90
+ }
91
+ }
92
+ }
93
+ }
94
+ return obj;
95
+ }
96
+
97
+ /**
98
+ * Converts a given snake_case string to camelCase.
99
+ * @param {string} snakeStr - The input string in snake_case format.
100
+ * @returns {string} - The converted string in camelCase format.
101
+ */
102
+ static snakeToCamel(snakeStr) {
103
+ return snakeStr.replace(/(_\w)/g, match => match[1].toUpperCase());
104
+ }
105
+
106
+ /**
107
+ * Returns A map with string keys and values.
108
+ * @return {Object<string, string>}
109
+ */
110
+ getMap() {
111
+ return this.map;
112
+ }
113
+
114
+ /**
115
+ * Sets A map with string keys and values.
116
+ * @param {Object<string, string>} map A map with string keys and values.
117
+ */
118
+ setMap(map) {
119
+ this.map = map;
120
+ }
121
+ get$Reserved() {
122
+ return this.$reserved;
123
+ }
124
+ get$ObjectType() {
125
+ return this.$objectType;
126
+ }
127
+ get$UnknownFields() {
128
+ return this.$unknownFields;
129
+ }
130
+ toJson(forMutation) {
131
+ if (forMutation === false) {
132
+ return {
133
+ ...(typeof this.getMap() !== 'undefined' && this.getMap() !== null ? {
134
+ 'map': _assertClassBrand(_MapOfStringWrapper_brand, this, _toJsonMapType).call(this, this.getMap(), false)
135
+ } : {}),
136
+ '$reserved': this.get$Reserved(),
137
+ '$objectType': this.get$ObjectType(),
138
+ ...(typeof this.get$UnknownFields() !== 'undefined' && this.get$UnknownFields() !== null ? this.get$UnknownFields() : {}),
139
+ '$unknownFields': {}
140
+ };
141
+ }
142
+ return {
143
+ ...(typeof this.getMap() !== 'undefined' && this.getMap() !== null ? {
144
+ 'map': _assertClassBrand(_MapOfStringWrapper_brand, this, _toJsonMapType).call(this, this.getMap())
145
+ } : {}),
146
+ '$reserved': this.get$Reserved(),
147
+ '$objectType': this.get$ObjectType(),
148
+ ...(typeof this.get$UnknownFields() !== 'undefined' && this.get$UnknownFields() !== null ? this.get$UnknownFields() : {}),
149
+ '$unknownFields': {}
150
+ };
151
+ }
152
+ validate(scope, properties) {
153
+ let propList = [];
154
+ if (arguments.length === 0 || arguments.length === 1 && arguments[0] instanceof _ValidationScopes.default) {
155
+ //cases validate() and validate(scope)
156
+ propList = [];
157
+ } else if (arguments.length === 1) {
158
+ //case validate(properties)
159
+ propList = arguments[0];
160
+ scope = null;
161
+ } else {
162
+ //case validate(scope, properties)
163
+ propList = arguments[1];
164
+ }
165
+ let res = [];
166
+ let err = null;
167
+ propList.forEach(property => {
168
+ err = this.validateProperty(property, scope);
169
+ if (err) {
170
+ res.push(err);
171
+ }
172
+ });
173
+ return new Promise(function (resolve, reject) {
174
+ if (res.length !== 0) {
175
+ reject(err);
176
+ } else {
177
+ resolve();
178
+ }
179
+ });
180
+ }
181
+ validateProperty(scope, property) {
182
+ if (property === "map") {
183
+ if (typeof this.map === 'undefined' || this.map === null) {
184
+ return new _ValidationError.default("map", "undefined or null");
185
+ }
186
+ }
187
+ if (property === "$reserved") {
188
+ if (typeof this.$reserved === 'undefined' || this.$reserved === null) {
189
+ return new _ValidationError.default("$reserved", "undefined or null");
190
+ }
191
+ }
192
+ if (property === "$objectType") {
193
+ if (typeof this.$objectType === 'undefined' || this.$objectType === null) {
194
+ return new _ValidationError.default("$objectType", "undefined or null");
195
+ }
196
+ }
197
+ if (property === "$unknownFields") {
198
+ if (typeof this.$unknownFields === 'undefined' || this.$unknownFields === null) {
199
+ return new _ValidationError.default("$unknownFields", "undefined or null");
200
+ }
201
+ }
202
+ return new _ValidationError.default(property, "no such property exists");
203
+ }
204
+ }
205
+
206
+ /**
207
+ * A map with string keys and values.
208
+ * @memberof MapOfStringWrapper
209
+ */
210
+ exports.default = MapOfStringWrapper;
211
+ function _toJsonMapType(obj, forMutation) {
212
+ if (obj instanceof Map) {
213
+ return Object.fromEntries(Array.from(obj, ([k, v]) => [k, typeof v.toJson !== "undefined" ? v.toJson(forMutation) : v]));
214
+ } else if (typeof obj === 'object' && obj != null && obj.constructor === Object) {
215
+ return Object.fromEntries(Array.from(Object.entries(obj), entry => {
216
+ return [entry[0], typeof entry[1].toJson !== "undefined" ? entry[1].toJson(forMutation) : entry[1]];
217
+ }));
218
+ }
219
+ return obj;
220
+ }
221
+ /*
222
+ * toJson method for a date type which serializes a Date object to proper Date or DateTime formatting
223
+ * @param {Object} obj Object to serialize
224
+ * @param {boolean} isDateOnly Boolean variable to identify Date or DateTime format for serialization
225
+ * @returns {Object|string} Returns serialized date object or original input object
226
+ */
227
+ function _handleDateType(obj, isDateOnly) {
228
+ if (obj instanceof Date && isDateOnly !== undefined) {
229
+ return isDateOnly ? obj.toISOString().slice(0, 10) : obj.toISOString();
230
+ }
231
+ return obj;
232
+ }
233
+ MapOfStringWrapper.prototype.map = undefined;
234
+ MapOfStringWrapper.prototype.$reserved = undefined;
235
+ MapOfStringWrapper.prototype.$objectType = undefined;
236
+ MapOfStringWrapper.prototype.$unknownFields = undefined;