Skip to content

Commit 97be425

Browse files
Generator: Update SDK /services/sfs (#3822)
* Generate sfs * chore(sfs) write changelog, bump version --------- Co-authored-by: Carlo Goetz <carlo.goetz@inovex.de>
1 parent 17b612a commit 97be425

9 files changed

Lines changed: 199 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
## Release (2026-MM-DD)
2-
- `sfs`: [v0.4.0](services/sfs/CHANGELOG.md#v040)
3-
- **Feature:** model `CreateResourcePoolPayload` now has an additional field `snapshotPolicyId`
4-
- **Feature:** model `CreateResourcePoolSnapshotPayload` now has an additional field `snaplockRetentionHours`
5-
- **Feature:** model `ResourcePool` now has an additional field `snapshotPolicy`
6-
- **Feature:** model `ResourcePoolSnapshot` now has an additional field `snaplockExpiryTime`
7-
- **Feature:** model `ResourcePoolSpace` now has an additional field `usedBySnapshotsGigabytes`
8-
- **Feature:** model `UpdateResourcePoolPayload` now has an additional field `snapshotPolicyId`
9-
- **Feature:** new models: `DisableLockResponse`, `EnableLockResponse`, `GetLockResponse`, `GetScheduleResponse`, `GetSnapshotPolicyResponse`, `ListSchedulesResponse`, `ListSnapshotPoliciesResponse`, `ResourcePoolSnapshotPolicy`, `Schedule`, `SnapshotPolicy`, `SnapshotPolicySchedule`, `UpdateResourcePoolSnapshotPayload`, `UpdateResourcePoolSnapshotResponse`
10-
- **Feature:** new operations: `UpdateResourcePoolSnapshot`, `ListSchedules`, `GetSchedule`, `ListSnapshotPolicies`, `GetSnapshotPolicy`, `DisableLock`, `GetLock`, `EnableLock`,
2+
- `sfs`:
3+
- [v0.5.0](services/sfs/CHANGELOG.md#v050)
4+
- **Deprecation:** deprecated field `schedules` in model `SnapshotPolicy`
5+
- **Feature:** new field `snapshotSchedules` in model `SnapshotPolicy`
6+
- **Feature:** new field `interval` in model `SnapshotPolicySchedule`
7+
- **Feature:** new model `SnapshotPolicySnapshotPolicySchedule`
8+
- [v0.4.0](services/sfs/CHANGELOG.md#v040)
9+
- **Feature:** model `CreateResourcePoolPayload` now has an additional field `snapshotPolicyId`
10+
- **Feature:** model `CreateResourcePoolSnapshotPayload` now has an additional field `snaplockRetentionHours`
11+
- **Feature:** model `ResourcePool` now has an additional field `snapshotPolicy`
12+
- **Feature:** model `ResourcePoolSnapshot` now has an additional field `snaplockExpiryTime`
13+
- **Feature:** model `ResourcePoolSpace` now has an additional field `usedBySnapshotsGigabytes`
14+
- **Feature:** model `UpdateResourcePoolPayload` now has an additional field `snapshotPolicyId`
15+
- **Feature:** new models: `DisableLockResponse`, `EnableLockResponse`, `GetLockResponse`, `GetScheduleResponse`, `GetSnapshotPolicyResponse`, `ListSchedulesResponse`, `ListSnapshotPoliciesResponse`, `ResourcePoolSnapshotPolicy`, `Schedule`, `SnapshotPolicy`, `SnapshotPolicySchedule`, `UpdateResourcePoolSnapshotPayload`, `UpdateResourcePoolSnapshotResponse`
16+
- **Feature:** new operations: `UpdateResourcePoolSnapshot`, `ListSchedules`, `GetSchedule`, `ListSnapshotPolicies`, `GetSnapshotPolicy`, `DisableLock`, `GetLock`, `EnableLock`,
1117
- `ske`: [v1.8.0](services/ske/CHANGELOG.md#v180)
1218
- **Breaking Change:** Change status codes: remove 200, change response type of 202 and add 400 in some API calls
1319
- **Breaking Change:** Aligned CRI name validation with the API side validation (removed docker)

services/sfs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v0.5.0
2+
- **Deprecation:** deprecated field `schedules` in model `SnapshotPolicy`
3+
- **Feature:** new field `snapshotSchedules` in model `SnapshotPolicy`
4+
- **Feature:** new field `interval` in model `SnapshotPolicySchedule`
5+
- **Feature:** new model `SnapshotPolicySnapshotPolicySchedule`
6+
17
## v0.4.0
28
- **Feature:** model `CreateResourcePoolPayload` now has an additional field `snapshotPolicyId`
39
- **Feature:** model `CreateResourcePoolSnapshotPayload` now has an additional field `snaplockRetentionHours`

services/sfs/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bda6ad3d9e8850526f25eddcb6589fcc7559c625
1+
a896a71ffc1c1152f63b40a0194ac461ce179d6c

services/sfs/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "stackit-sfs"
3-
version = "v0.4.0"
3+
version = "v0.5.0"
44
description = "STACKIT File Storage (SFS)"
55
authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
66
requires-python = ">=3.9,<4"

services/sfs/src/stackit/sfs/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"ShareExportPolicyRule",
6767
"SnapshotPolicy",
6868
"SnapshotPolicySchedule",
69+
"SnapshotPolicySnapshotPolicySchedule",
6970
"Status",
7071
"UpdateResourcePoolPayload",
7172
"UpdateResourcePoolResponse",
@@ -193,6 +194,9 @@
193194
from stackit.sfs.models.snapshot_policy_schedule import (
194195
SnapshotPolicySchedule as SnapshotPolicySchedule,
195196
)
197+
from stackit.sfs.models.snapshot_policy_snapshot_policy_schedule import (
198+
SnapshotPolicySnapshotPolicySchedule as SnapshotPolicySnapshotPolicySchedule,
199+
)
196200
from stackit.sfs.models.status import Status as Status
197201
from stackit.sfs.models.update_resource_pool_payload import (
198202
UpdateResourcePoolPayload as UpdateResourcePoolPayload,

services/sfs/src/stackit/sfs/models/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
from stackit.sfs.models.share_export_policy_rule import ShareExportPolicyRule
7676
from stackit.sfs.models.snapshot_policy import SnapshotPolicy
7777
from stackit.sfs.models.snapshot_policy_schedule import SnapshotPolicySchedule
78+
from stackit.sfs.models.snapshot_policy_snapshot_policy_schedule import (
79+
SnapshotPolicySnapshotPolicySchedule,
80+
)
7881
from stackit.sfs.models.status import Status
7982
from stackit.sfs.models.update_resource_pool_payload import UpdateResourcePoolPayload
8083
from stackit.sfs.models.update_resource_pool_response import UpdateResourcePoolResponse

services/sfs/src/stackit/sfs/models/snapshot_policy.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
from typing_extensions import Self
3131

3232
from stackit.sfs.models.snapshot_policy_schedule import SnapshotPolicySchedule
33+
from stackit.sfs.models.snapshot_policy_snapshot_policy_schedule import (
34+
SnapshotPolicySnapshotPolicySchedule,
35+
)
3336

3437

3538
class SnapshotPolicy(BaseModel):
@@ -42,8 +45,21 @@ class SnapshotPolicy(BaseModel):
4245
enabled: Optional[StrictBool] = Field(default=None, description="Wether the Snapshot Policy is enabled")
4346
id: Optional[StrictStr] = Field(default=None, description="ID of the Snapshot Policy")
4447
name: Optional[StrictStr] = Field(default=None, description="Name of the Snapshot Policy")
45-
schedules: Optional[List[SnapshotPolicySchedule]] = Field(default=None, description="associated schedules")
46-
__properties: ClassVar[List[str]] = ["comment", "createdAt", "enabled", "id", "name", "schedules"]
48+
schedules: Optional[List[SnapshotPolicySchedule]] = Field(
49+
default=None, description="(deprecated) associated schedules"
50+
)
51+
snapshot_schedules: Optional[List[SnapshotPolicySnapshotPolicySchedule]] = Field(
52+
default=None, description="associated schedules", alias="snapshotSchedules"
53+
)
54+
__properties: ClassVar[List[str]] = [
55+
"comment",
56+
"createdAt",
57+
"enabled",
58+
"id",
59+
"name",
60+
"schedules",
61+
"snapshotSchedules",
62+
]
4763

4864
@field_validator("created_at", mode="before")
4965
def created_at_change_year_zero_to_one(cls, value):
@@ -102,6 +118,13 @@ def to_dict(self) -> Dict[str, Any]:
102118
if _item_schedules:
103119
_items.append(_item_schedules.to_dict())
104120
_dict["schedules"] = _items
121+
# override the default output from pydantic by calling `to_dict()` of each item in snapshot_schedules (list)
122+
_items = []
123+
if self.snapshot_schedules:
124+
for _item_snapshot_schedules in self.snapshot_schedules:
125+
if _item_snapshot_schedules:
126+
_items.append(_item_snapshot_schedules.to_dict())
127+
_dict["snapshotSchedules"] = _items
105128
return _dict
106129

107130
@classmethod
@@ -125,6 +148,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
125148
if obj.get("schedules") is not None
126149
else None
127150
),
151+
"snapshotSchedules": (
152+
[SnapshotPolicySnapshotPolicySchedule.from_dict(_item) for _item in obj["snapshotSchedules"]]
153+
if obj.get("snapshotSchedules") is not None
154+
else None
155+
),
128156
}
129157
)
130158
return _obj

services/sfs/src/stackit/sfs/models/snapshot_policy_schedule.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ class SnapshotPolicySchedule(BaseModel):
2626
SnapshotPolicySchedule
2727
""" # noqa: E501
2828

29-
count: Optional[StrictInt] = None
30-
prefix: Optional[StrictStr] = None
31-
retention_period: Optional[StrictStr] = Field(default=None, alias="retentionPeriod")
32-
schedule_id: Optional[StrictStr] = Field(default=None, alias="scheduleId")
33-
__properties: ClassVar[List[str]] = ["count", "prefix", "retentionPeriod", "scheduleId"]
29+
count: Optional[StrictInt] = Field(default=None, description="Retention Count")
30+
interval: Optional[StrictStr] = Field(
31+
default=None, description="Interval of the Schedule (follows the cron schedule expression in Unix-like systems)"
32+
)
33+
prefix: Optional[StrictStr] = Field(
34+
default=None, description="Prefix used for the snapshots created by this policy"
35+
)
36+
retention_period: Optional[StrictStr] = Field(
37+
default=None, description='Retention Period (ISO 8601 format or "infinite")', alias="retentionPeriod"
38+
)
39+
schedule_id: Optional[StrictStr] = Field(default=None, description="ID of the Schedule", alias="scheduleId")
40+
__properties: ClassVar[List[str]] = ["count", "interval", "prefix", "retentionPeriod", "scheduleId"]
3441

3542
model_config = ConfigDict(
3643
populate_by_name=True,
@@ -83,6 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
8390
_obj = cls.model_validate(
8491
{
8592
"count": obj.get("count"),
93+
"interval": obj.get("interval"),
8694
"prefix": obj.get("prefix"),
8795
"retentionPeriod": obj.get("retentionPeriod"),
8896
"scheduleId": obj.get("scheduleId"),
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT File Storage (SFS)
5+
6+
API used to create and manage NFS Shares.
7+
8+
The version of the OpenAPI document: 1.0.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
from __future__ import annotations
15+
16+
import json
17+
import pprint
18+
import re # noqa: F401
19+
from datetime import datetime
20+
from typing import Any, ClassVar, Dict, List, Optional, Set
21+
22+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
23+
from typing_extensions import Self
24+
25+
26+
class SnapshotPolicySnapshotPolicySchedule(BaseModel):
27+
"""
28+
SnapshotPolicySnapshotPolicySchedule
29+
""" # noqa: E501
30+
31+
created_at: Optional[datetime] = Field(default=None, alias="createdAt")
32+
id: Optional[StrictStr] = Field(default=None, description="ID of the Schedule")
33+
interval: Optional[StrictStr] = Field(
34+
default=None, description="Interval of the Schedule (follows the cron schedule expression in Unix-like systems)"
35+
)
36+
name: Optional[StrictStr] = Field(default=None, description="Name of the Schedule")
37+
prefix: Optional[StrictStr] = Field(
38+
default=None, description="Prefix used for the snapshots created by this policy"
39+
)
40+
retention_count: Optional[StrictInt] = Field(default=None, description="Retention Count", alias="retentionCount")
41+
retention_period: Optional[StrictStr] = Field(
42+
default=None, description='Retention Period (ISO 8601 format or "infinite")', alias="retentionPeriod"
43+
)
44+
__properties: ClassVar[List[str]] = [
45+
"createdAt",
46+
"id",
47+
"interval",
48+
"name",
49+
"prefix",
50+
"retentionCount",
51+
"retentionPeriod",
52+
]
53+
54+
@field_validator("created_at", mode="before")
55+
def created_at_change_year_zero_to_one(cls, value):
56+
"""Workaround which prevents year 0 issue"""
57+
if isinstance(value, str):
58+
# Check for year "0000" at the beginning of the string
59+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
60+
if value.startswith("0000-01-01T") and re.match(
61+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
62+
):
63+
# Workaround: Replace "0000" with "0001"
64+
return "0001" + value[4:] # Take "0001" and append the rest of the string
65+
return value
66+
67+
model_config = ConfigDict(
68+
populate_by_name=True,
69+
validate_assignment=True,
70+
protected_namespaces=(),
71+
)
72+
73+
def to_str(self) -> str:
74+
"""Returns the string representation of the model using alias"""
75+
return pprint.pformat(self.model_dump(by_alias=True))
76+
77+
def to_json(self) -> str:
78+
"""Returns the JSON representation of the model using alias"""
79+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
80+
return json.dumps(self.to_dict())
81+
82+
@classmethod
83+
def from_json(cls, json_str: str) -> Optional[Self]:
84+
"""Create an instance of SnapshotPolicySnapshotPolicySchedule from a JSON string"""
85+
return cls.from_dict(json.loads(json_str))
86+
87+
def to_dict(self) -> Dict[str, Any]:
88+
"""Return the dictionary representation of the model using alias.
89+
90+
This has the following differences from calling pydantic's
91+
`self.model_dump(by_alias=True)`:
92+
93+
* `None` is only added to the output dict for nullable fields that
94+
were set at model initialization. Other fields with value `None`
95+
are ignored.
96+
"""
97+
excluded_fields: Set[str] = set([])
98+
99+
_dict = self.model_dump(
100+
by_alias=True,
101+
exclude=excluded_fields,
102+
exclude_none=True,
103+
)
104+
return _dict
105+
106+
@classmethod
107+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
108+
"""Create an instance of SnapshotPolicySnapshotPolicySchedule from a dict"""
109+
if obj is None:
110+
return None
111+
112+
if not isinstance(obj, dict):
113+
return cls.model_validate(obj)
114+
115+
_obj = cls.model_validate(
116+
{
117+
"createdAt": obj.get("createdAt"),
118+
"id": obj.get("id"),
119+
"interval": obj.get("interval"),
120+
"name": obj.get("name"),
121+
"prefix": obj.get("prefix"),
122+
"retentionCount": obj.get("retentionCount"),
123+
"retentionPeriod": obj.get("retentionPeriod"),
124+
}
125+
)
126+
return _obj

0 commit comments

Comments
 (0)