Skip to content

Commit a0cb178

Browse files
Generate cdn
1 parent cf47200 commit a0cb178

File tree

9 files changed

+410
-10
lines changed

9 files changed

+410
-10
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"GetCustomDomainResponseCertificate",
5555
"GetDistributionResponse",
5656
"GetLogsResponse",
57+
"GetLogsSearchFiltersResponse",
5758
"GetStatisticsResponse",
5859
"HttpBackend",
5960
"HttpBackendPatch",
@@ -152,6 +153,9 @@
152153
GetDistributionResponse as GetDistributionResponse,
153154
)
154155
from stackit.cdn.models.get_logs_response import GetLogsResponse as GetLogsResponse
156+
from stackit.cdn.models.get_logs_search_filters_response import (
157+
GetLogsSearchFiltersResponse as GetLogsSearchFiltersResponse,
158+
)
155159
from stackit.cdn.models.get_statistics_response import (
156160
GetStatisticsResponse as GetStatisticsResponse,
157161
)

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

Lines changed: 291 additions & 6 deletions
Large diffs are not rendered by default.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
)
5757
from stackit.cdn.models.get_distribution_response import GetDistributionResponse
5858
from stackit.cdn.models.get_logs_response import GetLogsResponse
59+
from stackit.cdn.models.get_logs_search_filters_response import (
60+
GetLogsSearchFiltersResponse,
61+
)
5962
from stackit.cdn.models.get_statistics_response import GetStatisticsResponse
6063
from stackit.cdn.models.http_backend import HttpBackend
6164
from stackit.cdn.models.http_backend_patch import HttpBackendPatch

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
from stackit.cdn.models.http_backend_patch import HttpBackendPatch
2424
from stackit.cdn.models.optimizer_patch import OptimizerPatch
25+
from stackit.cdn.models.patch_loki_log_sink import PatchLokiLogSink
2526
from stackit.cdn.models.region import Region
2627

2728

