From b008bc218196e32b60ed6333fd65371995085dab Mon Sep 17 00:00:00 2001 From: khannakshat7 Date: Mon, 17 Jun 2024 17:38:49 +0530 Subject: [PATCH] Added monthly unblended cost to ticket --- .openapi-generator/FILES | 6 + README.md | 2 + docs/CreateTenantTicketRequestMixin.md | 1 + docs/MonthlyUnblendedCost.md | 29 ++++ docs/MonthlyUnblendedCost1.md | 29 ++++ docs/TenantTicket.md | 1 + docs/UpdateTenantTicketAPIRequest.md | 1 + docs/UpdateTenantTicketRequest.md | 1 + docs/UpdateTenantTicketRequestMixin.md | 1 + onelens_backend_client/__init__.py | 2 + onelens_backend_client/models/__init__.py | 2 + .../create_tenant_ticket_request_mixin.py | 13 +- .../models/monthly_unblended_cost.py | 144 ++++++++++++++++++ .../models/monthly_unblended_cost1.py | 144 ++++++++++++++++++ .../models/tenant_ticket.py | 9 +- .../update_tenant_ticket_api_request.py | 15 +- .../models/update_tenant_ticket_request.py | 13 +- .../update_tenant_ticket_request_mixin.py | 13 +- test/test_monthly_unblended_cost.py | 50 ++++++ test/test_monthly_unblended_cost1.py | 50 ++++++ 20 files changed, 520 insertions(+), 6 deletions(-) create mode 100644 docs/MonthlyUnblendedCost.md create mode 100644 docs/MonthlyUnblendedCost1.md create mode 100644 onelens_backend_client/models/monthly_unblended_cost.py create mode 100644 onelens_backend_client/models/monthly_unblended_cost1.py create mode 100644 test/test_monthly_unblended_cost.py create mode 100644 test/test_monthly_unblended_cost1.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index ddb53401..30f9a634 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -183,6 +183,8 @@ docs/MetricsQuery.md docs/MetricsServiceApi.md docs/MetricsThreshold.md docs/MetricsValueUnit.md +docs/MonthlyUnblendedCost.md +docs/MonthlyUnblendedCost1.md docs/NewCost.md docs/OnelensDomainUtilitiesRepositoriesDynamicFiltersFilterCriteria.md docs/OnelensDomainUtilitiesRepositoriesDynamicFiltersOperator.md @@ -626,6 +628,8 @@ onelens_backend_client/models/metrics_look_back_period.py onelens_backend_client/models/metrics_query.py onelens_backend_client/models/metrics_threshold.py onelens_backend_client/models/metrics_value_unit.py +onelens_backend_client/models/monthly_unblended_cost.py +onelens_backend_client/models/monthly_unblended_cost1.py onelens_backend_client/models/new_cost.py onelens_backend_client/models/onelens_domain_utilities_repositories_dynamic_filters_filter_criteria.py onelens_backend_client/models/onelens_domain_utilities_repositories_dynamic_filters_operator.py @@ -827,4 +831,6 @@ setup.cfg setup.py test-requirements.txt test/__init__.py +test/test_monthly_unblended_cost.py +test/test_monthly_unblended_cost1.py tox.ini diff --git a/README.md b/README.md index 45ce801d..d2016f57 100644 --- a/README.md +++ b/README.md @@ -461,6 +461,8 @@ Class | Method | Description - [MetricsQuery](docs/MetricsQuery.md) - [MetricsThreshold](docs/MetricsThreshold.md) - [MetricsValueUnit](docs/MetricsValueUnit.md) + - [MonthlyUnblendedCost](docs/MonthlyUnblendedCost.md) + - [MonthlyUnblendedCost1](docs/MonthlyUnblendedCost1.md) - [NewCost](docs/NewCost.md) - [OnelensDomainUtilitiesRepositoriesDynamicFiltersFilterCriteria](docs/OnelensDomainUtilitiesRepositoriesDynamicFiltersFilterCriteria.md) - [OnelensDomainUtilitiesRepositoriesDynamicFiltersOperator](docs/OnelensDomainUtilitiesRepositoriesDynamicFiltersOperator.md) diff --git a/docs/CreateTenantTicketRequestMixin.md b/docs/CreateTenantTicketRequestMixin.md index 223b3c16..9f495ee5 100644 --- a/docs/CreateTenantTicketRequestMixin.md +++ b/docs/CreateTenantTicketRequestMixin.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **entity_id** | **str** | The id of the resource experiencing policy violation. | **entity_type** | **str** | The type of the resource experiencing policy violation. | **entity_attributes** | **object** | | [optional] +**monthly_unblended_cost** | [**MonthlyUnblendedCost**](MonthlyUnblendedCost.md) | | [optional] **assignment** | [**TicketAssignment**](TicketAssignment.md) | Assignment state of the ticket | **assigned_to** | **str** | | [optional] **last_run_id** | **str** | Id of the last policy violation/anomaly run | diff --git a/docs/MonthlyUnblendedCost.md b/docs/MonthlyUnblendedCost.md new file mode 100644 index 00000000..ba0acaab --- /dev/null +++ b/docs/MonthlyUnblendedCost.md @@ -0,0 +1,29 @@ +# MonthlyUnblendedCost + +The monthly unblended cost of the resource experiencing policy violation. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from onelens_backend_client.models.monthly_unblended_cost import MonthlyUnblendedCost + +# TODO update the JSON string below +json = "{}" +# create an instance of MonthlyUnblendedCost from a JSON string +monthly_unblended_cost_instance = MonthlyUnblendedCost.from_json(json) +# print the JSON string representation of the object +print(MonthlyUnblendedCost.to_json()) + +# convert the object into a dict +monthly_unblended_cost_dict = monthly_unblended_cost_instance.to_dict() +# create an instance of MonthlyUnblendedCost from a dict +monthly_unblended_cost_form_dict = monthly_unblended_cost.from_dict(monthly_unblended_cost_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MonthlyUnblendedCost1.md b/docs/MonthlyUnblendedCost1.md new file mode 100644 index 00000000..91a05f41 --- /dev/null +++ b/docs/MonthlyUnblendedCost1.md @@ -0,0 +1,29 @@ +# MonthlyUnblendedCost1 + +Monthly unblended cost of the resource experiencing policy violation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from onelens_backend_client.models.monthly_unblended_cost1 import MonthlyUnblendedCost1 + +# TODO update the JSON string below +json = "{}" +# create an instance of MonthlyUnblendedCost1 from a JSON string +monthly_unblended_cost1_instance = MonthlyUnblendedCost1.from_json(json) +# print the JSON string representation of the object +print(MonthlyUnblendedCost1.to_json()) + +# convert the object into a dict +monthly_unblended_cost1_dict = monthly_unblended_cost1_instance.to_dict() +# create an instance of MonthlyUnblendedCost1 from a dict +monthly_unblended_cost1_form_dict = monthly_unblended_cost1.from_dict(monthly_unblended_cost1_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TenantTicket.md b/docs/TenantTicket.md index eb6ee748..1046f03b 100644 --- a/docs/TenantTicket.md +++ b/docs/TenantTicket.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **entity_id** | **str** | The id of the resource experiencing policy violation. | **entity_type** | **str** | The type of the resource experiencing policy violation. | **entity_attributes** | **object** | | [optional] +**monthly_unblended_cost** | **str** | | [optional] **assignment** | [**TicketAssignment**](TicketAssignment.md) | Assignment state of the ticket | **assigned_to** | **str** | | [optional] **last_run_id** | **str** | Id of the last policy violation/anomaly run | diff --git a/docs/UpdateTenantTicketAPIRequest.md b/docs/UpdateTenantTicketAPIRequest.md index c3e52031..c873d3e2 100644 --- a/docs/UpdateTenantTicketAPIRequest.md +++ b/docs/UpdateTenantTicketAPIRequest.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **assignment** | [**TicketAssignment**](TicketAssignment.md) | | [optional] **details** | [**Details2**](Details2.md) | | [optional] **entity_attributes** | **object** | | [optional] +**monthly_unblended_cost** | [**MonthlyUnblendedCost1**](MonthlyUnblendedCost1.md) | | [optional] ## Example diff --git a/docs/UpdateTenantTicketRequest.md b/docs/UpdateTenantTicketRequest.md index d6b02b05..c26e383d 100644 --- a/docs/UpdateTenantTicketRequest.md +++ b/docs/UpdateTenantTicketRequest.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **assignment** | [**TicketAssignment**](TicketAssignment.md) | | [optional] **details** | [**Details2**](Details2.md) | | [optional] **entity_attributes** | **object** | | [optional] +**monthly_unblended_cost** | [**MonthlyUnblendedCost1**](MonthlyUnblendedCost1.md) | | [optional] **ticket_id** | **str** | The unique identifier of the ticket | **tenant_id** | **str** | The unique identifier of the tenant | diff --git a/docs/UpdateTenantTicketRequestMixin.md b/docs/UpdateTenantTicketRequestMixin.md index 8634daab..56ee41d2 100644 --- a/docs/UpdateTenantTicketRequestMixin.md +++ b/docs/UpdateTenantTicketRequestMixin.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **status** | [**Status1**](Status1.md) | | [optional] **details** | [**Details2**](Details2.md) | | [optional] **entity_attributes** | **object** | | [optional] +**monthly_unblended_cost** | [**MonthlyUnblendedCost1**](MonthlyUnblendedCost1.md) | | [optional] **cost_impact** | **float** | | [optional] **last_run_id** | **str** | | [optional] **last_run_at** | **datetime** | | [optional] diff --git a/onelens_backend_client/__init__.py b/onelens_backend_client/__init__.py index b6b4fbd3..07df689b 100644 --- a/onelens_backend_client/__init__.py +++ b/onelens_backend_client/__init__.py @@ -241,6 +241,8 @@ from onelens_backend_client.models.metrics_query import MetricsQuery from onelens_backend_client.models.metrics_threshold import MetricsThreshold from onelens_backend_client.models.metrics_value_unit import MetricsValueUnit +from onelens_backend_client.models.monthly_unblended_cost import MonthlyUnblendedCost +from onelens_backend_client.models.monthly_unblended_cost1 import MonthlyUnblendedCost1 from onelens_backend_client.models.new_cost import NewCost from onelens_backend_client.models.onelens_domain_utilities_repositories_dynamic_filters_filter_criteria import OnelensDomainUtilitiesRepositoriesDynamicFiltersFilterCriteria from onelens_backend_client.models.onelens_domain_utilities_repositories_dynamic_filters_operator import OnelensDomainUtilitiesRepositoriesDynamicFiltersOperator diff --git a/onelens_backend_client/models/__init__.py b/onelens_backend_client/models/__init__.py index 13f7aba1..8767ee3c 100644 --- a/onelens_backend_client/models/__init__.py +++ b/onelens_backend_client/models/__init__.py @@ -187,6 +187,8 @@ from onelens_backend_client.models.metrics_query import MetricsQuery from onelens_backend_client.models.metrics_threshold import MetricsThreshold from onelens_backend_client.models.metrics_value_unit import MetricsValueUnit +from onelens_backend_client.models.monthly_unblended_cost import MonthlyUnblendedCost +from onelens_backend_client.models.monthly_unblended_cost1 import MonthlyUnblendedCost1 from onelens_backend_client.models.new_cost import NewCost from onelens_backend_client.models.onelens_domain_utilities_repositories_dynamic_filters_filter_criteria import OnelensDomainUtilitiesRepositoriesDynamicFiltersFilterCriteria from onelens_backend_client.models.onelens_domain_utilities_repositories_dynamic_filters_operator import OnelensDomainUtilitiesRepositoriesDynamicFiltersOperator diff --git a/onelens_backend_client/models/create_tenant_ticket_request_mixin.py b/onelens_backend_client/models/create_tenant_ticket_request_mixin.py index d82ac096..1f12a7c2 100644 --- a/onelens_backend_client/models/create_tenant_ticket_request_mixin.py +++ b/onelens_backend_client/models/create_tenant_ticket_request_mixin.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from onelens_backend_client.models.details import Details +from onelens_backend_client.models.monthly_unblended_cost import MonthlyUnblendedCost from onelens_backend_client.models.status import Status from onelens_backend_client.models.ticket_assignment import TicketAssignment from onelens_backend_client.models.ticket_category import TicketCategory @@ -38,6 +39,7 @@ class CreateTenantTicketRequestMixin(BaseModel): entity_id: StrictStr = Field(description="The id of the resource experiencing policy violation.") entity_type: StrictStr = Field(description="The type of the resource experiencing policy violation.") entity_attributes: Optional[Dict[str, Any]] = None + monthly_unblended_cost: Optional[MonthlyUnblendedCost] = None assignment: TicketAssignment = Field(description="Assignment state of the ticket") assigned_to: Optional[StrictStr] = None last_run_id: StrictStr = Field(description="Id of the last policy violation/anomaly run") @@ -45,7 +47,7 @@ class CreateTenantTicketRequestMixin(BaseModel): first_run_at: datetime = Field(description="Datetime of the first policy violation/anomaly run") status: Status details: Details - __properties: ClassVar[List[str]] = ["monitor_id", "ticket_category", "state", "entity_id", "entity_type", "entity_attributes", "assignment", "assigned_to", "last_run_id", "last_run_at", "first_run_at", "status", "details"] + __properties: ClassVar[List[str]] = ["monitor_id", "ticket_category", "state", "entity_id", "entity_type", "entity_attributes", "monthly_unblended_cost", "assignment", "assigned_to", "last_run_id", "last_run_at", "first_run_at", "status", "details"] model_config = ConfigDict( populate_by_name=True, @@ -86,6 +88,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of monthly_unblended_cost + if self.monthly_unblended_cost: + _dict['monthly_unblended_cost'] = self.monthly_unblended_cost.to_dict() # override the default output from pydantic by calling `to_dict()` of status if self.status: _dict['status'] = self.status.to_dict() @@ -102,6 +107,11 @@ def to_dict(self) -> Dict[str, Any]: if self.entity_attributes is None and "entity_attributes" in self.model_fields_set: _dict['entity_attributes'] = None + # set to None if monthly_unblended_cost (nullable) is None + # and model_fields_set contains the field + if self.monthly_unblended_cost is None and "monthly_unblended_cost" in self.model_fields_set: + _dict['monthly_unblended_cost'] = None + # set to None if assigned_to (nullable) is None # and model_fields_set contains the field if self.assigned_to is None and "assigned_to" in self.model_fields_set: @@ -125,6 +135,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "entity_id": obj.get("entity_id"), "entity_type": obj.get("entity_type"), "entity_attributes": obj.get("entity_attributes"), + "monthly_unblended_cost": MonthlyUnblendedCost.from_dict(obj["monthly_unblended_cost"]) if obj.get("monthly_unblended_cost") is not None else None, "assignment": obj.get("assignment"), "assigned_to": obj.get("assigned_to"), "last_run_id": obj.get("last_run_id"), diff --git a/onelens_backend_client/models/monthly_unblended_cost.py b/onelens_backend_client/models/monthly_unblended_cost.py new file mode 100644 index 00000000..b5916167 --- /dev/null +++ b/onelens_backend_client/models/monthly_unblended_cost.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator +from typing import Optional, Union +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +MONTHLYUNBLENDEDCOST_ANY_OF_SCHEMAS = ["float", "str"] + +class MonthlyUnblendedCost(BaseModel): + """ + The monthly unblended cost of the resource experiencing policy violation. + """ + + # data type: float + anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None + # data type: str + anyof_schema_2_validator: Optional[StrictStr] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[float, str]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "float", "str" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = MonthlyUnblendedCost.model_construct() + error_messages = [] + # validate data type: float + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: str + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in MonthlyUnblendedCost with anyOf schemas: float, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # deserialize data into float + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into str + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into MonthlyUnblendedCost with anyOf schemas: float, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/onelens_backend_client/models/monthly_unblended_cost1.py b/onelens_backend_client/models/monthly_unblended_cost1.py new file mode 100644 index 00000000..72cfd1b3 --- /dev/null +++ b/onelens_backend_client/models/monthly_unblended_cost1.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator +from typing import Optional, Union +from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict +from typing_extensions import Literal, Self +from pydantic import Field + +MONTHLYUNBLENDEDCOST1_ANY_OF_SCHEMAS = ["float", "str"] + +class MonthlyUnblendedCost1(BaseModel): + """ + Monthly unblended cost of the resource experiencing policy violation + """ + + # data type: float + anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None + # data type: str + anyof_schema_2_validator: Optional[StrictStr] = None + if TYPE_CHECKING: + actual_instance: Optional[Union[float, str]] = None + else: + actual_instance: Any = None + any_of_schemas: Set[str] = { "float", "str" } + + model_config = { + "validate_assignment": True, + "protected_namespaces": (), + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_anyof(cls, v): + if v is None: + return v + + instance = MonthlyUnblendedCost1.model_construct() + error_messages = [] + # validate data type: float + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: str + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in MonthlyUnblendedCost1 with anyOf schemas: float, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + if json_str is None: + return instance + + error_messages = [] + # deserialize data into float + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into str + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into MonthlyUnblendedCost1 with anyOf schemas: float, str. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/onelens_backend_client/models/tenant_ticket.py b/onelens_backend_client/models/tenant_ticket.py index 40311ce3..c51f31a7 100644 --- a/onelens_backend_client/models/tenant_ticket.py +++ b/onelens_backend_client/models/tenant_ticket.py @@ -40,6 +40,7 @@ class TenantTicket(BaseModel): entity_id: StrictStr = Field(description="The id of the resource experiencing policy violation.") entity_type: StrictStr = Field(description="The type of the resource experiencing policy violation.") entity_attributes: Optional[Dict[str, Any]] = None + monthly_unblended_cost: Optional[StrictStr] = None assignment: TicketAssignment = Field(description="Assignment state of the ticket") assigned_to: Optional[StrictStr] = None last_run_id: StrictStr = Field(description="Id of the last policy violation/anomaly run") @@ -48,7 +49,7 @@ class TenantTicket(BaseModel): id: StrictStr = Field(description="The unique identifier of the ticket") status: Status details: Details1 - __properties: ClassVar[List[str]] = ["created_at", "updated_at", "monitor_id", "ticket_category", "state", "entity_id", "entity_type", "entity_attributes", "assignment", "assigned_to", "last_run_id", "last_run_at", "first_run_at", "id", "status", "details"] + __properties: ClassVar[List[str]] = ["created_at", "updated_at", "monitor_id", "ticket_category", "state", "entity_id", "entity_type", "entity_attributes", "monthly_unblended_cost", "assignment", "assigned_to", "last_run_id", "last_run_at", "first_run_at", "id", "status", "details"] model_config = ConfigDict( populate_by_name=True, @@ -105,6 +106,11 @@ def to_dict(self) -> Dict[str, Any]: if self.entity_attributes is None and "entity_attributes" in self.model_fields_set: _dict['entity_attributes'] = None + # set to None if monthly_unblended_cost (nullable) is None + # and model_fields_set contains the field + if self.monthly_unblended_cost is None and "monthly_unblended_cost" in self.model_fields_set: + _dict['monthly_unblended_cost'] = None + # set to None if assigned_to (nullable) is None # and model_fields_set contains the field if self.assigned_to is None and "assigned_to" in self.model_fields_set: @@ -130,6 +136,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "entity_id": obj.get("entity_id"), "entity_type": obj.get("entity_type"), "entity_attributes": obj.get("entity_attributes"), + "monthly_unblended_cost": obj.get("monthly_unblended_cost"), "assignment": obj.get("assignment"), "assigned_to": obj.get("assigned_to"), "last_run_id": obj.get("last_run_id"), diff --git a/onelens_backend_client/models/update_tenant_ticket_api_request.py b/onelens_backend_client/models/update_tenant_ticket_api_request.py index a801de05..df8695f9 100644 --- a/onelens_backend_client/models/update_tenant_ticket_api_request.py +++ b/onelens_backend_client/models/update_tenant_ticket_api_request.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict from typing import Any, ClassVar, Dict, List, Optional from onelens_backend_client.models.details2 import Details2 +from onelens_backend_client.models.monthly_unblended_cost1 import MonthlyUnblendedCost1 from onelens_backend_client.models.status1 import Status1 from onelens_backend_client.models.ticket_assignment import TicketAssignment from typing import Optional, Set @@ -33,7 +34,8 @@ class UpdateTenantTicketAPIRequest(BaseModel): assignment: Optional[TicketAssignment] = None details: Optional[Details2] = None entity_attributes: Optional[Dict[str, Any]] = None - __properties: ClassVar[List[str]] = ["status", "assignment", "details", "entity_attributes"] + monthly_unblended_cost: Optional[MonthlyUnblendedCost1] = None + __properties: ClassVar[List[str]] = ["status", "assignment", "details", "entity_attributes", "monthly_unblended_cost"] model_config = ConfigDict( populate_by_name=True, @@ -80,6 +82,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of details if self.details: _dict['details'] = self.details.to_dict() + # override the default output from pydantic by calling `to_dict()` of monthly_unblended_cost + if self.monthly_unblended_cost: + _dict['monthly_unblended_cost'] = self.monthly_unblended_cost.to_dict() # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -100,6 +105,11 @@ def to_dict(self) -> Dict[str, Any]: if self.entity_attributes is None and "entity_attributes" in self.model_fields_set: _dict['entity_attributes'] = None + # set to None if monthly_unblended_cost (nullable) is None + # and model_fields_set contains the field + if self.monthly_unblended_cost is None and "monthly_unblended_cost" in self.model_fields_set: + _dict['monthly_unblended_cost'] = None + return _dict @classmethod @@ -115,7 +125,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "status": Status1.from_dict(obj["status"]) if obj.get("status") is not None else None, "assignment": obj.get("assignment"), "details": Details2.from_dict(obj["details"]) if obj.get("details") is not None else None, - "entity_attributes": obj.get("entity_attributes") + "entity_attributes": obj.get("entity_attributes"), + "monthly_unblended_cost": MonthlyUnblendedCost1.from_dict(obj["monthly_unblended_cost"]) if obj.get("monthly_unblended_cost") is not None else None }) return _obj diff --git a/onelens_backend_client/models/update_tenant_ticket_request.py b/onelens_backend_client/models/update_tenant_ticket_request.py index 175d1e7e..e8974a8a 100644 --- a/onelens_backend_client/models/update_tenant_ticket_request.py +++ b/onelens_backend_client/models/update_tenant_ticket_request.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from onelens_backend_client.models.details2 import Details2 +from onelens_backend_client.models.monthly_unblended_cost1 import MonthlyUnblendedCost1 from onelens_backend_client.models.status1 import Status1 from onelens_backend_client.models.ticket_assignment import TicketAssignment from typing import Optional, Set @@ -33,9 +34,10 @@ class UpdateTenantTicketRequest(BaseModel): assignment: Optional[TicketAssignment] = None details: Optional[Details2] = None entity_attributes: Optional[Dict[str, Any]] = None + monthly_unblended_cost: Optional[MonthlyUnblendedCost1] = None ticket_id: StrictStr = Field(description="The unique identifier of the ticket") tenant_id: StrictStr = Field(description="The unique identifier of the tenant") - __properties: ClassVar[List[str]] = ["status", "assignment", "details", "entity_attributes", "ticket_id", "tenant_id"] + __properties: ClassVar[List[str]] = ["status", "assignment", "details", "entity_attributes", "monthly_unblended_cost", "ticket_id", "tenant_id"] model_config = ConfigDict( populate_by_name=True, @@ -82,6 +84,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of details if self.details: _dict['details'] = self.details.to_dict() + # override the default output from pydantic by calling `to_dict()` of monthly_unblended_cost + if self.monthly_unblended_cost: + _dict['monthly_unblended_cost'] = self.monthly_unblended_cost.to_dict() # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -102,6 +107,11 @@ def to_dict(self) -> Dict[str, Any]: if self.entity_attributes is None and "entity_attributes" in self.model_fields_set: _dict['entity_attributes'] = None + # set to None if monthly_unblended_cost (nullable) is None + # and model_fields_set contains the field + if self.monthly_unblended_cost is None and "monthly_unblended_cost" in self.model_fields_set: + _dict['monthly_unblended_cost'] = None + return _dict @classmethod @@ -118,6 +128,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "assignment": obj.get("assignment"), "details": Details2.from_dict(obj["details"]) if obj.get("details") is not None else None, "entity_attributes": obj.get("entity_attributes"), + "monthly_unblended_cost": MonthlyUnblendedCost1.from_dict(obj["monthly_unblended_cost"]) if obj.get("monthly_unblended_cost") is not None else None, "ticket_id": obj.get("ticket_id"), "tenant_id": obj.get("tenant_id") }) diff --git a/onelens_backend_client/models/update_tenant_ticket_request_mixin.py b/onelens_backend_client/models/update_tenant_ticket_request_mixin.py index 973f0741..ca2c97c3 100644 --- a/onelens_backend_client/models/update_tenant_ticket_request_mixin.py +++ b/onelens_backend_client/models/update_tenant_ticket_request_mixin.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional, Union from onelens_backend_client.models.details2 import Details2 +from onelens_backend_client.models.monthly_unblended_cost1 import MonthlyUnblendedCost1 from onelens_backend_client.models.status1 import Status1 from typing import Optional, Set from typing_extensions import Self @@ -33,10 +34,11 @@ class UpdateTenantTicketRequestMixin(BaseModel): status: Optional[Status1] = None details: Optional[Details2] = None entity_attributes: Optional[Dict[str, Any]] = None + monthly_unblended_cost: Optional[MonthlyUnblendedCost1] = None cost_impact: Optional[Union[StrictFloat, StrictInt]] = None last_run_id: Optional[StrictStr] = None last_run_at: Optional[datetime] = None - __properties: ClassVar[List[str]] = ["ticket_id", "status", "details", "entity_attributes", "cost_impact", "last_run_id", "last_run_at"] + __properties: ClassVar[List[str]] = ["ticket_id", "status", "details", "entity_attributes", "monthly_unblended_cost", "cost_impact", "last_run_id", "last_run_at"] model_config = ConfigDict( populate_by_name=True, @@ -83,6 +85,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of details if self.details: _dict['details'] = self.details.to_dict() + # override the default output from pydantic by calling `to_dict()` of monthly_unblended_cost + if self.monthly_unblended_cost: + _dict['monthly_unblended_cost'] = self.monthly_unblended_cost.to_dict() # set to None if status (nullable) is None # and model_fields_set contains the field if self.status is None and "status" in self.model_fields_set: @@ -98,6 +103,11 @@ def to_dict(self) -> Dict[str, Any]: if self.entity_attributes is None and "entity_attributes" in self.model_fields_set: _dict['entity_attributes'] = None + # set to None if monthly_unblended_cost (nullable) is None + # and model_fields_set contains the field + if self.monthly_unblended_cost is None and "monthly_unblended_cost" in self.model_fields_set: + _dict['monthly_unblended_cost'] = None + # set to None if cost_impact (nullable) is None # and model_fields_set contains the field if self.cost_impact is None and "cost_impact" in self.model_fields_set: @@ -129,6 +139,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "status": Status1.from_dict(obj["status"]) if obj.get("status") is not None else None, "details": Details2.from_dict(obj["details"]) if obj.get("details") is not None else None, "entity_attributes": obj.get("entity_attributes"), + "monthly_unblended_cost": MonthlyUnblendedCost1.from_dict(obj["monthly_unblended_cost"]) if obj.get("monthly_unblended_cost") is not None else None, "cost_impact": obj.get("cost_impact"), "last_run_id": obj.get("last_run_id"), "last_run_at": obj.get("last_run_at") diff --git a/test/test_monthly_unblended_cost.py b/test/test_monthly_unblended_cost.py new file mode 100644 index 00000000..eb0706d7 --- /dev/null +++ b/test/test_monthly_unblended_cost.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.models.monthly_unblended_cost import MonthlyUnblendedCost + +class TestMonthlyUnblendedCost(unittest.TestCase): + """MonthlyUnblendedCost unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MonthlyUnblendedCost: + """Test MonthlyUnblendedCost + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `MonthlyUnblendedCost` + """ + model = MonthlyUnblendedCost() + if include_optional: + return MonthlyUnblendedCost( + ) + else: + return MonthlyUnblendedCost( + ) + """ + + def testMonthlyUnblendedCost(self): + """Test MonthlyUnblendedCost""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_monthly_unblended_cost1.py b/test/test_monthly_unblended_cost1.py new file mode 100644 index 00000000..82f88dca --- /dev/null +++ b/test/test_monthly_unblended_cost1.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" + onelens-backend + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from onelens_backend_client.models.monthly_unblended_cost1 import MonthlyUnblendedCost1 + +class TestMonthlyUnblendedCost1(unittest.TestCase): + """MonthlyUnblendedCost1 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MonthlyUnblendedCost1: + """Test MonthlyUnblendedCost1 + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `MonthlyUnblendedCost1` + """ + model = MonthlyUnblendedCost1() + if include_optional: + return MonthlyUnblendedCost1( + ) + else: + return MonthlyUnblendedCost1( + ) + """ + + def testMonthlyUnblendedCost1(self): + """Test MonthlyUnblendedCost1""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main()