diff --git a/services/iaas/oas_commit b/services/iaas/oas_commit index 0962e389d..16ab3e1f3 100644 --- a/services/iaas/oas_commit +++ b/services/iaas/oas_commit @@ -1 +1 @@ -b155367fdf354045bbd1d2403a19bf4e363e76a3 +20c75d1fe743052968e3837f1eb1cf9fc84f40cd diff --git a/services/iaas/src/stackit/iaas/__init__.py b/services/iaas/src/stackit/iaas/__init__.py index 5fa26a000..a8eefb54e 100644 --- a/services/iaas/src/stackit/iaas/__init__.py +++ b/services/iaas/src/stackit/iaas/__init__.py @@ -72,6 +72,7 @@ "CreateVolumePayload", "DestinationCIDRv4", "DestinationCIDRv6", + "DestinationPrefixList", "Error", "GetServerLog200Response", "ICMPParameters", @@ -305,6 +306,9 @@ from stackit.iaas.models.destination_cidrv6 import ( DestinationCIDRv6 as DestinationCIDRv6, ) +from stackit.iaas.models.destination_prefix_list import ( + DestinationPrefixList as DestinationPrefixList, +) from stackit.iaas.models.error import Error as Error from stackit.iaas.models.get_server_log200_response import ( GetServerLog200Response as GetServerLog200Response, diff --git a/services/iaas/src/stackit/iaas/models/__init__.py b/services/iaas/src/stackit/iaas/models/__init__.py index a6a2f14c4..67fb4c39e 100644 --- a/services/iaas/src/stackit/iaas/models/__init__.py +++ b/services/iaas/src/stackit/iaas/models/__init__.py @@ -88,6 +88,7 @@ from stackit.iaas.models.create_volume_payload import CreateVolumePayload from stackit.iaas.models.destination_cidrv4 import DestinationCIDRv4 from stackit.iaas.models.destination_cidrv6 import DestinationCIDRv6 +from stackit.iaas.models.destination_prefix_list import DestinationPrefixList from stackit.iaas.models.error import Error from stackit.iaas.models.get_server_log200_response import GetServerLog200Response from stackit.iaas.models.icmp_parameters import ICMPParameters diff --git a/services/iaas/src/stackit/iaas/models/create_snapshot_payload.py b/services/iaas/src/stackit/iaas/models/create_snapshot_payload.py index 51cd61b83..7aa3d6afd 100644 --- a/services/iaas/src/stackit/iaas/models/create_snapshot_payload.py +++ b/services/iaas/src/stackit/iaas/models/create_snapshot_payload.py @@ -21,7 +21,15 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from uuid import UUID -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictInt, + StrictStr, + field_validator, +) from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -40,6 +48,7 @@ class CreateSnapshotPayload(BaseModel): description: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field( default=None, description="Description Object. Allows string up to 255 Characters." ) + encrypted: Optional[StrictBool] = Field(default=None, description="Indicates if a volume is encrypted.") id: Optional[UUID] = Field(default=None, description="Universally Unique Identifier (UUID).") labels: Optional[Dict[str, Any]] = Field( default=None, @@ -61,6 +70,7 @@ class CreateSnapshotPayload(BaseModel): "availabilityZone", "createdAt", "description", + "encrypted", "id", "labels", "name", @@ -171,11 +181,13 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. """ excluded_fields: Set[str] = set( [ "availability_zone", "created_at", + "encrypted", "id", "size", "status", @@ -204,6 +216,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "availabilityZone": obj.get("availabilityZone"), "createdAt": obj.get("createdAt"), "description": obj.get("description"), + "encrypted": obj.get("encrypted"), "id": obj.get("id"), "labels": obj.get("labels"), "name": obj.get("name"), diff --git a/services/iaas/src/stackit/iaas/models/destination_prefix_list.py b/services/iaas/src/stackit/iaas/models/destination_prefix_list.py new file mode 100644 index 000000000..f47d7a0ec --- /dev/null +++ b/services/iaas/src/stackit/iaas/models/destination_prefix_list.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +The version of the OpenAPI document: 2 +Contact: stackit-iaas@mail.schwarz +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python +from typing_extensions import Self + + +class DestinationPrefixList(BaseModel): + """ + Prefix List destination reference object. + """ # noqa: E501 + + type: StrictStr + value: UUID = Field(description="Universally Unique Identifier (UUID).") + __properties: ClassVar[List[str]] = ["type", "value"] + + @field_validator("type") + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(["prefixlist"]): + raise ValueError("must be one of enum values ('prefixlist')") + return value + + @field_validator("value") + def value_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value): + raise ValueError( + r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/" + ) + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DestinationPrefixList from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DestinationPrefixList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"type": obj.get("type"), "value": obj.get("value")}) + return _obj diff --git a/services/iaas/src/stackit/iaas/models/image_from_volume_payload.py b/services/iaas/src/stackit/iaas/models/image_from_volume_payload.py index 8d7f4dc73..697605ca7 100644 --- a/services/iaas/src/stackit/iaas/models/image_from_volume_payload.py +++ b/services/iaas/src/stackit/iaas/models/image_from_volume_payload.py @@ -40,7 +40,7 @@ class ImageFromVolumePayload(BaseModel): description="Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`.", alias="diskFormat" ) force: Optional[StrictBool] = Field( - default=False, description="When true the image is force created from a volume is currently being used." + default=False, description="When true the image is force created from a volume that is currently being used." ) name: Annotated[str, Field(strict=True, max_length=127)] = Field( description="The name for a General Object. Matches Names and also UUIDs." diff --git a/services/iaas/src/stackit/iaas/models/route_destination.py b/services/iaas/src/stackit/iaas/models/route_destination.py index e0031e38c..cc12b897c 100644 --- a/services/iaas/src/stackit/iaas/models/route_destination.py +++ b/services/iaas/src/stackit/iaas/models/route_destination.py @@ -28,8 +28,9 @@ from stackit.iaas.models.destination_cidrv4 import DestinationCIDRv4 from stackit.iaas.models.destination_cidrv6 import DestinationCIDRv6 +from stackit.iaas.models.destination_prefix_list import DestinationPrefixList -ROUTEDESTINATION_ONE_OF_SCHEMAS = ["DestinationCIDRv4", "DestinationCIDRv6"] +ROUTEDESTINATION_ONE_OF_SCHEMAS = ["DestinationCIDRv4", "DestinationCIDRv6", "DestinationPrefixList"] class RouteDestination(BaseModel): @@ -41,8 +42,10 @@ class RouteDestination(BaseModel): oneof_schema_1_validator: Optional[DestinationCIDRv4] = None # data type: DestinationCIDRv6 oneof_schema_2_validator: Optional[DestinationCIDRv6] = None - actual_instance: Optional[Union[DestinationCIDRv4, DestinationCIDRv6]] = None - one_of_schemas: Set[str] = {"DestinationCIDRv4", "DestinationCIDRv6"} + # data type: DestinationPrefixList + oneof_schema_3_validator: Optional[DestinationPrefixList] = None + actual_instance: Optional[Union[DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList]] = None + one_of_schemas: Set[str] = {"DestinationCIDRv4", "DestinationCIDRv6", "DestinationPrefixList"} model_config = ConfigDict( validate_assignment=True, @@ -76,10 +79,15 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `DestinationCIDRv6`") else: match += 1 + # validate data type: DestinationPrefixList + if not isinstance(v, DestinationPrefixList): + error_messages.append(f"Error! Input type `{type(v)}` is not `DestinationPrefixList`") + else: + match += 1 if match == 0: # no match raise ValueError( - "No match found when setting `actual_instance` in RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6. Details: " + "No match found when setting `actual_instance` in RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList. Details: " + ", ".join(error_messages) ) else: @@ -108,17 +116,23 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into DestinationPrefixList + try: + instance.actual_instance = DestinationPrefixList.from_json(json_str) + 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 RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6. Details: " + "Multiple matches found when deserializing the JSON string into RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList. Details: " + ", ".join(error_messages) ) elif match == 0: # no match raise ValueError( - "No match found when deserializing the JSON string into RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6. Details: " + "No match found when deserializing the JSON string into RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList. Details: " + ", ".join(error_messages) ) else: @@ -134,7 +148,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], DestinationCIDRv4, DestinationCIDRv6]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], DestinationCIDRv4, DestinationCIDRv6, DestinationPrefixList]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/services/iaas/src/stackit/iaas/models/snapshot.py b/services/iaas/src/stackit/iaas/models/snapshot.py index b0cbd9fb4..96bb720e1 100644 --- a/services/iaas/src/stackit/iaas/models/snapshot.py +++ b/services/iaas/src/stackit/iaas/models/snapshot.py @@ -21,7 +21,15 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from uuid import UUID -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictInt, + StrictStr, + field_validator, +) from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -40,6 +48,7 @@ class Snapshot(BaseModel): description: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field( default=None, description="Description Object. Allows string up to 255 Characters." ) + encrypted: Optional[StrictBool] = Field(default=None, description="Indicates if a volume is encrypted.") id: Optional[UUID] = Field(default=None, description="Universally Unique Identifier (UUID).") labels: Optional[Dict[str, Any]] = Field( default=None, @@ -61,6 +70,7 @@ class Snapshot(BaseModel): "availabilityZone", "createdAt", "description", + "encrypted", "id", "labels", "name", @@ -171,11 +181,13 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. """ excluded_fields: Set[str] = set( [ "availability_zone", "created_at", + "encrypted", "id", "size", "status", @@ -204,6 +216,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "availabilityZone": obj.get("availabilityZone"), "createdAt": obj.get("createdAt"), "description": obj.get("description"), + "encrypted": obj.get("encrypted"), "id": obj.get("id"), "labels": obj.get("labels"), "name": obj.get("name"),