-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces the following new models for the StArMap APIv2: - `QueryResponseContainer`: holds the whole Query APIv2 response within its property `responses` which is a list of `QueryResponseEntity`. - `QueryResponseEntity`: Represents a single mapping for a given workflow, name and cloud. It can be converted to the `QueryResponse` from APIv1 model which works in an analogue way (without support for cloud name as a property). - `MappingResponseObject`: Represent a single mapping entity which is part of `QueryResponseEntity`. It holds a list of `Destination` object, similar to what `QueryResponse` does on its `clouds` attribute. - `BillingCodeRule`: A dedicated model to represent a Billing Code Rule for the comnmunity workflow. Refers to SPSTRAT-382
- Loading branch information
Showing
35 changed files
with
1,420 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import Any, Dict | ||
|
||
|
||
def assert_is_dict(data: Any) -> None: | ||
"""Ensure the incoming data is a dictionary, raises ``ValueError`` if not.""" | ||
if not isinstance(data, dict): | ||
raise ValueError(f"Expected dictionary, got {type(data)}: {data}") | ||
|
||
|
||
def dict_union(a: Dict[str, Any], b: Dict[str, Any]) -> Dict[str, Any]: | ||
"""Return a new dictionary with the combination of A and B. | ||
Args: | ||
a (dict): | ||
The left dictionary to be combined | ||
b (dict): | ||
The right dictionary to be combined. It will override the same keys from A. | ||
Returns: | ||
dict: A new dictionary with combination of A and B. | ||
""" | ||
c = {} | ||
for x in [a, b]: | ||
assert_is_dict(x) | ||
c.update(x) | ||
return c |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
tests/data/query_v2/mapping_response_obj/invalid_mro1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"destinations": { | ||
"architecture": "x86_64", | ||
"destination": "fake_destination", | ||
"overwrite": false, | ||
"restrict_version": true, | ||
"meta": { | ||
"description": "Description on destination level." | ||
} | ||
}, | ||
"error": "Expected destinations to be a list, got \"<class 'dict'>\"" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"destinations": true, | ||
"error": "Expected destinations to be a list, got \"<class 'bool'>\"" | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/data/query_v2/mapping_response_obj/invalid_mro3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"destinations": [ | ||
{ | ||
"architecture": "x86_64", | ||
"destination": "fake_destination", | ||
"overwrite": false, | ||
"restrict_version": true | ||
} | ||
], | ||
"meta": [], | ||
"provider": "AWS", | ||
"error": "Expected dictionary, got <class 'list'>: \\[\\]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"destinations": [ | ||
{ | ||
"architecture": "x86_64", | ||
"destination": "fake_destination", | ||
"overwrite": false, | ||
"restrict_version": true | ||
} | ||
], | ||
"meta": { | ||
"description": "Description on map level." | ||
}, | ||
"provider": "AWS" | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/data/query_v2/mapping_response_obj/valid_mro1_meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"description": "Description on map level." | ||
} |
Oops, something went wrong.