Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion instana_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
""" # noqa: E501


__version__ = "1.0.2"
__version__ = "1.0.3"

# import apis into sdk package
from instana_client.api.ai_management_api import AIManagementApi
Expand Down
2 changes: 1 addition & 1 deletion instana_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def to_debug_report(self) -> str:
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.309.1268\n"\
"SDK Package Version: 1.0.2".\
"SDK Package Version: 1.0.3".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self) -> List[HostSetting]:
Expand Down
547 changes: 544 additions & 3 deletions instana_client/models/__init__.py

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions instana_client/models/tag_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501
""" # noqa: E501


from __future__ import annotations
import pprint
import re # noqa: F401
import json

from pydantic import ConfigDict, Field, StrictStr, field_validator
from pydantic import ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing_extensions import Annotated
from instana_client.models.tag_filter_all_of_value import TagFilterAllOfValue
from instana_client.models.tag_filter_expression_element import TagFilterExpressionElement
from typing import Optional, Set
from typing_extensions import Self
Expand All @@ -29,15 +30,16 @@ class TagFilter(TagFilterExpressionElement):
"""
TagFilter
""" # noqa: E501
boolean_value: Optional[StrictBool] = Field(default=None, description="Boolean value for the tag filter.", alias="booleanValue")
entity: StrictStr = Field(description="SOURCE or DESTINATION tag in case of a call tag. For Infrastructure, always set to NOT_APPLICABLE.")
float_value: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Float value for the tag filter.", alias="floatValue")
key: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=512)]] = Field(default=None, description="Tag key in case of a key/value tag.")
name: Annotated[str, Field(min_length=0, strict=True, max_length=128)] = Field(description="Name of the tag.")
number_value: Optional[StrictInt] = Field(default=None, description="Number value for the tag filter.", alias="numberValue")
operator: StrictStr
value: Optional[Union[str, int, float, bool, Dict[str, Any]]] = Field(default=None, description="Tag value to filter on. Can be a string, number, boolean, or dictionary.")
string_value: Optional[str] = Field(default=None, alias="stringValue", description="String value for the tag filter.")
number_value: Optional[float] = Field(default=None, alias="numberValue", description="Number value for the tag filter.")
boolean_value: Optional[bool] = Field(default=None, alias="booleanValue", description="Boolean value for the tag filter.")
__properties: ClassVar[List[str]] = ["type", "entity", "key", "name", "operator", "value", "stringValue", "numberValue", "booleanValue"]
string_value: Optional[StrictStr] = Field(default=None, description="String value for the tag filter.", alias="stringValue")
value: Optional[TagFilterAllOfValue] = None
__properties: ClassVar[List[str]] = ["type", "booleanValue", "entity", "floatValue", "key", "name", "numberValue", "operator", "stringValue", "value"]

@field_validator('entity')
def entity_validate_enum(cls, value):
Expand Down Expand Up @@ -92,13 +94,9 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# Ensure the new fields are included with their aliases
if self.string_value is not None:
_dict['stringValue'] = self.string_value
if self.number_value is not None:
_dict['numberValue'] = self.number_value
if self.boolean_value is not None:
_dict['booleanValue'] = self.boolean_value
# override the default output from pydantic by calling `to_dict()` of value
if self.value:
_dict['value'] = self.value.to_dict()
return _dict

@classmethod
Expand All @@ -112,14 +110,16 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate({
"type": obj.get("type"),
"booleanValue": obj.get("booleanValue"),
"entity": obj.get("entity"),
"floatValue": obj.get("floatValue"),
"key": obj.get("key"),
"name": obj.get("name"),
"numberValue": obj.get("numberValue"),
"operator": obj.get("operator"),
"value": obj.get("value"),
"stringValue": obj.get("stringValue"),
"numberValue": obj.get("numberValue"),
"booleanValue": obj.get("booleanValue")
"value": TagFilterAllOfValue.from_dict(obj["value"]) if obj.get("value") is not None else None
})
return _obj


195 changes: 195 additions & 0 deletions instana_client/models/tag_filter_all_of_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# coding: utf-8