@@ -46,6 +47,7 @@ class ConfigPatch(BaseModel):
4647
description="Sets the default cache duration for the distribution. The default cache duration is applied when a 'Cache-Control' header is not presented in the origin's response. We use ISO8601 duration format for cache duration (e.g. P1DT2H30M) ",
4748
alias="defaultCacheDuration",
4849
)
50+
log_sink: Optional[PatchLokiLogSink] = Field(default=None, alias="logSink")
4951
monthly_limit_bytes: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(
5052
default=None,
5153
description="Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. ",
@@ -58,6 +60,7 @@ class ConfigPatch(BaseModel):
5860
"blockedCountries",
5961
"blockedIPs",
6062
"defaultCacheDuration",
63+
"logSink",
6164
"monthlyLimitBytes",
6265
"optimizer",
6366
"regions",
@@ -103,6 +106,9 @@ def to_dict(self) -> Dict[str, Any]:
103106
# override the default output from pydantic by calling `to_dict()` of backend
104107
if self.backend:
105108
_dict["backend"] = self.backend.to_dict()
109+
# override the default output from pydantic by calling `to_dict()` of log_sink
110+
if self.log_sink:
111+
_dict["logSink"] = self.log_sink.to_dict()
106112
# override the default output from pydantic by calling `to_dict()` of optimizer
107113
if self.optimizer:
108114
_dict["optimizer"] = self.optimizer.to_dict()
@@ -111,6 +117,11 @@ def to_dict(self) -> Dict[str, Any]:
111117
if self.default_cache_duration is None and "default_cache_duration" in self.model_fields_set:
112118
_dict["defaultCacheDuration"] = None
113119

120+
# set to None if log_sink (nullable) is None
121+
# and model_fields_set contains the field
122+
if self.log_sink is None and "log_sink" in self.model_fields_set:
123+
_dict["logSink"] = None
124+
114125
# set to None if monthly_limit_bytes (nullable) is None
115126
# and model_fields_set contains the field
116127
if self.monthly_limit_bytes is None and "monthly_limit_bytes" in self.model_fields_set:
@@ -133,6 +144,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
133144
"blockedCountries": obj.get("blockedCountries"),
134145
"blockedIPs": obj.get("blockedIPs"),
135146
"defaultCacheDuration": obj.get("defaultCacheDuration"),
147+
"logSink": PatchLokiLogSink.from_dict(obj["logSink"]) if obj.get("logSink") is not None else None,
136148
"monthlyLimitBytes": obj.get("monthlyLimitBytes"),
137149
"optimizer": OptimizerPatch.from_dict(obj["optimizer"]) if obj.get("optimizer") is not None else None,
138150
"regions": obj.get("regions"),

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class CreateDistributionPayload(BaseModel):
4545
description="Sets the default cache duration for the distribution. The default cache duration is applied when a 'Cache-Control' header is not presented in the origin's response. We use ISO8601 duration format for cache duration (e.g. P1DT2H30M) ",
4646
alias="defaultCacheDuration",
4747
)
48+
geofencing: Optional[Dict[str, List[StrictStr]]] = Field(
49+
default=None,
50+
description="An object mapping multiple alternative origins to country codes. Any request from one of those country codes will route to the alternative origin. Do note that country codes may only be used once. You can not have a country be assigned to multiple alternative origins. ",
51+
)
4852
intent_id: Optional[StrictStr] = Field(
4953
default=None,
5054
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. ",
@@ -73,6 +77,7 @@ class CreateDistributionPayload(BaseModel):
7377
"blockedCountries",
7478
"blockedIPs",
7579
"defaultCacheDuration",
80+
"geofencing",
7681
"intentId",
7782
"logSink",
7883
"monthlyLimitBytes",
@@ -141,6 +146,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
141146
"blockedCountries": obj.get("blockedCountries"),
142147
"blockedIPs": obj.get("blockedIPs"),
143148
"defaultCacheDuration": obj.get("defaultCacheDuration"),
149+
"geofencing": obj.get("geofencing"),
144150
"intentId": obj.get("intentId"),
145151
"logSink": PatchLokiLogSink.from_dict(obj["logSink"]) if obj.get("logSink") is not None else None,
146152
"monthlyLimitBytes": obj.get("monthlyLimitBytes"),
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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
13+
14+
from __future__ import annotations
15+
16+
import json
17+
import pprint
18+
from typing import Any, ClassVar, Dict, List, Optional, Set
19+
20+
from pydantic import BaseModel, ConfigDict, StrictStr
21+
from typing_extensions import Self
22+
23+
24+
class GetLogsSearchFiltersResponse(BaseModel):
25+
"""
26+
GetLogsSearchFiltersResponse
27+
""" # noqa: E501
28+
29+
filters: List[StrictStr]
30+
__properties: ClassVar[List[str]] = ["filters"]
31+
32+
model_config = ConfigDict(
33+
populate_by_name=True,
34+
validate_assignment=True,
35+
protected_namespaces=(),
36+
)
37+
38+
def to_str(self) -> str:
39+
"""Returns the string representation of the model using alias"""
40+
return pprint.pformat(self.model_dump(by_alias=True))
41+
42+
def to_json(self) -> str:
43+
"""Returns the JSON representation of the model using alias"""
44+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
45+
return json.dumps(self.to_dict())
46+
47+
@classmethod
48+
def from_json(cls, json_str: str) -> Optional[Self]:
49+
"""Create an instance of GetLogsSearchFiltersResponse from a JSON string"""
50+
return cls.from_dict(json.loads(json_str))
51+
52+
def to_dict(self) -> Dict[str, Any]:
53+
"""Return the dictionary representation of the model using alias.
54+
55+
This has the following differences from calling pydantic's
56+
`self.model_dump(by_alias=True)`:
57+
58+
* `None` is only added to the output dict for nullable fields that
59+
were set at model initialization. Other fields with value `None`
60+
are ignored.
61+
"""
62+
excluded_fields: Set[str] = set([])
63+
64+
_dict = self.model_dump(
65+
by_alias=True,
66+
exclude=excluded_fields,
67+
exclude_none=True,
68+
)
69+
return _dict
70+
71+
@classmethod
72+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
73+
"""Create an instance of GetLogsSearchFiltersResponse from a dict"""
74+
if obj is None:
75+
return None
76+
77+
if not isinstance(obj, dict):
78+
return cls.model_validate(obj)
79+
80+
_obj = cls.model_validate({"filters": obj.get("filters")})
81+
return _obj

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ class HttpBackend(BaseModel):
2626
HttpBackend
2727
""" # noqa: E501
2828

29+
geofencing: Dict[str, List[StrictStr]] = Field(
30+
description="An object mapping multiple alternative origins to country codes. Any request from one of those country codes will route to the alternative origin. Do note that country codes may only be used once. You cannot have a country be assigned to multiple alternative origins. "
31+
)
2932
origin_request_headers: Dict[str, StrictStr] = Field(
3033
description="Headers that will be sent with every request to the configured origin. **WARNING**: Do not store sensitive values in the headers. The configuration is stored as plain text. ",
3134
alias="originRequestHeaders",
3235
)
3336
origin_url: StrictStr = Field(alias="originUrl")
3437
type: StrictStr
35-
__properties: ClassVar[List[str]] = ["originRequestHeaders", "originUrl", "type"]
38+
__properties: ClassVar[List[str]] = ["geofencing", "originRequestHeaders", "originUrl", "type"]
3639

3740
model_config = ConfigDict(
3841
populate_by_name=True,
@@ -84,6 +87,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
8487

8588
_obj = cls.model_validate(
8689
{
90+
"geofencing": obj.get("geofencing"),
8791
"originRequestHeaders": obj.get("originRequestHeaders"),
8892
"originUrl": obj.get("originUrl"),
8993
"type": obj.get("type"),

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@ class HttpBackendPatch(BaseModel):
2626
A partial HTTP Backend
2727
""" # noqa: E501
2828

29+
geofencing: Optional[Dict[str, List[StrictStr]]] = Field(
30+
default=None,
31+
description="An object mapping multiple alternative origins to country codes. Any request from one of those country codes will route to the alternative origin. Do note that country codes may only be used once. You cannot have a country be assigned to multiple alternative origins. ",
32+
)
2933
origin_request_headers: Optional[Dict[str, StrictStr]] = Field(
3034
default=None,
3135
description="Headers that will be sent with every request to the configured origin. **WARNING**: Do not store sensitive values in the headers. The configuration is stored as plain text. ",
3236
alias="originRequestHeaders",
3337
)
3438
origin_url: Optional[StrictStr] = Field(default=None, alias="originUrl")
3539
type: StrictStr = Field(description="This property is required to determine the used backend type.")
36-
__properties: ClassVar[List[str]] = ["originRequestHeaders", "originUrl", "type"]
40+
__properties: ClassVar[List[str]] = ["geofencing", "originRequestHeaders", "originUrl", "type"]
3741

3842
model_config = ConfigDict(
3943
populate_by_name=True,
@@ -85,6 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
8589

8690
_obj = cls.model_validate(
8791
{
92+
"geofencing": obj.get("geofencing"),
8893
"originRequestHeaders": obj.get("originRequestHeaders"),
8994
"originUrl": obj.get("originUrl"),
9095
"type": obj.get("type"),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class PutCustomDomainCustomCertificate(BaseModel):
2626
Returned if a custom certificate is used. Response does not contain the certificate or key.
2727
""" # noqa: E501
2828

29-
certificate: StrictStr = Field(description="base64-encoded certificate")
30-
key: StrictStr = Field(description="base64-encoded key")
29+
certificate: StrictStr = Field(description="base64-encoded PEM-encoded certificate")
30+
key: StrictStr = Field(description="base64-encoded PEM encoded key")
3131
type: StrictStr
3232
__properties: ClassVar[List[str]] = ["certificate", "key", "type"]
3333

0 commit comments

Comments
 (0)