@nutanix-scratch/objects-js-client 4.0.1 → 4.0.2

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 (174) hide show
  1. package/README.md +31 -18
  2. package/dist/Ntnx-Objects-js-client-prod.js +1 -1
  3. package/dist/Ntnx-Objects-js-client.js +283 -277
  4. package/dist/es/ApiClient.d.ts +35 -7
  5. package/dist/es/ApiClient.js +862 -684
  6. package/dist/es/Paginable.d.ts +1 -1
  7. package/dist/es/Paginable.js +144 -183
  8. package/dist/es/apis/objectstores-endpoints.d.ts +5 -69
  9. package/dist/es/apis/objectstores-endpoints.js +406 -479
  10. package/dist/es/apis/stats-endpoints.d.ts +1 -24
  11. package/dist/es/apis/stats-endpoints.js +73 -105
  12. package/dist/es/index.js +120 -120
  13. package/dist/es/models/common/v1/config/FQDN.d.ts +2 -7
  14. package/dist/es/models/common/v1/config/FQDN.js +141 -180
  15. package/dist/es/models/common/v1/config/Flag.d.ts +2 -8
  16. package/dist/es/models/common/v1/config/Flag.js +170 -211
  17. package/dist/es/models/common/v1/config/IPAddress.d.ts +2 -20
  18. package/dist/es/models/common/v1/config/IPAddress.js +170 -217
  19. package/dist/es/models/common/v1/config/IPv4Address.d.ts +2 -8
  20. package/dist/es/models/common/v1/config/IPv4Address.js +174 -215
  21. package/dist/es/models/common/v1/config/IPv6Address.d.ts +2 -8
  22. package/dist/es/models/common/v1/config/IPv6Address.js +174 -215
  23. package/dist/es/models/common/v1/config/KVPair.d.ts +2 -8
  24. package/dist/es/models/common/v1/config/KVPair.js +225 -270
  25. package/dist/es/models/common/v1/config/MapOfStringWrapper.d.ts +2 -7
  26. package/dist/es/models/common/v1/config/MapOfStringWrapper.js +139 -178
  27. package/dist/es/models/common/v1/config/Message.d.ts +2 -10
  28. package/dist/es/models/common/v1/config/Message.js +213 -258
  29. package/dist/es/models/common/v1/config/MessageSeverity.js +7 -9
  30. package/dist/es/models/common/v1/config/Metadata.d.ts +2 -11
  31. package/dist/es/models/common/v1/config/Metadata.js +261 -308
  32. package/dist/es/models/common/v1/config/TenantAwareModel.d.ts +5 -10
  33. package/dist/es/models/common/v1/config/TenantAwareModel.js +138 -178
  34. package/dist/es/models/common/v1/response/ApiLink.d.ts +2 -8
  35. package/dist/es/models/common/v1/response/ApiLink.js +165 -206
  36. package/dist/es/models/common/v1/response/ApiResponseMetadata.d.ts +2 -40
  37. package/dist/es/models/common/v1/response/ApiResponseMetadata.js +281 -344
  38. package/dist/es/models/common/v1/response/ExternalizableAbstractModel.d.ts +1 -15
  39. package/dist/es/models/common/v1/response/ExternalizableAbstractModel.js +155 -203
  40. package/dist/es/models/common/v1/stats/DownSamplingOperator.js +7 -9
  41. package/dist/es/models/common/v1/stats/TimeIntValuePair.d.ts +2 -8
  42. package/dist/es/models/common/v1/stats/TimeIntValuePair.js +165 -206
  43. package/dist/es/models/objects/v4/config/Certificate.d.ts +1 -58
  44. package/dist/es/models/objects/v4/config/Certificate.js +319 -381
  45. package/dist/es/models/objects/v4/config/CertificateProjection.d.ts +1 -1
  46. package/dist/es/models/objects/v4/config/CertificateProjection.js +73 -102
  47. package/dist/es/models/objects/v4/config/CreateCertificateApiResponse.d.ts +2 -45
  48. package/dist/es/models/objects/v4/config/CreateCertificateApiResponse.js +185 -240
  49. package/dist/es/models/objects/v4/config/CreateObjectstoreApiResponse.d.ts +2 -43
  50. package/dist/es/models/objects/v4/config/CreateObjectstoreApiResponse.js +185 -240
  51. package/dist/es/models/objects/v4/config/DeleteObjectstoreApiResponse.d.ts +2 -43
  52. package/dist/es/models/objects/v4/config/DeleteObjectstoreApiResponse.js +185 -240
  53. package/dist/es/models/objects/v4/config/GetCaApiResponse.d.ts +2 -43
  54. package/dist/es/models/objects/v4/config/GetCaApiResponse.js +185 -240
  55. package/dist/es/models/objects/v4/config/GetCertificateApiResponse.d.ts +2 -43
  56. package/dist/es/models/objects/v4/config/GetCertificateApiResponse.js +185 -240
  57. package/dist/es/models/objects/v4/config/GetObjectstoreApiResponse.d.ts +2 -45
  58. package/dist/es/models/objects/v4/config/GetObjectstoreApiResponse.js +185 -240
  59. package/dist/es/models/objects/v4/config/ListCertificatesApiResponse.d.ts +2 -43
  60. package/dist/es/models/objects/v4/config/ListCertificatesApiResponse.js +211 -266
  61. package/dist/es/models/objects/v4/config/ListObjectstoresApiResponse.d.ts +2 -43
  62. package/dist/es/models/objects/v4/config/ListObjectstoresApiResponse.js +211 -266
  63. package/dist/es/models/objects/v4/config/ObjectStore.d.ts +1 -96
  64. package/dist/es/models/objects/v4/config/ObjectStore.js +628 -711
  65. package/dist/es/models/objects/v4/config/ObjectStoreProjection.d.ts +1 -152
  66. package/dist/es/models/objects/v4/config/ObjectStoreProjection.js +221 -238
  67. package/dist/es/models/objects/v4/config/State.js +7 -9
  68. package/dist/es/models/objects/v4/config/UpdateObjectstoreApiResponse.d.ts +2 -43
  69. package/dist/es/models/objects/v4/config/UpdateObjectstoreApiResponse.js +185 -240
  70. package/dist/es/models/objects/v4/error/AppMessage.d.ts +5 -15
  71. package/dist/es/models/objects/v4/error/AppMessage.js +264 -313
  72. package/dist/es/models/objects/v4/error/ErrorResponse.d.ts +2 -7
  73. package/dist/es/models/objects/v4/error/ErrorResponse.js +174 -217
  74. package/dist/es/models/objects/v4/error/SchemaValidationError.d.ts +2 -18
  75. package/dist/es/models/objects/v4/error/SchemaValidationError.js +248 -299
  76. package/dist/es/models/objects/v4/error/SchemaValidationErrorMessage.d.ts +2 -9
  77. package/dist/es/models/objects/v4/error/SchemaValidationErrorMessage.js +190 -233
  78. package/dist/es/models/objects/v4/stats/GetObjectstoreStatsApiResponse.d.ts +2 -43
  79. package/dist/es/models/objects/v4/stats/GetObjectstoreStatsApiResponse.js +185 -240
  80. package/dist/es/models/objects/v4/stats/ObjectstoreStats.d.ts +1 -169
  81. package/dist/es/models/objects/v4/stats/ObjectstoreStats.js +957 -1129
  82. package/dist/es/models/objects/v4/stats/TimeFloatValuePair.d.ts +2 -8
  83. package/dist/es/models/objects/v4/stats/TimeFloatValuePair.js +165 -206
  84. package/dist/es/models/prism/v4/config/TaskReference.d.ts +5 -10
  85. package/dist/es/models/prism/v4/config/TaskReference.js +143 -182
  86. package/dist/es/models/validation/ValidationError.js +26 -42
  87. package/dist/es/models/validation/ValidationScopes.js +3 -3
  88. package/dist/es/utils/ValidationUtils.js +39 -69
  89. package/dist/lib/ApiClient.d.ts +35 -7
  90. package/dist/lib/ApiClient.js +862 -684
  91. package/dist/lib/Paginable.d.ts +1 -1
  92. package/dist/lib/Paginable.js +144 -183
  93. package/dist/lib/apis/objectstores-endpoints.d.ts +5 -69
  94. package/dist/lib/apis/objectstores-endpoints.js +406 -479
  95. package/dist/lib/apis/stats-endpoints.d.ts +1 -24
  96. package/dist/lib/apis/stats-endpoints.js +73 -105
  97. package/dist/lib/index.js +120 -120
  98. package/dist/lib/models/common/v1/config/FQDN.d.ts +2 -7
  99. package/dist/lib/models/common/v1/config/FQDN.js +141 -180
  100. package/dist/lib/models/common/v1/config/Flag.d.ts +2 -8
  101. package/dist/lib/models/common/v1/config/Flag.js +170 -211
  102. package/dist/lib/models/common/v1/config/IPAddress.d.ts +2 -20
  103. package/dist/lib/models/common/v1/config/IPAddress.js +170 -217
  104. package/dist/lib/models/common/v1/config/IPv4Address.d.ts +2 -8
  105. package/dist/lib/models/common/v1/config/IPv4Address.js +174 -215
  106. package/dist/lib/models/common/v1/config/IPv6Address.d.ts +2 -8
  107. package/dist/lib/models/common/v1/config/IPv6Address.js +174 -215
  108. package/dist/lib/models/common/v1/config/KVPair.d.ts +2 -8
  109. package/dist/lib/models/common/v1/config/KVPair.js +225 -270
  110. package/dist/lib/models/common/v1/config/MapOfStringWrapper.d.ts +2 -7
  111. package/dist/lib/models/common/v1/config/MapOfStringWrapper.js +139 -178
  112. package/dist/lib/models/common/v1/config/Message.d.ts +2 -10
  113. package/dist/lib/models/common/v1/config/Message.js +213 -258
  114. package/dist/lib/models/common/v1/config/MessageSeverity.js +7 -9
  115. package/dist/lib/models/common/v1/config/Metadata.d.ts +2 -11
  116. package/dist/lib/models/common/v1/config/Metadata.js +261 -308
  117. package/dist/lib/models/common/v1/config/TenantAwareModel.d.ts +5 -10
  118. package/dist/lib/models/common/v1/config/TenantAwareModel.js +138 -178
  119. package/dist/lib/models/common/v1/response/ApiLink.d.ts +2 -8
  120. package/dist/lib/models/common/v1/response/ApiLink.js +165 -206
  121. package/dist/lib/models/common/v1/response/ApiResponseMetadata.d.ts +2 -40
  122. package/dist/lib/models/common/v1/response/ApiResponseMetadata.js +281 -344
  123. package/dist/lib/models/common/v1/response/ExternalizableAbstractModel.d.ts +1 -15
  124. package/dist/lib/models/common/v1/response/ExternalizableAbstractModel.js +155 -203
  125. package/dist/lib/models/common/v1/stats/DownSamplingOperator.js +7 -9
  126. package/dist/lib/models/common/v1/stats/TimeIntValuePair.d.ts +2 -8
  127. package/dist/lib/models/common/v1/stats/TimeIntValuePair.js +165 -206
  128. package/dist/lib/models/objects/v4/config/Certificate.d.ts +1 -58
  129. package/dist/lib/models/objects/v4/config/Certificate.js +319 -381
  130. package/dist/lib/models/objects/v4/config/CertificateProjection.d.ts +1 -1
  131. package/dist/lib/models/objects/v4/config/CertificateProjection.js +73 -102
  132. package/dist/lib/models/objects/v4/config/CreateCertificateApiResponse.d.ts +2 -45
  133. package/dist/lib/models/objects/v4/config/CreateCertificateApiResponse.js +185 -240
  134. package/dist/lib/models/objects/v4/config/CreateObjectstoreApiResponse.d.ts +2 -43
  135. package/dist/lib/models/objects/v4/config/CreateObjectstoreApiResponse.js +185 -240
  136. package/dist/lib/models/objects/v4/config/DeleteObjectstoreApiResponse.d.ts +2 -43
  137. package/dist/lib/models/objects/v4/config/DeleteObjectstoreApiResponse.js +185 -240
  138. package/dist/lib/models/objects/v4/config/GetCaApiResponse.d.ts +2 -43
  139. package/dist/lib/models/objects/v4/config/GetCaApiResponse.js +185 -240
  140. package/dist/lib/models/objects/v4/config/GetCertificateApiResponse.d.ts +2 -43
  141. package/dist/lib/models/objects/v4/config/GetCertificateApiResponse.js +185 -240
  142. package/dist/lib/models/objects/v4/config/GetObjectstoreApiResponse.d.ts +2 -45
  143. package/dist/lib/models/objects/v4/config/GetObjectstoreApiResponse.js +185 -240
  144. package/dist/lib/models/objects/v4/config/ListCertificatesApiResponse.d.ts +2 -43
  145. package/dist/lib/models/objects/v4/config/ListCertificatesApiResponse.js +211 -266
  146. package/dist/lib/models/objects/v4/config/ListObjectstoresApiResponse.d.ts +2 -43
  147. package/dist/lib/models/objects/v4/config/ListObjectstoresApiResponse.js +211 -266
  148. package/dist/lib/models/objects/v4/config/ObjectStore.d.ts +1 -96
  149. package/dist/lib/models/objects/v4/config/ObjectStore.js +628 -711
  150. package/dist/lib/models/objects/v4/config/ObjectStoreProjection.d.ts +1 -152
  151. package/dist/lib/models/objects/v4/config/ObjectStoreProjection.js +221 -238
  152. package/dist/lib/models/objects/v4/config/State.js +7 -9
  153. package/dist/lib/models/objects/v4/config/UpdateObjectstoreApiResponse.d.ts +2 -43
  154. package/dist/lib/models/objects/v4/config/UpdateObjectstoreApiResponse.js +185 -240
  155. package/dist/lib/models/objects/v4/error/AppMessage.d.ts +5 -15
  156. package/dist/lib/models/objects/v4/error/AppMessage.js +264 -313
  157. package/dist/lib/models/objects/v4/error/ErrorResponse.d.ts +2 -7
  158. package/dist/lib/models/objects/v4/error/ErrorResponse.js +174 -217
  159. package/dist/lib/models/objects/v4/error/SchemaValidationError.d.ts +2 -18
  160. package/dist/lib/models/objects/v4/error/SchemaValidationError.js +248 -299
  161. package/dist/lib/models/objects/v4/error/SchemaValidationErrorMessage.d.ts +2 -9
  162. package/dist/lib/models/objects/v4/error/SchemaValidationErrorMessage.js +190 -233
  163. package/dist/lib/models/objects/v4/stats/GetObjectstoreStatsApiResponse.d.ts +2 -43
  164. package/dist/lib/models/objects/v4/stats/GetObjectstoreStatsApiResponse.js +185 -240
  165. package/dist/lib/models/objects/v4/stats/ObjectstoreStats.d.ts +1 -169
  166. package/dist/lib/models/objects/v4/stats/ObjectstoreStats.js +957 -1129
  167. package/dist/lib/models/objects/v4/stats/TimeFloatValuePair.d.ts +2 -8
  168. package/dist/lib/models/objects/v4/stats/TimeFloatValuePair.js +165 -206
  169. package/dist/lib/models/prism/v4/config/TaskReference.d.ts +5 -10
  170. package/dist/lib/models/prism/v4/config/TaskReference.js +143 -182
  171. package/dist/lib/models/validation/ValidationError.js +26 -42
  172. package/dist/lib/models/validation/ValidationScopes.js +3 -3
  173. package/dist/lib/utils/ValidationUtils.js +39 -69
  174. package/package.json +2 -2