"""
Instana REST API documentation

Documentation for INSTANA REST API

The version of the OpenAPI document: 1.309.1268
Contact: support@instana.com
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


from __future__ import annotations
import json
import pprint
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
from typing import Any, Dict, List, Optional, Union
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing_extensions import Literal, Self

TAGFILTERALLOFVALUE_ONE_OF_SCHEMAS = ["bool", "float", "int", "object", "str"]

class TagFilterAllOfValue(BaseModel):
"""
Tag value to filter on. Can be a string, number, boolean, or dictionary.
"""
# data type: str
oneof_schema_1_validator: Optional[StrictStr] = None
# data type: int
oneof_schema_2_validator: Optional[StrictInt] = None
# data type: float
oneof_schema_3_validator: Optional[Union[StrictFloat, StrictInt]] = None
# data type: bool
oneof_schema_4_validator: Optional[StrictBool] = None
# data type: object
oneof_schema_5_validator: Optional[Dict[str, Any]] = None
actual_instance: Optional[Union[bool, float, int, object, str]] = None
one_of_schemas: Set[str] = { "bool", "float", "int", "object", "str" }

model_config = ConfigDict(
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_oneof(cls, v):
instance = TagFilterAllOfValue.model_construct()
error_messages = []
match = 0
# validate data type: str
try:
instance.oneof_schema_1_validator = v
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# validate data type: int
try:
instance.oneof_schema_2_validator = v
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# validate data type: float
try:
instance.oneof_schema_3_validator = v
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# validate data type: bool
try:
instance.oneof_schema_4_validator = v
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# validate data type: object
try:
instance.oneof_schema_5_validator = v
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when setting `actual_instance` in TagFilterAllOfValue with oneOf schemas: bool, float, int, object, str. Details: " + ", ".join(error_messages))
elif match == 0:
# no match
raise ValueError("No match found when setting `actual_instance` in TagFilterAllOfValue with oneOf schemas: bool, float, int, object, str. Details: " + ", ".join(error_messages))
else:
return v

@classmethod
def from_dict(cls, obj: Union[str, 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()
error_messages = []
match = 0

# deserialize data into str
try:
# validation
instance.oneof_schema_1_validator = json.loads(json_str)
# assign value to actual_instance
instance.actual_instance = instance.oneof_schema_1_validator
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into int
try:
# validation
instance.oneof_schema_2_validator = json.loads(json_str)
# assign value to actual_instance
instance.actual_instance = instance.oneof_schema_2_validator
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into float
try:
# validation
instance.oneof_schema_3_validator = json.loads(json_str)
# assign value to actual_instance
instance.actual_instance = instance.oneof_schema_3_validator
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into bool
try:
# validation
instance.oneof_schema_4_validator = json.loads(json_str)
# assign value to actual_instance
instance.actual_instance = instance.oneof_schema_4_validator
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))
# deserialize data into object
try:
# validation
instance.oneof_schema_5_validator = json.loads(json_str)
# assign value to actual_instance
instance.actual_instance = instance.oneof_schema_5_validator
match += 1
except (ValidationError, ValueError) as e:
error_messages.append(str(e))

if match > 1:
# more than 1 match
raise ValueError("Multiple matches found when deserializing the JSON string into TagFilterAllOfValue with oneOf schemas: bool, float, int, object, str. Details: " + ", ".join(error_messages))
elif match == 0:
# no match
raise ValueError("No match found when deserializing the JSON string into TagFilterAllOfValue with oneOf schemas: bool, float, int, object, 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], bool, float, int, object, 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:
# primitive type
return self.actual_instance

def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.model_dump())


2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "instana_client"
version = "1.0.2"
version = "1.0.3"
description = "Instana REST API documentation"
authors = [
{name = "© Instana",email = "support@instana.com"},
Expand Down
15 changes: 11 additions & 4 deletions sanity_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ REQUIRED_PACKAGES=("setuptools" "pydantic" "python-dateutil" "urllib3")
for package in "${REQUIRED_PACKAGES[@]}"; do
if ! python3 -c "import $package" 2>/dev/null; then
print_warning "$package not found, installing..."
python3 -m pip install --break-system-packages "$package" >/dev/null 2>&1
if [ $? -eq 0 ]; then
# Try with --break-system-packages first (for Homebrew Python), fall back to regular install
if python3 -m pip install --break-system-packages "$package" >/dev/null 2>&1; then
print_success "$package installed successfully"
elif python3 -m pip install "$package" >/dev/null 2>&1; then
print_success "$package installed successfully"
else
print_error "Failed to install $package"
Expand Down Expand Up @@ -114,7 +116,10 @@ fi

# Test 3: Install package
print_status "Testing package installation..."
if python3 setup.py install --user >/dev/null 2>&1; then
# Use pip install instead of setup.py install (modern approach)
if python3 -m pip install --break-system-packages -e . >/dev/null 2>&1; then
print_success "Package installs successfully"
elif python3 -m pip install -e . >/dev/null 2>&1; then
print_success "Package installs successfully"
else
print_error "Package installation failed"
Expand All @@ -130,10 +135,12 @@ echo "------------------------------------------------------"

# Test 4: Basic import
print_status "Testing basic package import..."
if python3 -c "import instana_client; print('Basic import: SUCCESS')" 2>/dev/null; then
if python3 -c "import instana_client; print('Basic import: SUCCESS')" 2>&1; then
print_success "Basic package import works"
else
print_error "Basic package import failed"
print_error "Attempting to show import error details..."
python3 -c "import instana_client" 2>&1 || true
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
NAME = "instana-client"
VERSION = "1.0.2"
VERSION = "1.0.3"
PYTHON_REQUIRES = ">= 3.9"
REQUIRES = [
"urllib3 >= 2.1.0, < 3.0.0",
Expand Down
Loading