Skip to content
Open
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/cdn/oas_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b7d1b614138d667d378a5fd45e2a91539a7fb02e
f385f3b154cb566b3c9e5156c29b28150f2af4a2
32 changes: 32 additions & 0 deletions services/cdn/src/stackit/cdn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"BucketBackendCreate",
"BucketBackendPatch",
"BucketCredentials",
"CacheConfig",
"CacheConfigCreate",
"CacheConfigPatch",
"Config",
"ConfigBackend",
"ConfigLogSink",
Expand Down Expand Up @@ -81,6 +84,13 @@
"Matcher",
"Optimizer",
"OptimizerPatch",
"OtlpLogSink",
"OtlpLogSinkBasicCredentials",
"OtlpLogSinkBearerCredentials",
"OtlpLogSinkCreate",
"OtlpLogSinkCreateCredentials",
"OtlpLogSinkPatch",
"OtlpLogSinkPatchCredentials",
"PatchDistributionPayload",
"PatchDistributionResponse",
"PurgeCachePayload",
Expand Down Expand Up @@ -138,6 +148,11 @@
BucketBackendPatch as BucketBackendPatch,
)
from stackit.cdn.models.bucket_credentials import BucketCredentials as BucketCredentials
from stackit.cdn.models.cache_config import CacheConfig as CacheConfig
from stackit.cdn.models.cache_config_create import (
CacheConfigCreate as CacheConfigCreate,
)
from stackit.cdn.models.cache_config_patch import CacheConfigPatch as CacheConfigPatch
from stackit.cdn.models.config import Config as Config
from stackit.cdn.models.config_backend import ConfigBackend as ConfigBackend
from stackit.cdn.models.config_log_sink import ConfigLogSink as ConfigLogSink
Expand Down Expand Up @@ -250,6 +265,23 @@
from stackit.cdn.models.matcher import Matcher as Matcher
from stackit.cdn.models.optimizer import Optimizer as Optimizer
from stackit.cdn.models.optimizer_patch import OptimizerPatch as OptimizerPatch
from stackit.cdn.models.otlp_log_sink import OtlpLogSink as OtlpLogSink
from stackit.cdn.models.otlp_log_sink_basic_credentials import (
OtlpLogSinkBasicCredentials as OtlpLogSinkBasicCredentials,
)
from stackit.cdn.models.otlp_log_sink_bearer_credentials import (
OtlpLogSinkBearerCredentials as OtlpLogSinkBearerCredentials,
)
from stackit.cdn.models.otlp_log_sink_create import (
OtlpLogSinkCreate as OtlpLogSinkCreate,
)
from stackit.cdn.models.otlp_log_sink_create_credentials import (
OtlpLogSinkCreateCredentials as OtlpLogSinkCreateCredentials,
)
from stackit.cdn.models.otlp_log_sink_patch import OtlpLogSinkPatch as OtlpLogSinkPatch
from stackit.cdn.models.otlp_log_sink_patch_credentials import (
OtlpLogSinkPatchCredentials as OtlpLogSinkPatchCredentials,
)
from stackit.cdn.models.patch_distribution_payload import (
PatchDistributionPayload as PatchDistributionPayload,
)
Expand Down
18 changes: 18 additions & 0 deletions services/cdn/src/stackit/cdn/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from stackit.cdn.models.bucket_backend_create import BucketBackendCreate
from stackit.cdn.models.bucket_backend_patch import BucketBackendPatch
from stackit.cdn.models.bucket_credentials import BucketCredentials
from stackit.cdn.models.cache_config import CacheConfig
from stackit.cdn.models.cache_config_create import CacheConfigCreate
from stackit.cdn.models.cache_config_patch import CacheConfigPatch
from stackit.cdn.models.config import Config
from stackit.cdn.models.config_backend import ConfigBackend
from stackit.cdn.models.config_log_sink import ConfigLogSink
Expand Down Expand Up @@ -93,6 +96,21 @@
from stackit.cdn.models.matcher import Matcher
from stackit.cdn.models.optimizer import Optimizer
from stackit.cdn.models.optimizer_patch import OptimizerPatch
from stackit.cdn.models.otlp_log_sink import OtlpLogSink
from stackit.cdn.models.otlp_log_sink_basic_credentials import (
OtlpLogSinkBasicCredentials,
)
from stackit.cdn.models.otlp_log_sink_bearer_credentials import (
OtlpLogSinkBearerCredentials,
)
from stackit.cdn.models.otlp_log_sink_create import OtlpLogSinkCreate
from stackit.cdn.models.otlp_log_sink_create_credentials import (
OtlpLogSinkCreateCredentials,
)
from stackit.cdn.models.otlp_log_sink_patch import OtlpLogSinkPatch
from stackit.cdn.models.otlp_log_sink_patch_credentials import (
OtlpLogSinkPatchCredentials,
)
from stackit.cdn.models.patch_distribution_payload import PatchDistributionPayload
from stackit.cdn.models.patch_distribution_response import PatchDistributionResponse
from stackit.cdn.models.purge_cache_payload import PurgeCachePayload
Expand Down
99 changes: 99 additions & 0 deletions services/cdn/src/stackit/cdn/models/cache_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# coding: utf-8