@@ -3,37 +3,22 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = void 0;
6
+ exports.default = void 0;
7
7
  var _MapOfStringWrapper = _interopRequireDefault(require("./MapOfStringWrapper"));
8
8
  var _ValidationScopes = _interopRequireDefault(require("../../../validation/ValidationScopes"));
9
9
  var _ValidationUtils = _interopRequireDefault(require("../../../../utils/ValidationUtils"));
10
10
  var _ValidationError = _interopRequireDefault(require("../../../validation/ValidationError"));
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
17
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
18
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
19
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
22
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
23
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
24
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
25
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
26
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
12
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
28
13
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
29
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"); } /*
30
15
  * Nutanix Objects Storage Management APIs
31
16
  *
32
- * OpenAPI spec version: 4.0.1
17
+ * OpenAPI spec version: 4.0.2
33
18
  *
34
19
  * NOTE: This class is auto generated by the Open API Dev Platform.
35
20
  *
36
- * Open API Dev Platform Codegen version: 16.9.1.8738-RELEASE
21
+ * Open API Dev Platform Codegen version: 17.5.0.10128-RELEASE
37
22
  *
38
23
  * Do not edit the class manually.
39
24
  *
@@ -41,18 +26,17 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
41
26
  /**
42
27
  * The KVPair model module.
43
28
  * @module Ntnx/KVPair
44
- * @version 4.0.1
29
+ * @version 4.0.2
45
30
  * @class KVPair
46
31
  */
47
32
  var _KVPair_brand = /*#__PURE__*/new WeakSet();
48
- var KVPair = exports["default"] = /*#__PURE__*/function () {
33
+ class KVPair {
49
34
  /**
50
35
  * Constructs a new <code>KVPair</code>.
51
36
  * A map describing a set of keys and their corresponding values.
52
37
  * @alias module:Ntnx/KVPair
53
38
  */
54
- function KVPair() {
55
- _classCallCheck(this, KVPair);
39
+ constructor() {
56
40
  /*
57
41
  * toJson method for a map type which supports map with primitive keys and values of object types
58
42
  * @param {Object} obj
@@ -77,278 +61,249 @@ var KVPair = exports["default"] = /*#__PURE__*/function () {
77
61
  * @param callFromChild {Boolean} Flag to recognise calling instance
78
62
  * @return {module:Ntnx/KVPair} The populated <code>KVPair</code> instance.
79
63
  */
80
- return _createClass(KVPair, [{
81
- key: "getName",
82
- value:
83
- /**
84
- * Returns The key of the key-value pair.
85
- * @return {string}
86
- */
87
- function getName() {
88
- return this.name;
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
+ }
89
151
  }
152
+ return obj;
153
+ }
90
154
 
91
- /**
92
- * Sets The key of the key-value pair.
93
- * @param {string} name The key of the key-value pair.
94
- */
95
- }, {
96
- key: "setName",
97
- value: function setName(name) {
98
- this.name = name;
99
- }
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
+ }
100
163
 
101
- /**
102
- * Returns The value associated with the key for this key-value pair
103
- * @return {string | Number | boolean | string[] | Object<string, string> | MapOfStringWrapper[] | integer[]}
104
- */
105
- }, {
106
- key: "getValue",
107
- value: function getValue() {
108
- return this.value;
109
- }
164
+ /**
165
+ * Returns The key of the key-value pair.
166
+ * @return {string}
167
+ */
168
+ getName() {
169
+ return this.name;
170
+ }
110
171
 
111
- /**
112
- * Sets The value associated with the key for this key-value pair
113
- * @param {string | Number | boolean | string[] | Object<string, string> | MapOfStringWrapper[] | integer[]} value The value associated with the key for this key-value pair
114
- */
115
- }, {
116
- key: "setValue",
117
- value: function setValue(value) {
118
- this.value = value;
119
- }
120
- }, {
121
- key: "get$Reserved",
122
- value: function get$Reserved() {
123
- return this.$reserved;
124
- }
125
- }, {
126
- key: "get$ObjectType",
127
- value: function get$ObjectType() {
128
- return this.$objectType;
129
- }
130
- }, {
131
- key: "get$UnknownFields",
132
- value: function get$UnknownFields() {
133
- return this.$unknownFields;
134
- }
135
- }, {
136
- key: "toJson",
137
- value: function toJson(forMutation) {
138
- if (forMutation === false) {
139
- return _objectSpread(_objectSpread(_objectSpread({}, typeof this.getName() !== 'undefined' && this.getName() !== null ? {
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 ? {
140
208
  'name': this.getName()
141
- } : {}), typeof this.getValue() !== 'undefined' && this.getValue() !== null ? {
142
- 'value': typeof this.getValue().toJson !== "undefined" ? this.getValue().toJson(false) : Array.isArray(this.getValue()) ? this.getValue().map(function (item) {
143
- return typeof item.toJson !== "undefined" ? item.toJson(false) : item;
144
- }) : _assertClassBrand(_KVPair_brand, this, _toJsonMapType).call(this, this.getValue(), false)
145
- } : {}), {}, {
146
- '$reserved': this.get$Reserved(),
147
- '$objectType': this.get$ObjectType(),
148
- '$unknownFields': this.get$UnknownFields()
149
- });
150
- }
151
- return _objectSpread(_objectSpread(_objectSpread({}, typeof this.getName() !== 'undefined' && this.getName() !== null ? {
152
- 'name': this.getName()
153
- } : {}), typeof this.getValue() !== 'undefined' && this.getValue() !== null ? {
154
- 'value': typeof this.getValue().toJson !== "undefined" ? this.getValue().toJson() : Array.isArray(this.getValue()) ? this.getValue().map(function (item) {
155
- return typeof item.toJson !== "undefined" ? item.toJson() : item;
156
- }) : _assertClassBrand(_KVPair_brand, this, _toJsonMapType).call(this, this.getValue())
157
- } : {}), {}, {
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
+ } : {}),
158
213
  '$reserved': this.get$Reserved(),
159
214
  '$objectType': this.get$ObjectType(),
160
- '$unknownFields': this.get$UnknownFields()
161
- });
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];
162
244
  }
163
- }, {
164
- key: "validate",
165
- value: function validate(scope, properties) {
166
- var _this = this;
167
- var propList = [];
168
- if (arguments.length === 0 || arguments.length === 1 && arguments[0] instanceof _ValidationScopes["default"]) {
169
- //cases validate() and validate(scope)
170
- propList = [];
171
- } else if (arguments.length === 1) {
172
- //case validate(properties)
173
- propList = arguments[0];
174
- scope = null;
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);
175
256
  } else {
176
- //case validate(scope, properties)
177
- propList = arguments[1];
257
+ resolve();
178
258
  }
179
- var res = [];
180
- var err = null;
181
- propList.forEach(function (property) {
182
- err = _this.validateProperty(property, scope);
183
- if (err) {
184
- res.push(err);
185
- }
186
- });
187
- return new Promise(function (resolve, reject) {
188
- if (res.length !== 0) {
189
- reject(err);
190
- } else {
191
- resolve();
192
- }
193
- });
194
- }
195
- }, {
196
- key: "validateProperty",
197
- value: function validateProperty(scope, property) {
198
- if (property === "name") {
199
- if (typeof this.name === 'undefined' || this.name === null) {
200
- return new _ValidationError["default"]("name", "undefined or null");
201
- }
202
- if (!_ValidationUtils["default"].validateMaxLength(this.name, 128)) {
203
- return new _ValidationError["default"]("name", "does not satisfy required maxLength constraint: 128");
204
- }
205
- if (!_ValidationUtils["default"].validateMinLength(this.name, 3)) {
206
- return new _ValidationError["default"]("name", "does not satisfy required minLength constraint: 3");
207
- }
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");
208
265
  }
209
- if (property === "value") {
210
- if (typeof this.value === 'undefined' || this.value === null) {
211
- return new _ValidationError["default"]("value", "undefined or null");
212
- }
266
+ if (!_ValidationUtils.default.validateMaxLength(this.name, 128)) {
267
+ return new _ValidationError.default("name", "does not satisfy required maxLength constraint: 128");
213
268
  }
214
- if (property === "$reserved") {
215
- if (typeof this.$reserved === 'undefined' || this.$reserved === null) {
216
- return new _ValidationError["default"]("$reserved", "undefined or null");
217
- }
269
+ if (!_ValidationUtils.default.validateMinLength(this.name, 3)) {
270
+ return new _ValidationError.default("name", "does not satisfy required minLength constraint: 3");
218
271
  }
219
- if (property === "$objectType") {
220
- if (typeof this.$objectType === 'undefined' || this.$objectType === null) {
221
- return new _ValidationError["default"]("$objectType", "undefined or null");
222
- }
272
+ }
273
+ if (property === "value") {
274
+ if (typeof this.value === 'undefined' || this.value === null) {
275
+ return new _ValidationError.default("value", "undefined or null");
223
276
  }
224
- if (property === "$unknownFields") {
225
- if (typeof this.$unknownFields === 'undefined' || this.$unknownFields === null) {
226
- return new _ValidationError["default"]("$unknownFields", "undefined or null");
227
- }
277
+ }
278
+ if (property === "$reserved") {
279
+ if (typeof this.$reserved === 'undefined' || this.$reserved === null) {
280
+ return new _ValidationError.default("$reserved", "undefined or null");
228
281
  }
229
- return new _ValidationError["default"](property, "no such property exists");
230
282
  }
231
- }], [{
232
- key: "constructFromObject",
233
- value: function constructFromObject(data) {
234
- var obj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
235
- var callFromChild = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
236
- var items, item, i, itemArr, discriminator;
237
- if (data) {
238
- obj = obj || new KVPair();
239
- if (data.hasOwnProperty('name') && data.name !== null && data.name !== undefined) {
240
- obj.setName(data['name']);
241
- }
242
- if (data.hasOwnProperty('value') && data.value !== null && data.value !== undefined) {
243
- if (Array.isArray(data['value'])) {
244
- if (data['value'].length === 0) {
245
- obj.setValue([]);
246
- } else {
247
- itemArr = [];
248
- items = data['value'];
249
- if (items[0].hasOwnProperty('$objectType')) {
250
- discriminator = items[0]['$objectType'];
251
- } else {
252
- discriminator = _typeof(items[0]);
253
- }
254
- for (i = 0; i < items.length; i++) {
255
- switch (discriminator) {
256
- case 'string':
257
- itemArr.push(items[i]);
258
- break;
259
- case 'common.v1.config.MapOfStringWrapper':
260
- item = _MapOfStringWrapper["default"].constructFromObject(items[i], undefined);
261
- itemArr.push(item);
262
- break;
263
- case 'integer':
264
- itemArr.push(items[i]);
265
- break;
266
- case 'number':
267
- itemArr.push(items[i]);
268
- break;
269
- default:
270
- throw "Unknown list of type " + discriminator + " in data";
271
- }
272
- }
273
- obj.setValue(itemArr);
274
- }
275
- } else {
276
- if (data['value'].hasOwnProperty('$objectType')) {
277
- discriminator = data['value']['$objectType'];
278
- } else {
279
- discriminator = _typeof(data['value']);
280
- }
281
- switch (discriminator) {
282
- case 'string':
283
- obj.setValue(data['value']);
284
- break;
285
- case 'boolean':
286
- obj.setValue(data['value']);
287
- break;
288
- case 'number':
289
- obj.setValue(data['value']);
290
- break;
291
- case 'object':
292
- obj.setValue(new Map(Object.entries(data['value'])));
293
- break;
294
- default:
295
- throw "Unknown datatype " + discriminator + " in data";
296
- }
297
- }
298
- }
299
- if (data.hasOwnProperty('$reserved')) {
300
- obj.$reserved = data['$reserved'];
301
- }
302
- if (data.hasOwnProperty('$objectType')) {
303
- obj.$objectType = data['$objectType'];
304
- }
305
- if (data.hasOwnProperty('$unknownFields')) {
306
- obj.$unknownFields = data['$unknownFields'];
307
- }
308
- if (!callFromChild) {
309
- obj.$unknownFields = _objectSpread({}, data.$unknownFields);
310
- for (var property in data) {
311
- // Check if the `property` is not already present in `obj` keys, either in snake_case or camelCase,
312
- // as the model's fields are generated in camelCase, but the server might return snake_case (e.g., due to standards like OIDC).
313
- // Also, ensure the `property` does not start with '$' and end with 'ItemDiscriminator'.
314
- // If all conditions are true, add the `property` from `data` to `obj.$unknownFields` as an unknown field.
315
- if (!Object.keys(obj).includes(property) && !Object.keys(obj).includes(this.snakeToCamel(property)) && !(property[0] === "$" && property.endsWith("ItemDiscriminator"))) {
316
- obj.$unknownFields[property] = data[property];
317
- }
318
- }
319
- }
283
+ if (property === "$objectType") {
284
+ if (typeof this.$objectType === 'undefined' || this.$objectType === null) {
285
+ return new _ValidationError.default("$objectType", "undefined or null");
320
286
  }
321
- return obj;
322
287
  }
323
-
324
- /**
325
- * Converts a given snake_case string to camelCase.
326
- * @param {string} snakeStr - The input string in snake_case format.
327
- * @returns {string} - The converted string in camelCase format.
328
- */
329
- }, {
330
- key: "snakeToCamel",
331
- value: function snakeToCamel(snakeStr) {
332
- return snakeStr.replace(/(_\w)/g, function (match) {
333
- return match[1].toUpperCase();
334
- });
288
+ if (property === "$unknownFields") {
289
+ if (typeof this.$unknownFields === 'undefined' || this.$unknownFields === null) {
290
+ return new _ValidationError.default("$unknownFields", "undefined or null");
291
+ }
335
292
  }
336
- }]);
337
- }();
293
+ return new _ValidationError.default(property, "no such property exists");
294
+ }
295
+ }
296
+
338
297
  /**
339
298
  * The key of the key-value pair.
340
299
  * @memberof KVPair
341
300
  */
301
+ exports.default = KVPair;
342
302
  function _toJsonMapType(obj, forMutation) {
343
303
  if (obj instanceof Map) {
344
- return Object.fromEntries(Array.from(obj, function (_ref) {
345
- var _ref2 = _slicedToArray(_ref, 2),
346
- k = _ref2[0],
347
- v = _ref2[1];
348
- return [k, typeof v.toJson !== "undefined" ? v.toJson(forMutation) : v];
349
- }));
350
- } else if (_typeof(obj) === 'object' && obj != null && obj.constructor === Object) {
351
- return Object.fromEntries(Array.from(Object.entries(obj), function (entry) {
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 => {
352
307
  return [entry[0], typeof entry[1].toJson !== "undefined" ? entry[1].toJson(forMutation) : entry[1]];
353
308
  }));
354
309
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The MapOfStringWrapper model module.
3
3
  * @module Ntnx/MapOfStringWrapper
4
- * @version 4.0.1
4
+ * @version 4.0.2
5
5
  * @class MapOfStringWrapper
6
6
  */
7
7
  export default class MapOfStringWrapper {
@@ -45,12 +45,7 @@ export default class MapOfStringWrapper {
45
45
  get$Reserved(): any;
46
46
  get$ObjectType(): string;
47
47
  get$UnknownFields(): any;
48
- toJson(forMutation: any): {
49
- $reserved: any;
50
- $objectType: string;
51
- $unknownFields: any;
52
- map?: any;
53
- };
48
+ toJson(forMutation: any): any;
54
49
  validate(scope: any, properties: any, ...args: any[]): Promise<any>;
55
50
  validateProperty(scope: any, property: any): ValidationError;
56
51
  #private;