From 829da21d0415ff1c38d4d42329a3f0dbb94f4bdc Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 2 Dec 2025 13:26:22 +0000 Subject: [PATCH 1/2] Generate cdn --- services/cdn/src/stackit/cdn/__init__.py | 44 ++- .../cdn/src/stackit/cdn/api/default_api.py | 342 +++++++++++++++++- services/cdn/src/stackit/cdn/api_client.py | 2 +- services/cdn/src/stackit/cdn/configuration.py | 2 +- services/cdn/src/stackit/cdn/exceptions.py | 2 +- .../cdn/src/stackit/cdn/models/__init__.py | 30 +- .../src/stackit/cdn/models/bucket_backend.py | 2 +- .../cdn/models/bucket_backend_create.py | 2 +- .../cdn/models/bucket_backend_patch.py | 2 +- .../stackit/cdn/models/bucket_credentials.py | 2 +- services/cdn/src/stackit/cdn/models/config.py | 2 +- .../src/stackit/cdn/models/config_backend.py | 2 +- .../src/stackit/cdn/models/config_patch.py | 2 +- .../cdn/models/config_patch_backend.py | 2 +- .../cdn/models/create_distribution_payload.py | 2 +- .../create_distribution_payload_backend.py | 2 +- .../models/create_distribution_response.py | 2 +- .../src/stackit/cdn/models/custom_domain.py | 2 +- .../models/delete_custom_domain_response.py | 2 +- .../models/delete_distribution_response.py | 2 +- .../src/stackit/cdn/models/distribution.py | 2 +- .../cdn/models/distribution_logs_record.py | 12 +- .../models/distribution_statistics_record.py | 2 +- .../distribution_statistics_record_entry.py | 2 +- .../distribution_statistics_record_regions.py | 2 +- .../stackit/cdn/models/distribution_waf.py | 2 +- services/cdn/src/stackit/cdn/models/domain.py | 2 +- .../src/stackit/cdn/models/domain_status.py | 2 +- .../src/stackit/cdn/models/error_details.py | 8 +- .../cdn/models/find_cache_paths_response.py | 2 +- .../models/find_cache_paths_response_entry.py | 2 +- .../cdn/models/generic_json_response.py | 2 +- .../cdn/models/get_cache_info_response.py | 2 +- .../get_cache_info_response_history_entry.py | 2 +- .../get_custom_domain_custom_certificate.py | 2 +- .../get_custom_domain_managed_certificate.py | 2 +- .../cdn/models/get_custom_domain_response.py | 2 +- .../get_custom_domain_response_certificate.py | 2 +- .../cdn/models/get_distribution_response.py | 2 +- .../stackit/cdn/models/get_logs_response.py | 2 +- .../get_logs_search_filters_response.py | 115 ++++++ ...earch_filters_response_datacenter_block.py | 152 ++++++++ ..._filters_response_datacenter_block_item.py | 82 +++++ .../cdn/models/get_statistics_response.py | 2 +- .../src/stackit/cdn/models/http_backend.py | 2 +- .../stackit/cdn/models/http_backend_create.py | 2 +- .../stackit/cdn/models/http_backend_patch.py | 2 +- .../cdn/models/list_distributions_response.py | 2 +- .../models/list_waf_collections_response.py | 2 +- .../src/stackit/cdn/models/loki_log_sink.py | 2 +- .../cdn/models/loki_log_sink_create.py | 2 +- .../cdn/models/loki_log_sink_credentials.py | 2 +- .../stackit/cdn/models/loki_log_sink_patch.py | 2 +- .../cdn/src/stackit/cdn/models/optimizer.py | 2 +- .../src/stackit/cdn/models/optimizer_patch.py | 2 +- .../cdn/models/patch_distribution_payload.py | 2 +- .../cdn/models/patch_distribution_response.py | 2 +- .../stackit/cdn/models/purge_cache_payload.py | 2 +- .../put_custom_domain_custom_certificate.py | 2 +- .../put_custom_domain_managed_certificate.py | 2 +- .../cdn/models/put_custom_domain_payload.py | 2 +- .../put_custom_domain_payload_certificate.py | 2 +- .../cdn/models/put_custom_domain_response.py | 2 +- .../put_custom_domain_response_certificate.py | 2 +- services/cdn/src/stackit/cdn/models/region.py | 2 +- .../src/stackit/cdn/models/status_error.py | 12 +- .../cdn/src/stackit/cdn/models/waf_config.py | 85 ++++- .../stackit/cdn/models/waf_config_patch.py | 90 ++++- .../cdn/src/stackit/cdn/models/waf_mode.py | 4 +- .../stackit/cdn/models/waf_paranoia_level.py | 38 ++ .../cdn/src/stackit/cdn/models/waf_rule.py | 2 +- .../src/stackit/cdn/models/waf_rule_action.py | 37 ++ .../stackit/cdn/models/waf_rule_collection.py | 2 +- .../src/stackit/cdn/models/waf_rule_group.py | 2 +- .../cdn/models/waf_status_rule_block.py | 17 +- .../models/waf_status_rule_block_reason.py | 235 ++++++++++++ ...atus_rule_block_reason_directly_defined.py | 81 +++++ ..._block_reason_inherited_from_collection.py | 84 +++++ ..._rule_block_reason_inherited_from_group.py | 84 +++++ ...atus_rule_block_reason_invalid_waf_type.py | 87 +++++ ..._status_rule_block_reason_never_defined.py | 81 +++++ .../cdn/src/stackit/cdn/models/waf_type.py | 2 +- .../src/stackit/cdn/models/waf_violation.py | 97 +++++ services/cdn/src/stackit/cdn/rest.py | 2 +- 84 files changed, 1839 insertions(+), 102 deletions(-) create mode 100644 services/cdn/src/stackit/cdn/models/get_logs_search_filters_response.py create mode 100644 services/cdn/src/stackit/cdn/models/get_logs_search_filters_response_datacenter_block.py create mode 100644 services/cdn/src/stackit/cdn/models/get_logs_search_filters_response_datacenter_block_item.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_paranoia_level.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_rule_action.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_directly_defined.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_inherited_from_collection.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_inherited_from_group.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_invalid_waf_type.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_never_defined.py create mode 100644 services/cdn/src/stackit/cdn/models/waf_violation.py diff --git a/services/cdn/src/stackit/cdn/__init__.py b/services/cdn/src/stackit/cdn/__init__.py index da7cae9f1..c5b672971 100644 --- a/services/cdn/src/stackit/cdn/__init__.py +++ b/services/cdn/src/stackit/cdn/__init__.py @@ -7,7 +7,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -62,6 +62,9 @@ "GetCustomDomainResponseCertificate", "GetDistributionResponse", "GetLogsResponse", + "GetLogsSearchFiltersResponse", + "GetLogsSearchFiltersResponseDatacenterBlock", + "GetLogsSearchFiltersResponseDatacenterBlockItem", "GetStatisticsResponse", "HttpBackend", "HttpBackendCreate", @@ -85,13 +88,22 @@ "PutCustomDomainResponseCertificate", "Region", "StatusError", + "WAFRuleAction", + "WAFViolation", "WafConfig", "WafConfigPatch", "WafMode", + "WafParanoiaLevel", "WafRule", "WafRuleCollection", "WafRuleGroup", "WafStatusRuleBlock", + "WafStatusRuleBlockReason", + "WafStatusRuleBlockReasonDirectlyDefined", + "WafStatusRuleBlockReasonInheritedFromCollection", + "WafStatusRuleBlockReasonInheritedFromGroup", + "WafStatusRuleBlockReasonInvalidWafType", + "WafStatusRuleBlockReasonNeverDefined", "WafType", ] @@ -188,6 +200,15 @@ GetDistributionResponse as GetDistributionResponse, ) from stackit.cdn.models.get_logs_response import GetLogsResponse as GetLogsResponse +from stackit.cdn.models.get_logs_search_filters_response import ( + GetLogsSearchFiltersResponse as GetLogsSearchFiltersResponse, +) +from stackit.cdn.models.get_logs_search_filters_response_datacenter_block import ( + GetLogsSearchFiltersResponseDatacenterBlock as GetLogsSearchFiltersResponseDatacenterBlock, +) +from stackit.cdn.models.get_logs_search_filters_response_datacenter_block_item import ( + GetLogsSearchFiltersResponseDatacenterBlockItem as GetLogsSearchFiltersResponseDatacenterBlockItem, +) from stackit.cdn.models.get_statistics_response import ( GetStatisticsResponse as GetStatisticsResponse, ) @@ -244,7 +265,9 @@ from stackit.cdn.models.waf_config import WafConfig as WafConfig from stackit.cdn.models.waf_config_patch import WafConfigPatch as WafConfigPatch from stackit.cdn.models.waf_mode import WafMode as WafMode +from stackit.cdn.models.waf_paranoia_level import WafParanoiaLevel as WafParanoiaLevel from stackit.cdn.models.waf_rule import WafRule as WafRule +from stackit.cdn.models.waf_rule_action import WAFRuleAction as WAFRuleAction from stackit.cdn.models.waf_rule_collection import ( WafRuleCollection as WafRuleCollection, ) @@ -252,4 +275,23 @@ from stackit.cdn.models.waf_status_rule_block import ( WafStatusRuleBlock as WafStatusRuleBlock, ) +from stackit.cdn.models.waf_status_rule_block_reason import ( + WafStatusRuleBlockReason as WafStatusRuleBlockReason, +) +from stackit.cdn.models.waf_status_rule_block_reason_directly_defined import ( + WafStatusRuleBlockReasonDirectlyDefined as WafStatusRuleBlockReasonDirectlyDefined, +) +from stackit.cdn.models.waf_status_rule_block_reason_inherited_from_collection import ( + WafStatusRuleBlockReasonInheritedFromCollection as WafStatusRuleBlockReasonInheritedFromCollection, +) +from stackit.cdn.models.waf_status_rule_block_reason_inherited_from_group import ( + WafStatusRuleBlockReasonInheritedFromGroup as WafStatusRuleBlockReasonInheritedFromGroup, +) +from stackit.cdn.models.waf_status_rule_block_reason_invalid_waf_type import ( + WafStatusRuleBlockReasonInvalidWafType as WafStatusRuleBlockReasonInvalidWafType, +) +from stackit.cdn.models.waf_status_rule_block_reason_never_defined import ( + WafStatusRuleBlockReasonNeverDefined as WafStatusRuleBlockReasonNeverDefined, +) from stackit.cdn.models.waf_type import WafType as WafType +from stackit.cdn.models.waf_violation import WAFViolation as WAFViolation diff --git a/services/cdn/src/stackit/cdn/api/default_api.py b/services/cdn/src/stackit/cdn/api/default_api.py index f7bca6e51..76e327501 100644 --- a/services/cdn/src/stackit/cdn/api/default_api.py +++ b/services/cdn/src/stackit/cdn/api/default_api.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -36,6 +36,9 @@ from stackit.cdn.models.get_custom_domain_response import GetCustomDomainResponse from stackit.cdn.models.get_distribution_response import GetDistributionResponse from stackit.cdn.models.get_logs_response import GetLogsResponse +from stackit.cdn.models.get_logs_search_filters_response import ( + GetLogsSearchFiltersResponse, +) from stackit.cdn.models.get_statistics_response import GetStatisticsResponse from stackit.cdn.models.list_distributions_response import ListDistributionsResponse from stackit.cdn.models.list_waf_collections_response import ListWafCollectionsResponse @@ -44,6 +47,7 @@ from stackit.cdn.models.purge_cache_payload import PurgeCachePayload from stackit.cdn.models.put_custom_domain_payload import PutCustomDomainPayload from stackit.cdn.models.put_custom_domain_response import PutCustomDomainResponse +from stackit.cdn.models.waf_rule_action import WAFRuleAction from stackit.cdn.rest import RESTResponseType @@ -308,7 +312,7 @@ def _create_distribution_serialize( return self.api_client.param_serialize( method="POST", - resource_path="/v1beta2/projects/{projectId}/distributions", + resource_path="/v1/projects/{projectId}/distributions", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -590,7 +594,7 @@ def _delete_custom_domain_serialize( return self.api_client.param_serialize( method="DELETE", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -872,7 +876,7 @@ def _delete_distribution_serialize( return self.api_client.param_serialize( method="DELETE", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1139,7 +1143,7 @@ def _find_cache_paths_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}/cache/paths", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/cache/paths", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1406,7 +1410,7 @@ def _get_cache_info_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}/cache", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/cache", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1674,7 +1678,7 @@ def _get_custom_domain_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1959,7 +1963,7 @@ def _get_distribution_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2005,6 +2009,12 @@ def get_logs( ), ] = None, sort_order: Optional[StrictStr] = None, + waf_action: Annotated[ + Optional[WAFRuleAction], + Field( + description="If this is set then only log entries with the chosen WAF rule action/outcome are returned. Specifically, if `ALLOWED` then all requests with no violation are returned. If `BLOCKED` then those where a WAF rule blocked a request and if `LOGGED` then only those requests where the WAF violation was only logged but the request not blocked " + ), + ] = None, data_center_region: Annotated[ Optional[StrictStr], Field( @@ -2058,6 +2068,8 @@ def get_logs( :type sort_by: str :param sort_order: :type sort_order: str + :param waf_action: If this is set then only log entries with the chosen WAF rule action/outcome are returned. Specifically, if `ALLOWED` then all requests with no violation are returned. If `BLOCKED` then those where a WAF rule blocked a request and if `LOGGED` then only those requests where the WAF violation was only logged but the request not blocked + :type waf_action: WAFRuleAction :param data_center_region: Filters by the CDN data center region that served the request. Can be combined with other filters :type data_center_region: str :param request_country_code: Filters by the originating country of the user request. Can be combined with other filters @@ -2097,6 +2109,7 @@ def get_logs( page_identifier=page_identifier, sort_by=sort_by, sort_order=sort_order, + waf_action=waf_action, data_center_region=data_center_region, request_country_code=request_country_code, status_code=status_code, @@ -2153,6 +2166,12 @@ def get_logs_with_http_info( ), ] = None, sort_order: Optional[StrictStr] = None, + waf_action: Annotated[ + Optional[WAFRuleAction], + Field( + description="If this is set then only log entries with the chosen WAF rule action/outcome are returned. Specifically, if `ALLOWED` then all requests with no violation are returned. If `BLOCKED` then those where a WAF rule blocked a request and if `LOGGED` then only those requests where the WAF violation was only logged but the request not blocked " + ), + ] = None, data_center_region: Annotated[ Optional[StrictStr], Field( @@ -2206,6 +2225,8 @@ def get_logs_with_http_info( :type sort_by: str :param sort_order: :type sort_order: str + :param waf_action: If this is set then only log entries with the chosen WAF rule action/outcome are returned. Specifically, if `ALLOWED` then all requests with no violation are returned. If `BLOCKED` then those where a WAF rule blocked a request and if `LOGGED` then only those requests where the WAF violation was only logged but the request not blocked + :type waf_action: WAFRuleAction :param data_center_region: Filters by the CDN data center region that served the request. Can be combined with other filters :type data_center_region: str :param request_country_code: Filters by the originating country of the user request. Can be combined with other filters @@ -2245,6 +2266,7 @@ def get_logs_with_http_info( page_identifier=page_identifier, sort_by=sort_by, sort_order=sort_order, + waf_action=waf_action, data_center_region=data_center_region, request_country_code=request_country_code, status_code=status_code, @@ -2301,6 +2323,12 @@ def get_logs_without_preload_content( ), ] = None, sort_order: Optional[StrictStr] = None, + waf_action: Annotated[ + Optional[WAFRuleAction], + Field( + description="If this is set then only log entries with the chosen WAF rule action/outcome are returned. Specifically, if `ALLOWED` then all requests with no violation are returned. If `BLOCKED` then those where a WAF rule blocked a request and if `LOGGED` then only those requests where the WAF violation was only logged but the request not blocked " + ), + ] = None, data_center_region: Annotated[ Optional[StrictStr], Field( @@ -2354,6 +2382,8 @@ def get_logs_without_preload_content( :type sort_by: str :param sort_order: :type sort_order: str + :param waf_action: If this is set then only log entries with the chosen WAF rule action/outcome are returned. Specifically, if `ALLOWED` then all requests with no violation are returned. If `BLOCKED` then those where a WAF rule blocked a request and if `LOGGED` then only those requests where the WAF violation was only logged but the request not blocked + :type waf_action: WAFRuleAction :param data_center_region: Filters by the CDN data center region that served the request. Can be combined with other filters :type data_center_region: str :param request_country_code: Filters by the originating country of the user request. Can be combined with other filters @@ -2393,6 +2423,7 @@ def get_logs_without_preload_content( page_identifier=page_identifier, sort_by=sort_by, sort_order=sort_order, + waf_action=waf_action, data_center_region=data_center_region, request_country_code=request_country_code, status_code=status_code, @@ -2422,6 +2453,7 @@ def _get_logs_serialize( page_identifier, sort_by, sort_order, + waf_action, data_center_region, request_country_code, status_code, @@ -2477,6 +2509,10 @@ def _get_logs_serialize( _query_params.append(("sortOrder", sort_order)) + if waf_action is not None: + + _query_params.append(("wafAction", waf_action.value)) + if data_center_region is not None: _query_params.append(("dataCenterRegion", data_center_region)) @@ -2506,7 +2542,283 @@ def _get_logs_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}/logs", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/logs", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_logs_search_filters( + self, + project_id: Annotated[StrictStr, Field(description="Your STACKIT Project ID.")], + distribution_id: Annotated[StrictStr, Field(description="Your CDN distribution ID.")], + filter: Annotated[ + Optional[StrictStr], + Field(description="Optional search string. Will search the **values** for the text input."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetLogsSearchFiltersResponse: + """Get relevant search filters for this distribution based on user input. + + + :param project_id: Your STACKIT Project ID. (required) + :type project_id: str + :param distribution_id: Your CDN distribution ID. (required) + :type distribution_id: str + :param filter: Optional search string. Will search the **values** for the text input. + :type filter: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_logs_search_filters_serialize( + project_id=project_id, + distribution_id=distribution_id, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetLogsSearchFiltersResponse", + "400": "GenericJsonResponse", + "401": "str", + "422": "GenericJsonResponse", + "500": "GenericJsonResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_logs_search_filters_with_http_info( + self, + project_id: Annotated[StrictStr, Field(description="Your STACKIT Project ID.")], + distribution_id: Annotated[StrictStr, Field(description="Your CDN distribution ID.")], + filter: Annotated[ + Optional[StrictStr], + Field(description="Optional search string. Will search the **values** for the text input."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetLogsSearchFiltersResponse]: + """Get relevant search filters for this distribution based on user input. + + + :param project_id: Your STACKIT Project ID. (required) + :type project_id: str + :param distribution_id: Your CDN distribution ID. (required) + :type distribution_id: str + :param filter: Optional search string. Will search the **values** for the text input. + :type filter: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_logs_search_filters_serialize( + project_id=project_id, + distribution_id=distribution_id, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetLogsSearchFiltersResponse", + "400": "GenericJsonResponse", + "401": "str", + "422": "GenericJsonResponse", + "500": "GenericJsonResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_logs_search_filters_without_preload_content( + self, + project_id: Annotated[StrictStr, Field(description="Your STACKIT Project ID.")], + distribution_id: Annotated[StrictStr, Field(description="Your CDN distribution ID.")], + filter: Annotated[ + Optional[StrictStr], + Field(description="Optional search string. Will search the **values** for the text input."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get relevant search filters for this distribution based on user input. + + + :param project_id: Your STACKIT Project ID. (required) + :type project_id: str + :param distribution_id: Your CDN distribution ID. (required) + :type distribution_id: str + :param filter: Optional search string. Will search the **values** for the text input. + :type filter: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_logs_search_filters_serialize( + project_id=project_id, + distribution_id=distribution_id, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetLogsSearchFiltersResponse", + "400": "GenericJsonResponse", + "401": "str", + "422": "GenericJsonResponse", + "500": "GenericJsonResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_logs_search_filters_serialize( + self, + project_id, + distribution_id, + filter, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if distribution_id is not None: + _path_params["distributionId"] = distribution_id + # process the query parameters + if filter is not None: + + _query_params.append(("filter", filter)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "text/plain"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/logs/searchFilters", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2847,7 +3159,7 @@ def _get_statistics_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}/statistics", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/statistics", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3227,7 +3539,7 @@ def _list_distributions_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta2/projects/{projectId}/distributions", + resource_path="/v1/projects/{projectId}/distributions", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3462,7 +3774,7 @@ def _list_waf_collections_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta2/projects/{projectId}/waf/collections", + resource_path="/v1/projects/{projectId}/waf/collections", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3735,7 +4047,7 @@ def _patch_distribution_serialize( return self.api_client.param_serialize( method="PATCH", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4008,7 +4320,7 @@ def _purge_cache_serialize( return self.api_client.param_serialize( method="POST", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}/cache/purge", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/cache/purge", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4296,7 +4608,7 @@ def _put_custom_domain_serialize( return self.api_client.param_serialize( method="PUT", - resource_path="/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}", + resource_path="/v1/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}", path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/services/cdn/src/stackit/cdn/api_client.py b/services/cdn/src/stackit/cdn/api_client.py index 11b618f9b..9a87aa62e 100644 --- a/services/cdn/src/stackit/cdn/api_client.py +++ b/services/cdn/src/stackit/cdn/api_client.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/configuration.py b/services/cdn/src/stackit/cdn/configuration.py index 92d3a9c18..8862407fb 100644 --- a/services/cdn/src/stackit/cdn/configuration.py +++ b/services/cdn/src/stackit/cdn/configuration.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/exceptions.py b/services/cdn/src/stackit/cdn/exceptions.py index 2d905f936..1e539ba3c 100644 --- a/services/cdn/src/stackit/cdn/exceptions.py +++ b/services/cdn/src/stackit/cdn/exceptions.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/__init__.py b/services/cdn/src/stackit/cdn/models/__init__.py index 010c5c954..018106559 100644 --- a/services/cdn/src/stackit/cdn/models/__init__.py +++ b/services/cdn/src/stackit/cdn/models/__init__.py @@ -6,7 +6,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -66,6 +66,15 @@ ) from stackit.cdn.models.get_distribution_response import GetDistributionResponse from stackit.cdn.models.get_logs_response import GetLogsResponse +from stackit.cdn.models.get_logs_search_filters_response import ( + GetLogsSearchFiltersResponse, +) +from stackit.cdn.models.get_logs_search_filters_response_datacenter_block import ( + GetLogsSearchFiltersResponseDatacenterBlock, +) +from stackit.cdn.models.get_logs_search_filters_response_datacenter_block_item import ( + GetLogsSearchFiltersResponseDatacenterBlockItem, +) from stackit.cdn.models.get_statistics_response import GetStatisticsResponse from stackit.cdn.models.http_backend import HttpBackend from stackit.cdn.models.http_backend_create import HttpBackendCreate @@ -100,8 +109,27 @@ from stackit.cdn.models.waf_config import WafConfig from stackit.cdn.models.waf_config_patch import WafConfigPatch from stackit.cdn.models.waf_mode import WafMode +from stackit.cdn.models.waf_paranoia_level import WafParanoiaLevel from stackit.cdn.models.waf_rule import WafRule +from stackit.cdn.models.waf_rule_action import WAFRuleAction from stackit.cdn.models.waf_rule_collection import WafRuleCollection from stackit.cdn.models.waf_rule_group import WafRuleGroup from stackit.cdn.models.waf_status_rule_block import WafStatusRuleBlock +from stackit.cdn.models.waf_status_rule_block_reason import WafStatusRuleBlockReason +from stackit.cdn.models.waf_status_rule_block_reason_directly_defined import ( + WafStatusRuleBlockReasonDirectlyDefined, +) +from stackit.cdn.models.waf_status_rule_block_reason_inherited_from_collection import ( + WafStatusRuleBlockReasonInheritedFromCollection, +) +from stackit.cdn.models.waf_status_rule_block_reason_inherited_from_group import ( + WafStatusRuleBlockReasonInheritedFromGroup, +) +from stackit.cdn.models.waf_status_rule_block_reason_invalid_waf_type import ( + WafStatusRuleBlockReasonInvalidWafType, +) +from stackit.cdn.models.waf_status_rule_block_reason_never_defined import ( + WafStatusRuleBlockReasonNeverDefined, +) from stackit.cdn.models.waf_type import WafType +from stackit.cdn.models.waf_violation import WAFViolation diff --git a/services/cdn/src/stackit/cdn/models/bucket_backend.py b/services/cdn/src/stackit/cdn/models/bucket_backend.py index ca1df6f1e..629574e57 100644 --- a/services/cdn/src/stackit/cdn/models/bucket_backend.py +++ b/services/cdn/src/stackit/cdn/models/bucket_backend.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/bucket_backend_create.py b/services/cdn/src/stackit/cdn/models/bucket_backend_create.py index b3ed76d24..ca3ee3db6 100644 --- a/services/cdn/src/stackit/cdn/models/bucket_backend_create.py +++ b/services/cdn/src/stackit/cdn/models/bucket_backend_create.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/bucket_backend_patch.py b/services/cdn/src/stackit/cdn/models/bucket_backend_patch.py index 899f6d390..835c532bb 100644 --- a/services/cdn/src/stackit/cdn/models/bucket_backend_patch.py +++ b/services/cdn/src/stackit/cdn/models/bucket_backend_patch.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/bucket_credentials.py b/services/cdn/src/stackit/cdn/models/bucket_credentials.py index f3ccd768c..c2110baab 100644 --- a/services/cdn/src/stackit/cdn/models/bucket_credentials.py +++ b/services/cdn/src/stackit/cdn/models/bucket_credentials.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/config.py b/services/cdn/src/stackit/cdn/models/config.py index 60db0d33d..2feb1995f 100644 --- a/services/cdn/src/stackit/cdn/models/config.py +++ b/services/cdn/src/stackit/cdn/models/config.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/config_backend.py b/services/cdn/src/stackit/cdn/models/config_backend.py index 5f7946d66..9024b8191 100644 --- a/services/cdn/src/stackit/cdn/models/config_backend.py +++ b/services/cdn/src/stackit/cdn/models/config_backend.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/config_patch.py b/services/cdn/src/stackit/cdn/models/config_patch.py index 4dc7cab88..8eab45e37 100644 --- a/services/cdn/src/stackit/cdn/models/config_patch.py +++ b/services/cdn/src/stackit/cdn/models/config_patch.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/config_patch_backend.py b/services/cdn/src/stackit/cdn/models/config_patch_backend.py index 1ed67f5cc..b8d43df16 100644 --- a/services/cdn/src/stackit/cdn/models/config_patch_backend.py +++ b/services/cdn/src/stackit/cdn/models/config_patch_backend.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. 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 03d5fb230..be8bafdeb 100644 --- a/services/cdn/src/stackit/cdn/models/create_distribution_payload.py +++ b/services/cdn/src/stackit/cdn/models/create_distribution_payload.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/create_distribution_payload_backend.py b/services/cdn/src/stackit/cdn/models/create_distribution_payload_backend.py index 4334f311a..3972d06ab 100644 --- a/services/cdn/src/stackit/cdn/models/create_distribution_payload_backend.py +++ b/services/cdn/src/stackit/cdn/models/create_distribution_payload_backend.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/create_distribution_response.py b/services/cdn/src/stackit/cdn/models/create_distribution_response.py index 2b23088bc..53f3dfa3e 100644 --- a/services/cdn/src/stackit/cdn/models/create_distribution_response.py +++ b/services/cdn/src/stackit/cdn/models/create_distribution_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/custom_domain.py b/services/cdn/src/stackit/cdn/models/custom_domain.py index 8928d5eb5..ed6f08239 100644 --- a/services/cdn/src/stackit/cdn/models/custom_domain.py +++ b/services/cdn/src/stackit/cdn/models/custom_domain.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/delete_custom_domain_response.py b/services/cdn/src/stackit/cdn/models/delete_custom_domain_response.py index 1ae209912..711696b60 100644 --- a/services/cdn/src/stackit/cdn/models/delete_custom_domain_response.py +++ b/services/cdn/src/stackit/cdn/models/delete_custom_domain_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/delete_distribution_response.py b/services/cdn/src/stackit/cdn/models/delete_distribution_response.py index 5f12bd6c0..6756b8517 100644 --- a/services/cdn/src/stackit/cdn/models/delete_distribution_response.py +++ b/services/cdn/src/stackit/cdn/models/delete_distribution_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/distribution.py b/services/cdn/src/stackit/cdn/models/distribution.py index 773ec50b6..0396d462f 100644 --- a/services/cdn/src/stackit/cdn/models/distribution.py +++ b/services/cdn/src/stackit/cdn/models/distribution.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/distribution_logs_record.py b/services/cdn/src/stackit/cdn/models/distribution_logs_record.py index f256a0277..267b786ee 100644 --- a/services/cdn/src/stackit/cdn/models/distribution_logs_record.py +++ b/services/cdn/src/stackit/cdn/models/distribution_logs_record.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -30,6 +30,8 @@ ) from typing_extensions import Annotated, Self +from stackit.cdn.models.waf_violation import WAFViolation + class DistributionLogsRecord(BaseModel): """ @@ -47,6 +49,7 @@ class DistributionLogsRecord(BaseModel): size: Annotated[int, Field(strict=True, ge=0)] status_code: StrictInt = Field(alias="statusCode") timestamp: datetime + waf_violation: Optional[WAFViolation] = Field(default=None, alias="wafViolation") __properties: ClassVar[List[str]] = [ "cacheHit", "dataCenterRegion", @@ -57,6 +60,7 @@ class DistributionLogsRecord(BaseModel): "size", "statusCode", "timestamp", + "wafViolation", ] @field_validator("timestamp", mode="before") @@ -109,6 +113,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of waf_violation + if self.waf_violation: + _dict["wafViolation"] = self.waf_violation.to_dict() return _dict @classmethod @@ -131,6 +138,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "size": obj.get("size"), "statusCode": obj.get("statusCode"), "timestamp": obj.get("timestamp"), + "wafViolation": ( + WAFViolation.from_dict(obj["wafViolation"]) if obj.get("wafViolation") is not None else None + ), } ) return _obj diff --git a/services/cdn/src/stackit/cdn/models/distribution_statistics_record.py b/services/cdn/src/stackit/cdn/models/distribution_statistics_record.py index 76746aa15..be2f163b6 100644 --- a/services/cdn/src/stackit/cdn/models/distribution_statistics_record.py +++ b/services/cdn/src/stackit/cdn/models/distribution_statistics_record.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/distribution_statistics_record_entry.py b/services/cdn/src/stackit/cdn/models/distribution_statistics_record_entry.py index 52877e9b9..97d6718be 100644 --- a/services/cdn/src/stackit/cdn/models/distribution_statistics_record_entry.py +++ b/services/cdn/src/stackit/cdn/models/distribution_statistics_record_entry.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/distribution_statistics_record_regions.py b/services/cdn/src/stackit/cdn/models/distribution_statistics_record_regions.py index d5fc89954..f25888e61 100644 --- a/services/cdn/src/stackit/cdn/models/distribution_statistics_record_regions.py +++ b/services/cdn/src/stackit/cdn/models/distribution_statistics_record_regions.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/distribution_waf.py b/services/cdn/src/stackit/cdn/models/distribution_waf.py index 1958d3f99..70ce0853f 100644 --- a/services/cdn/src/stackit/cdn/models/distribution_waf.py +++ b/services/cdn/src/stackit/cdn/models/distribution_waf.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/domain.py b/services/cdn/src/stackit/cdn/models/domain.py index 84b94544b..f6aa71e62 100644 --- a/services/cdn/src/stackit/cdn/models/domain.py +++ b/services/cdn/src/stackit/cdn/models/domain.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/domain_status.py b/services/cdn/src/stackit/cdn/models/domain_status.py index aafaeded8..bc40e1eb0 100644 --- a/services/cdn/src/stackit/cdn/models/domain_status.py +++ b/services/cdn/src/stackit/cdn/models/domain_status.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/error_details.py b/services/cdn/src/stackit/cdn/models/error_details.py index 439748848..1df5fbe13 100644 --- a/services/cdn/src/stackit/cdn/models/error_details.py +++ b/services/cdn/src/stackit/cdn/models/error_details.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -39,9 +39,11 @@ class ErrorDetails(BaseModel): @field_validator("key") def key_validate_enum(cls, value): """Validates the enum""" - if value not in set(["UNKNOWN", "CUSTOM_DOMAIN_CNAME_MISSING", "INVALID_ARGUMENT"]): + if value not in set( + ["UNKNOWN", "CUSTOM_DOMAIN_CNAME_MISSING", "INVALID_ARGUMENT", "LOG_SINK_INSTANCE_UNAVAILABLE"] + ): raise ValueError( - "must be one of enum values ('UNKNOWN', 'CUSTOM_DOMAIN_CNAME_MISSING', 'INVALID_ARGUMENT')" + "must be one of enum values ('UNKNOWN', 'CUSTOM_DOMAIN_CNAME_MISSING', 'INVALID_ARGUMENT', 'LOG_SINK_INSTANCE_UNAVAILABLE')" ) return value diff --git a/services/cdn/src/stackit/cdn/models/find_cache_paths_response.py b/services/cdn/src/stackit/cdn/models/find_cache_paths_response.py index dfb3ac95c..e65e1ab9f 100644 --- a/services/cdn/src/stackit/cdn/models/find_cache_paths_response.py +++ b/services/cdn/src/stackit/cdn/models/find_cache_paths_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/find_cache_paths_response_entry.py b/services/cdn/src/stackit/cdn/models/find_cache_paths_response_entry.py index 10c2b11f7..dd0fc4156 100644 --- a/services/cdn/src/stackit/cdn/models/find_cache_paths_response_entry.py +++ b/services/cdn/src/stackit/cdn/models/find_cache_paths_response_entry.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/generic_json_response.py b/services/cdn/src/stackit/cdn/models/generic_json_response.py index a7201d0c5..26553d1e4 100644 --- a/services/cdn/src/stackit/cdn/models/generic_json_response.py +++ b/services/cdn/src/stackit/cdn/models/generic_json_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_cache_info_response.py b/services/cdn/src/stackit/cdn/models/get_cache_info_response.py index f47090565..154b98571 100644 --- a/services/cdn/src/stackit/cdn/models/get_cache_info_response.py +++ b/services/cdn/src/stackit/cdn/models/get_cache_info_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_cache_info_response_history_entry.py b/services/cdn/src/stackit/cdn/models/get_cache_info_response_history_entry.py index ce8515b1a..586ba62f8 100644 --- a/services/cdn/src/stackit/cdn/models/get_cache_info_response_history_entry.py +++ b/services/cdn/src/stackit/cdn/models/get_cache_info_response_history_entry.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_custom_domain_custom_certificate.py b/services/cdn/src/stackit/cdn/models/get_custom_domain_custom_certificate.py index f03eabc7c..78aaa0222 100644 --- a/services/cdn/src/stackit/cdn/models/get_custom_domain_custom_certificate.py +++ b/services/cdn/src/stackit/cdn/models/get_custom_domain_custom_certificate.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_custom_domain_managed_certificate.py b/services/cdn/src/stackit/cdn/models/get_custom_domain_managed_certificate.py index 09f5819fe..bb7207561 100644 --- a/services/cdn/src/stackit/cdn/models/get_custom_domain_managed_certificate.py +++ b/services/cdn/src/stackit/cdn/models/get_custom_domain_managed_certificate.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_custom_domain_response.py b/services/cdn/src/stackit/cdn/models/get_custom_domain_response.py index 694bd12fa..b9b978bf1 100644 --- a/services/cdn/src/stackit/cdn/models/get_custom_domain_response.py +++ b/services/cdn/src/stackit/cdn/models/get_custom_domain_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_custom_domain_response_certificate.py b/services/cdn/src/stackit/cdn/models/get_custom_domain_response_certificate.py index cfcb508e8..9ad7fd39a 100644 --- a/services/cdn/src/stackit/cdn/models/get_custom_domain_response_certificate.py +++ b/services/cdn/src/stackit/cdn/models/get_custom_domain_response_certificate.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_distribution_response.py b/services/cdn/src/stackit/cdn/models/get_distribution_response.py index 79cd65a25..34a26c21e 100644 --- a/services/cdn/src/stackit/cdn/models/get_distribution_response.py +++ b/services/cdn/src/stackit/cdn/models/get_distribution_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_logs_response.py b/services/cdn/src/stackit/cdn/models/get_logs_response.py index 6d43b0324..6ccd9f7b6 100644 --- a/services/cdn/src/stackit/cdn/models/get_logs_response.py +++ b/services/cdn/src/stackit/cdn/models/get_logs_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response.py b/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response.py new file mode 100644 index 000000000..141679091 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + 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, StrictStr, field_validator +from typing_extensions import Annotated, Self + +from stackit.cdn.models.get_logs_search_filters_response_datacenter_block import ( + GetLogsSearchFiltersResponseDatacenterBlock, +) + + +class GetLogsSearchFiltersResponse(BaseModel): + """ + GetLogsSearchFiltersResponse + """ # noqa: E501 + + cache: List[StrictStr] + data_center: GetLogsSearchFiltersResponseDatacenterBlock = Field(alias="dataCenter") + remote_country: List[Annotated[str, Field(min_length=2, strict=True, max_length=2)]] = Field( + description="List of ISO-3166 Alpha2 Country Codes matching the input filter. Response is ordered in ascending order. For more Info about the country codes, see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ", + alias="remoteCountry", + ) + status: List[Annotated[int, Field(strict=True, ge=0)]] = Field( + description="List of Status Codes matching the input filter. Response is ordered in ascending order." + ) + __properties: ClassVar[List[str]] = ["cache", "dataCenter", "remoteCountry", "status"] + + @field_validator("cache") + def cache_validate_enum(cls, value): + """Validates the enum""" + for i in value: + if i not in set(["HIT", "MISS"]): + raise ValueError("each list item must be one of ('HIT', 'MISS')") + return value + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetLogsSearchFiltersResponse 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, + ) + # override the default output from pydantic by calling `to_dict()` of data_center + if self.data_center: + _dict["dataCenter"] = self.data_center.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetLogsSearchFiltersResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "cache": obj.get("cache"), + "dataCenter": ( + GetLogsSearchFiltersResponseDatacenterBlock.from_dict(obj["dataCenter"]) + if obj.get("dataCenter") is not None + else None + ), + "remoteCountry": obj.get("remoteCountry"), + "status": obj.get("status"), + } + ) + return _obj diff --git a/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response_datacenter_block.py b/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response_datacenter_block.py new file mode 100644 index 000000000..3682d23e2 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response_datacenter_block.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + 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 +from typing_extensions import Self + +from stackit.cdn.models.get_logs_search_filters_response_datacenter_block_item import ( + GetLogsSearchFiltersResponseDatacenterBlockItem, +) + + +class GetLogsSearchFiltersResponseDatacenterBlock(BaseModel): + """ + Object containing Datacenters to filter for. Each datacenter is grouped to the respective region. + """ # noqa: E501 + + af: List[GetLogsSearchFiltersResponseDatacenterBlockItem] = Field(alias="AF") + asia: List[GetLogsSearchFiltersResponseDatacenterBlockItem] = Field(alias="ASIA") + eu: List[GetLogsSearchFiltersResponseDatacenterBlockItem] = Field(alias="EU") + na: List[GetLogsSearchFiltersResponseDatacenterBlockItem] = Field(alias="NA") + sa: List[GetLogsSearchFiltersResponseDatacenterBlockItem] = Field(alias="SA") + __properties: ClassVar[List[str]] = ["AF", "ASIA", "EU", "NA", "SA"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetLogsSearchFiltersResponseDatacenterBlock 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, + ) + # override the default output from pydantic by calling `to_dict()` of each item in af (list) + _items = [] + if self.af: + for _item in self.af: + if _item: + _items.append(_item.to_dict()) + _dict["AF"] = _items + # override the default output from pydantic by calling `to_dict()` of each item in asia (list) + _items = [] + if self.asia: + for _item in self.asia: + if _item: + _items.append(_item.to_dict()) + _dict["ASIA"] = _items + # override the default output from pydantic by calling `to_dict()` of each item in eu (list) + _items = [] + if self.eu: + for _item in self.eu: + if _item: + _items.append(_item.to_dict()) + _dict["EU"] = _items + # override the default output from pydantic by calling `to_dict()` of each item in na (list) + _items = [] + if self.na: + for _item in self.na: + if _item: + _items.append(_item.to_dict()) + _dict["NA"] = _items + # override the default output from pydantic by calling `to_dict()` of each item in sa (list) + _items = [] + if self.sa: + for _item in self.sa: + if _item: + _items.append(_item.to_dict()) + _dict["SA"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetLogsSearchFiltersResponseDatacenterBlock from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "AF": ( + [GetLogsSearchFiltersResponseDatacenterBlockItem.from_dict(_item) for _item in obj["AF"]] + if obj.get("AF") is not None + else None + ), + "ASIA": ( + [GetLogsSearchFiltersResponseDatacenterBlockItem.from_dict(_item) for _item in obj["ASIA"]] + if obj.get("ASIA") is not None + else None + ), + "EU": ( + [GetLogsSearchFiltersResponseDatacenterBlockItem.from_dict(_item) for _item in obj["EU"]] + if obj.get("EU") is not None + else None + ), + "NA": ( + [GetLogsSearchFiltersResponseDatacenterBlockItem.from_dict(_item) for _item in obj["NA"]] + if obj.get("NA") is not None + else None + ), + "SA": ( + [GetLogsSearchFiltersResponseDatacenterBlockItem.from_dict(_item) for _item in obj["SA"]] + if obj.get("SA") is not None + else None + ), + } + ) + return _obj diff --git a/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response_datacenter_block_item.py b/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response_datacenter_block_item.py new file mode 100644 index 000000000..296e6b337 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/get_logs_search_filters_response_datacenter_block_item.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + 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, StrictStr +from typing_extensions import Self + + +class GetLogsSearchFiltersResponseDatacenterBlockItem(BaseModel): + """ + A datacenter. The `id` defines the key needed to filter against the logs endpoint, while the `displayName` defines a human-readable Name. + """ # noqa: E501 + + display_name: StrictStr = Field(alias="displayName") + id: StrictStr + __properties: ClassVar[List[str]] = ["displayName", "id"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetLogsSearchFiltersResponseDatacenterBlockItem 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 GetLogsSearchFiltersResponseDatacenterBlockItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"displayName": obj.get("displayName"), "id": obj.get("id")}) + return _obj diff --git a/services/cdn/src/stackit/cdn/models/get_statistics_response.py b/services/cdn/src/stackit/cdn/models/get_statistics_response.py index 9361250f1..6df543b5b 100644 --- a/services/cdn/src/stackit/cdn/models/get_statistics_response.py +++ b/services/cdn/src/stackit/cdn/models/get_statistics_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/http_backend.py b/services/cdn/src/stackit/cdn/models/http_backend.py index 09efe9ca1..4b5825e05 100644 --- a/services/cdn/src/stackit/cdn/models/http_backend.py +++ b/services/cdn/src/stackit/cdn/models/http_backend.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/http_backend_create.py b/services/cdn/src/stackit/cdn/models/http_backend_create.py index 7f09fd67c..dc54dd349 100644 --- a/services/cdn/src/stackit/cdn/models/http_backend_create.py +++ b/services/cdn/src/stackit/cdn/models/http_backend_create.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/http_backend_patch.py b/services/cdn/src/stackit/cdn/models/http_backend_patch.py index ba3911fdc..f2bf560db 100644 --- a/services/cdn/src/stackit/cdn/models/http_backend_patch.py +++ b/services/cdn/src/stackit/cdn/models/http_backend_patch.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/list_distributions_response.py b/services/cdn/src/stackit/cdn/models/list_distributions_response.py index 19085270c..403d61e4c 100644 --- a/services/cdn/src/stackit/cdn/models/list_distributions_response.py +++ b/services/cdn/src/stackit/cdn/models/list_distributions_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/list_waf_collections_response.py b/services/cdn/src/stackit/cdn/models/list_waf_collections_response.py index 2f5330e62..fd268904f 100644 --- a/services/cdn/src/stackit/cdn/models/list_waf_collections_response.py +++ b/services/cdn/src/stackit/cdn/models/list_waf_collections_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/loki_log_sink.py b/services/cdn/src/stackit/cdn/models/loki_log_sink.py index 8fb950da0..bc2d62ec2 100644 --- a/services/cdn/src/stackit/cdn/models/loki_log_sink.py +++ b/services/cdn/src/stackit/cdn/models/loki_log_sink.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/loki_log_sink_create.py b/services/cdn/src/stackit/cdn/models/loki_log_sink_create.py index c0abcc96a..4616ff482 100644 --- a/services/cdn/src/stackit/cdn/models/loki_log_sink_create.py +++ b/services/cdn/src/stackit/cdn/models/loki_log_sink_create.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/loki_log_sink_credentials.py b/services/cdn/src/stackit/cdn/models/loki_log_sink_credentials.py index 227d6aafb..49a7831f0 100644 --- a/services/cdn/src/stackit/cdn/models/loki_log_sink_credentials.py +++ b/services/cdn/src/stackit/cdn/models/loki_log_sink_credentials.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/loki_log_sink_patch.py b/services/cdn/src/stackit/cdn/models/loki_log_sink_patch.py index 2863e8252..451caf3dd 100644 --- a/services/cdn/src/stackit/cdn/models/loki_log_sink_patch.py +++ b/services/cdn/src/stackit/cdn/models/loki_log_sink_patch.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/optimizer.py b/services/cdn/src/stackit/cdn/models/optimizer.py index ca2e3d23b..1cd176775 100644 --- a/services/cdn/src/stackit/cdn/models/optimizer.py +++ b/services/cdn/src/stackit/cdn/models/optimizer.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/optimizer_patch.py b/services/cdn/src/stackit/cdn/models/optimizer_patch.py index a453b2278..341c0b801 100644 --- a/services/cdn/src/stackit/cdn/models/optimizer_patch.py +++ b/services/cdn/src/stackit/cdn/models/optimizer_patch.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/patch_distribution_payload.py b/services/cdn/src/stackit/cdn/models/patch_distribution_payload.py index 05f353338..e6eae85a3 100644 --- a/services/cdn/src/stackit/cdn/models/patch_distribution_payload.py +++ b/services/cdn/src/stackit/cdn/models/patch_distribution_payload.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/patch_distribution_response.py b/services/cdn/src/stackit/cdn/models/patch_distribution_response.py index 634ea59dc..b30f8376c 100644 --- a/services/cdn/src/stackit/cdn/models/patch_distribution_response.py +++ b/services/cdn/src/stackit/cdn/models/patch_distribution_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/purge_cache_payload.py b/services/cdn/src/stackit/cdn/models/purge_cache_payload.py index 85922d588..b8d1adae6 100644 --- a/services/cdn/src/stackit/cdn/models/purge_cache_payload.py +++ b/services/cdn/src/stackit/cdn/models/purge_cache_payload.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/put_custom_domain_custom_certificate.py b/services/cdn/src/stackit/cdn/models/put_custom_domain_custom_certificate.py index 53532fee3..52370e01b 100644 --- a/services/cdn/src/stackit/cdn/models/put_custom_domain_custom_certificate.py +++ b/services/cdn/src/stackit/cdn/models/put_custom_domain_custom_certificate.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/put_custom_domain_managed_certificate.py b/services/cdn/src/stackit/cdn/models/put_custom_domain_managed_certificate.py index df32773e7..5f77b8baa 100644 --- a/services/cdn/src/stackit/cdn/models/put_custom_domain_managed_certificate.py +++ b/services/cdn/src/stackit/cdn/models/put_custom_domain_managed_certificate.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/put_custom_domain_payload.py b/services/cdn/src/stackit/cdn/models/put_custom_domain_payload.py index ff82f32f5..991c4ff3b 100644 --- a/services/cdn/src/stackit/cdn/models/put_custom_domain_payload.py +++ b/services/cdn/src/stackit/cdn/models/put_custom_domain_payload.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/put_custom_domain_payload_certificate.py b/services/cdn/src/stackit/cdn/models/put_custom_domain_payload_certificate.py index 71fe8107e..d0493f4e1 100644 --- a/services/cdn/src/stackit/cdn/models/put_custom_domain_payload_certificate.py +++ b/services/cdn/src/stackit/cdn/models/put_custom_domain_payload_certificate.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/put_custom_domain_response.py b/services/cdn/src/stackit/cdn/models/put_custom_domain_response.py index e97791293..c095a1688 100644 --- a/services/cdn/src/stackit/cdn/models/put_custom_domain_response.py +++ b/services/cdn/src/stackit/cdn/models/put_custom_domain_response.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/put_custom_domain_response_certificate.py b/services/cdn/src/stackit/cdn/models/put_custom_domain_response_certificate.py index 7e694f908..4b9cfcf67 100644 --- a/services/cdn/src/stackit/cdn/models/put_custom_domain_response_certificate.py +++ b/services/cdn/src/stackit/cdn/models/put_custom_domain_response_certificate.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/region.py b/services/cdn/src/stackit/cdn/models/region.py index e7af423f8..005f7f1a5 100644 --- a/services/cdn/src/stackit/cdn/models/region.py +++ b/services/cdn/src/stackit/cdn/models/region.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/status_error.py b/services/cdn/src/stackit/cdn/models/status_error.py index 5428f5b52..7951d7013 100644 --- a/services/cdn/src/stackit/cdn/models/status_error.py +++ b/services/cdn/src/stackit/cdn/models/status_error.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -42,10 +42,16 @@ class StatusError(BaseModel): def key_validate_enum(cls, value): """Validates the enum""" if value not in set( - ["UNKNOWN", "CUSTOM_DOMAIN_CNAME_MISSING", "CUSTOM_DOMAIN_ALREADY_IN_USE", "PUBLIC_BETA_QUOTA_REACHED"] + [ + "UNKNOWN", + "CUSTOM_DOMAIN_CNAME_MISSING", + "CUSTOM_DOMAIN_ALREADY_IN_USE", + "PUBLIC_BETA_QUOTA_REACHED", + "LOG_SINK_INSTANCE_UNAVAILABLE", + ] ): raise ValueError( - "must be one of enum values ('UNKNOWN', 'CUSTOM_DOMAIN_CNAME_MISSING', 'CUSTOM_DOMAIN_ALREADY_IN_USE', 'PUBLIC_BETA_QUOTA_REACHED')" + "must be one of enum values ('UNKNOWN', 'CUSTOM_DOMAIN_CNAME_MISSING', 'CUSTOM_DOMAIN_ALREADY_IN_USE', 'PUBLIC_BETA_QUOTA_REACHED', 'LOG_SINK_INSTANCE_UNAVAILABLE')" ) return value diff --git a/services/cdn/src/stackit/cdn/models/waf_config.py b/services/cdn/src/stackit/cdn/models/waf_config.py index 8edc7f7ed..4f16e1848 100644 --- a/services/cdn/src/stackit/cdn/models/waf_config.py +++ b/services/cdn/src/stackit/cdn/models/waf_config.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,24 +18,83 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self +from typing_extensions import Annotated, Self from stackit.cdn.models.waf_mode import WafMode +from stackit.cdn.models.waf_paranoia_level import WafParanoiaLevel from stackit.cdn.models.waf_type import WafType class WafConfig(BaseModel): """ - Configuration of the WAF of a distribution + Configuration of the WAF of a distribution A WAF Config always contains a WAF Mode and Type. If a WAF was never enabled, most of the properties are not present. To **enable** the WAF for your Distribution, you must set the `mode` to `ENABLED` or `LOG_ONLY`. This causes the other properties to be populated. ## Rules There are 9 properties used to control which Rules are enabled, disabled or set to Log-Only. These properties can be grouped in 3 groups of 3. Each of these groups varies in specificity: Rules are more specific than Rule Groups, which in turn are more specific than Collections. More specific definitions override more generic definitions. ### Collections - `enabledRuleCollectionIds` - `disabledRuleCollectionIds` - `logOnlyRuleCollectionIds` These are the least specific selectors. As of 2025, only two collections exist: - `@builtin/crs/response`, containing all Rules regarding Responses - `@builtin/crs/request`, containing all Rules regarding Requests More collections may be added in the future ### Rule Groups - `enabledRuleGroupIds` - `disabledRuleGroupIds` - `logOnlyRuleGroupIds` These are more specific than Collections and will override their selector. You can find all available Rule Groups by calling the `ListWafCollections` Operation. ### Rules - `enabledRuleIds` - `disabledRuleIds` - `logOnlyRuleGds` Being the most specific selectors, these will override both Collection and Rule Group selectors. You can find all available Rule Groups by calling the `ListWafCollections` Operation. ### TIP: Review resolved config If you call `GetDistribution` with `?withWafStatus=true`, you get back a resolved WAF Rules Config which contains a `waf` property which you can inspect to see why a Rule is either enabled, disabled or logOnly. """ # noqa: E501 + allowed_http_methods: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field( + default=None, + description="This whitelist restricts which HTTP methods the distribution accepts. Requests using non-whitelisted methods are blocked by the WAF before reaching the origin. Common methods: `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS`, `CONNECT`, `TRACE` Validation ensures: 1. At least one method is allowed 2. No duplicate methods (e.g., `GET` appearing twice) 3. Each method is valid per HTTP standards ", + alias="allowedHttpMethods", + ) + allowed_http_versions: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field( + default=None, alias="allowedHttpVersions" + ) + allowed_request_content_types: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field( + default=None, + description="This allow list restricts which Content-Type headers are accepted in request bodies. Format: Must be `type/subtype` with no spaces. Common content types: - `application/json` - `application/x-www-form-urlencoded` - `multipart/form-data` - `text/html` - `text/plain` - `application/xml` ", + alias="allowedRequestContentTypes", + ) + disabled_rule_collection_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Collections to mark as disabled ", alias="disabledRuleCollectionIds" + ) + disabled_rule_group_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Rule Groups to mark as disabled ", alias="disabledRuleGroupIds" + ) + disabled_rule_ids: Optional[List[StrictStr]] = Field( + default=None, + description="Ids of WAF Rules that are **explicitly** disabled for this distribution. ", + alias="disabledRuleIds", + ) + enabled_rule_collection_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Collections to mark as enabled ", alias="enabledRuleCollectionIds" + ) + enabled_rule_group_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Rule Groups to mark as enabled ", alias="enabledRuleGroupIds" + ) enabled_rule_ids: List[StrictStr] = Field( description="Ids of the WAF rules that are **explicitly** enabled for this distribution. If this rule is in a disabled / log Only RuleGroup or Collection, it will be enabled regardless as `enabledRuleIds` overrides those in specificity. Do note that rules can also be enabled because a Rulegroup or Collection is enabled. **DO NOT** use this property to find all active rules. Instead, pass `?withWafStatus=true` as a query parameter to `GetDistribution` or `ListDistributions`. This will expose the `waf` Property on distribution Level. From there you can `$.waf.enabledRules.map(e => e.id)` to get a list of all enabled rules. ", alias="enabledRuleIds", ) + log_only_rule_collection_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Collections to mark as log Only. ", alias="logOnlyRuleCollectionIds" + ) + log_only_rule_group_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Rule Groups to mark as log Only. ", alias="logOnlyRuleGroupIds" + ) + log_only_rule_ids: Optional[List[StrictStr]] = Field( + default=None, + description="Ids of WAF Rules that are **explicitly** marked as Log Only for this distribution. ", + alias="logOnlyRuleIds", + ) mode: WafMode + paranoia_level: Optional[WafParanoiaLevel] = Field(default=None, alias="paranoiaLevel") type: WafType - __properties: ClassVar[List[str]] = ["enabledRuleIds", "mode", "type"] + __properties: ClassVar[List[str]] = [ + "allowedHttpMethods", + "allowedHttpVersions", + "allowedRequestContentTypes", + "disabledRuleCollectionIds", + "disabledRuleGroupIds", + "disabledRuleIds", + "enabledRuleCollectionIds", + "enabledRuleGroupIds", + "enabledRuleIds", + "logOnlyRuleCollectionIds", + "logOnlyRuleGroupIds", + "logOnlyRuleIds", + "mode", + "paranoiaLevel", + "type", + ] model_config = ConfigDict( populate_by_name=True, @@ -86,6 +145,22 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate( - {"enabledRuleIds": obj.get("enabledRuleIds"), "mode": obj.get("mode"), "type": obj.get("type")} + { + "allowedHttpMethods": obj.get("allowedHttpMethods"), + "allowedHttpVersions": obj.get("allowedHttpVersions"), + "allowedRequestContentTypes": obj.get("allowedRequestContentTypes"), + "disabledRuleCollectionIds": obj.get("disabledRuleCollectionIds"), + "disabledRuleGroupIds": obj.get("disabledRuleGroupIds"), + "disabledRuleIds": obj.get("disabledRuleIds"), + "enabledRuleCollectionIds": obj.get("enabledRuleCollectionIds"), + "enabledRuleGroupIds": obj.get("enabledRuleGroupIds"), + "enabledRuleIds": obj.get("enabledRuleIds"), + "logOnlyRuleCollectionIds": obj.get("logOnlyRuleCollectionIds"), + "logOnlyRuleGroupIds": obj.get("logOnlyRuleGroupIds"), + "logOnlyRuleIds": obj.get("logOnlyRuleIds"), + "mode": obj.get("mode"), + "paranoiaLevel": obj.get("paranoiaLevel"), + "type": obj.get("type"), + } ) return _obj diff --git a/services/cdn/src/stackit/cdn/models/waf_config_patch.py b/services/cdn/src/stackit/cdn/models/waf_config_patch.py index b7212e79f..41a93c559 100644 --- a/services/cdn/src/stackit/cdn/models/waf_config_patch.py +++ b/services/cdn/src/stackit/cdn/models/waf_config_patch.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -17,21 +17,81 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing_extensions import Annotated, Self from stackit.cdn.models.waf_mode import WafMode +from stackit.cdn.models.waf_paranoia_level import WafParanoiaLevel from stackit.cdn.models.waf_type import WafType class WafConfigPatch(BaseModel): """ - WafConfigPatch + Modify the WAF Configuration ## WAF Rules You can modify the set of enabled, disabled and log-only Rules by modifying these 9 properties: - enabledRuleIds - disabledRuleIds - logOnlyRuleIds - enabledRuleGroupIds - disabledRuleGroupIds - logOnlyRuleGroupIds - enabledRuleCollectionIds - disabledRuleCollectionIds - logOnlyRuleCollectionIds Please inquire the `WafConfig` Description on how the effective configuration is determined. For patching, if an ID is already used in one of the properties, it will be removed (and effectively moved) to the new property. If patching multiple properties with the same ID (e.g. writing `@builtin/crs/response` to `logOnlyRuleCollectionIds` and `enabledRuleCollectionIds`), the request will be rejected with a 400. """ # noqa: E501 + allowed_http_methods: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field( + default=None, alias="allowedHttpMethods" + ) + allowed_http_versions: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field( + default=None, alias="allowedHttpVersions" + ) + allowed_request_content_types: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field( + default=None, alias="allowedRequestContentTypes" + ) + disabled_rule_collection_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Collections to mark as disabled ", alias="disabledRuleCollectionIds" + ) + disabled_rule_group_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Rule Groups to mark as disabled ", alias="disabledRuleGroupIds" + ) + disabled_rule_ids: Optional[List[StrictStr]] = Field( + default=None, + description="Ids of WAF Rules that are **explicitly** disabled for this distribution. ", + alias="disabledRuleIds", + ) + enabled_rule_collection_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Collections to mark as enabled ", alias="enabledRuleCollectionIds" + ) + enabled_rule_group_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Rule Groups to mark as enabled ", alias="enabledRuleGroupIds" + ) + enabled_rule_ids: Optional[List[StrictStr]] = Field( + default=None, + description="Ids of WAF Rules that are **explicitly** enabled for this distribution. ", + alias="enabledRuleIds", + ) + log_only_rule_collection_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Collections to mark as log Only. ", alias="logOnlyRuleCollectionIds" + ) + log_only_rule_group_ids: Optional[List[StrictStr]] = Field( + default=None, description="Ids of WAF Rule Groups to mark as log Only. ", alias="logOnlyRuleGroupIds" + ) + log_only_rule_ids: Optional[List[StrictStr]] = Field( + default=None, + description="Ids of WAF Rules that are **explicitly** marked as Log Only for this distribution. ", + alias="logOnlyRuleIds", + ) mode: Optional[WafMode] = None + paranoia_level: Optional[WafParanoiaLevel] = Field(default=None, alias="paranoiaLevel") type: Optional[WafType] = None - __properties: ClassVar[List[str]] = ["mode", "type"] + __properties: ClassVar[List[str]] = [ + "allowedHttpMethods", + "allowedHttpVersions", + "allowedRequestContentTypes", + "disabledRuleCollectionIds", + "disabledRuleGroupIds", + "disabledRuleIds", + "enabledRuleCollectionIds", + "enabledRuleGroupIds", + "enabledRuleIds", + "logOnlyRuleCollectionIds", + "logOnlyRuleGroupIds", + "logOnlyRuleIds", + "mode", + "paranoiaLevel", + "type", + ] model_config = ConfigDict( populate_by_name=True, @@ -81,5 +141,23 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"mode": obj.get("mode"), "type": obj.get("type")}) + _obj = cls.model_validate( + { + "allowedHttpMethods": obj.get("allowedHttpMethods"), + "allowedHttpVersions": obj.get("allowedHttpVersions"), + "allowedRequestContentTypes": obj.get("allowedRequestContentTypes"), + "disabledRuleCollectionIds": obj.get("disabledRuleCollectionIds"), + "disabledRuleGroupIds": obj.get("disabledRuleGroupIds"), + "disabledRuleIds": obj.get("disabledRuleIds"), + "enabledRuleCollectionIds": obj.get("enabledRuleCollectionIds"), + "enabledRuleGroupIds": obj.get("enabledRuleGroupIds"), + "enabledRuleIds": obj.get("enabledRuleIds"), + "logOnlyRuleCollectionIds": obj.get("logOnlyRuleCollectionIds"), + "logOnlyRuleGroupIds": obj.get("logOnlyRuleGroupIds"), + "logOnlyRuleIds": obj.get("logOnlyRuleIds"), + "mode": obj.get("mode"), + "paranoiaLevel": obj.get("paranoiaLevel"), + "type": obj.get("type"), + } + ) return _obj diff --git a/services/cdn/src/stackit/cdn/models/waf_mode.py b/services/cdn/src/stackit/cdn/models/waf_mode.py index 1cbaceb08..db41c4dc7 100644 --- a/services/cdn/src/stackit/cdn/models/waf_mode.py +++ b/services/cdn/src/stackit/cdn/models/waf_mode.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,7 +21,7 @@ class WafMode(str, Enum): """ - WafMode + - `ENABLED`: The WAF actively inspects and blocks malicious requests. - `DISABLED`: The WAF is completely off. No inspection occurs. - `LOG_ONLY`: The WAF inspects requests and logs matches but never blocks. """ """ diff --git a/services/cdn/src/stackit/cdn/models/waf_paranoia_level.py b/services/cdn/src/stackit/cdn/models/waf_paranoia_level.py new file mode 100644 index 000000000..6089be29d --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_paranoia_level.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + 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 +from enum import Enum + +from typing_extensions import Self + + +class WafParanoiaLevel(str, Enum): + """ + The paranoia level defines how aggressively the WAF should action on requests. It ranges from `L1` (least strict, lowest chance of false positives) to `L4` (most strict, highest chance of false positives). A higher paranoia level is more effective at catching attacks but can also block legitimate traffic. + """ + + """ + allowed enum values + """ + L1 = "L1" + L2 = "L2" + L3 = "L3" + L4 = "L4" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WafParanoiaLevel from a JSON string""" + return cls(json.loads(json_str)) diff --git a/services/cdn/src/stackit/cdn/models/waf_rule.py b/services/cdn/src/stackit/cdn/models/waf_rule.py index a99c4dc80..1ccbc9ef9 100644 --- a/services/cdn/src/stackit/cdn/models/waf_rule.py +++ b/services/cdn/src/stackit/cdn/models/waf_rule.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/waf_rule_action.py b/services/cdn/src/stackit/cdn/models/waf_rule_action.py new file mode 100644 index 000000000..29fe80715 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_rule_action.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + 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 +from enum import Enum + +from typing_extensions import Self + + +class WAFRuleAction(str, Enum): + """ + The action a WAF rule can take based on a request + """ + + """ + allowed enum values + """ + BLOCKED = "BLOCKED" + LOGGED = "LOGGED" + ALLOWED = "ALLOWED" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WAFRuleAction from a JSON string""" + return cls(json.loads(json_str)) diff --git a/services/cdn/src/stackit/cdn/models/waf_rule_collection.py b/services/cdn/src/stackit/cdn/models/waf_rule_collection.py index a94302797..e32f8d9f3 100644 --- a/services/cdn/src/stackit/cdn/models/waf_rule_collection.py +++ b/services/cdn/src/stackit/cdn/models/waf_rule_collection.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/waf_rule_group.py b/services/cdn/src/stackit/cdn/models/waf_rule_group.py index edbf35bc8..42ffdb077 100644 --- a/services/cdn/src/stackit/cdn/models/waf_rule_group.py +++ b/services/cdn/src/stackit/cdn/models/waf_rule_group.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/waf_status_rule_block.py b/services/cdn/src/stackit/cdn/models/waf_status_rule_block.py index 30a9327f1..73be1c518 100644 --- a/services/cdn/src/stackit/cdn/models/waf_status_rule_block.py +++ b/services/cdn/src/stackit/cdn/models/waf_status_rule_block.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -20,6 +20,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing_extensions import Self +from stackit.cdn.models.waf_status_rule_block_reason import WafStatusRuleBlockReason + class WafStatusRuleBlock(BaseModel): """ @@ -27,7 +29,8 @@ class WafStatusRuleBlock(BaseModel): """ # noqa: E501 id: StrictStr = Field(description="Specifies the Id of the Rule.") - __properties: ClassVar[List[str]] = ["id"] + reason: WafStatusRuleBlockReason + __properties: ClassVar[List[str]] = ["id", "reason"] model_config = ConfigDict( populate_by_name=True, @@ -66,6 +69,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of reason + if self.reason: + _dict["reason"] = self.reason.to_dict() return _dict @classmethod @@ -77,5 +83,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"id": obj.get("id")}) + _obj = cls.model_validate( + { + "id": obj.get("id"), + "reason": WafStatusRuleBlockReason.from_dict(obj["reason"]) if obj.get("reason") is not None else None, + } + ) return _obj diff --git a/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason.py b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason.py new file mode 100644 index 000000000..4e8826cc1 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + 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, Dict, Optional, Set, Union + +from pydantic import ( + BaseModel, + ConfigDict, + ValidationError, + field_validator, +) +from typing_extensions import Self + +from stackit.cdn.models.waf_status_rule_block_reason_directly_defined import ( + WafStatusRuleBlockReasonDirectlyDefined, +) +from stackit.cdn.models.waf_status_rule_block_reason_inherited_from_collection import ( + WafStatusRuleBlockReasonInheritedFromCollection, +) +from stackit.cdn.models.waf_status_rule_block_reason_inherited_from_group import ( + WafStatusRuleBlockReasonInheritedFromGroup, +) +from stackit.cdn.models.waf_status_rule_block_reason_invalid_waf_type import ( + WafStatusRuleBlockReasonInvalidWafType, +) +from stackit.cdn.models.waf_status_rule_block_reason_never_defined import ( + WafStatusRuleBlockReasonNeverDefined, +) + + +WAFSTATUSRULEBLOCKREASON_ONE_OF_SCHEMAS = [ + "WafStatusRuleBlockReasonDirectlyDefined", + "WafStatusRuleBlockReasonInheritedFromCollection", + "WafStatusRuleBlockReasonInheritedFromGroup", + "WafStatusRuleBlockReasonInvalidWafType", + "WafStatusRuleBlockReasonNeverDefined", +] + + +class WafStatusRuleBlockReason(BaseModel): + """ + Defines the Reason why a Rule is in the specified state (set to be enabled, disabled or logOnly). + """ + + # data type: WafStatusRuleBlockReasonNeverDefined + oneof_schema_1_validator: Optional[WafStatusRuleBlockReasonNeverDefined] = None + # data type: WafStatusRuleBlockReasonDirectlyDefined + oneof_schema_2_validator: Optional[WafStatusRuleBlockReasonDirectlyDefined] = None + # data type: WafStatusRuleBlockReasonInvalidWafType + oneof_schema_3_validator: Optional[WafStatusRuleBlockReasonInvalidWafType] = None + # data type: WafStatusRuleBlockReasonInheritedFromCollection + oneof_schema_4_validator: Optional[WafStatusRuleBlockReasonInheritedFromCollection] = None + # data type: WafStatusRuleBlockReasonInheritedFromGroup + oneof_schema_5_validator: Optional[WafStatusRuleBlockReasonInheritedFromGroup] = None + actual_instance: Optional[ + Union[ + WafStatusRuleBlockReasonDirectlyDefined, + WafStatusRuleBlockReasonInheritedFromCollection, + WafStatusRuleBlockReasonInheritedFromGroup, + WafStatusRuleBlockReasonInvalidWafType, + WafStatusRuleBlockReasonNeverDefined, + ] + ] = None + one_of_schemas: Set[str] = { + "WafStatusRuleBlockReasonDirectlyDefined", + "WafStatusRuleBlockReasonInheritedFromCollection", + "WafStatusRuleBlockReasonInheritedFromGroup", + "WafStatusRuleBlockReasonInvalidWafType", + "WafStatusRuleBlockReasonNeverDefined", + } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + discriminator_value_class_map: Dict[str, str] = {} + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator("actual_instance") + def actual_instance_must_validate_oneof(cls, v): + instance = WafStatusRuleBlockReason.model_construct() + error_messages = [] + match = 0 + # validate data type: WafStatusRuleBlockReasonNeverDefined + if not isinstance(v, WafStatusRuleBlockReasonNeverDefined): + error_messages.append(f"Error! Input type `{type(v)}` is not `WafStatusRuleBlockReasonNeverDefined`") + else: + match += 1 + # validate data type: WafStatusRuleBlockReasonDirectlyDefined + if not isinstance(v, WafStatusRuleBlockReasonDirectlyDefined): + error_messages.append(f"Error! Input type `{type(v)}` is not `WafStatusRuleBlockReasonDirectlyDefined`") + else: + match += 1 + # validate data type: WafStatusRuleBlockReasonInvalidWafType + if not isinstance(v, WafStatusRuleBlockReasonInvalidWafType): + error_messages.append(f"Error! Input type `{type(v)}` is not `WafStatusRuleBlockReasonInvalidWafType`") + else: + match += 1 + # validate data type: WafStatusRuleBlockReasonInheritedFromCollection + if not isinstance(v, WafStatusRuleBlockReasonInheritedFromCollection): + error_messages.append( + f"Error! Input type `{type(v)}` is not `WafStatusRuleBlockReasonInheritedFromCollection`" + ) + else: + match += 1 + # validate data type: WafStatusRuleBlockReasonInheritedFromGroup + if not isinstance(v, WafStatusRuleBlockReasonInheritedFromGroup): + error_messages.append(f"Error! Input type `{type(v)}` is not `WafStatusRuleBlockReasonInheritedFromGroup`") + else: + match += 1 + if match == 0: + # no match + raise ValueError( + "No match found when setting `actual_instance` in WafStatusRuleBlockReason with oneOf schemas: WafStatusRuleBlockReasonDirectlyDefined, WafStatusRuleBlockReasonInheritedFromCollection, WafStatusRuleBlockReasonInheritedFromGroup, WafStatusRuleBlockReasonInvalidWafType, WafStatusRuleBlockReasonNeverDefined. Details: " + + ", ".join(error_messages) + ) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into WafStatusRuleBlockReasonNeverDefined + try: + instance.actual_instance = WafStatusRuleBlockReasonNeverDefined.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WafStatusRuleBlockReasonDirectlyDefined + try: + instance.actual_instance = WafStatusRuleBlockReasonDirectlyDefined.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WafStatusRuleBlockReasonInvalidWafType + try: + instance.actual_instance = WafStatusRuleBlockReasonInvalidWafType.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WafStatusRuleBlockReasonInheritedFromCollection + try: + instance.actual_instance = WafStatusRuleBlockReasonInheritedFromCollection.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WafStatusRuleBlockReasonInheritedFromGroup + try: + instance.actual_instance = WafStatusRuleBlockReasonInheritedFromGroup.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError( + "Multiple matches found when deserializing the JSON string into WafStatusRuleBlockReason with oneOf schemas: WafStatusRuleBlockReasonDirectlyDefined, WafStatusRuleBlockReasonInheritedFromCollection, WafStatusRuleBlockReasonInheritedFromGroup, WafStatusRuleBlockReasonInvalidWafType, WafStatusRuleBlockReasonNeverDefined. Details: " + + ", ".join(error_messages) + ) + elif match == 0: + # no match + raise ValueError( + "No match found when deserializing the JSON string into WafStatusRuleBlockReason with oneOf schemas: WafStatusRuleBlockReasonDirectlyDefined, WafStatusRuleBlockReasonInheritedFromCollection, WafStatusRuleBlockReasonInheritedFromGroup, WafStatusRuleBlockReasonInvalidWafType, WafStatusRuleBlockReasonNeverDefined. Details: " + + ", ".join(error_messages) + ) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict( + self, + ) -> Optional[ + Union[ + Dict[str, Any], + WafStatusRuleBlockReasonDirectlyDefined, + WafStatusRuleBlockReasonInheritedFromCollection, + WafStatusRuleBlockReasonInheritedFromGroup, + WafStatusRuleBlockReasonInvalidWafType, + WafStatusRuleBlockReasonNeverDefined, + ] + ]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) diff --git a/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_directly_defined.py b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_directly_defined.py new file mode 100644 index 000000000..f73921e88 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_directly_defined.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + 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, StrictStr +from typing_extensions import Self + + +class WafStatusRuleBlockReasonDirectlyDefined(BaseModel): + """ + WafStatusRuleBlockReasonDirectlyDefined + """ # noqa: E501 + + type: StrictStr = Field(description="This is always `directlyDefined`") + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WafStatusRuleBlockReasonDirectlyDefined 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 WafStatusRuleBlockReasonDirectlyDefined from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"type": obj.get("type")}) + return _obj diff --git a/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_inherited_from_collection.py b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_inherited_from_collection.py new file mode 100644 index 000000000..dc60ae23b --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_inherited_from_collection.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + 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, StrictStr +from typing_extensions import Self + + +class WafStatusRuleBlockReasonInheritedFromCollection(BaseModel): + """ + WafStatusRuleBlockReasonInheritedFromCollection + """ # noqa: E501 + + collection_id: StrictStr = Field( + description="The Collection that caused this rule to be in its current state.", alias="collectionId" + ) + type: StrictStr = Field(description="This is always `inheritedFromCollection`") + __properties: ClassVar[List[str]] = ["collectionId", "type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WafStatusRuleBlockReasonInheritedFromCollection 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 WafStatusRuleBlockReasonInheritedFromCollection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"collectionId": obj.get("collectionId"), "type": obj.get("type")}) + return _obj diff --git a/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_inherited_from_group.py b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_inherited_from_group.py new file mode 100644 index 000000000..e5dff23c0 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_inherited_from_group.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + 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, StrictStr +from typing_extensions import Self + + +class WafStatusRuleBlockReasonInheritedFromGroup(BaseModel): + """ + WafStatusRuleBlockReasonInheritedFromGroup + """ # noqa: E501 + + group_id: StrictStr = Field( + description="The Group that caused this rule to be in its current state.", alias="groupId" + ) + type: StrictStr = Field(description="This is always `inheritedFromGroup`") + __properties: ClassVar[List[str]] = ["groupId", "type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WafStatusRuleBlockReasonInheritedFromGroup 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 WafStatusRuleBlockReasonInheritedFromGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"groupId": obj.get("groupId"), "type": obj.get("type")}) + return _obj diff --git a/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_invalid_waf_type.py b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_invalid_waf_type.py new file mode 100644 index 000000000..3bb39c4f2 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_invalid_waf_type.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + 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, StrictStr +from typing_extensions import Annotated, Self + +from stackit.cdn.models.waf_type import WafType + + +class WafStatusRuleBlockReasonInvalidWafType(BaseModel): + """ + WafStatusRuleBlockReasonInvalidWafType + """ # noqa: E501 + + allowed_waf_types: Annotated[List[WafType], Field(min_length=1)] = Field( + description="A list containing all WAF Types which can use this Rule. You must patch you WAF to one of these WAF Types to make use of this rule. Rules show up with this state if they would have been enabled or logOnly otherwise. ", + alias="allowedWafTypes", + ) + type: StrictStr = Field(description="This is always `invalidWafType`") + __properties: ClassVar[List[str]] = ["allowedWafTypes", "type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WafStatusRuleBlockReasonInvalidWafType 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 WafStatusRuleBlockReasonInvalidWafType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"allowedWafTypes": obj.get("allowedWafTypes"), "type": obj.get("type")}) + return _obj diff --git a/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_never_defined.py b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_never_defined.py new file mode 100644 index 000000000..2c350fd77 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_status_rule_block_reason_never_defined.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + 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, StrictStr +from typing_extensions import Self + + +class WafStatusRuleBlockReasonNeverDefined(BaseModel): + """ + This object only ever shows up in the disabled rules section. If rules are never defined (e.g. no collection, rule group, or the rule itself is ever mentioned), they are implicitly disabled + """ # noqa: E501 + + type: StrictStr = Field(description="This is always `neverDefined`") + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WafStatusRuleBlockReasonNeverDefined 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 WafStatusRuleBlockReasonNeverDefined from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"type": obj.get("type")}) + return _obj diff --git a/services/cdn/src/stackit/cdn/models/waf_type.py b/services/cdn/src/stackit/cdn/models/waf_type.py index 0008643a3..173908580 100644 --- a/services/cdn/src/stackit/cdn/models/waf_type.py +++ b/services/cdn/src/stackit/cdn/models/waf_type.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/services/cdn/src/stackit/cdn/models/waf_violation.py b/services/cdn/src/stackit/cdn/models/waf_violation.py new file mode 100644 index 000000000..a618301b0 --- /dev/null +++ b/services/cdn/src/stackit/cdn/models/waf_violation.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + 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, StrictStr +from typing_extensions import Self + +from stackit.cdn.models.waf_rule_action import WAFRuleAction + + +class WAFViolation(BaseModel): + """ + Information about a violated WAF rule in case the WAF is enabled and a rule was triggered (either in BLOCK or LOG_ONLY mode) + """ # noqa: E501 + + action: WAFRuleAction + asn: StrictStr = Field(description="ASN for the request") + message: StrictStr = Field(description="Rule specific message explaining the violation") + method: StrictStr = Field(description="HTTP Method of the request that triggered the violation") + request_headers: Dict[str, StrictStr] = Field(alias="requestHeaders") + rule_id: StrictStr = Field(description="ID of the WAF rule that was triggered", alias="ruleId") + __properties: ClassVar[List[str]] = ["action", "asn", "message", "method", "requestHeaders", "ruleId"] + + model_config = ConfigDict( + populate_by_name=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""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WAFViolation 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 WAFViolation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "action": obj.get("action"), + "asn": obj.get("asn"), + "message": obj.get("message"), + "method": obj.get("method"), + "requestHeaders": obj.get("requestHeaders"), + "ruleId": obj.get("ruleId"), + } + ) + return _obj diff --git a/services/cdn/src/stackit/cdn/rest.py b/services/cdn/src/stackit/cdn/rest.py index b67aac158..9ebfe5673 100644 --- a/services/cdn/src/stackit/cdn/rest.py +++ b/services/cdn/src/stackit/cdn/rest.py @@ -5,7 +5,7 @@ API used to create and manage your CDN distributions. - The version of the OpenAPI document: 1beta2.0.0 + The version of the OpenAPI document: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. From 491cce6c2f75335ec370bb84ee9a28be01904aa5 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Tue, 2 Dec 2025 17:45:26 +0100 Subject: [PATCH 2/2] add changelog entries --- CHANGELOG.md | 19 +++++++++++++++++++ services/cdn/CHANGELOG.md | 20 ++++++++++++++++++++ services/cdn/pyproject.toml | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7743950c0..e8070fd88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,23 @@ ## Release (2025-XX-XX) +- `cdn`: [v2.2.0](services/cdn/CHANGELOG.md#v220) + - **Feature:** Switch from `v1beta2` CDN API version to `v1` version. + - **Feature:** Add new function `GetLogsSearchFilters` + - **Feature:** Add `WafAction` method to `ApiGetLogsRequest` struct + - **Feature:** Add `Reason` field to `WafStatusRuleBlock` model struct + - **Feature:** Add fields to `WafConfig` and `WafConfigPatch` model struct: + - `AllowedHttpMethods` + - `AllowedHttpVersions` + - `AllowedRequestContentTypes` + - `DisabledRuleCollectionIds` + - `DisabledRuleGroupIds` + - `DisabledRuleIds` + - `EnabledRuleCollectionIds` + - `EnabledRuleGroupIds` + - `EnabledRuleIds` + - `LogOnlyRuleCollectionIds` + - `LogOnlyRuleGroupIds` + - `LogOnlyRuleIds` + - `ParanoiaLevel` - `intake`: [v0.4.0](services/intake/CHANGELOG.md#v040) - **Feature:** Add new enum class `PartitioningUpdateType` - **Feature:** Add attributes `partition_by` and `partitioning` to `IntakeCatalogPatch` model class diff --git a/services/cdn/CHANGELOG.md b/services/cdn/CHANGELOG.md index 5f792de0c..386c451c4 100644 --- a/services/cdn/CHANGELOG.md +++ b/services/cdn/CHANGELOG.md @@ -1,3 +1,23 @@ +## v2.2.0 +- **Feature:** Switch from `v1beta2` CDN API version to `v1` version. +- **Feature:** Add new function `GetLogsSearchFilters` +- **Feature:** Add `WafAction` method to `ApiGetLogsRequest` struct +- **Feature:** Add `Reason` field to `WafStatusRuleBlock` model struct +- **Feature:** Add fields to `WafConfig` and `WafConfigPatch` model struct: + - `AllowedHttpMethods` + - `AllowedHttpVersions` + - `AllowedRequestContentTypes` + - `DisabledRuleCollectionIds` + - `DisabledRuleGroupIds` + - `DisabledRuleIds` + - `EnabledRuleCollectionIds` + - `EnabledRuleGroupIds` + - `EnabledRuleIds` + - `LogOnlyRuleCollectionIds` + - `LogOnlyRuleGroupIds` + - `LogOnlyRuleIds` + - `ParanoiaLevel` + ## v2.1.0 - **Breaking change:** Remove unused model classes: `GetLogsSearchFiltersResponse`, `PatchLokiLogSink` diff --git a/services/cdn/pyproject.toml b/services/cdn/pyproject.toml index 3da714286..a5cbd139f 100644 --- a/services/cdn/pyproject.toml +++ b/services/cdn/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-cdn" [tool.poetry] name = "stackit-cdn" -version = "v2.1.0" +version = "v2.2.0" authors = [ "STACKIT Developer Tools ", ]