From b045adfa41900c3921971edc4f3e8636d3794d24 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 21 May 2026 12:34:11 +0000 Subject: [PATCH] Generate certificates --- services/certificates/oas_commit | 2 +- .../src/stackit/certificates/__init__.py | 8 + .../stackit/certificates/models/__init__.py | 3 + .../models/certificate_usage_item.py | 91 ++++++++ .../src/stackit/certificates/models/data.py | 220 ++++++++++++++++++ .../models/get_certificate_response.py | 17 +- .../src/stackit/certificates/models/usage.py | 103 ++++++++ 7 files changed, 441 insertions(+), 3 deletions(-) create mode 100644 services/certificates/src/stackit/certificates/models/certificate_usage_item.py create mode 100644 services/certificates/src/stackit/certificates/models/data.py create mode 100644 services/certificates/src/stackit/certificates/models/usage.py diff --git a/services/certificates/oas_commit b/services/certificates/oas_commit index b11b4bcce..6d213dd5d 100644 --- a/services/certificates/oas_commit +++ b/services/certificates/oas_commit @@ -1 +1 @@ -8ccf08fdae6320251259ca695f1e7180eeb21275 +63e66b38f15c58f5369e9ffc1ee9b87d907b31d4 diff --git a/services/certificates/src/stackit/certificates/__init__.py b/services/certificates/src/stackit/certificates/__init__.py index f34fecf6e..b057f1b2f 100644 --- a/services/certificates/src/stackit/certificates/__init__.py +++ b/services/certificates/src/stackit/certificates/__init__.py @@ -28,14 +28,17 @@ "ApiKeyError", "ApiAttributeError", "ApiException", + "CertificateUsageItem", "CertificatesQuota", "CreateCertificatePayload", + "Data", "GetCertificateResponse", "GetQuotaResponse", "GoogleProtobufAny", "ListCertificatesResponse", "Quotas", "Status", + "Usage", ] # import apis into sdk package @@ -53,12 +56,16 @@ from stackit.certificates.exceptions import OpenApiException as OpenApiException # import models into sdk package +from stackit.certificates.models.certificate_usage_item import ( + CertificateUsageItem as CertificateUsageItem, +) from stackit.certificates.models.certificates_quota import ( CertificatesQuota as CertificatesQuota, ) from stackit.certificates.models.create_certificate_payload import ( CreateCertificatePayload as CreateCertificatePayload, ) +from stackit.certificates.models.data import Data as Data from stackit.certificates.models.get_certificate_response import ( GetCertificateResponse as GetCertificateResponse, ) @@ -73,3 +80,4 @@ ) from stackit.certificates.models.quotas import Quotas as Quotas from stackit.certificates.models.status import Status as Status +from stackit.certificates.models.usage import Usage as Usage diff --git a/services/certificates/src/stackit/certificates/models/__init__.py b/services/certificates/src/stackit/certificates/models/__init__.py index 40626de69..7fd29c40d 100644 --- a/services/certificates/src/stackit/certificates/models/__init__.py +++ b/services/certificates/src/stackit/certificates/models/__init__.py @@ -13,10 +13,12 @@ """ # noqa: E501 # import models into model package +from stackit.certificates.models.certificate_usage_item import CertificateUsageItem from stackit.certificates.models.certificates_quota import CertificatesQuota from stackit.certificates.models.create_certificate_payload import ( CreateCertificatePayload, ) +from stackit.certificates.models.data import Data from stackit.certificates.models.get_certificate_response import GetCertificateResponse from stackit.certificates.models.get_quota_response import GetQuotaResponse from stackit.certificates.models.google_protobuf_any import GoogleProtobufAny @@ -25,3 +27,4 @@ ) from stackit.certificates.models.quotas import Quotas from stackit.certificates.models.status import Status +from stackit.certificates.models.usage import Usage diff --git a/services/certificates/src/stackit/certificates/models/certificate_usage_item.py b/services/certificates/src/stackit/certificates/models/certificate_usage_item.py new file mode 100644 index 000000000..8cae4bedd --- /dev/null +++ b/services/certificates/src/stackit/certificates/models/certificate_usage_item.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + STACKIT Application Load Balancer Certificates API + + This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + + The version of the OpenAPI document: 2.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 pydantic_core import to_jsonable_python +from typing_extensions import Self + + +class CertificateUsageItem(BaseModel): + """ + CertificateUsageItem + """ # noqa: E501 + + listener_names: Optional[List[StrictStr]] = Field( + default=None, + description="A list of listener names on this Load Balancer that are using the certificate.", + alias="listenerNames", + ) + load_balancer_name: Optional[StrictStr] = Field( + default=None, description="The display name of the Load Balancer.", alias="loadBalancerName" + ) + __properties: ClassVar[List[str]] = ["listenerNames", "loadBalancerName"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CertificateUsageItem 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 CertificateUsageItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"listenerNames": obj.get("listenerNames"), "loadBalancerName": obj.get("loadBalancerName")} + ) + return _obj diff --git a/services/certificates/src/stackit/certificates/models/data.py b/services/certificates/src/stackit/certificates/models/data.py new file mode 100644 index 000000000..b6b263e2a --- /dev/null +++ b/services/certificates/src/stackit/certificates/models/data.py @@ -0,0 +1,220 @@ +# coding: utf-8 + +""" + STACKIT Application Load Balancer Certificates API + + This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + + The version of the OpenAPI document: 2.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 +import re # noqa: F401 +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from pydantic_core import to_jsonable_python +from typing_extensions import Annotated, Self + + +class Data(BaseModel): + """ + Data + """ # noqa: E501 + + dns_names: Optional[StrictStr] = Field( + default=None, + description="Comma-separated list of all domains and IP addresses the certificate is valid for (Subject Alternative Names).", + alias="dnsNames", + ) + extended_key_usage: Optional[StrictStr] = Field( + default=None, + description="Comma-separated list of purposes the cert is valid for. 'Server Auth' is required for Load Balancer use.", + alias="extendedKeyUsage", + ) + fingerprint_sha1: Optional[Annotated[str, Field(strict=True)]] = Field( + default=None, + description="The legacy SHA1 thumbprint. Provided for cross-referencing with older systems and browsers.", + alias="fingerprintSha1", + ) + fingerprint_sha256: Optional[Annotated[str, Field(strict=True)]] = Field( + default=None, + description="The unique SHA256 hash of the raw certificate bytes. Use this as the primary unique identifier.", + alias="fingerprintSha256", + ) + is_ca: Optional[StrictBool] = Field( + default=None, + description="Indicates if the certificate is a Certificate Authority, meaning it can sign other certificates.", + alias="isCa", + ) + is_self_signed: Optional[StrictBool] = Field( + default=None, + description="Indicates if the certificate was signed by its own private key rather than a trusted third-party CA.", + alias="isSelfSigned", + ) + issuer_cn: Optional[StrictStr] = Field( + default=None, + description="The Common Name of the Certificate Authority (CA) that signed and issued the certificate.", + alias="issuerCn", + ) + key_strength: Optional[StrictStr] = Field( + default=None, + description="Human-readable summary of the public key's algorithm and bit-length or curve name.", + alias="keyStrength", + ) + not_after: Optional[StrictStr] = Field( + default=None, + description="The expiration timestamp. After this date, browsers will show security warnings (RFC3339 format).", + alias="notAfter", + ) + not_before: Optional[StrictStr] = Field( + default=None, + description="The timestamp indicating when the certificate starts being valid (RFC3339 format).", + alias="notBefore", + ) + organization: Optional[StrictStr] = Field( + default=None, description="Organization name associated with the certificate subject." + ) + public_key_algorithm: Optional[StrictStr] = Field( + default=None, + description="The cryptographic algorithm used to generate the public/private key pair.", + alias="publicKeyAlgorithm", + ) + serial_number: Optional[StrictStr] = Field( + default=None, + description="The unique serial number assigned by the CA, represented in uppercase hexadecimal format.", + alias="serialNumber", + ) + signature_algorithm: Optional[StrictStr] = Field( + default=None, description="The algorithm used by the CA to sign this certificate.", alias="signatureAlgorithm" + ) + subject_cn: Optional[StrictStr] = Field( + default=None, + description="The primary identity of the certificate. Fallback sequence: Common Name -> First DNS Name -> Full Subject String.", + alias="subjectCn", + ) + __properties: ClassVar[List[str]] = [ + "dnsNames", + "extendedKeyUsage", + "fingerprintSha1", + "fingerprintSha256", + "isCa", + "isSelfSigned", + "issuerCn", + "keyStrength", + "notAfter", + "notBefore", + "organization", + "publicKeyAlgorithm", + "serialNumber", + "signatureAlgorithm", + "subjectCn", + ] + + @field_validator("fingerprint_sha1") + def fingerprint_sha1_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-fA-F0-9]{40}$", value): + raise ValueError(r"must validate the regular expression /^[a-fA-F0-9]{40}$/") + return value + + @field_validator("fingerprint_sha256") + def fingerprint_sha256_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-fA-F0-9]{64}$", value): + raise ValueError(r"must validate the regular expression /^[a-fA-F0-9]{64}$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Data 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 Data from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "dnsNames": obj.get("dnsNames"), + "extendedKeyUsage": obj.get("extendedKeyUsage"), + "fingerprintSha1": obj.get("fingerprintSha1"), + "fingerprintSha256": obj.get("fingerprintSha256"), + "isCa": obj.get("isCa"), + "isSelfSigned": obj.get("isSelfSigned"), + "issuerCn": obj.get("issuerCn"), + "keyStrength": obj.get("keyStrength"), + "notAfter": obj.get("notAfter"), + "notBefore": obj.get("notBefore"), + "organization": obj.get("organization"), + "publicKeyAlgorithm": obj.get("publicKeyAlgorithm"), + "serialNumber": obj.get("serialNumber"), + "signatureAlgorithm": obj.get("signatureAlgorithm"), + "subjectCn": obj.get("subjectCn"), + } + ) + return _obj diff --git a/services/certificates/src/stackit/certificates/models/get_certificate_response.py b/services/certificates/src/stackit/certificates/models/get_certificate_response.py index 9ba9b4239..3b403d245 100644 --- a/services/certificates/src/stackit/certificates/models/get_certificate_response.py +++ b/services/certificates/src/stackit/certificates/models/get_certificate_response.py @@ -22,23 +22,28 @@ from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self +from stackit.certificates.models.data import Data +from stackit.certificates.models.usage import Usage + class GetCertificateResponse(BaseModel): """ GetCertificateResponse returns name, id and public key """ # noqa: E501 + data: Optional[Data] = None id: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The certificates resource id") labels: Optional[Dict[str, StrictStr]] = Field( default=None, description="Labels represent user-defined metadata as key-value pairs. Label count should not exceed 64 per Certificate. **Key Formatting Rules:** Length: 1-63 characters. Characters: Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. Keys starting with 'stackit-' are system-reserved; users MUST NOT manage them. **Value Formatting Rules:** Length: 0-63 characters (empty string explicitly allowed). Characters (for non-empty values): Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. ", ) - name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="TLS certificate name") + name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Certificate display name") public_key: Optional[StrictStr] = Field( default=None, description="The PEM encoded public key part", alias="publicKey" ) region: Optional[StrictStr] = Field(default=None, description="Region of the LoadBalancer") - __properties: ClassVar[List[str]] = ["id", "labels", "name", "publicKey", "region"] + usage: Optional[Usage] = None + __properties: ClassVar[List[str]] = ["data", "id", "labels", "name", "publicKey", "region", "usage"] @field_validator("id") def id_validate_regular_expression(cls, value): @@ -103,6 +108,12 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict["data"] = self.data.to_dict() + # override the default output from pydantic by calling `to_dict()` of usage + if self.usage: + _dict["usage"] = self.usage.to_dict() return _dict @classmethod @@ -116,11 +127,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { + "data": Data.from_dict(obj["data"]) if obj.get("data") is not None else None, "id": obj.get("id"), "labels": obj.get("labels"), "name": obj.get("name"), "publicKey": obj.get("publicKey"), "region": obj.get("region"), + "usage": Usage.from_dict(obj["usage"]) if obj.get("usage") is not None else None, } ) return _obj diff --git a/services/certificates/src/stackit/certificates/models/usage.py b/services/certificates/src/stackit/certificates/models/usage.py new file mode 100644 index 000000000..5ab2f1ed3 --- /dev/null +++ b/services/certificates/src/stackit/certificates/models/usage.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + STACKIT Application Load Balancer Certificates API + + This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + + The version of the OpenAPI document: 2.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, StrictInt +from pydantic_core import to_jsonable_python +from typing_extensions import Self + +from stackit.certificates.models.certificate_usage_item import CertificateUsageItem + + +class Usage(BaseModel): + """ + Usage + """ # noqa: E501 + + count: Optional[StrictInt] = Field(default=None, description="Number of Load Balancers using this certificate.") + items: Optional[List[CertificateUsageItem]] = Field( + default=None, description="List of Load Balancers with their associated listeners that use this certificate." + ) + __properties: ClassVar[List[str]] = ["count", "items"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Usage 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict["items"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Usage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "count": obj.get("count"), + "items": ( + [CertificateUsageItem.from_dict(_item) for _item in obj["items"]] + if obj.get("items") is not None + else None + ), + } + ) + return _obj