"""
STACKIT CDN API

API used to create and manage your CDN distributions.

The version of the OpenAPI document: 1.0.0
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, StrictBool
from pydantic_core import to_jsonable_python
from typing_extensions import Annotated, Self


class CacheConfig(BaseModel):
"""
Groups the cache options that influence how the CDN builds its cache key. **Cache cardinality warning:** enabling query-string vary produces one cache entry per unique query-string combination (**unbounded** when `queryStringVaryParameters` is empty). Each entry in `cacheKeyHeaders` multiplies the number of cache variants by the number of distinct values observed for that header. Use these settings sparingly. `queryStringVaryParameters` is stored independently of `queryStringVaryEnabled` so that this feature can be toggled on and off without losing the configured allowlist. Only `queryStringVaryEnabled` gates whether the parameter allowlist actually varies the cache. **Optimizer interaction:** when the Optimizer is enabled, the CDN automatically enables query-string vary for image responses regardless of this setting.
""" # noqa: E501

cache_key_headers: List[Annotated[str, Field(strict=True)]] = Field(
description="HTTP request header names whose values participate in the cache key. Each entry multiplies the number of cache variants by the number of distinct values observed for that header. ",
alias="cacheKeyHeaders",
)
query_string_vary_enabled: StrictBool = Field(
description="When true, the CDN varies its cache by the request query string. If `queryStringVaryParameters` is empty, every unique query-string combination produces its own cache entry; if non-empty, only the listed parameters influence the cache key. ",
alias="queryStringVaryEnabled",
)
query_string_vary_parameters: List[Annotated[str, Field(strict=True)]] = Field(
description="Allowlist of query-string parameter names that participate in the cache key when `queryStringVaryEnabled` is true. Ignored while `queryStringVaryEnabled` is false, but still stored so it can be re-activated without losing the list. ",
alias="queryStringVaryParameters",
)
__properties: ClassVar[List[str]] = ["cacheKeyHeaders", "queryStringVaryEnabled", "queryStringVaryParameters"]

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

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

_obj = cls.model_validate(
{
"cacheKeyHeaders": obj.get("cacheKeyHeaders"),
"queryStringVaryEnabled": obj.get("queryStringVaryEnabled"),
"queryStringVaryParameters": obj.get("queryStringVaryParameters"),
}
)
return _obj
104 changes: 104 additions & 0 deletions services/cdn/src/stackit/cdn/models/cache_config_create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# coding: utf-8

"""
STACKIT CDN API

API used to create and manage your CDN distributions.

The version of the OpenAPI document: 1.0.0
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, StrictBool
from pydantic_core import to_jsonable_python
from typing_extensions import Annotated, Self


class CacheConfigCreate(BaseModel):
"""
Groups the cache options that influence how the CDN builds its cache key on distribution creation. **Cache cardinality warning:** enabling query-string vary produces one cache entry per unique query-string combination (**unbounded** when `queryStringVaryParameters` is empty). Each entry in `cacheKeyHeaders` multiplies the number of cache variants by the number of distinct values observed for that header. Use these settings sparingly. `queryStringVaryParameters` is stored independently of `queryStringVaryEnabled` so that this feature can be toggled on and off without losing the configured allowlist. Only `queryStringVaryEnabled` gates whether the parameter allowlist actually varies the cache. **Optimizer interaction:** when the Optimizer is enabled, the CDN automatically enables query-string vary for image responses regardless of this setting.
""" # noqa: E501

cache_key_headers: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
default=None,
description="HTTP request header names whose values participate in the cache key. Each entry multiplies the number of cache variants by the number of distinct values observed for that header. ",
alias="cacheKeyHeaders",
)
query_string_vary_enabled: Optional[StrictBool] = Field(
default=False,
description="When true, the CDN varies its cache by the request query string. If `queryStringVaryParameters` is empty, every unique query-string combination produces its own cache entry; if non-empty, only the listed parameters influence the cache key. ",
alias="queryStringVaryEnabled",
)
query_string_vary_parameters: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
default=None,
description="Allowlist of query-string parameter names that participate in the cache key when `queryStringVaryEnabled` is true. Ignored while `queryStringVaryEnabled` is false, but still stored so it can be re-activated without losing the list. ",
alias="queryStringVaryParameters",
)
__properties: ClassVar[List[str]] = ["cacheKeyHeaders", "queryStringVaryEnabled", "queryStringVaryParameters"]

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

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

_obj = cls.model_validate(
{
"cacheKeyHeaders": obj.get("cacheKeyHeaders"),
"queryStringVaryEnabled": (
obj.get("queryStringVaryEnabled") if obj.get("queryStringVaryEnabled") is not None else False
),
"queryStringVaryParameters": obj.get("queryStringVaryParameters"),
}
)
return _obj
Loading
Loading