Skip to content
Closed
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 services/mongodbflex/oas_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9873a8f7a4120017699e43baba2e8b2af7bca93e
3d55d58fe8607afa4f894077e1e5c0a19ef57b3f
2 changes: 2 additions & 0 deletions services/mongodbflex/src/stackit/mongodbflex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"SlowQuery",
"Storage",
"StorageRange",
"StorageUpdate",
"SuggestedIndex",
"UpdateBackupSchedulePayload",
"UpdateInstancePayload",
Expand Down Expand Up @@ -193,6 +194,7 @@
from stackit.mongodbflex.models.slow_query import SlowQuery as SlowQuery
from stackit.mongodbflex.models.storage import Storage as Storage
from stackit.mongodbflex.models.storage_range import StorageRange as StorageRange
from stackit.mongodbflex.models.storage_update import StorageUpdate as StorageUpdate
from stackit.mongodbflex.models.suggested_index import SuggestedIndex as SuggestedIndex
from stackit.mongodbflex.models.update_backup_schedule_payload import (
UpdateBackupSchedulePayload as UpdateBackupSchedulePayload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
from stackit.mongodbflex.models.slow_query import SlowQuery
from stackit.mongodbflex.models.storage import Storage
from stackit.mongodbflex.models.storage_range import StorageRange
from stackit.mongodbflex.models.storage_update import StorageUpdate
from stackit.mongodbflex.models.suggested_index import SuggestedIndex
from stackit.mongodbflex.models.update_backup_schedule_payload import (
UpdateBackupSchedulePayload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from typing_extensions import Annotated, Self

from stackit.mongodbflex.models.acl import ACL
from stackit.mongodbflex.models.storage import Storage
from stackit.mongodbflex.models.storage_update import StorageUpdate


class PartialUpdateInstancePayload(BaseModel):
Expand All @@ -39,7 +39,7 @@ class PartialUpdateInstancePayload(BaseModel):
name: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=63)]] = None
options: Optional[Dict[str, StrictStr]] = None
replicas: Optional[StrictInt] = None
storage: Optional[Storage] = None
storage: Optional[StorageUpdate] = None
version: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = [
"acl",
Expand Down Expand Up @@ -129,7 +129,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"name": obj.get("name"),
"options": obj.get("options"),
"replicas": obj.get("replicas"),
"storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None,
"storage": StorageUpdate.from_dict(obj["storage"]) if obj.get("storage") is not None else None,
"version": obj.get("version"),
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# coding: utf-8

"""
STACKIT MongoDB Service API

This is the documentation for the STACKIT MongoDB Flex Service API

The version of the OpenAPI document: 2.0.0
Contact: [email protected]
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 typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from pydantic_core import to_jsonable_python
from typing_extensions import Self


class StorageUpdate(BaseModel):
"""
StorageUpdate
""" # noqa: E501

var_class: Optional[StrictStr] = Field(
default=None,
description="DEPRECATED: Starting November 2026, the API will reject requests that attempt to modify the storage class.",
alias="class",
)
size: Optional[StrictInt] = None
__properties: ClassVar[List[str]] = ["class", "size"]

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 StorageUpdate 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 StorageUpdate from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({"class": obj.get("class"), "size": obj.get("size")})
return _obj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from typing_extensions import Annotated, Self

from stackit.mongodbflex.models.acl import ACL
from stackit.mongodbflex.models.storage import Storage
from stackit.mongodbflex.models.storage_update import StorageUpdate


class UpdateInstancePayload(BaseModel):
Expand All @@ -39,7 +39,7 @@ class UpdateInstancePayload(BaseModel):
name: Annotated[str, Field(min_length=3, strict=True, max_length=63)]
options: Dict[str, StrictStr]
replicas: StrictInt
storage: Storage
storage: StorageUpdate
version: StrictStr
__properties: ClassVar[List[str]] = [
"acl",
Expand Down Expand Up @@ -126,7 +126,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"name": obj.get("name"),
"options": obj.get("options"),
"replicas": obj.get("replicas"),
"storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None,
"storage": StorageUpdate.from_dict(obj["storage"]) if obj.get("storage") is not None else None,
"version": obj.get("version"),
}
)
Expand Down
Loading