Skip to content

Commit 604ffc2

Browse files
Generator: Update SDK /services/cdn (#1040)
* Generate cdn * chore(sdk): add changelogs --------- Co-authored-by: Rüdiger Schmitz <[email protected]>
1 parent c9515bc commit 604ffc2

14 files changed

+855
-118
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
- **Minor change:** Service update.
1717
- `git`: [v0.1.1](services/git/CHANGELOG.md#v011-2025-05-05)
1818
- **Bugfix**: Spelling corrections in documentation
19+
- `cdn`[v1.0.0](services/cdn/CHANGELOG.md#v100-2025-05-05)
20+
- **Feature:** Support for log management
21+
- **Feature:** Create distribution payload has additional optional attributes for blocked countries, IPs and volume limitation
22+
- **Feature:** Config Patch payload has additional optional attributes for blocked countries, IPs and volume limitation
23+
- **Breaking Change:** Config has additional required attributes for blocked countries, IPs and volume limitation
1924

2025
## Release (2025-04-30)
2126
- `stackitmarketplace`: [v0.4.0](services/stackitmarketplace/CHANGELOG.md#v040-2025-04-16)

services/cdn/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
## v1.0.0 (2025-05-05)
2+
- **Feature:** Support for log management
3+
- **Feature:** Create distribution payload has additional optional attributes for blocked countries, IPs and volume limitation
4+
- **Feature:** Config Patch payload has additional optional attributes for blocked countries, IPs and volume limitation
5+
- **Breaking Change:** Config has additional required attributes for blocked countries, IPs and volume limitation
6+
17
## v0.1.0 (2025-03-18)
28
- **New**: Client for managing the CDN service

services/cdn/src/stackit/cdn/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from stackit.cdn.models.delete_custom_domain_response import DeleteCustomDomainResponse
4444
from stackit.cdn.models.delete_distribution_response import DeleteDistributionResponse
4545
from stackit.cdn.models.distribution import Distribution
46+
from stackit.cdn.models.distribution_logs_record import DistributionLogsRecord
4647
from stackit.cdn.models.distribution_statistics_record import (
4748
DistributionStatisticsRecord,
4849
)
@@ -54,20 +55,19 @@
5455
)
5556
from stackit.cdn.models.domain import Domain
5657
from stackit.cdn.models.domain_status import DomainStatus
58+
from stackit.cdn.models.error_details import ErrorDetails
5759
from stackit.cdn.models.find_cache_paths_response import FindCachePathsResponse
5860
from stackit.cdn.models.find_cache_paths_response_entry import (
5961
FindCachePathsResponseEntry,
6062
)
6163
from stackit.cdn.models.generic_json_response import GenericJSONResponse
62-
from stackit.cdn.models.generic_json_response_details_inner import (
63-
GenericJSONResponseDetailsInner,
64-
)
6564
from stackit.cdn.models.get_cache_info_response import GetCacheInfoResponse
6665
from stackit.cdn.models.get_cache_info_response_history_entry import (
6766
GetCacheInfoResponseHistoryEntry,
6867
)
6968
from stackit.cdn.models.get_custom_domain_response import GetCustomDomainResponse
7069
from stackit.cdn.models.get_distribution_response import GetDistributionResponse
70+
from stackit.cdn.models.get_logs_response import GetLogsResponse
7171
from stackit.cdn.models.get_statistics_response import GetStatisticsResponse
7272
from stackit.cdn.models.http_backend import HttpBackend
7373
from stackit.cdn.models.http_backend_patch import HttpBackendPatch

services/cdn/src/stackit/cdn/api/default_api.py

Lines changed: 507 additions & 87 deletions
Large diffs are not rendered by default.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from stackit.cdn.models.delete_custom_domain_response import DeleteCustomDomainResponse
2525
from stackit.cdn.models.delete_distribution_response import DeleteDistributionResponse
2626
from stackit.cdn.models.distribution import Distribution
27+
from stackit.cdn.models.distribution_logs_record import DistributionLogsRecord
2728
from stackit.cdn.models.distribution_statistics_record import (
2829
DistributionStatisticsRecord,
2930
)
@@ -35,20 +36,19 @@
3536
)
3637
from stackit.cdn.models.domain import Domain
3738
from stackit.cdn.models.domain_status import DomainStatus
39+
from stackit.cdn.models.error_details import ErrorDetails
3840
from stackit.cdn.models.find_cache_paths_response import FindCachePathsResponse
3941
from stackit.cdn.models.find_cache_paths_response_entry import (
4042
FindCachePathsResponseEntry,
4143
)
4244
from stackit.cdn.models.generic_json_response import GenericJSONResponse
43-
from stackit.cdn.models.generic_json_response_details_inner import (
44-
GenericJSONResponseDetailsInner,
45-
)
4645
from stackit.cdn.models.get_cache_info_response import GetCacheInfoResponse
4746
from stackit.cdn.models.get_cache_info_response_history_entry import (
4847
GetCacheInfoResponseHistoryEntry,
4948
)
5049
from stackit.cdn.models.get_custom_domain_response import GetCustomDomainResponse
5150
from stackit.cdn.models.get_distribution_response import GetDistributionResponse
51+
from stackit.cdn.models.get_logs_response import GetLogsResponse
5252
from stackit.cdn.models.get_statistics_response import GetStatisticsResponse
5353
from stackit.cdn.models.http_backend import HttpBackend
5454
from stackit.cdn.models.http_backend_patch import HttpBackendPatch

services/cdn/src/stackit/cdn/models/config.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import pprint
1818
from typing import Any, ClassVar, Dict, List, Optional, Set
1919

20-
from pydantic import BaseModel, ConfigDict, Field
20+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
2121
from typing_extensions import Annotated, Self
2222

2323
from stackit.cdn.models.config_backend import ConfigBackend
@@ -30,8 +30,21 @@ class Config(BaseModel):
3030
"""
3131

3232
backend: ConfigBackend
33+
blocked_countries: List[StrictStr] = Field(
34+
description="Restricts access to your content based on country. We use the ISO 3166-1 alpha-2 standard for country codes (e.g., DE, ES, GB). This setting blocks users from the specified countries. ",
35+
alias="blockedCountries",
36+
)
37+
blocked_ips: List[StrictStr] = Field(
38+
description="Restricts access to your content by specifying a list of blocked IPv4 addresses. This feature enhances security and privacy by preventing these addresses from accessing your distribution. ",
39+
alias="blockedIPs",
40+
)
41+
monthly_limit_bytes: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
42+
default=None,
43+
description="Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. ",
44+
alias="monthlyLimitBytes",
45+
)
3346
regions: Annotated[List[Region], Field(min_length=1)]
34-
__properties: ClassVar[List[str]] = ["backend", "regions"]
47+
__properties: ClassVar[List[str]] = ["backend", "blockedCountries", "blockedIPs", "monthlyLimitBytes", "regions"]
3548

3649
model_config = ConfigDict(
3750
populate_by_name=True,
@@ -73,6 +86,11 @@ def to_dict(self) -> Dict[str, Any]:
7386
# override the default output from pydantic by calling `to_dict()` of backend
7487
if self.backend:
7588
_dict["backend"] = self.backend.to_dict()
89+
# set to None if monthly_limit_bytes (nullable) is None
90+
# and model_fields_set contains the field
91+
if self.monthly_limit_bytes is None and "monthly_limit_bytes" in self.model_fields_set:
92+
_dict["monthlyLimitBytes"] = None
93+
7694
return _dict
7795

7896
@classmethod
@@ -87,6 +105,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87105
_obj = cls.model_validate(
88106
{
89107
"backend": ConfigBackend.from_dict(obj["backend"]) if obj.get("backend") is not None else None,
108+
"blockedCountries": obj.get("blockedCountries"),
109+
"blockedIPs": obj.get("blockedIPs"),
110+
"monthlyLimitBytes": obj.get("monthlyLimitBytes"),
90111
"regions": obj.get("regions"),
91112
}
92113
)

services/cdn/src/stackit/cdn/models/config_patch.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import pprint
1818
from typing import Any, ClassVar, Dict, List, Optional, Set
1919

20-
from pydantic import BaseModel, ConfigDict, Field
20+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
2121
from typing_extensions import Annotated, Self
2222

2323
from stackit.cdn.models.config_patch_backend import ConfigPatchBackend
@@ -30,8 +30,23 @@ class ConfigPatch(BaseModel):
3030
"""
3131

3232
backend: Optional[ConfigPatchBackend] = None
33+
blocked_countries: Optional[List[StrictStr]] = Field(
34+
default=None,
35+
description="Restricts access to your content based on country. We use the ISO 3166-1 alpha-2 standard for country codes (e.g., DE, ES, GB). This setting blocks users from the specified countries. ",
36+
alias="blockedCountries",
37+
)
38+
blocked_ips: Optional[List[StrictStr]] = Field(
39+
default=None,
40+
description="Restricts access to your content by specifying a list of blocked IPv4 addresses. This feature enhances security and privacy by preventing these addresses from accessing your distribution. ",
41+
alias="blockedIPs",
42+
)
43+
monthly_limit_bytes: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
44+
default=None,
45+
description="Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. ",
46+
alias="monthlyLimitBytes",
47+
)
3348
regions: Optional[Annotated[List[Region], Field(min_length=1)]] = None
34-
__properties: ClassVar[List[str]] = ["backend", "regions"]
49+
__properties: ClassVar[List[str]] = ["backend", "blockedCountries", "blockedIPs", "monthlyLimitBytes", "regions"]
3550

3651
model_config = ConfigDict(
3752
populate_by_name=True,
@@ -73,6 +88,11 @@ def to_dict(self) -> Dict[str, Any]:
7388
# override the default output from pydantic by calling `to_dict()` of backend
7489
if self.backend:
7590
_dict["backend"] = self.backend.to_dict()
91+
# set to None if monthly_limit_bytes (nullable) is None
92+
# and model_fields_set contains the field
93+
if self.monthly_limit_bytes is None and "monthly_limit_bytes" in self.model_fields_set:
94+
_dict["monthlyLimitBytes"] = None
95+
7696
return _dict
7797

7898
@classmethod
@@ -87,6 +107,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87107
_obj = cls.model_validate(
88108
{
89109
"backend": ConfigPatchBackend.from_dict(obj["backend"]) if obj.get("backend") is not None else None,
110+
"blockedCountries": obj.get("blockedCountries"),
111+
"blockedIPs": obj.get("blockedIPs"),
112+
"monthlyLimitBytes": obj.get("monthlyLimitBytes"),
90113
"regions": obj.get("regions"),
91114
}
92115
)

services/cdn/src/stackit/cdn/models/create_distribution_payload.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,26 @@ class CreateDistributionPayload(BaseModel):
2828
CreateDistributionPayload
2929
"""
3030

31+
blocked_countries: Optional[List[StrictStr]] = Field(
32+
default=None,
33+
description="Restricts access to your content based on country. We use the ISO 3166-1 alpha-2 standard for country codes (e.g., DE, ES, GB). This setting blocks users from the specified countries. ",
34+
alias="blockedCountries",
35+
)
36+
blocked_ips: Optional[List[StrictStr]] = Field(
37+
default=None,
38+
description="Restricts access to your content by specifying a list of blocked IPv4 addresses. This feature enhances security and privacy by preventing these addresses from accessing your distribution. ",
39+
alias="blockedIPs",
40+
)
3141
intent_id: Optional[StrictStr] = Field(
3242
default=None,
3343
description="While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple POST-Requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. ",
3444
alias="intentId",
3545
)
46+
monthly_limit_bytes: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
47+
default=None,
48+
description="Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. ",
49+
alias="monthlyLimitBytes",
50+
)
3651
origin_request_headers: Optional[Dict[str, StrictStr]] = Field(
3752
default=None,
3853
description="Headers that will be sent with every request to the configured origin. WARNING: Do not store sensitive values in the headers. The data is stores as plain text. ",
@@ -45,7 +60,15 @@ class CreateDistributionPayload(BaseModel):
4560
regions: Annotated[List[Region], Field(min_length=1)] = Field(
4661
description="Define in which regions you would like your content to be cached. "
4762
)
48-
__properties: ClassVar[List[str]] = ["intentId", "originRequestHeaders", "originUrl", "regions"]
63+
__properties: ClassVar[List[str]] = [
64+
"blockedCountries",
65+
"blockedIPs",
66+
"intentId",
67+
"monthlyLimitBytes",
68+
"originRequestHeaders",
69+
"originUrl",
70+
"regions",
71+
]
4972

5073
model_config = ConfigDict(
5174
populate_by_name=True,
@@ -97,7 +120,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97120

98121
_obj = cls.model_validate(
99122
{
123+
"blockedCountries": obj.get("blockedCountries"),
124+
"blockedIPs": obj.get("blockedIPs"),
100125
"intentId": obj.get("intentId"),
126+
"monthlyLimitBytes": obj.get("monthlyLimitBytes"),
101127
"originRequestHeaders": obj.get("originRequestHeaders"),
102128
"originUrl": obj.get("originUrl"),
103129
"regions": obj.get("regions"),

services/cdn/src/stackit/cdn/models/distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Distribution(BaseModel):
4646
description="- `CREATING`: The distribution was just created. All the relevant resources are created in the background. Once fully reconciled, this switches to `ACTIVE`. If there are any issues, the status changes to `ERROR`. You can look at the `errors` array to get more infos. - `ACTIVE`: The usual state. The desired configuration is synced, there are no errors - `UPDATING`: The state when there is a discrepancy between the desired and actual configuration state. This occurs right after an update. Will switch to `ACTIVE` or `ERROR`, depending on if synchronizing succeeds or not. - `DELETING`: The state right after a delete request was received. The distribution will stay in this status until all resources have been successfully removed, or until we encounter an `ERROR` state. **NOTE:** You can keep fetching the distribution while it is deleting. After successful deletion, trying to get a distribution will return a 404 Not Found response - `ERROR`: The error state. Look at the `errors` array for more info. "
4747
)
4848
updated_at: datetime = Field(
49-
description="RFC3339 string which returns the last time the distribution's configuration was modified. ",
49+
description="RFC3339 string which returns the last time the distribution configuration was modified. ",
5050
alias="updatedAt",
5151
)
5252
__properties: ClassVar[List[str]] = [
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# coding: utf-8
2+
3+
"""
4+
CDN API
5+
6+
API used to create and manage your CDN distributions.
7+
8+
The version of the OpenAPI document: 1beta.0.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501 docstring might be too long
13+
14+
from __future__ import annotations
15+
16+
import json
17+
import pprint
18+
from datetime import datetime
19+
from typing import Any, ClassVar, Dict, List, Optional, Set
20+
21+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
22+
from typing_extensions import Annotated, Self
23+
24+
25+
class DistributionLogsRecord(BaseModel):
26+
"""
27+
DistributionLogsRecord
28+
"""
29+
30+
cache_hit: StrictBool = Field(alias="cacheHit")
31+
data_center_region: StrictStr = Field(alias="dataCenterRegion")
32+
distribution_id: StrictStr = Field(alias="distributionID")
33+
host: StrictStr
34+
path: StrictStr
35+
request_country_code: Annotated[str, Field(min_length=2, strict=True, max_length=2)] = Field(
36+
description="ISO 3166-1 A2 compliant country code", alias="requestCountryCode"
37+
)
38+
size: Annotated[int, Field(strict=True, ge=0)]
39+
status_code: StrictInt = Field(alias="statusCode")
40+
timestamp: datetime
41+
__properties: ClassVar[List[str]] = [
42+
"cacheHit",
43+
"dataCenterRegion",
44+
"distributionID",
45+
"host",
46+
"path",
47+
"requestCountryCode",
48+
"size",
49+
"statusCode",
50+
"timestamp",
51+
]
52+
53+
model_config = ConfigDict(
54+
populate_by_name=True,
55+
validate_assignment=True,
56+
protected_namespaces=(),
57+
)
58+
59+
def to_str(self) -> str:
60+
"""Returns the string representation of the model using alias"""
61+
return pprint.pformat(self.model_dump(by_alias=True))
62+
63+
def to_json(self) -> str:
64+
"""Returns the JSON representation of the model using alias"""
65+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66+
return json.dumps(self.to_dict())
67+
68+
@classmethod
69+
def from_json(cls, json_str: str) -> Optional[Self]:
70+
"""Create an instance of DistributionLogsRecord from a JSON string"""
71+
return cls.from_dict(json.loads(json_str))
72+
73+
def to_dict(self) -> Dict[str, Any]:
74+
"""Return the dictionary representation of the model using alias.
75+
76+
This has the following differences from calling pydantic's
77+
`self.model_dump(by_alias=True)`:
78+
79+
* `None` is only added to the output dict for nullable fields that
80+
were set at model initialization. Other fields with value `None`
81+
are ignored.
82+
"""
83+
excluded_fields: Set[str] = set([])
84+
85+
_dict = self.model_dump(
86+
by_alias=True,
87+
exclude=excluded_fields,
88+
exclude_none=True,
89+
)
90+
return _dict
91+
92+
@classmethod
93+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
94+
"""Create an instance of DistributionLogsRecord from a dict"""
95+
if obj is None:
96+
return None
97+
98+
if not isinstance(obj, dict):
99+
return cls.model_validate(obj)
100+
101+
_obj = cls.model_validate(
102+
{
103+
"cacheHit": obj.get("cacheHit"),
104+
"dataCenterRegion": obj.get("dataCenterRegion"),
105+
"distributionID": obj.get("distributionID"),
106+
"host": obj.get("host"),
107+
"path": obj.get("path"),
108+
"requestCountryCode": obj.get("requestCountryCode"),
109+
"size": obj.get("size"),
110+
"statusCode": obj.get("statusCode"),
111+
"timestamp": obj.get("timestamp"),
112+
}
113+
)
114+
return _obj

0 commit comments

Comments
 (0)