diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c2ab7cb9..5688aa041 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## Release (2025-XX-YY) +- `cdn`: [v1.2.0](services/cdn/CHANGELOG.md#v120) + - **Feature:** Add `default_cache_duration` attribute to `Config`, `ConfigPatch` and `CreateDistributionPayload` model + - Add `originUrlRelated` to available options given in `sort_by` description + ## Release (2025-06-16) - `core`: [v0.2.0](core/CHANGELOG.md#v020-2025-06-12) - **Feature:** Allow setting custom token endpoint url in configuration diff --git a/services/cdn/CHANGELOG.md b/services/cdn/CHANGELOG.md index 06134230c..70d3bc153 100644 --- a/services/cdn/CHANGELOG.md +++ b/services/cdn/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.2.0 +- **Feature:** Add `default_cache_duration` attribute to `Config`, `ConfigPatch` and `CreateDistributionPayload` model +- Add `originUrlRelated` to available options given in `sort_by` description + ## v1.1.0 (2025-05-27) - **Feature:** Add support for CDN Optimizer feature diff --git a/services/cdn/pyproject.toml b/services/cdn/pyproject.toml index 42f7db108..7e56e9425 100644 --- a/services/cdn/pyproject.toml +++ b/services/cdn/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-cdn" [tool.poetry] name = "stackit-cdn" -version = "v1.1.0" +version = "v1.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/cdn/src/stackit/cdn/api/default_api.py b/services/cdn/src/stackit/cdn/api/default_api.py index 98bcfcffa..6d430383c 100644 --- a/services/cdn/src/stackit/cdn/api/default_api.py +++ b/services/cdn/src/stackit/cdn/api/default_api.py @@ -2717,7 +2717,7 @@ def list_distributions( sort_by: Annotated[ Optional[StrictStr], Field( - description="The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison " + description="The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison - `originUrlRelated` - The origin URL is segmented and reversed before sorting. E.g. `www.example.com` is converted to `com.example.www` for sorting. This way, distributions pointing to the same domain trees are grouped next to each other. " ), ] = None, sort_order: Optional[StrictStr] = None, @@ -2741,7 +2741,7 @@ def list_distributions( :type page_size: int :param page_identifier: Identifier is returned by the previous response and is used to request the next page. As the `pageIdentifier` encodes an element, inserts during pagination will *not* shift the result. So a scenario like: - Start listing first page - Insert new element - Start listing second page will *never* result in an element from the first page to get \"pushed\" to the second page, like it could occur with basic limit + offset pagination. The identifier should be treated as an opaque string and never modified. Only pass values returned by the API. :type page_identifier: str - :param sort_by: The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison + :param sort_by: The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison - `originUrlRelated` - The origin URL is segmented and reversed before sorting. E.g. `www.example.com` is converted to `com.example.www` for sorting. This way, distributions pointing to the same domain trees are grouped next to each other. :type sort_by: str :param sort_order: :type sort_order: str @@ -2811,7 +2811,7 @@ def list_distributions_with_http_info( sort_by: Annotated[ Optional[StrictStr], Field( - description="The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison " + description="The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison - `originUrlRelated` - The origin URL is segmented and reversed before sorting. E.g. `www.example.com` is converted to `com.example.www` for sorting. This way, distributions pointing to the same domain trees are grouped next to each other. " ), ] = None, sort_order: Optional[StrictStr] = None, @@ -2835,7 +2835,7 @@ def list_distributions_with_http_info( :type page_size: int :param page_identifier: Identifier is returned by the previous response and is used to request the next page. As the `pageIdentifier` encodes an element, inserts during pagination will *not* shift the result. So a scenario like: - Start listing first page - Insert new element - Start listing second page will *never* result in an element from the first page to get \"pushed\" to the second page, like it could occur with basic limit + offset pagination. The identifier should be treated as an opaque string and never modified. Only pass values returned by the API. :type page_identifier: str - :param sort_by: The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison + :param sort_by: The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison - `originUrlRelated` - The origin URL is segmented and reversed before sorting. E.g. `www.example.com` is converted to `com.example.www` for sorting. This way, distributions pointing to the same domain trees are grouped next to each other. :type sort_by: str :param sort_order: :type sort_order: str @@ -2905,7 +2905,7 @@ def list_distributions_without_preload_content( sort_by: Annotated[ Optional[StrictStr], Field( - description="The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison " + description="The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison - `originUrlRelated` - The origin URL is segmented and reversed before sorting. E.g. `www.example.com` is converted to `com.example.www` for sorting. This way, distributions pointing to the same domain trees are grouped next to each other. " ), ] = None, sort_order: Optional[StrictStr] = None, @@ -2929,7 +2929,7 @@ def list_distributions_without_preload_content( :type page_size: int :param page_identifier: Identifier is returned by the previous response and is used to request the next page. As the `pageIdentifier` encodes an element, inserts during pagination will *not* shift the result. So a scenario like: - Start listing first page - Insert new element - Start listing second page will *never* result in an element from the first page to get \"pushed\" to the second page, like it could occur with basic limit + offset pagination. The identifier should be treated as an opaque string and never modified. Only pass values returned by the API. :type page_identifier: str - :param sort_by: The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison + :param sort_by: The following sort options exist. We default to `createdAt` - `id` - Sort by distribution ID using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by distribution status, using String comparison - `originUrlRelated` - The origin URL is segmented and reversed before sorting. E.g. `www.example.com` is converted to `com.example.www` for sorting. This way, distributions pointing to the same domain trees are grouped next to each other. :type sort_by: str :param sort_order: :type sort_order: str diff --git a/services/cdn/src/stackit/cdn/models/config.py b/services/cdn/src/stackit/cdn/models/config.py index 76a581195..e5485dcca 100644 --- a/services/cdn/src/stackit/cdn/models/config.py +++ b/services/cdn/src/stackit/cdn/models/config.py @@ -39,6 +39,11 @@ class Config(BaseModel): 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. ", alias="blockedIPs", ) + default_cache_duration: Optional[StrictStr] = Field( + default=None, + 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) ", + alias="defaultCacheDuration", + ) monthly_limit_bytes: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( default=None, description="Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. ", @@ -50,6 +55,7 @@ class Config(BaseModel): "backend", "blockedCountries", "blockedIPs", + "defaultCacheDuration", "monthlyLimitBytes", "optimizer", "regions", @@ -98,6 +104,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of optimizer if self.optimizer: _dict["optimizer"] = self.optimizer.to_dict() + # set to None if default_cache_duration (nullable) is None + # and model_fields_set contains the field + if self.default_cache_duration is None and "default_cache_duration" in self.model_fields_set: + _dict["defaultCacheDuration"] = None + # set to None if monthly_limit_bytes (nullable) is None # and model_fields_set contains the field if self.monthly_limit_bytes is None and "monthly_limit_bytes" in self.model_fields_set: @@ -119,6 +130,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "backend": ConfigBackend.from_dict(obj["backend"]) if obj.get("backend") is not None else None, "blockedCountries": obj.get("blockedCountries"), "blockedIPs": obj.get("blockedIPs"), + "defaultCacheDuration": obj.get("defaultCacheDuration"), "monthlyLimitBytes": obj.get("monthlyLimitBytes"), "optimizer": Optimizer.from_dict(obj["optimizer"]) if obj.get("optimizer") is not None else None, "regions": obj.get("regions"), diff --git a/services/cdn/src/stackit/cdn/models/config_patch.py b/services/cdn/src/stackit/cdn/models/config_patch.py index 1d51c6575..d0aee3f69 100644 --- a/services/cdn/src/stackit/cdn/models/config_patch.py +++ b/services/cdn/src/stackit/cdn/models/config_patch.py @@ -41,6 +41,11 @@ class ConfigPatch(BaseModel): 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. ", alias="blockedIPs", ) + default_cache_duration: Optional[StrictStr] = Field( + default=None, + 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) ", + alias="defaultCacheDuration", + ) monthly_limit_bytes: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( default=None, description="Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. ", @@ -52,6 +57,7 @@ class ConfigPatch(BaseModel): "backend", "blockedCountries", "blockedIPs", + "defaultCacheDuration", "monthlyLimitBytes", "optimizer", "regions", @@ -100,6 +106,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of optimizer if self.optimizer: _dict["optimizer"] = self.optimizer.to_dict() + # set to None if default_cache_duration (nullable) is None + # and model_fields_set contains the field + if self.default_cache_duration is None and "default_cache_duration" in self.model_fields_set: + _dict["defaultCacheDuration"] = None + # set to None if monthly_limit_bytes (nullable) is None # and model_fields_set contains the field if self.monthly_limit_bytes is None and "monthly_limit_bytes" in self.model_fields_set: @@ -121,6 +132,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "backend": ConfigPatchBackend.from_dict(obj["backend"]) if obj.get("backend") is not None else None, "blockedCountries": obj.get("blockedCountries"), "blockedIPs": obj.get("blockedIPs"), + "defaultCacheDuration": obj.get("defaultCacheDuration"), "monthlyLimitBytes": obj.get("monthlyLimitBytes"), "optimizer": OptimizerPatch.from_dict(obj["optimizer"]) if obj.get("optimizer") is not None else None, "regions": obj.get("regions"), diff --git a/services/cdn/src/stackit/cdn/models/create_distribution_payload.py b/services/cdn/src/stackit/cdn/models/create_distribution_payload.py index 0a6d69e6d..37e3c431d 100644 --- a/services/cdn/src/stackit/cdn/models/create_distribution_payload.py +++ b/services/cdn/src/stackit/cdn/models/create_distribution_payload.py @@ -39,6 +39,11 @@ class CreateDistributionPayload(BaseModel): 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. ", alias="blockedIPs", ) + default_cache_duration: Optional[StrictStr] = Field( + default=None, + 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) ", + alias="defaultCacheDuration", + ) intent_id: Optional[StrictStr] = Field( default=None, 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. ", @@ -65,6 +70,7 @@ class CreateDistributionPayload(BaseModel): __properties: ClassVar[List[str]] = [ "blockedCountries", "blockedIPs", + "defaultCacheDuration", "intentId", "monthlyLimitBytes", "optimizer", @@ -128,6 +134,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: { "blockedCountries": obj.get("blockedCountries"), "blockedIPs": obj.get("blockedIPs"), + "defaultCacheDuration": obj.get("defaultCacheDuration"), "intentId": obj.get("intentId"), "monthlyLimitBytes": obj.get("monthlyLimitBytes"), "optimizer": Optimizer.from_dict(obj["optimizer"]) if obj.get("optimizer") is not None else None,