-
Story
-
Resolution: Done
-
Normal
-
None
-
None
-
False
-
-
True
-
BIZ-356 - Export of Subscription Watch data
-
-
The expectation for this story is that when a subscription export request is encountered, we'll actually query the database for data, and then POST it back to the export service.
Requirements:
- Implement the fetchData method for subscriptions export in swatch-subscription-sync
- fetched data should always be limited to the orgId that the user is allowed to access. There's a redhatorgid field on the message, as well as the an org id in the base64 encoded data.x-rh-identity field.
- consult the data.filters field when querying the database for subscription data. The following filter parameters must be supported:
- product_id
- sla
- usage
uommetric_id- billing_provider
- billing_account_id
display_name_contains- category
- If any extra filters are provided, log it and move on.
- If no filters are provided, return unfiltered results (with the exception of limiting by appropriate org id)
- fetchData must throw an exception for bad product_id, sla, usage, uom, billing_provider, or category
- The listener must catch and report these errors with exportClient.downloadExportError with error code 400 and a message explaining what parameter(s) are bad. The error message may be limited to a single parameter.
- If the data.format != json, continue to throw not yet implemented exception.
- If no exceptions are thrown, implement uploadJson and call exportClient.downloadExportUpload with JSON-formatted data
- Create a yaml json schema file in src/main/resources/subscriptions-export.yaml and generate the POJO model using jsonSchema2Pojo.
JSON example:
{ "subscriptions": [ { "sku": "RH00001", "product_name": "Red Hat Enterprise Linux for Virtual Datacenters, Premium", "service_level": "Premium", "usage": "Production", "metric_id": "Sockets", "subscriptions": [ { "id": "123456", "number": "123456", "quantity": 42, "capacity": 0, "hypervisor_capacity": 42, "begin": "2021-11-28T16:38:12.951046Z", "end": "2023-11-28T16:38:12.951046Z", } ] } ] }
- Use streams wherever possible to mitigate OOM issues
Testing:
- Attempted export with bad parameter(s) should fail with a message explaining which parameter(s) are bad.
- Attempted export for JSON should succeed (after correcting bad parameters)
- Attempted export for CSV should fail because the format is not yet implemented.
- blocks
-
SWATCH-2023 Add CSV support subscriptions export
- Closed
-
SWATCH-2353 GUI - Activate export functionality
- Closed
-
SWATCH-2018 Report filtered instance data to Export Service in JSON
- Closed
- is blocked by
-
SWATCH-2150 Remove stubbing for export client calls
- Closed
-
SWATCH-2017 Implement rbac checking for exports
- Closed
- is depended on by
-
SWATCH-2327 Measure performance/limit of entities we can export
- Closed
- mentioned on
1.
|
Add JSON support to subscriptions export | Closed | Unassigned |