diff --git a/.env b/.env
index dc85448fa..3b0585eb8 100644
--- a/.env
+++ b/.env
@@ -50,5 +50,5 @@ REACT_APP_SERVICES_RHSM_TALLY=/api/rhsm-subscriptions/v1/tally/products/{0}/{1}
REACT_APP_SERVICES_RHSM_CAPACITY=/api/rhsm-subscriptions/v1/capacity/products/{0}/{1}
REACT_APP_SERVICES_RHSM_INVENTORY_INSTANCES=/api/rhsm-subscriptions/v1/instances/products/
REACT_APP_SERVICES_RHSM_INVENTORY_INSTANCES_GUESTS=/api/rhsm-subscriptions/v1/instances/{0}/guests
-REACT_APP_SERVICES_RHSM_INVENTORY_SUBSCRIPTIONS=/api/rhsm-subscriptions/v1/subscriptions/products/
+REACT_APP_SERVICES_RHSM_INVENTORY_SUBSCRIPTIONS=/api/rhsm-subscriptions/v2/subscriptions/products/
REACT_APP_SERVICES_RHSM_OPTIN=/api/rhsm-subscriptions/v1/opt-in
diff --git a/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap b/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap
index 9460fc2ca..c57b25ee6 100644
--- a/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap
+++ b/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap
@@ -568,10 +568,6 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"key": "curiosity-inventory.measurement",
"match": "translate('curiosity-inventory.measurement', { context: (total && 'value')",
},
- {
- "key": "curiosity-inventory.header",
- "match": "translate('curiosity-inventory.header', { context: ['subscriptions', RHSM_API_PATH_METRIC_TYPES.CORES] })",
- },
{
"key": "curiosity-inventory.label",
"match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY, RHSM_API_PATH_METRIC_TYPES.CORES] })",
@@ -580,10 +576,6 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"key": "curiosity-inventory.measurement",
"match": "translate('curiosity-inventory.measurement', { context: (total && 'value')",
},
- {
- "key": "curiosity-inventory.header",
- "match": "translate('curiosity-inventory.header', { context: ['subscriptions', RHSM_API_PATH_METRIC_TYPES.SOCKETS] })",
- },
{
"key": "curiosity-inventory.label",
"match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY, RHSM_API_PATH_METRIC_TYPES.SOCKETS] })",
@@ -780,10 +772,6 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"key": "curiosity-inventory.measurement",
"match": "translate('curiosity-inventory.measurement', { context: (total && 'value')",
},
- {
- "key": "curiosity-inventory.header",
- "match": "translate('curiosity-inventory.header', { context: ['subscriptions', RHSM_API_PATH_METRIC_TYPES.SOCKETS] })",
- },
{
"key": "curiosity-inventory.label",
"match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY, RHSM_API_PATH_METRIC_TYPES.SOCKETS] })",
diff --git a/src/config/__tests__/__snapshots__/product.config.test.js.snap b/src/config/__tests__/__snapshots__/product.config.test.js.snap
index 34c9773b7..ff78295ec 100644
--- a/src/config/__tests__/__snapshots__/product.config.test.js.snap
+++ b/src/config/__tests__/__snapshots__/product.config.test.js.snap
@@ -5462,21 +5462,21 @@ exports[`Product specific configurations should apply variations in inventory fi
},
{
"cell": [Function],
- "content": "t(curiosity-inventory.header_subscriptions, {"context":"Cores"})",
+ "content": "t([curiosity-inventory.header_Cores,curiosity-inventory.guestsHeader_Cores], {"context":"OpenShift Container Platform"})",
"info": undefined,
"isWrap": true,
"label": [Function],
- "metric": "total_capacity",
+ "metric": "Cores",
"modifier": "wrap",
"width": 10,
},
{
"cell": [Function],
- "content": "t(curiosity-inventory.header_subscriptions, {"context":"Sockets"})",
+ "content": "t([curiosity-inventory.header_Sockets,curiosity-inventory.guestsHeader_Sockets], {"context":"OpenShift Container Platform"})",
"info": undefined,
"isWrap": true,
"label": [Function],
- "metric": "total_capacity",
+ "metric": "Sockets",
"modifier": "wrap",
"width": 10,
},
@@ -5540,18 +5540,34 @@ exports[`Product specific configurations should apply variations in inventory fi
title={null}
/>
,
- "dataLabel": "t(curiosity-inventory.header_subscriptions, {"context":"Cores"})",
+ "dataLabel": "t([curiosity-inventory.header_Cores,curiosity-inventory.guestsHeader_Cores], {"context":"OpenShift Container Platform"})",
"header": [Function],
"isWrap": true,
- "metric": "total_capacity",
+ "metric": "Cores",
"width": 10,
},
{
- "content": "t(curiosity-inventory.measurement, {"testId":{"type":"span","key":null,"ref":null,"props":{"data-test":"subscriptions-cell-total_capacity-Sockets","data-value":"undefined"},"_owner":null,"_store":{}}})",
- "dataLabel": "t(curiosity-inventory.header_subscriptions, {"context":"Sockets"})",
+ "content":
+
+ ,
+ "dataLabel": "t([curiosity-inventory.header_Sockets,curiosity-inventory.guestsHeader_Sockets], {"context":"OpenShift Container Platform"})",
"header": [Function],
"isWrap": true,
- "metric": "total_capacity",
+ "metric": "Sockets",
"width": 10,
},
{
@@ -5568,14 +5584,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -5715,14 +5729,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -5769,12 +5781,11 @@ exports[`Product specific configurations should apply variations in inventory fi
},
{
"cell": [Function],
- "content": "t(curiosity-inventory.header_subscriptions, {"context":"Sockets"})",
+ "content": "t([curiosity-inventory.header_Sockets,curiosity-inventory.guestsHeader_Sockets], {"context":"RHEL for x86"})",
"info": undefined,
- "isSort": true,
"isWrap": true,
"label": [Function],
- "metric": "total_capacity",
+ "metric": "Sockets",
"modifier": "wrap",
"width": undefined,
},
@@ -5821,12 +5832,27 @@ exports[`Product specific configurations should apply variations in inventory fi
"width": 10,
},
{
- "content": "t(curiosity-inventory.measurement, {"testId":{"type":"span","key":null,"ref":null,"props":{"data-test":"subscriptions-cell-total_capacity-Sockets","data-value":"undefined"},"_owner":null,"_store":{}}})",
- "dataLabel": "t(curiosity-inventory.header_subscriptions, {"context":"Sockets"})",
+ "content":
+
+ ,
+ "dataLabel": "t([curiosity-inventory.header_Sockets,curiosity-inventory.guestsHeader_Sockets], {"context":"RHEL for x86"})",
"header": [Function],
- "isSort": true,
"isWrap": true,
- "metric": "total_capacity",
+ "metric": "Sockets",
"width": undefined,
},
{
@@ -5843,14 +5869,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -5990,14 +6014,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -6137,14 +6159,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -6225,14 +6245,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -6295,21 +6313,21 @@ exports[`Product specific configurations should apply variations in inventory fi
},
{
"cell": [Function],
- "content": "t(curiosity-inventory.header_subscriptions, {"context":"Cores"})",
+ "content": "t([curiosity-inventory.header_Cores,curiosity-inventory.guestsHeader_Cores], {"context":"OpenShift Container Platform"})",
"info": undefined,
"isWrap": true,
"label": [Function],
- "metric": "total_capacity",
+ "metric": "Cores",
"modifier": "wrap",
"width": 10,
},
{
"cell": [Function],
- "content": "t(curiosity-inventory.header_subscriptions, {"context":"Sockets"})",
+ "content": "t([curiosity-inventory.header_Sockets,curiosity-inventory.guestsHeader_Sockets], {"context":"OpenShift Container Platform"})",
"info": undefined,
"isWrap": true,
"label": [Function],
- "metric": "total_capacity",
+ "metric": "Sockets",
"modifier": "wrap",
"width": 10,
},
@@ -6373,18 +6391,34 @@ exports[`Product specific configurations should apply variations in inventory fi
title={null}
/>
,
- "dataLabel": "t(curiosity-inventory.header_subscriptions, {"context":"Cores"})",
+ "dataLabel": "t([curiosity-inventory.header_Cores,curiosity-inventory.guestsHeader_Cores], {"context":"OpenShift Container Platform"})",
"header": [Function],
"isWrap": true,
- "metric": "total_capacity",
+ "metric": "Cores",
"width": 10,
},
{
- "content": "t(curiosity-inventory.measurement, {"testId":{"type":"span","key":null,"ref":null,"props":{"data-test":"subscriptions-cell-total_capacity-Sockets","data-value":"undefined"},"_owner":null,"_store":{}}})",
- "dataLabel": "t(curiosity-inventory.header_subscriptions, {"context":"Sockets"})",
+ "content":
+
+ ,
+ "dataLabel": "t([curiosity-inventory.header_Sockets,curiosity-inventory.guestsHeader_Sockets], {"context":"OpenShift Container Platform"})",
"header": [Function],
"isWrap": true,
- "metric": "total_capacity",
+ "metric": "Sockets",
"width": 10,
},
{
@@ -6401,14 +6435,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -6548,14 +6580,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -6602,12 +6632,11 @@ exports[`Product specific configurations should apply variations in inventory fi
},
{
"cell": [Function],
- "content": "t(curiosity-inventory.header_subscriptions, {"context":"Sockets"})",
+ "content": "t([curiosity-inventory.header_Sockets,curiosity-inventory.guestsHeader_Sockets], {"context":"RHEL for x86"})",
"info": undefined,
- "isSort": true,
"isWrap": true,
"label": [Function],
- "metric": "total_capacity",
+ "metric": "Sockets",
"modifier": "wrap",
"width": undefined,
},
@@ -6654,12 +6683,27 @@ exports[`Product specific configurations should apply variations in inventory fi
"width": 10,
},
{
- "content": "t(curiosity-inventory.measurement, {"testId":{"type":"span","key":null,"ref":null,"props":{"data-test":"subscriptions-cell-total_capacity-Sockets","data-value":"undefined"},"_owner":null,"_store":{}}})",
- "dataLabel": "t(curiosity-inventory.header_subscriptions, {"context":"Sockets"})",
+ "content":
+
+ ,
+ "dataLabel": "t([curiosity-inventory.header_Sockets,curiosity-inventory.guestsHeader_Sockets], {"context":"RHEL for x86"})",
"header": [Function],
- "isSort": true,
"isWrap": true,
- "metric": "total_capacity",
+ "metric": "Sockets",
"width": undefined,
},
{
@@ -6676,14 +6720,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -6823,14 +6865,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -6970,14 +7010,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
@@ -7058,14 +7096,12 @@ exports[`Product specific configurations should apply variations in inventory fi
"row": {
"Cores": 2000,
"billing_provider": "dolor sit",
- "hasInfiniteCores": true,
+ "has_infinite_quantity": true,
"loremIpsum": "hello world",
- "metric_id": "Cores",
"next_event_date": "2022-01-01T00:00:00.000Z",
"product_name": "lorem",
"quantity": 1,
"service_level": "hello world",
- "total_capacity": 2000,
},
},
],
diff --git a/src/config/__tests__/product.config.test.js b/src/config/__tests__/product.config.test.js
index bed17b80b..1376853ae 100644
--- a/src/config/__tests__/product.config.test.js
+++ b/src/config/__tests__/product.config.test.js
@@ -248,10 +248,8 @@ describe('Product specific configurations', () => {
[SUBSCRIPTIONS_INVENTORY_TYPES.NEXT_EVENT_DATE]: '2022-01-01T00:00:00.000Z',
[SUBSCRIPTIONS_INVENTORY_TYPES.QUANTITY]: 1,
[SUBSCRIPTIONS_INVENTORY_TYPES.SERVICE_LEVEL]: 'hello world',
- [SUBSCRIPTIONS_INVENTORY_TYPES.TOTAL_CAPACITY]: 2000,
- [SUBSCRIPTIONS_INVENTORY_TYPES.METRIC_ID]: 'Cores',
[RHSM_API_PATH_METRIC_TYPES.CORES]: 2000,
- [`hasInfinite${RHSM_API_PATH_METRIC_TYPES.CORES}`]: true,
+ [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY]: true,
loremIpsum: 'hello world'
}
]
diff --git a/src/config/product.openshiftContainer.js b/src/config/product.openshiftContainer.js
index 626ceb53f..3e13d322e 100644
--- a/src/config/product.openshiftContainer.js
+++ b/src/config/product.openshiftContainer.js
@@ -288,10 +288,11 @@ const config = {
width: 10
},
{
- metric: SUBSCRIPTIONS_INVENTORY_TYPES.TOTAL_CAPACITY,
- header: () =>
- translate('curiosity-inventory.header', { context: ['subscriptions', RHSM_API_PATH_METRIC_TYPES.CORES] }),
- cell: ({ hasInfiniteCores: hasInfiniteQuantity, [RHSM_API_PATH_METRIC_TYPES.CORES]: total } = {}) => {
+ metric: RHSM_API_PATH_METRIC_TYPES.CORES,
+ cell: ({
+ [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY]: hasInfiniteQuantity,
+ [RHSM_API_PATH_METRIC_TYPES.CORES]: total
+ } = {}) => {
if (hasInfiniteQuantity === true) {
const content = translate(`curiosity-inventory.label`, {
context: [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY, RHSM_API_PATH_METRIC_TYPES.CORES]
@@ -305,22 +306,18 @@ const config = {
return translate('curiosity-inventory.measurement', {
context: (total && 'value') || undefined,
total,
- testId: (
-
- )
+ testId:
});
},
isWrap: true,
width: 10
},
{
- metric: SUBSCRIPTIONS_INVENTORY_TYPES.TOTAL_CAPACITY,
- header: () =>
- translate('curiosity-inventory.header', { context: ['subscriptions', RHSM_API_PATH_METRIC_TYPES.SOCKETS] }),
- cell: ({ hasInfiniteSockets: hasInfiniteQuantity, [RHSM_API_PATH_METRIC_TYPES.SOCKETS]: total } = {}) => {
+ metric: RHSM_API_PATH_METRIC_TYPES.SOCKETS,
+ cell: ({
+ [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY]: hasInfiniteQuantity,
+ [RHSM_API_PATH_METRIC_TYPES.SOCKETS]: total
+ } = {}) => {
if (hasInfiniteQuantity === true) {
const content = translate(`curiosity-inventory.label`, {
context: [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY, RHSM_API_PATH_METRIC_TYPES.SOCKETS]
@@ -335,10 +332,7 @@ const config = {
context: (total && 'value') || undefined,
total,
testId: (
-
+
)
});
},
diff --git a/src/config/product.rhel.js b/src/config/product.rhel.js
index 8e3752a21..2c24a497a 100644
--- a/src/config/product.rhel.js
+++ b/src/config/product.rhel.js
@@ -315,10 +315,11 @@ const config = {
width: 10
},
{
- metric: SUBSCRIPTIONS_INVENTORY_TYPES.TOTAL_CAPACITY,
- header: () =>
- translate('curiosity-inventory.header', { context: ['subscriptions', RHSM_API_PATH_METRIC_TYPES.SOCKETS] }),
- cell: ({ hasInfiniteSockets: hasInfiniteQuantity, [RHSM_API_PATH_METRIC_TYPES.SOCKETS]: total } = {}) => {
+ metric: RHSM_API_PATH_METRIC_TYPES.SOCKETS,
+ cell: ({
+ [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY]: hasInfiniteQuantity,
+ [RHSM_API_PATH_METRIC_TYPES.SOCKETS]: total
+ } = {}) => {
if (hasInfiniteQuantity === true) {
const content = translate(`curiosity-inventory.label`, {
context: [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY, RHSM_API_PATH_METRIC_TYPES.SOCKETS]
@@ -333,14 +334,10 @@ const config = {
context: (total && 'value') || undefined,
total,
testId: (
-
+
)
});
},
- isSort: true,
isWrap: true
},
{
diff --git a/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap b/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap
index abff728f3..d6b6268ec 100644
--- a/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap
+++ b/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap
@@ -218,17 +218,16 @@ exports[`RHSM Constants should have specific properties: all exported constants
"INVENTORY_ID": "inventory_id",
"LAST_SEEN": "last_seen",
"MEASUREMENTS": "measurements",
- "METRIC_ID": "metric_id",
"NEXT_EVENT_DATE": "next_event_date",
"NUMBER_OF_GUESTS": "number_of_guests",
"PRODUCT_NAME": "product_name",
"QUANTITY": "quantity",
"SERVICE_LEVEL": "service_level",
"SUBSCRIPTION_MANAGER_ID": "subscription_manager_id",
- "TOTAL_CAPACITY": "total_capacity",
},
"RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES": {
"COUNT": "count",
+ "MEASUREMENTS": "measurements",
"PRODUCT": "product",
"SUBSCRIPTION_TYPE": "subscription_type",
},
@@ -483,17 +482,16 @@ exports[`RHSM Constants should have specific properties: all exported constants
"INVENTORY_ID": "inventory_id",
"LAST_SEEN": "last_seen",
"MEASUREMENTS": "measurements",
- "METRIC_ID": "metric_id",
"NEXT_EVENT_DATE": "next_event_date",
"NUMBER_OF_GUESTS": "number_of_guests",
"PRODUCT_NAME": "product_name",
"QUANTITY": "quantity",
"SERVICE_LEVEL": "service_level",
"SUBSCRIPTION_MANAGER_ID": "subscription_manager_id",
- "TOTAL_CAPACITY": "total_capacity",
},
"RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES": {
"COUNT": "count",
+ "MEASUREMENTS": "measurements",
"PRODUCT": "product",
"SUBSCRIPTION_TYPE": "subscription_type",
},
@@ -749,17 +747,16 @@ exports[`RHSM Constants should have specific properties: all exported constants
"INVENTORY_ID": "inventory_id",
"LAST_SEEN": "last_seen",
"MEASUREMENTS": "measurements",
- "METRIC_ID": "metric_id",
"NEXT_EVENT_DATE": "next_event_date",
"NUMBER_OF_GUESTS": "number_of_guests",
"PRODUCT_NAME": "product_name",
"QUANTITY": "quantity",
"SERVICE_LEVEL": "service_level",
"SUBSCRIPTION_MANAGER_ID": "subscription_manager_id",
- "TOTAL_CAPACITY": "total_capacity",
},
"RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES": {
"COUNT": "count",
+ "MEASUREMENTS": "measurements",
"PRODUCT": "product",
"SUBSCRIPTION_TYPE": "subscription_type",
},
@@ -1019,17 +1016,16 @@ exports[`RHSM Constants should have specific properties: specific constants 1`]
"INVENTORY_ID": "inventory_id",
"LAST_SEEN": "last_seen",
"MEASUREMENTS": "measurements",
- "METRIC_ID": "metric_id",
"NEXT_EVENT_DATE": "next_event_date",
"NUMBER_OF_GUESTS": "number_of_guests",
"PRODUCT_NAME": "product_name",
"QUANTITY": "quantity",
"SERVICE_LEVEL": "service_level",
"SUBSCRIPTION_MANAGER_ID": "subscription_manager_id",
- "TOTAL_CAPACITY": "total_capacity",
},
"RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES": {
"COUNT": "count",
+ "MEASUREMENTS": "measurements",
"PRODUCT": "product",
"SUBSCRIPTION_TYPE": "subscription_type",
},
diff --git a/src/services/rhsm/__tests__/__snapshots__/rhsmTransformers.test.js.snap b/src/services/rhsm/__tests__/__snapshots__/rhsmTransformers.test.js.snap
index 211cf0a8a..50fcd311e 100644
--- a/src/services/rhsm/__tests__/__snapshots__/rhsmTransformers.test.js.snap
+++ b/src/services/rhsm/__tests__/__snapshots__/rhsmTransformers.test.js.snap
@@ -399,75 +399,71 @@ exports[`RHSM Transformers should attempt to parse a guests response: guests, fa
}
`;
-exports[`RHSM Transformers should attempt to parse a subscriptions response: subscriptions, failed 1`] = `
+exports[`RHSM Transformers should attempt to parse a subscriptions response: subscriptions 1`] = `
{
- "data": [],
+ "data": [
+ {
+ "a": 0.0003456,
+ "b": 2,
+ "c": 1000,
+ },
+ ],
"meta": {
"count": undefined,
+ "lorem": "ipsum",
+ "measurements": [
+ "c",
+ "a",
+ "b",
+ ],
"productId": undefined,
},
}
`;
-exports[`RHSM Transformers should attempt to parse a subscriptions response: subscriptions, metric_id cores 1`] = `
+exports[`RHSM Transformers should attempt to parse a subscriptions response: subscriptions, failed 1`] = `
{
- "data": [
- {
- "Cores": undefined,
- "hasInfiniteCores": undefined,
- "has_infinite_quantity": undefined,
- "metric_id": "Cores",
- "total_capacity": undefined,
- },
- ],
+ "data": [],
"meta": {
"count": undefined,
- "lorem": "ipsum",
"productId": undefined,
},
}
`;
-exports[`RHSM Transformers should attempt to parse a subscriptions response: subscriptions, metric_id sockets as parameter 1`] = `
+exports[`RHSM Transformers should attempt to parse a subscriptions response: subscriptions, metric_id cores 1`] = `
{
"data": [
{
- "Cores": undefined,
- "hasInfiniteCores": undefined,
- "has_infinite_quantity": undefined,
- "metric_id": "Cores",
- "total_capacity": undefined,
+ "Cores": 2000,
},
],
"meta": {
"count": undefined,
- "lorem": "ipsum",
+ "measurements": [
+ [
+ "Cores",
+ ],
+ ],
"productId": undefined,
},
}
`;
-exports[`RHSM Transformers should attempt to parse a subscriptions response: subscriptions, metric_id sockets, cores response 1`] = `
+exports[`RHSM Transformers should attempt to parse a subscriptions response: subscriptions, metric_id sockets 1`] = `
{
"data": [
{
- "Cores": undefined,
- "hasInfiniteCores": undefined,
- "has_infinite_quantity": undefined,
- "metric_id": "Cores",
- "total_capacity": undefined,
- },
- {
- "Sockets": undefined,
- "hasInfiniteSockets": undefined,
- "has_infinite_quantity": undefined,
- "metric_id": "Sockets",
- "total_capacity": undefined,
+ "Sockets": 1000,
},
],
"meta": {
"count": undefined,
- "lorem": "ipsum",
+ "measurements": [
+ [
+ "Sockets",
+ ],
+ ],
"productId": undefined,
},
}
@@ -885,27 +881,7 @@ exports[`RHSM Transformers should attempt to parse an instances response: instan
{
"data": [
{
- "a": 0.0003456,
- "b": 2,
- "c": 1000,
- "numberOfGuests": undefined,
- "number_of_guests": undefined,
- },
- ],
- "meta": {
- "count": undefined,
- "productId": undefined,
- },
-}
-`;
-
-exports[`RHSM Transformers should attempt to parse an instances response: instances, metric_id cores as parameter 1`] = `
-{
- "data": [
- {
- "a": 0.0003456,
- "b": 2,
- "c": 1000,
+ "Cores": 2000,
"numberOfGuests": undefined,
"number_of_guests": undefined,
},
@@ -921,27 +897,7 @@ exports[`RHSM Transformers should attempt to parse an instances response: instan
{
"data": [
{
- "a": 0.0003456,
- "b": 2,
- "c": 1000,
- "numberOfGuests": undefined,
- "number_of_guests": undefined,
- },
- ],
- "meta": {
- "count": undefined,
- "productId": undefined,
- },
-}
-`;
-
-exports[`RHSM Transformers should attempt to parse an instances response: instances, metric_id sockets as parameter 1`] = `
-{
- "data": [
- {
- "a": 0.0003456,
- "b": 2,
- "c": 1000,
+ "Sockets": 1000,
"numberOfGuests": undefined,
"number_of_guests": undefined,
},
diff --git a/src/services/rhsm/__tests__/rhsmTransformers.test.js b/src/services/rhsm/__tests__/rhsmTransformers.test.js
index 19803d50b..d67830007 100644
--- a/src/services/rhsm/__tests__/rhsmTransformers.test.js
+++ b/src/services/rhsm/__tests__/rhsmTransformers.test.js
@@ -218,57 +218,49 @@ describe('RHSM Transformers', () => {
it('should attempt to parse an instances response', () => {
expect(rhsmTransformers.instances(undefined)).toMatchSnapshot('instances, failed');
- const response = {
- [rhsmConstants.RHSM_API_RESPONSE_DATA]: [
- {
- [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_DATA_TYPES.MEASUREMENTS]: [1000, 0.0003456, 2]
- }
- ],
- [rhsmConstants.RHSM_API_RESPONSE_META]: {
- [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_META_TYPES.MEASUREMENTS]: ['c', 'a', 'b'],
- lorem: 'ipsum'
- }
- };
-
- expect(rhsmTransformers.instances(response)).toMatchSnapshot('instances');
-
expect(
rhsmTransformers.instances({
- ...response
- })
- ).toMatchSnapshot('instances, metric_id sockets');
-
- expect(
- rhsmTransformers.instances(
- {
- ...response
- },
- {
- params: {
- [rhsmConstants.RHSM_API_QUERY_SET_INVENTORY_TYPES.METRIC_ID]: 'Sockets'
+ [rhsmConstants.RHSM_API_RESPONSE_DATA]: [
+ {
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_DATA_TYPES.MEASUREMENTS]: [1000, 0.0003456, 2]
}
+ ],
+ [rhsmConstants.RHSM_API_RESPONSE_META]: {
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_META_TYPES.MEASUREMENTS]: ['c', 'a', 'b'],
+ lorem: 'ipsum'
}
- )
- ).toMatchSnapshot('instances, metric_id sockets as parameter');
+ })
+ ).toMatchSnapshot('instances');
expect(
rhsmTransformers.instances({
- ...response
+ [rhsmConstants.RHSM_API_RESPONSE_DATA]: [
+ {
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_DATA_TYPES.MEASUREMENTS]: [1000]
+ }
+ ],
+ [rhsmConstants.RHSM_API_RESPONSE_META]: {
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_META_TYPES.MEASUREMENTS]: [
+ [rhsmConstants.RHSM_API_PATH_METRIC_TYPES.SOCKETS]
+ ]
+ }
})
- ).toMatchSnapshot('instances, metric_id cores');
+ ).toMatchSnapshot('instances, metric_id sockets');
expect(
- rhsmTransformers.instances(
- {
- ...response
- },
- {
- params: {
- [rhsmConstants.RHSM_API_QUERY_SET_INVENTORY_TYPES.METRIC_ID]: 'Cores'
+ rhsmTransformers.instances({
+ [rhsmConstants.RHSM_API_RESPONSE_DATA]: [
+ {
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_DATA_TYPES.MEASUREMENTS]: [2000]
}
+ ],
+ [rhsmConstants.RHSM_API_RESPONSE_META]: {
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_META_TYPES.MEASUREMENTS]: [
+ [rhsmConstants.RHSM_API_PATH_METRIC_TYPES.CORES]
+ ]
}
- )
- ).toMatchSnapshot('instances, metric_id cores as parameter');
+ })
+ ).toMatchSnapshot('instances, metric_id cores');
});
it('should attempt to parse a guests response', () => {
@@ -336,47 +328,49 @@ describe('RHSM Transformers', () => {
it('should attempt to parse a subscriptions response', () => {
expect(rhsmTransformers.subscriptions(undefined)).toMatchSnapshot('subscriptions, failed');
- const response = {
- [rhsmConstants.RHSM_API_RESPONSE_DATA]: [
- {
- [rhsmConstants.RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES.METRIC_ID]: 'Cores'
+ expect(
+ rhsmTransformers.subscriptions({
+ [rhsmConstants.RHSM_API_RESPONSE_DATA]: [
+ {
+ [rhsmConstants.RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES.MEASUREMENTS]: [1000, 0.0003456, 2]
+ }
+ ],
+ [rhsmConstants.RHSM_API_RESPONSE_META]: {
+ [rhsmConstants.RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES.MEASUREMENTS]: ['c', 'a', 'b'],
+ lorem: 'ipsum'
}
- ],
- [rhsmConstants.RHSM_API_RESPONSE_META]: {
- lorem: 'ipsum'
- }
- };
-
- expect(rhsmTransformers.subscriptions(response)).toMatchSnapshot('subscriptions, metric_id cores');
+ })
+ ).toMatchSnapshot('subscriptions');
expect(
- rhsmTransformers.subscriptions(
- {
- ...response
- },
- {
- params: {
- [rhsmConstants.RHSM_API_QUERY_SET_INVENTORY_TYPES.METRIC_ID]: 'sockets'
+ rhsmTransformers.subscriptions({
+ [rhsmConstants.RHSM_API_RESPONSE_DATA]: [
+ {
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_DATA_TYPES.MEASUREMENTS]: [1000]
}
+ ],
+ [rhsmConstants.RHSM_API_RESPONSE_META]: {
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_META_TYPES.MEASUREMENTS]: [
+ [rhsmConstants.RHSM_API_PATH_METRIC_TYPES.SOCKETS]
+ ]
}
- )
- ).toMatchSnapshot('subscriptions, metric_id sockets as parameter');
+ })
+ ).toMatchSnapshot('subscriptions, metric_id sockets');
expect(
rhsmTransformers.subscriptions({
[rhsmConstants.RHSM_API_RESPONSE_DATA]: [
{
- [rhsmConstants.RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES.METRIC_ID]: 'Cores'
- },
- {
- [rhsmConstants.RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES.METRIC_ID]: 'Sockets'
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_DATA_TYPES.MEASUREMENTS]: [2000]
}
],
[rhsmConstants.RHSM_API_RESPONSE_META]: {
- lorem: 'ipsum'
+ [rhsmConstants.RHSM_API_RESPONSE_INSTANCES_META_TYPES.MEASUREMENTS]: [
+ [rhsmConstants.RHSM_API_PATH_METRIC_TYPES.CORES]
+ ]
}
})
- ).toMatchSnapshot('subscriptions, metric_id sockets, cores response');
+ ).toMatchSnapshot('subscriptions, metric_id cores');
});
it('should attempt to parse a tally response', () => {
diff --git a/src/services/rhsm/rhsmConstants.js b/src/services/rhsm/rhsmConstants.js
index 173676ace..5f8ec087a 100644
--- a/src/services/rhsm/rhsmConstants.js
+++ b/src/services/rhsm/rhsmConstants.js
@@ -175,9 +175,9 @@ const RHSM_API_RESPONSE_INSTANCES_META_TYPES = {
* RHSM response Subscriptions DATA types.
*
* @type {{BILLING_ACCOUNT_ID: string, QUANTITY: string, SUBSCRIPTION_MANAGER_ID: string, INVENTORY_ID: string,
- * NUMBER_OF_GUESTS: string, METRIC_ID: string, HAS_INFINITE_QUANTITY: string, TOTAL_CAPACITY: string,
- * PRODUCT_NAME: string, SERVICE_LEVEL: string, DISPLAY_NAME: string, INSTANCE_ID: string, MEASUREMENTS: string,
- * CATEGORY: string, NEXT_EVENT_DATE: string, BILLING_PROVIDER: string, CLOUD_PROVIDER: string, LAST_SEEN:
+ * NUMBER_OF_GUESTS: string, HAS_INFINITE_QUANTITY: string, PRODUCT_NAME: string, SERVICE_LEVEL: string,
+ * DISPLAY_NAME: string, INSTANCE_ID: string, MEASUREMENTS: string, CATEGORY: string, NEXT_EVENT_DATE: string,
+ * BILLING_PROVIDER: string, CLOUD_PROVIDER: string, LAST_SEEN:
* string}}
*/
const RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES = {
@@ -186,18 +186,16 @@ const RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES = {
NEXT_EVENT_DATE: 'next_event_date',
PRODUCT_NAME: 'product_name',
QUANTITY: 'quantity',
- SERVICE_LEVEL: 'service_level',
- TOTAL_CAPACITY: 'total_capacity',
- METRIC_ID: 'metric_id'
+ SERVICE_LEVEL: 'service_level'
};
/**
* RHSM response Subscriptions META types.
*
- * @type {{PRODUCT: string, SUBSCRIPTION_TYPE: string, COUNT: string}}
+ * @type {{MEASUREMENTS: string, PRODUCT: string, SUBSCRIPTION_TYPE: string, COUNT: string}}
*/
const RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES = {
- ...RHSM_API_RESPONSE_META_TYPES,
+ ...RHSM_API_RESPONSE_INSTANCES_META_TYPES,
SUBSCRIPTION_TYPE: 'subscription_type'
};
@@ -432,36 +430,38 @@ const RHSM_INTERNAL_PRODUCT_DISPLAY_TYPES = {
*
* @type {{RHSM_API_QUERY_SET_TALLY_CAPACITY_TYPES: {GRANULARITY: string, USAGE: string, CATEGORY: string,
* END_DATE: string, SLA: string, START_DATE: string, BILLING_PROVIDER: string, USE_RUNNING_TOTALS_FORMAT: string,
- * BILLING_CATEGORY: string}, RHSM_API_RESPONSE_DATA: string, RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES: {PRODUCT:
- * string, SUBSCRIPTION_TYPE: string, COUNT: string}, RHSM_API_PATH_PRODUCT_VARIANT_SATELLITE_TYPES:
- * {SATELLITE_SERVER: string, SATELLITE_CAPSULE: string}, RHSM_API_PATH_METRIC_TYPES: {CORES: string,
- * STORAGE_GIBIBYTES: string, SOCKETS: string, INSTANCE_HOURS: string, TRANSFER_GIBIBYTES: string, VCPUS: string,
- * CORE_SECONDS: string, STORAGE_GIBIBYTE_MONTHS: string}, RHSM_API_RESPONSE_INSTANCES_META_TYPES: {MEASUREMENTS:
- * string, PRODUCT: string, COUNT: string}, RHSM_API_RESPONSE_INSTANCES_DATA_TYPES: {MEASUREMENTS: string,
- * BILLING_ACCOUNT_ID: string, CATEGORY: string, SUBSCRIPTION_MANAGER_ID: string, INVENTORY_ID: string,
- * NUMBER_OF_GUESTS: string, BILLING_PROVIDER: string, DISPLAY_NAME: string, CLOUD_PROVIDER: string, INSTANCE_ID:
- * string, LAST_SEEN: string}, RHSM_API_RESPONSE_SLA_TYPES: {PREMIUM: string, SELF: string, NONE: string, STANDARD:
- * string}, RHSM_API_PATH_PRODUCT_VARIANT_RHEL_ELS_TYPES: {RHEL_X86_ELS_PAYG_ADDON: string, RHEL_X86_ELS_PAYG:
- * string}, RHSM_API_RESPONSE_META_TYPES: {PRODUCT: string, COUNT: string}, RHSM_API_RESPONSE_ERRORS_CODE_TYPES:
- * {GENERIC: string, OPTIN: string}, RHSM_API_QUERY_GRANULARITY_TYPES: {WEEKLY: string, QUARTERLY: string, DAILY:
- * string, MONTHLY: string}, RHSM_API_PATH_PRODUCT_VARIANT_RHEL_TYPES: {RHEL_ARM: string, RHEL_X86_RS: string,
+ * BILLING_CATEGORY: string}, RHSM_API_RESPONSE_DATA: string, RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES:
+ * {MEASUREMENTS: string, PRODUCT: string, SUBSCRIPTION_TYPE: string, COUNT: string},
+ * RHSM_API_PATH_PRODUCT_VARIANT_SATELLITE_TYPES: {SATELLITE_SERVER: string, SATELLITE_CAPSULE: string},
+ * RHSM_API_PATH_METRIC_TYPES: {CORES: string, STORAGE_GIBIBYTES: string, SOCKETS: string, INSTANCE_HOURS: string,
+ * TRANSFER_GIBIBYTES: string, VCPUS: string, CORE_SECONDS: string, STORAGE_GIBIBYTE_MONTHS: string},
+ * RHSM_API_RESPONSE_INSTANCES_META_TYPES: {MEASUREMENTS: string, PRODUCT: string, COUNT: string},
+ * RHSM_API_RESPONSE_INSTANCES_DATA_TYPES: {MEASUREMENTS: string, BILLING_ACCOUNT_ID: string, CATEGORY: string,
+ * SUBSCRIPTION_MANAGER_ID: string, INVENTORY_ID: string, NUMBER_OF_GUESTS: string, BILLING_PROVIDER: string,
+ * DISPLAY_NAME: string, CLOUD_PROVIDER: string, INSTANCE_ID: string, LAST_SEEN: string},
+ * RHSM_API_RESPONSE_SLA_TYPES: {PREMIUM: string, SELF: string, NONE: string, STANDARD: string},
+ * RHSM_API_PATH_PRODUCT_VARIANT_RHEL_ELS_TYPES: {RHEL_X86_ELS_PAYG_ADDON: string, RHEL_X86_ELS_PAYG: string},
+ * RHSM_API_RESPONSE_META_TYPES: {PRODUCT: string, COUNT: string}, RHSM_API_RESPONSE_ERRORS_CODE_TYPES: {GENERIC:
+ * string, OPTIN: string}, RHSM_API_QUERY_GRANULARITY_TYPES: {WEEKLY: string, QUARTERLY: string, DAILY: string,
+ * MONTHLY: string}, RHSM_API_PATH_PRODUCT_VARIANT_RHEL_TYPES: {RHEL_ARM: string, RHEL_X86_RS: string,
* RHEL_X86_ELS_UNCONVERTED: string, RHEL_X86_EUS: string, RHEL_X86_HA: string, RHEL_X86_SAP: string, RHEL_IBM_Z:
* string, RHEL_IBM_POWER: string, RHEL_X86: string}, RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES:
* {BILLING_ACCOUNT_ID: string, QUANTITY: string, SUBSCRIPTION_MANAGER_ID: string, INVENTORY_ID: string,
- * NUMBER_OF_GUESTS: string, METRIC_ID: string, HAS_INFINITE_QUANTITY: string, TOTAL_CAPACITY: string,
- * PRODUCT_NAME: string, SERVICE_LEVEL: string, DISPLAY_NAME: string, INSTANCE_ID: string, MEASUREMENTS: string,
- * CATEGORY: string, NEXT_EVENT_DATE: string, BILLING_PROVIDER: string, CLOUD_PROVIDER: string, LAST_SEEN: string},
+ * NUMBER_OF_GUESTS: string, HAS_INFINITE_QUANTITY: string, PRODUCT_NAME: string, SERVICE_LEVEL: string,
+ * DISPLAY_NAME: string, INSTANCE_ID: string, MEASUREMENTS: string, CATEGORY: string, NEXT_EVENT_DATE: string,
+ * BILLING_PROVIDER: string, CLOUD_PROVIDER: string, LAST_SEEN: string},
* RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES: {ASCENDING: string, DESCENDING: string},
* RHSM_API_RESPONSE_SUBSCRIPTION_TYPES: {ANNUAL: string, ON_DEMAND: string}, RHSM_API_QUERY_INVENTORY_SORT_TYPES:
* {CORES: string, SOCKETS: string, INSTANCE_HOURS: string, NUMBER_OF_GUESTS: string, CORE_SECONDS: string, NAME:
* string, STORAGE_GIBIBYTES: string, CATEGORY: string, TRANSFER_GIBIBYTES: string, VCPUS: string,
* BILLING_PROVIDER: string, STORAGE_GIBIBYTE_MONTHS: string, LAST_SEEN: string}, RHSM_API_PATH_PRODUCT_TYPES:
- * {RHEL_ARM: string, OPENSHIFT_METRICS: string, RHEL_X86_EUS: string, RHEL_WORKSTATION: string, RHEL_X86_SAP:
- * string, RHODS: string, ROSA: string, RHEL_X86: string, RHEL_COMPUTE_NODE: string, RHEL_X86_ELS_PAYG: string,
- * OPENSHIFT: string, RHEL_X86_RS: string, SATELLITE_SERVER: string, RHEL_X86_ELS_PAYG_ADDON: string,
- * OPENSHIFT_DEDICATED_METRICS: string, RHEL_X86_HA: string, SATELLITE_CAPSULE: string, RHEL_IBM_Z: string,
- * RHEL_IBM_POWER: string, RHACS: string}, RHSM_API_RESPONSE_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: string,
- * RED_HAT: string, NONE: string, AWS: string, ORACLE: string}, RHSM_API_RESPONSE_ERRORS_TYPES: {CODE: string},
+ * {RHEL_ARM: string, OPENSHIFT_METRICS: string, RHEL_X86_ELS_UNCONVERTED: string, RHEL_X86_EUS: string,
+ * RHEL_WORKSTATION: string, RHEL_X86_SAP: string, RHODS: string, ROSA: string, RHEL_X86: string,
+ * RHEL_COMPUTE_NODE: string, RHEL_X86_ELS_PAYG: string, OPENSHIFT: string, RHEL_X86_RS: string, SATELLITE_SERVER:
+ * string, RHEL_X86_ELS_PAYG_ADDON: string, OPENSHIFT_DEDICATED_METRICS: string, RHEL_X86_HA: string,
+ * SATELLITE_CAPSULE: string, RHEL_IBM_Z: string, RHEL_IBM_POWER: string, RHACS: string},
+ * RHSM_API_RESPONSE_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: string, RED_HAT: string, NONE: string, AWS:
+ * string, ORACLE: string}, RHSM_API_RESPONSE_ERRORS_TYPES: {CODE: string},
* RHSM_API_RESPONSE_TALLY_CAPACITY_DATA_TYPES: {DATE: string, HAS_DATA: string, VALUE: string,
* HAS_INFINITE_QUANTITY: string}, RHSM_API_RESPONSE_TALLY_CAPACITY_META_TYPES: {TOTAL_MONTHLY: string, DATE:
* string, PRODUCT: string, HAS_CLOUDIGRADE_DATA: string, HAS_CLOUDIGRADE_MISMATCH: string, HAS_DATA: string,
diff --git a/src/services/rhsm/rhsmServices.js b/src/services/rhsm/rhsmServices.js
index cf60016d8..2b8f4ef1c 100644
--- a/src/services/rhsm/rhsmServices.js
+++ b/src/services/rhsm/rhsmServices.js
@@ -14,7 +14,7 @@ import { rhsmTransformers } from './rhsmTransformers';
* @api {get} /api/rhsm-subscriptions/v1/version
* @apiDescription Retrieve API version information
*
- * Reference [RHSM API](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml)
+ * Reference [RHSM API](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-v1-spec.yaml)
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
@@ -1231,7 +1231,7 @@ const getGraphTally = (id, params = {}, options = {}) => {
* @api {get} /api/rhsm-subscriptions/v1/capacity/products/:product_id/:metric_id Get RHSM graph capacity data
* @apiDescription Retrieve graph capacity data, such as thresholds.
*
- * Reference [RHSM for capacity params and commands](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml)
+ * Reference [RHSM for capacity params and commands](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-v1-spec.yaml)
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
@@ -1529,7 +1529,7 @@ const getGraphCapacity = (id, params = {}, options = {}) => {
* @api {get} /api/rhsm-subscriptions/v1/instances/:instance_id/guests Get RHSM instances/systems inventory guests data
* @apiDescription Retrieve instances/systems table/inventory guests data.
*
- * Reference [RHSM for instances guests](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml)
+ * Reference [RHSM for instances guests](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-v1-spec.yaml)
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
@@ -1672,7 +1672,7 @@ const getInstancesInventoryGuests = (id, params = {}, options = {}) => {
* @api {get} /api/rhsm-subscriptions/v1/instances/products/:product_id Get RHSM instances table/inventory data
* @apiDescription Retrieve instances table/inventory data.
*
- * Reference [RHSM for instances table/inventory](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml)
+ * Reference [RHSM for instances table/inventory](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-v1-spec.yaml)
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
@@ -1830,10 +1830,10 @@ const getInstancesInventory = (id, params = {}, options = {}) => {
/**
* @apiMock {DelayResponse} 0
- * @api {get} /api/rhsm-subscriptions/v1/subscriptions/products/:product_id Get RHSM subscriptions table/inventory data
+ * @api {get} /api/rhsm-subscriptions/v2/subscriptions/products/:product_id Get RHSM subscriptions table/inventory data
* @apiDescription Retrieve subscriptions table/inventory data.
*
- * Reference [RHSM for subscriptions table/inventory](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml)
+ * Reference [RHSM for subscriptions table/inventory](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-v2-spec.yaml)
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
@@ -1853,10 +1853,11 @@ const getInstancesInventory = (id, params = {}, options = {}) => {
* "next_event_date": "2020-04-01T00:00:00Z",
* "next_event_type": "Subscription Begin",
* "quantity": 1,
- * "physical_capacity": 1,
- * "virtual_capacity": 1,
- * "total_capacity": 2,
- * "metric_id": "Sockets",
+ * "measurements": [
+ * 1,
+ * 1,
+ * 2
+ * ],
* "has_infinite_quantity": true
* },
* {
@@ -1869,10 +1870,11 @@ const getInstancesInventory = (id, params = {}, options = {}) => {
* "next_event_date": "2020-04-02T00:00:00Z",
* "next_event_type": "Subscription Begin",
* "quantity": 15,
- * "physical_capacity": 1,
- * "virtual_capacity": 1,
- * "total_capacity": 2,
- * "metric_id": "Sockets",
+ * "measurements": [
+ * 1,
+ * null,
+ * 2
+ * ],
* "has_infinite_quantity": false
* },
* {
@@ -1887,16 +1889,22 @@ const getInstancesInventory = (id, params = {}, options = {}) => {
* "next_event_date": "2020-04-01T00:00:00Z",
* "next_event_type": "Subscription End",
* "quantity": 3000,
- * "physical_capacity": 2,
- * "virtual_capacity": 2,
- * "total_capacity": 4,
- * "metric_id": "Cores",
+ * "measurements": [
+ * 2,
+ * 2,
+ * 4
+ * ],
* "has_infinite_quantity": false
* }
* ],
* "links": {},
* "meta": {
* "count": 3,
+ * "measurements": [
+ * "Cores",
+ * "Sockets",
+ * "Instance-hours"
+ * ],
* "subscription_type": "On-demand"
* }
* }
diff --git a/src/services/rhsm/rhsmTransformers.js b/src/services/rhsm/rhsmTransformers.js
index 6cf4a2744..4996a3246 100644
--- a/src/services/rhsm/rhsmTransformers.js
+++ b/src/services/rhsm/rhsmTransformers.js
@@ -1,7 +1,6 @@
import moment from 'moment';
import {
RHSM_API_QUERY_SET_TYPES,
- RHSM_API_PATH_METRIC_TYPES,
RHSM_API_RESPONSE_INSTANCES_DATA_TYPES as INSTANCES_DATA_TYPES,
RHSM_API_RESPONSE_INSTANCES_META_TYPES as INSTANCES_META_TYPES,
RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES as SUBSCRIPTIONS_DATA_TYPES,
@@ -103,6 +102,9 @@ const rhsmInstancesGuests = (response, { params, _id } = {}) => {
return updatedResponse;
};
+/**
+ * Note: The "has_infinite_quantity" bool response property applies to ALL measurements!
+ */
/**
* Parse RHSM subscriptions response for caching.
* Attempt to align Instances and Subscriptions responses.
@@ -114,30 +116,19 @@ const rhsmSubscriptions = response => {
const updatedResponse = {};
const { [rhsmConstants.RHSM_API_RESPONSE_DATA]: data = [], [rhsmConstants.RHSM_API_RESPONSE_META]: meta = {} } =
response || {};
+ const metaMeasurements = meta[INSTANCES_META_TYPES.MEASUREMENTS];
- updatedResponse.data = data.map(
- ({
- [SUBSCRIPTIONS_DATA_TYPES.METRIC_ID]: metricId,
- [SUBSCRIPTIONS_DATA_TYPES.TOTAL_CAPACITY]: totalCapacity,
- [SUBSCRIPTIONS_DATA_TYPES.HAS_INFINITE_QUANTITY]: hasInfiniteQuantity,
+ updatedResponse.data = data.map(({ [SUBSCRIPTIONS_DATA_TYPES.MEASUREMENTS]: measurements, ...dataResponse }) => {
+ const updatedData = {
...dataResponse
- }) => {
- const updatedData = {
- [SUBSCRIPTIONS_DATA_TYPES.TOTAL_CAPACITY]: totalCapacity,
- [SUBSCRIPTIONS_DATA_TYPES.HAS_INFINITE_QUANTITY]: hasInfiniteQuantity,
- ...dataResponse
- };
+ };
- const normalizedMetricId = Object.values(RHSM_API_PATH_METRIC_TYPES).find(value =>
- new RegExp(value, 'i').test(metricId)
- );
- updatedData[normalizedMetricId] = totalCapacity;
- updatedData[SUBSCRIPTIONS_DATA_TYPES.METRIC_ID] = normalizedMetricId;
- updatedData[`hasInfinite${normalizedMetricId}`] = hasInfiniteQuantity;
+ metaMeasurements?.forEach((measurement, index) => {
+ updatedData[measurement] = measurements[index];
+ });
- return updatedData;
- }
- );
+ return updatedData;
+ });
updatedResponse.meta = {
...meta,
diff --git a/src/services/user/userServices.js b/src/services/user/userServices.js
index 95c685a55..657a2498d 100644
--- a/src/services/user/userServices.js
+++ b/src/services/user/userServices.js
@@ -46,7 +46,7 @@ const getLocale = () => {
* @api {delete} /api/rhsm-subscriptions/v1/opt-in
* @apiDescription Delete a RHSM account opt-in config
*
- * Reference [RHSM API](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml)
+ * Reference [RHSM API](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-v1-spec.yaml)
*
* @apiSuccessExample {text} Success-Response:
* HTTP/1.1 204 OK
@@ -122,7 +122,7 @@ const deleteAccountOptIn = () =>
* @api {get} /api/rhsm-subscriptions/v1/opt-in
* @apiDescription Get a RHSM account opt-in config
*
- * Reference [RHSM API](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml)
+ * Reference [RHSM API](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-v1-spec.yaml)
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
@@ -189,7 +189,7 @@ const getAccountOptIn = (options = {}) => {
* @apiDescription Create/Update an account's opt-in configuration. Account and Org ID are defined by
* the identity header. If no parameters are specified, everything will be enabled.
*
- * Reference [RHSM API](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml)
+ * Reference [RHSM API](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-v1-spec.yaml)
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK