From 75d3609bc5e7132c93a12d60e5af684c7da7036b Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Wed, 16 Apr 2025 09:25:39 +0000 Subject: [PATCH 1/2] Generate stackitmarketplace --- .../stackit/stackitmarketplace/__init__.py | 37 +++--- .../stackitmarketplace/api/default_api.py | 69 +++++++---- .../stackitmarketplace/models/__init__.py | 37 +++--- .../models/approve_subscription_payload.py | 19 ++- .../models/become_vendor.py | 24 ++-- .../models/catalog_product_detail.py | 84 +++++++++----- .../models/catalog_product_details_vendor.py | 53 +++++++-- .../models/catalog_product_overview.py | 55 +++++---- .../models/catalog_product_overview_vendor.py | 29 ++++- .../models/catalog_product_pricing_option.py | 20 +--- .../catalog_product_support_resource.py | 19 ++- .../models/catalog_product_vendor_terms.py | 20 +++- .../models/contact_sales.py | 22 +--- .../current_subscription_state_response.py | 103 ----------------- .../models/delivery_method.py | 39 +++++++ ...ome_vendor.py => inquiry_become_vendor.py} | 12 +- ...tact_sales.py => inquiry_contact_sales.py} | 14 +-- .../models/inquiry_form_type.py | 39 +++++++ ...testing.py => inquiry_register_testing.py} | 12 +- ..._product.py => inquiry_suggest_product.py} | 16 +-- .../models/list_catalog_products_response.py | 12 +- .../list_vendor_subscriptions_response.py | 12 +- .../stackitmarketplace/models/price_type.py | 40 +++++++ .../models/pricing_option_unit.py | 36 ++++++ .../models/product_lifecycle_state.py | 37 ++++++ .../models/register_testing.py | 20 ++-- .../requested_subscription_state_response.py | 103 ----------------- .../models/subscription_cancel_response.py | 109 ------------------ .../models/subscription_lifecycle_state.py | 41 +++++++ .../models/subscription_product.py | 68 ++++++----- .../models/suggest_product.py | 20 ++-- .../models/vendor_subscription.py | 29 ++--- 32 files changed, 636 insertions(+), 614 deletions(-) delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/current_subscription_state_response.py create mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/delivery_method.py rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{become_vendor_become_vendor.py => inquiry_become_vendor.py} (87%) rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{contact_sales_contact_sales.py => inquiry_contact_sales.py} (89%) create mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_form_type.py rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{register_testing_register_testing.py => inquiry_register_testing.py} (89%) rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{suggest_product_suggest_product.py => inquiry_suggest_product.py} (88%) create mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/price_type.py create mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/pricing_option_unit.py create mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/product_lifecycle_state.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/requested_subscription_state_response.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_cancel_response.py create mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_lifecycle_state.py diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py index 52f7e17d..54614c3c 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py @@ -38,9 +38,6 @@ ApproveSubscriptionPayload, ) from stackit.stackitmarketplace.models.become_vendor import BecomeVendor -from stackit.stackitmarketplace.models.become_vendor_become_vendor import ( - BecomeVendorBecomeVendor, -) from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import ( CatalogPricingOptionHighlight, ) @@ -69,38 +66,38 @@ CatalogProductVendorTerms, ) from stackit.stackitmarketplace.models.contact_sales import ContactSales -from stackit.stackitmarketplace.models.contact_sales_contact_sales import ( - ContactSalesContactSales, -) -from stackit.stackitmarketplace.models.current_subscription_state_response import ( - CurrentSubscriptionStateResponse, -) +from stackit.stackitmarketplace.models.delivery_method import DeliveryMethod from stackit.stackitmarketplace.models.error_response import ErrorResponse from stackit.stackitmarketplace.models.inquiries_create_inquiry_payload import ( InquiriesCreateInquiryPayload, ) +from stackit.stackitmarketplace.models.inquiry_become_vendor import InquiryBecomeVendor +from stackit.stackitmarketplace.models.inquiry_contact_sales import InquiryContactSales +from stackit.stackitmarketplace.models.inquiry_form_type import InquiryFormType +from stackit.stackitmarketplace.models.inquiry_register_testing import ( + InquiryRegisterTesting, +) +from stackit.stackitmarketplace.models.inquiry_suggest_product import ( + InquirySuggestProduct, +) from stackit.stackitmarketplace.models.list_catalog_products_response import ( ListCatalogProductsResponse, ) from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import ( ListVendorSubscriptionsResponse, ) -from stackit.stackitmarketplace.models.register_testing import RegisterTesting -from stackit.stackitmarketplace.models.register_testing_register_testing import ( - RegisterTestingRegisterTesting, -) -from stackit.stackitmarketplace.models.requested_subscription_state_response import ( - RequestedSubscriptionStateResponse, +from stackit.stackitmarketplace.models.price_type import PriceType +from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit +from stackit.stackitmarketplace.models.product_lifecycle_state import ( + ProductLifecycleState, ) +from stackit.stackitmarketplace.models.register_testing import RegisterTesting from stackit.stackitmarketplace.models.resolve_customer_payload import ( ResolveCustomerPayload, ) -from stackit.stackitmarketplace.models.subscription_cancel_response import ( - SubscriptionCancelResponse, +from stackit.stackitmarketplace.models.subscription_lifecycle_state import ( + SubscriptionLifecycleState, ) from stackit.stackitmarketplace.models.subscription_product import SubscriptionProduct from stackit.stackitmarketplace.models.suggest_product import SuggestProduct -from stackit.stackitmarketplace.models.suggest_product_suggest_product import ( - SuggestProductSuggestProduct, -) from stackit.stackitmarketplace.models.vendor_subscription import VendorSubscription diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py index 0a7dce0c..49ae5561 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py @@ -64,8 +64,10 @@ def __init__(self, configuration: Configuration = None) -> None: @validate_call def approve_subscription( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], - subscription_id: Annotated[StrictStr, Field(description="The subscription ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], + subscription_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="The subscription ID.") + ], approve_subscription_payload: Optional[ApproveSubscriptionPayload] = None, _request_timeout: Union[ None, @@ -136,8 +138,10 @@ def approve_subscription( @validate_call def approve_subscription_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], - subscription_id: Annotated[StrictStr, Field(description="The subscription ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], + subscription_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="The subscription ID.") + ], approve_subscription_payload: Optional[ApproveSubscriptionPayload] = None, _request_timeout: Union[ None, @@ -208,8 +212,10 @@ def approve_subscription_with_http_info( @validate_call def approve_subscription_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], - subscription_id: Annotated[StrictStr, Field(description="The subscription ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], + subscription_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="The subscription ID.") + ], approve_subscription_payload: Optional[ApproveSubscriptionPayload] = None, _request_timeout: Union[ None, @@ -340,7 +346,7 @@ def _approve_subscription_serialize( @validate_call def get_catalog_product( self, - product_id: Annotated[StrictStr, Field(description="The product ID.")], + product_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The product ID.")], locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, _request_timeout: Union[ None, @@ -408,7 +414,7 @@ def get_catalog_product( @validate_call def get_catalog_product_with_http_info( self, - product_id: Annotated[StrictStr, Field(description="The product ID.")], + product_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The product ID.")], locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, _request_timeout: Union[ None, @@ -476,7 +482,7 @@ def get_catalog_product_with_http_info( @validate_call def get_catalog_product_without_preload_content( self, - product_id: Annotated[StrictStr, Field(description="The product ID.")], + product_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The product ID.")], locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, _request_timeout: Union[ None, @@ -595,8 +601,10 @@ def _get_catalog_product_serialize( @validate_call def get_vendor_subscription( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], - subscription_id: Annotated[StrictStr, Field(description="The subscription ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], + subscription_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="The subscription ID.") + ], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -663,8 +671,10 @@ def get_vendor_subscription( @validate_call def get_vendor_subscription_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], - subscription_id: Annotated[StrictStr, Field(description="The subscription ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], + subscription_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="The subscription ID.") + ], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -731,8 +741,10 @@ def get_vendor_subscription_with_http_info( @validate_call def get_vendor_subscription_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], - subscription_id: Annotated[StrictStr, Field(description="The subscription ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], + subscription_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="The subscription ID.") + ], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1471,7 +1483,7 @@ def _list_catalog_products_serialize( @validate_call def list_vendor_subscriptions( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], cursor: Annotated[ Optional[StrictStr], Field( @@ -1488,7 +1500,10 @@ def list_vendor_subscriptions( description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." ), ] = None, - product_id: Annotated[Optional[StrictStr], Field(description="The product ID.")] = None, + product_id: Annotated[ + Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]], + Field(description="The product ID."), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1560,7 +1575,7 @@ def list_vendor_subscriptions( @validate_call def list_vendor_subscriptions_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], cursor: Annotated[ Optional[StrictStr], Field( @@ -1577,7 +1592,10 @@ def list_vendor_subscriptions_with_http_info( description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." ), ] = None, - product_id: Annotated[Optional[StrictStr], Field(description="The product ID.")] = None, + product_id: Annotated[ + Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]], + Field(description="The product ID."), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1649,7 +1667,7 @@ def list_vendor_subscriptions_with_http_info( @validate_call def list_vendor_subscriptions_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], cursor: Annotated[ Optional[StrictStr], Field( @@ -1666,7 +1684,10 @@ def list_vendor_subscriptions_without_preload_content( description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." ), ] = None, - product_id: Annotated[Optional[StrictStr], Field(description="The product ID.")] = None, + product_id: Annotated[ + Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]], + Field(description="The product ID."), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1799,7 +1820,7 @@ def _list_vendor_subscriptions_serialize( @validate_call def resolve_customer( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], resolve_customer_payload: ResolveCustomerPayload, _request_timeout: Union[ None, @@ -1867,7 +1888,7 @@ def resolve_customer( @validate_call def resolve_customer_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], resolve_customer_payload: ResolveCustomerPayload, _request_timeout: Union[ None, @@ -1935,7 +1956,7 @@ def resolve_customer_with_http_info( @validate_call def resolve_customer_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The project ID.")], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], resolve_customer_payload: ResolveCustomerPayload, _request_timeout: Union[ None, diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py index aa388dbc..7f3ca99b 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py @@ -19,9 +19,6 @@ ApproveSubscriptionPayload, ) from stackit.stackitmarketplace.models.become_vendor import BecomeVendor -from stackit.stackitmarketplace.models.become_vendor_become_vendor import ( - BecomeVendorBecomeVendor, -) from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import ( CatalogPricingOptionHighlight, ) @@ -50,38 +47,38 @@ CatalogProductVendorTerms, ) from stackit.stackitmarketplace.models.contact_sales import ContactSales -from stackit.stackitmarketplace.models.contact_sales_contact_sales import ( - ContactSalesContactSales, -) -from stackit.stackitmarketplace.models.current_subscription_state_response import ( - CurrentSubscriptionStateResponse, -) +from stackit.stackitmarketplace.models.delivery_method import DeliveryMethod from stackit.stackitmarketplace.models.error_response import ErrorResponse from stackit.stackitmarketplace.models.inquiries_create_inquiry_payload import ( InquiriesCreateInquiryPayload, ) +from stackit.stackitmarketplace.models.inquiry_become_vendor import InquiryBecomeVendor +from stackit.stackitmarketplace.models.inquiry_contact_sales import InquiryContactSales +from stackit.stackitmarketplace.models.inquiry_form_type import InquiryFormType +from stackit.stackitmarketplace.models.inquiry_register_testing import ( + InquiryRegisterTesting, +) +from stackit.stackitmarketplace.models.inquiry_suggest_product import ( + InquirySuggestProduct, +) from stackit.stackitmarketplace.models.list_catalog_products_response import ( ListCatalogProductsResponse, ) from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import ( ListVendorSubscriptionsResponse, ) -from stackit.stackitmarketplace.models.register_testing import RegisterTesting -from stackit.stackitmarketplace.models.register_testing_register_testing import ( - RegisterTestingRegisterTesting, -) -from stackit.stackitmarketplace.models.requested_subscription_state_response import ( - RequestedSubscriptionStateResponse, +from stackit.stackitmarketplace.models.price_type import PriceType +from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit +from stackit.stackitmarketplace.models.product_lifecycle_state import ( + ProductLifecycleState, ) +from stackit.stackitmarketplace.models.register_testing import RegisterTesting from stackit.stackitmarketplace.models.resolve_customer_payload import ( ResolveCustomerPayload, ) -from stackit.stackitmarketplace.models.subscription_cancel_response import ( - SubscriptionCancelResponse, +from stackit.stackitmarketplace.models.subscription_lifecycle_state import ( + SubscriptionLifecycleState, ) from stackit.stackitmarketplace.models.subscription_product import SubscriptionProduct from stackit.stackitmarketplace.models.suggest_product import SuggestProduct -from stackit.stackitmarketplace.models.suggest_product_suggest_product import ( - SuggestProductSuggestProduct, -) from stackit.stackitmarketplace.models.vendor_subscription import VendorSubscription diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/approve_subscription_payload.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/approve_subscription_payload.py index 0951ec55..3a487162 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/approve_subscription_payload.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/approve_subscription_payload.py @@ -16,10 +16,11 @@ import json import pprint +import re from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing_extensions import Annotated, Self class ApproveSubscriptionPayload(BaseModel): @@ -27,13 +28,25 @@ class ApproveSubscriptionPayload(BaseModel): ApproveSubscriptionPayload """ - instance_target: Optional[StrictStr] = Field( + instance_target: Optional[Annotated[str, Field(strict=True, max_length=512)]] = Field( default=None, description="The target URL of the user instance, used to redirect the user to the instance after the subscription is active.", alias="instanceTarget", ) __properties: ClassVar[List[str]] = ["instanceTarget"] + @field_validator("instance_target") + def instance_target_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor.py index 282075dc..3f3025fe 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor.py @@ -18,30 +18,22 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Self -from stackit.stackitmarketplace.models.become_vendor_become_vendor import ( - BecomeVendorBecomeVendor, -) +from stackit.stackitmarketplace.models.inquiry_become_vendor import InquiryBecomeVendor +from stackit.stackitmarketplace.models.inquiry_form_type import InquiryFormType class BecomeVendor(BaseModel): """ - Become a vendor. + Become a Vendor. """ - become_vendor: BecomeVendorBecomeVendor = Field(alias="becomeVendor") - type: StrictStr = Field(description="The form type.") + become_vendor: InquiryBecomeVendor = Field(alias="becomeVendor") + type: InquiryFormType __properties: ClassVar[List[str]] = ["becomeVendor", "type"] - @field_validator("type") - def type_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["become_vendor"]): - raise ValueError("must be one of enum values ('become_vendor')") - return value - model_config = ConfigDict( populate_by_name=True, validate_assignment=True, @@ -96,9 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { "becomeVendor": ( - BecomeVendorBecomeVendor.from_dict(obj["becomeVendor"]) - if obj.get("becomeVendor") is not None - else None + InquiryBecomeVendor.from_dict(obj["becomeVendor"]) if obj.get("becomeVendor") is not None else None ), "type": obj.get("type"), } diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py index 84907759..c8b8f6c1 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py @@ -16,17 +16,19 @@ import json import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set +import re +from typing import Any, ClassVar, Dict, List, Optional, Set, Union from pydantic import ( BaseModel, ConfigDict, Field, StrictBool, + StrictBytes, StrictStr, field_validator, ) -from typing_extensions import Self +from typing_extensions import Annotated, Self from stackit.stackitmarketplace.models.catalog_product_details_vendor import ( CatalogProductDetailsVendor, @@ -43,6 +45,10 @@ from stackit.stackitmarketplace.models.catalog_product_vendor_terms import ( CatalogProductVendorTerms, ) +from stackit.stackitmarketplace.models.delivery_method import DeliveryMethod +from stackit.stackitmarketplace.models.product_lifecycle_state import ( + ProductLifecycleState, +) class CatalogProductDetail(BaseModel): @@ -53,29 +59,28 @@ class CatalogProductDetail(BaseModel): categories: Optional[List[StrictStr]] = Field( default=None, description="The list of categories associated to the product." ) - delivery_method: StrictStr = Field( - description="The product type. For reference: SAAS - Software as a Service, SAI - STACKIT Application Image", - alias="deliveryMethod", - ) + delivery_method: DeliveryMethod = Field(alias="deliveryMethod") description: StrictStr = Field(description="The product description.") - documentation_url: StrictStr = Field(description="The documentation URL.", alias="documentationUrl") + documentation_url: Annotated[str, Field(strict=True, max_length=512)] = Field( + description="The documentation URL.", alias="documentationUrl" + ) + email: Optional[StrictStr] = Field(default=None, description="A e-mail address.") highlights: List[CatalogProductHighlight] = Field(description="The list of highlights.") is_product_listing: StrictBool = Field( description="If true, the product is not fully integrated but only listed. Product listings may not have prices and support information.", alias="isProductListing", ) - lifecycle_state: StrictStr = Field(description="The lifecycle state of the product.", alias="lifecycleState") - logo: StrictStr = Field(description="The logo base64 encoded.") - name: StrictStr = Field(description="The product name.") + lifecycle_state: ProductLifecycleState = Field(alias="lifecycleState") + logo: Union[StrictBytes, StrictStr] = Field(description="The logo base64 encoded.") + name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The name of the product.") pricing_options: List[CatalogProductPricingOption] = Field( description="The list of pricing options.", alias="pricingOptions" ) - product_id: StrictStr = Field(description="The product ID.", alias="productId") + product_id: object = Field(alias="productId") summary: StrictStr = Field(description="The short summary of the product.") - support_email: Optional[StrictStr] = Field( - default=None, description="The e-mail address for support inquiries.", alias="supportEmail" + support_faq: Optional[Annotated[str, Field(strict=True, max_length=512)]] = Field( + default=None, description="The support FAQ URL.", alias="supportFaq" ) - support_faq: Optional[StrictStr] = Field(default=None, description="The support FAQ URL.", alias="supportFaq") support_phone: Optional[StrictStr] = Field( default=None, description="The phone number for support inquiries.", alias="supportPhone" ) @@ -86,12 +91,15 @@ class CatalogProductDetail(BaseModel): vendor_terms: Optional[List[CatalogProductVendorTerms]] = Field( default=None, description="The list of terms of use.", alias="vendorTerms" ) - video_url: StrictStr = Field(description="The video URL.", alias="videoUrl") + video_url: Annotated[str, Field(strict=True, max_length=512)] = Field( + description="The video URL.", alias="videoUrl" + ) __properties: ClassVar[List[str]] = [ "categories", "deliveryMethod", "description", "documentationUrl", + "email", "highlights", "isProductListing", "lifecycleState", @@ -100,7 +108,6 @@ class CatalogProductDetail(BaseModel): "pricingOptions", "productId", "summary", - "supportEmail", "supportFaq", "supportPhone", "supportResources", @@ -109,18 +116,41 @@ class CatalogProductDetail(BaseModel): "videoUrl", ] - @field_validator("delivery_method") - def delivery_method_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["SAAS", "KUBERNETES", "SAI", "PROFESSIONAL_SERVICE"]): - raise ValueError("must be one of enum values ('SAAS', 'KUBERNETES', 'SAI', 'PROFESSIONAL_SERVICE')") + @field_validator("documentation_url") + def documentation_url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) + return value + + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$", value): + raise ValueError(r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$/") + return value + + @field_validator("support_faq") + def support_faq_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) return value - @field_validator("lifecycle_state") - def lifecycle_state_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["PRODUCT_LIVE", "PRODUCT_PREVIEW"]): - raise ValueError("must be one of enum values ('PRODUCT_LIVE', 'PRODUCT_PREVIEW')") + @field_validator("video_url") + def video_url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) return value model_config = ConfigDict( @@ -208,6 +238,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "deliveryMethod": obj.get("deliveryMethod"), "description": obj.get("description"), "documentationUrl": obj.get("documentationUrl"), + "email": obj.get("email"), "highlights": ( [CatalogProductHighlight.from_dict(_item) for _item in obj["highlights"]] if obj.get("highlights") is not None @@ -224,7 +255,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: ), "productId": obj.get("productId"), "summary": obj.get("summary"), - "supportEmail": obj.get("supportEmail"), "supportFaq": obj.get("supportFaq"), "supportPhone": obj.get("supportPhone"), "supportResources": ( diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_details_vendor.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_details_vendor.py index 31445810..e39ac175 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_details_vendor.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_details_vendor.py @@ -16,10 +16,18 @@ import json import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set +import re +from typing import Any, ClassVar, Dict, List, Optional, Set, Union -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBytes, + StrictStr, + field_validator, +) +from typing_extensions import Annotated, Self class CatalogProductDetailsVendor(BaseModel): @@ -28,13 +36,42 @@ class CatalogProductDetailsVendor(BaseModel): """ description: StrictStr = Field(description="The vendor description.") - logo: StrictStr = Field(description="The vendor logo base64 encoded.") - name: StrictStr = Field(description="The vendor name.") - vendor_id: StrictStr = Field(description="The vendor ID.", alias="vendorId") - video_url: StrictStr = Field(description="The vendor video URL.", alias="videoUrl") - website_url: StrictStr = Field(description="The vendor website URL.", alias="websiteUrl") + logo: Union[StrictBytes, StrictStr] = Field(description="The logo base64 encoded.") + name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The product's vendor name.") + vendor_id: object = Field(alias="vendorId") + video_url: Annotated[str, Field(strict=True, max_length=512)] = Field( + description="The vendor video URL.", alias="videoUrl" + ) + website_url: Annotated[str, Field(strict=True, max_length=512)] = Field( + description="The vendor website URL.", alias="websiteUrl" + ) __properties: ClassVar[List[str]] = ["description", "logo", "name", "vendorId", "videoUrl", "websiteUrl"] + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$", value): + raise ValueError(r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$/") + return value + + @field_validator("video_url") + def video_url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) + return value + + @field_validator("website_url") + def website_url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview.py index 7bb0b144..7fd32535 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview.py @@ -16,14 +16,26 @@ 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 Self +import re +from typing import Any, ClassVar, Dict, List, Optional, Set, Union + +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBytes, + StrictStr, + field_validator, +) +from typing_extensions import Annotated, Self from stackit.stackitmarketplace.models.catalog_product_overview_vendor import ( CatalogProductOverviewVendor, ) +from stackit.stackitmarketplace.models.delivery_method import DeliveryMethod +from stackit.stackitmarketplace.models.product_lifecycle_state import ( + ProductLifecycleState, +) class CatalogProductOverview(BaseModel): @@ -31,15 +43,12 @@ class CatalogProductOverview(BaseModel): CatalogProductOverview """ - delivery_method: StrictStr = Field( - description="The product type. For reference: SAAS - Software as a Service, SAI - STACKIT Application Image", - alias="deliveryMethod", - ) - lifecycle_state: StrictStr = Field(description="The lifecycle state of the product.", alias="lifecycleState") - logo: Optional[StrictStr] = Field(default=None, description="The logo base64 encoded.") - name: StrictStr = Field(description="The product name.") - product_id: StrictStr = Field(description="The product ID.", alias="productId") - summary: StrictStr = Field(description="The short summary of the product.") + delivery_method: DeliveryMethod = Field(alias="deliveryMethod") + lifecycle_state: ProductLifecycleState = Field(alias="lifecycleState") + logo: Optional[Union[StrictBytes, StrictStr]] = Field(default=None, description="The logo base64 encoded.") + name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The name of the product.") + product_id: object = Field(alias="productId") + summary: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The short summary of the product.") vendor: CatalogProductOverviewVendor __properties: ClassVar[List[str]] = [ "deliveryMethod", @@ -51,18 +60,18 @@ class CatalogProductOverview(BaseModel): "vendor", ] - @field_validator("delivery_method") - def delivery_method_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["SAAS", "KUBERNETES", "SAI", "PROFESSIONAL_SERVICE"]): - raise ValueError("must be one of enum values ('SAAS', 'KUBERNETES', 'SAI', 'PROFESSIONAL_SERVICE')") + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$", value): + raise ValueError(r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$/") return value - @field_validator("lifecycle_state") - def lifecycle_state_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["PRODUCT_LIVE", "PRODUCT_PREVIEW"]): - raise ValueError("must be one of enum values ('PRODUCT_LIVE', 'PRODUCT_PREVIEW')") + @field_validator("summary") + def summary_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$", value): + raise ValueError(r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$/") return value model_config = ConfigDict( diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview_vendor.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview_vendor.py index 03107e29..0d5d2f10 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview_vendor.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview_vendor.py @@ -16,10 +16,11 @@ import json import pprint +import re from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing_extensions import Annotated, Self class CatalogProductOverviewVendor(BaseModel): @@ -27,11 +28,29 @@ class CatalogProductOverviewVendor(BaseModel): CatalogProductOverviewVendor """ - name: StrictStr = Field(description="The vendor name.") - vendor_id: StrictStr = Field(description="The vendor ID.", alias="vendorId") - website_url: StrictStr = Field(description="The vendor website URL.", alias="websiteUrl") + name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The product's vendor name.") + vendor_id: object = Field(alias="vendorId") + website_url: Annotated[str, Field(strict=True, max_length=512)] = Field( + description="Uniform Resource Locator.", alias="websiteUrl" + ) __properties: ClassVar[List[str]] = ["name", "vendorId", "websiteUrl"] + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$", value): + raise ValueError(r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$/") + return value + + @field_validator("website_url") + def website_url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_pricing_option.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_pricing_option.py index 95691a73..1cfb562c 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_pricing_option.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_pricing_option.py @@ -18,12 +18,14 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing_extensions import Self from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import ( CatalogPricingOptionHighlight, ) +from stackit.stackitmarketplace.models.price_type import PriceType +from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit class CatalogProductPricingOption(BaseModel): @@ -34,9 +36,7 @@ class CatalogProductPricingOption(BaseModel): description: StrictStr = Field(description="The pricing option description.") highlights: List[CatalogPricingOptionHighlight] = Field(description="The list of highlights.") name: StrictStr = Field(description="The pricing option name.") - price_type: Optional[StrictStr] = Field( - default=None, description="The price type / pricing model.", alias="priceType" - ) + price_type: Optional[PriceType] = Field(default=None, alias="priceType") pricing_plan: Optional[StrictStr] = Field( default=None, description="Additional price type information.", alias="pricingPlan" ) @@ -46,7 +46,7 @@ class CatalogProductPricingOption(BaseModel): sku_info_details: StrictStr = Field( description="More details about what this offering entails.", alias="skuInfoDetails" ) - unit: Optional[StrictStr] = Field(default=None, description="The interval to which the rate applies.") + unit: Optional[PricingOptionUnit] = None __properties: ClassVar[List[str]] = [ "description", "highlights", @@ -60,16 +60,6 @@ class CatalogProductPricingOption(BaseModel): "unit", ] - @field_validator("price_type") - def price_type_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set(["CONTRACT", "FREE", "FREE_TRIAL", "BYOL", "PAYG"]): - raise ValueError("must be one of enum values ('CONTRACT', 'FREE', 'FREE_TRIAL', 'BYOL', 'PAYG')") - return value - model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_support_resource.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_support_resource.py index b109e360..3760ce6a 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_support_resource.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_support_resource.py @@ -16,10 +16,11 @@ import json import pprint +import re from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing_extensions import Annotated, Self class CatalogProductSupportResource(BaseModel): @@ -27,7 +28,7 @@ class CatalogProductSupportResource(BaseModel): CatalogProductSupportResource """ - support_link: Optional[StrictStr] = Field( + support_link: Optional[Annotated[str, Field(strict=True, max_length=512)]] = Field( default=None, description="The support resource link.", alias="supportLink" ) support_link_title: Optional[StrictStr] = Field( @@ -35,6 +36,18 @@ class CatalogProductSupportResource(BaseModel): ) __properties: ClassVar[List[str]] = ["supportLink", "supportLinkTitle"] + @field_validator("support_link") + def support_link_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_vendor_terms.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_vendor_terms.py index cf68e2fb..67bb19c4 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_vendor_terms.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_vendor_terms.py @@ -16,10 +16,11 @@ import json import pprint +import re from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Self +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing_extensions import Annotated, Self class CatalogProductVendorTerms(BaseModel): @@ -27,11 +28,20 @@ class CatalogProductVendorTerms(BaseModel): CatalogProductVendorTerms """ - description: StrictStr = Field(description="The terms of use description.") - title: StrictStr = Field(description="The terms of use title.") - url: StrictStr = Field(description="The terms of use url.") + description: StrictStr = Field(description="The terms of service description.") + title: StrictStr = Field(description="The terms of service title.") + url: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The terms of use url.") __properties: ClassVar[List[str]] = ["description", "title", "url"] + @field_validator("url") + def url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales.py index 00812a5c..beb4f3d0 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales.py @@ -18,12 +18,11 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Self -from stackit.stackitmarketplace.models.contact_sales_contact_sales import ( - ContactSalesContactSales, -) +from stackit.stackitmarketplace.models.inquiry_contact_sales import InquiryContactSales +from stackit.stackitmarketplace.models.inquiry_form_type import InquiryFormType class ContactSales(BaseModel): @@ -31,17 +30,10 @@ class ContactSales(BaseModel): Contact sales. """ - contact_sales: ContactSalesContactSales = Field(alias="contactSales") - type: StrictStr = Field(description="The form type.") + contact_sales: InquiryContactSales = Field(alias="contactSales") + type: InquiryFormType __properties: ClassVar[List[str]] = ["contactSales", "type"] - @field_validator("type") - def type_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["contact_sales"]): - raise ValueError("must be one of enum values ('contact_sales')") - return value - model_config = ConfigDict( populate_by_name=True, validate_assignment=True, @@ -96,9 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { "contactSales": ( - ContactSalesContactSales.from_dict(obj["contactSales"]) - if obj.get("contactSales") is not None - else None + InquiryContactSales.from_dict(obj["contactSales"]) if obj.get("contactSales") is not None else None ), "type": obj.get("type"), } diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/current_subscription_state_response.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/current_subscription_state_response.py deleted file mode 100644 index e4fd4d88..00000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/current_subscription_state_response.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - STACKIT Marketplace API - - API to manage STACKIT Marketplace. - - The version of the OpenAPI document: 1 - Contact: marketplace@stackit.cloud - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 docstring might be too long - -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 Self - - -class CurrentSubscriptionStateResponse(BaseModel): - """ - CurrentSubscriptionStateResponse - """ - - lifecycle_state: StrictStr = Field(description="Lifecycle state of the subscription.", alias="lifecycleState") - subscription_id: StrictStr = Field(description="The subscription ID.", alias="subscriptionId") - __properties: ClassVar[List[str]] = ["lifecycleState", "subscriptionId"] - - @field_validator("lifecycle_state") - def lifecycle_state_validate_enum(cls, value): - """Validates the enum""" - if value not in set( - [ - "SUBSCRIPTION_PENDING", - "SUBSCRIPTION_ACTIVE", - "SUBSCRIPTION_INACTIVE", - "SUBSCRIPTION_CANCELLING", - "SUBSCRIPTION_CANCELLED", - "SUBSCRIPTION_REJECTED", - ] - ): - raise ValueError( - "must be one of enum values ('SUBSCRIPTION_PENDING', 'SUBSCRIPTION_ACTIVE', 'SUBSCRIPTION_INACTIVE', 'SUBSCRIPTION_CANCELLING', 'SUBSCRIPTION_CANCELLED', 'SUBSCRIPTION_REJECTED')" - ) - 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 CurrentSubscriptionStateResponse 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 CurrentSubscriptionStateResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"lifecycleState": obj.get("lifecycleState"), "subscriptionId": obj.get("subscriptionId")} - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/delivery_method.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/delivery_method.py new file mode 100644 index 00000000..4a0ac914 --- /dev/null +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/delivery_method.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + STACKIT Marketplace API + + API to manage STACKIT Marketplace. + + The version of the OpenAPI document: 1 + Contact: marketplace@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +from enum import Enum + +from typing_extensions import Self + + +class DeliveryMethod(str, Enum): + """ + The product delivery method/type. For reference: SAAS - Software as a Service, SAI - STACKIT Application Image + """ + + """ + allowed enum values + """ + SAAS = "SAAS" + KUBERNETES = "KUBERNETES" + SAI = "SAI" + PROFESSIONAL_SERVICE = "PROFESSIONAL_SERVICE" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DeliveryMethod from a JSON string""" + return cls(json.loads(json_str)) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor_become_vendor.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_become_vendor.py similarity index 87% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor_become_vendor.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_become_vendor.py index c6ccaf3c..d5193bbc 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor_become_vendor.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_become_vendor.py @@ -23,13 +23,13 @@ from typing_extensions import Annotated, Self -class BecomeVendorBecomeVendor(BaseModel): +class InquiryBecomeVendor(BaseModel): """ - BecomeVendorBecomeVendor + Become a vendor. """ - contact_email: StrictStr = Field(description="The contact e-mail address.", alias="contactEmail") - message: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The message content.") + contact_email: StrictStr = Field(description="A e-mail address.", alias="contactEmail") + message: Annotated[str, Field(strict=True, max_length=512)] = Field(description="A custom message.") __properties: ClassVar[List[str]] = ["contactEmail", "message"] @field_validator("message") @@ -56,7 +56,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of BecomeVendorBecomeVendor from a JSON string""" + """Create an instance of InquiryBecomeVendor from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of BecomeVendorBecomeVendor from a dict""" + """Create an instance of InquiryBecomeVendor from a dict""" if obj is None: return None diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales_contact_sales.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_contact_sales.py similarity index 89% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales_contact_sales.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_contact_sales.py index f32e1368..92b0076e 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales_contact_sales.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_contact_sales.py @@ -23,20 +23,20 @@ from typing_extensions import Annotated, Self -class ContactSalesContactSales(BaseModel): +class InquiryContactSales(BaseModel): """ - ContactSalesContactSales + Contact sales. """ company_name: Annotated[str, Field(strict=True, max_length=512)] = Field( description="The company name.", alias="companyName" ) - contact_email: StrictStr = Field(description="The contact e-mail address.", alias="contactEmail") + contact_email: StrictStr = Field(description="A e-mail address.", alias="contactEmail") full_name: Annotated[str, Field(strict=True, max_length=512)] = Field( description="The full name of the contact person.", alias="fullName" ) - message: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The message content.") - product_id: StrictStr = Field(description="The product ID.", alias="productId") + message: Annotated[str, Field(strict=True, max_length=512)] = Field(description="A custom message.") + product_id: object = Field(alias="productId") __properties: ClassVar[List[str]] = ["companyName", "contactEmail", "fullName", "message", "productId"] @field_validator("company_name") @@ -77,7 +77,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ContactSalesContactSales from a JSON string""" + """Create an instance of InquiryContactSales from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -101,7 +101,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ContactSalesContactSales from a dict""" + """Create an instance of InquiryContactSales from a dict""" if obj is None: return None diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_form_type.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_form_type.py new file mode 100644 index 00000000..b87dfe6f --- /dev/null +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_form_type.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + STACKIT Marketplace API + + API to manage STACKIT Marketplace. + + The version of the OpenAPI document: 1 + Contact: marketplace@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +from enum import Enum + +from typing_extensions import Self + + +class InquiryFormType(str, Enum): + """ + The form type. + """ + + """ + allowed enum values + """ + SUGGESTPRODUCT = "suggestProduct" + CONTACTSALES = "contactSales" + BECOMEVENDOR = "becomeVendor" + REGISTERTESTING = "registerTesting" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of InquiryFormType from a JSON string""" + return cls(json.loads(json_str)) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing_register_testing.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_register_testing.py similarity index 89% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing_register_testing.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_register_testing.py index 2c71d3d9..5ffdc85f 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing_register_testing.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_register_testing.py @@ -23,16 +23,16 @@ from typing_extensions import Annotated, Self -class RegisterTestingRegisterTesting(BaseModel): +class InquiryRegisterTesting(BaseModel): """ - RegisterTestingRegisterTesting + Register for testing. """ - contact_email: StrictStr = Field(description="The contact e-mail address.", alias="contactEmail") + contact_email: StrictStr = Field(description="A e-mail address.", alias="contactEmail") full_name: Annotated[str, Field(strict=True, max_length=512)] = Field( description="The full name of the contact person.", alias="fullName" ) - message: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The message content.") + message: Annotated[str, Field(strict=True, max_length=512)] = Field(description="A custom message.") __properties: ClassVar[List[str]] = ["contactEmail", "fullName", "message"] @field_validator("full_name") @@ -66,7 +66,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of RegisterTestingRegisterTesting from a JSON string""" + """Create an instance of InquiryRegisterTesting from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -90,7 +90,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of RegisterTestingRegisterTesting from a dict""" + """Create an instance of InquiryRegisterTesting from a dict""" if obj is None: return None diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product_suggest_product.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_suggest_product.py similarity index 88% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product_suggest_product.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_suggest_product.py index 8d325a1f..c979e6d2 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product_suggest_product.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_suggest_product.py @@ -23,16 +23,16 @@ from typing_extensions import Annotated, Self -class SuggestProductSuggestProduct(BaseModel): +class InquirySuggestProduct(BaseModel): """ - SuggestProductSuggestProduct + Suggest a product. """ company_name: Annotated[str, Field(strict=True, max_length=512)] = Field( description="The suggested product's company name.", alias="companyName" ) message: Optional[Annotated[str, Field(strict=True, max_length=512)]] = Field( - default=None, description="An additional message." + default=None, description="A custom message." ) name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The suggested product name.") url: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The suggested product's website URL.") @@ -65,8 +65,10 @@ def name_validate_regular_expression(cls, value): @field_validator("url") def url_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$", value): - raise ValueError(r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$/") + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) return value model_config = ConfigDict( @@ -86,7 +88,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of SuggestProductSuggestProduct from a JSON string""" + """Create an instance of InquirySuggestProduct from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -110,7 +112,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of SuggestProductSuggestProduct from a dict""" + """Create an instance of InquirySuggestProduct from a dict""" if obj is None: return None diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_catalog_products_response.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_catalog_products_response.py index f121edc2..33aeb97f 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_catalog_products_response.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_catalog_products_response.py @@ -16,7 +16,7 @@ import json import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set +from typing import Any, ClassVar, Dict, List, Optional, Set, Union from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing_extensions import Annotated, Self @@ -32,12 +32,12 @@ class ListCatalogProductsResponse(BaseModel): """ cursor: StrictStr = Field( - description="A pagination cursor that represents a position in the dataset. Use it in subsequent requests to continue retrieving data from this position. If `null`, there are no more results to retrieve." + description="A pagination cursor that represents a position in the dataset. If given, results will be returned from the item after the cursor. If not given, results will be returned from the beginning." ) items: List[CatalogProductOverview] - limit: Annotated[int, Field(le=100, strict=True, ge=0)] = Field( - description="The maximum number of items to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used." - ) + limit: Union[ + Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] + ] = Field(description="Limit for returned Objects.") __properties: ClassVar[List[str]] = ["cursor", "items", "limit"] model_config = ConfigDict( @@ -103,7 +103,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if obj.get("items") is not None else None ), - "limit": obj.get("limit") if obj.get("limit") is not None else 50, + "limit": obj.get("limit"), } ) return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py index c65642e3..cfbaada8 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py @@ -16,7 +16,7 @@ import json import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set +from typing import Any, ClassVar, Dict, List, Optional, Set, Union from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing_extensions import Annotated, Self @@ -30,12 +30,12 @@ class ListVendorSubscriptionsResponse(BaseModel): """ cursor: StrictStr = Field( - description="A pagination cursor that represents a position in the dataset. Use it in subsequent requests to continue retrieving data from this position. If `null`, there are no more results to retrieve." + description="A pagination cursor that represents a position in the dataset. If given, results will be returned from the item after the cursor. If not given, results will be returned from the beginning." ) items: List[VendorSubscription] = Field(description="List of subscriptions.") - limit: Annotated[int, Field(le=100, strict=True, ge=0)] = Field( - description="Number of subscriptions returned for a single request." - ) + limit: Union[ + Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] + ] = Field(description="Limit for returned Objects.") __properties: ClassVar[List[str]] = ["cursor", "items", "limit"] model_config = ConfigDict( @@ -101,7 +101,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if obj.get("items") is not None else None ), - "limit": obj.get("limit") if obj.get("limit") is not None else 50, + "limit": obj.get("limit"), } ) return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/price_type.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/price_type.py new file mode 100644 index 00000000..cdda7080 --- /dev/null +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/price_type.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + STACKIT Marketplace API + + API to manage STACKIT Marketplace. + + The version of the OpenAPI document: 1 + Contact: marketplace@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +from enum import Enum + +from typing_extensions import Self + + +class PriceType(str, Enum): + """ + The product's price type. + """ + + """ + allowed enum values + """ + CONTRACT = "CONTRACT" + FREE = "FREE" + FREE_TRIAL = "FREE_TRIAL" + BYOL = "BYOL" + PAYG = "PAYG" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PriceType from a JSON string""" + return cls(json.loads(json_str)) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/pricing_option_unit.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/pricing_option_unit.py new file mode 100644 index 00000000..e707e333 --- /dev/null +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/pricing_option_unit.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + STACKIT Marketplace API + + API to manage STACKIT Marketplace. + + The version of the OpenAPI document: 1 + Contact: marketplace@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +from enum import Enum + +from typing_extensions import Self + + +class PricingOptionUnit(str, Enum): + """ + The interval to which the rate applies. + """ + + """ + allowed enum values + """ + MONTH = "month" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PricingOptionUnit from a JSON string""" + return cls(json.loads(json_str)) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/product_lifecycle_state.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/product_lifecycle_state.py new file mode 100644 index 00000000..5e829c29 --- /dev/null +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/product_lifecycle_state.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + STACKIT Marketplace API + + API to manage STACKIT Marketplace. + + The version of the OpenAPI document: 1 + Contact: marketplace@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +from enum import Enum + +from typing_extensions import Self + + +class ProductLifecycleState(str, Enum): + """ + The lifecycle state of the product. + """ + + """ + allowed enum values + """ + PRODUCT_LIVE = "PRODUCT_LIVE" + PRODUCT_PREVIEW = "PRODUCT_PREVIEW" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ProductLifecycleState from a JSON string""" + return cls(json.loads(json_str)) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing.py index 70672011..63061206 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing.py @@ -18,11 +18,12 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Self -from stackit.stackitmarketplace.models.register_testing_register_testing import ( - RegisterTestingRegisterTesting, +from stackit.stackitmarketplace.models.inquiry_form_type import InquiryFormType +from stackit.stackitmarketplace.models.inquiry_register_testing import ( + InquiryRegisterTesting, ) @@ -31,17 +32,10 @@ class RegisterTesting(BaseModel): Register for testing. """ - register_testing: RegisterTestingRegisterTesting = Field(alias="registerTesting") - type: StrictStr = Field(description="The form type.") + register_testing: InquiryRegisterTesting = Field(alias="registerTesting") + type: InquiryFormType __properties: ClassVar[List[str]] = ["registerTesting", "type"] - @field_validator("type") - def type_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["register_testing"]): - raise ValueError("must be one of enum values ('register_testing')") - return value - model_config = ConfigDict( populate_by_name=True, validate_assignment=True, @@ -96,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { "registerTesting": ( - RegisterTestingRegisterTesting.from_dict(obj["registerTesting"]) + InquiryRegisterTesting.from_dict(obj["registerTesting"]) if obj.get("registerTesting") is not None else None ), diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/requested_subscription_state_response.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/requested_subscription_state_response.py deleted file mode 100644 index ab9b9312..00000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/requested_subscription_state_response.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - STACKIT Marketplace API - - API to manage STACKIT Marketplace. - - The version of the OpenAPI document: 1 - Contact: marketplace@stackit.cloud - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 docstring might be too long - -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 Self - - -class RequestedSubscriptionStateResponse(BaseModel): - """ - RequestedSubscriptionStateResponse - """ - - lifecycle_state: StrictStr = Field(description="Lifecycle state of the subscription.", alias="lifecycleState") - subscription_id: StrictStr = Field(description="The subscription ID.", alias="subscriptionId") - __properties: ClassVar[List[str]] = ["lifecycleState", "subscriptionId"] - - @field_validator("lifecycle_state") - def lifecycle_state_validate_enum(cls, value): - """Validates the enum""" - if value not in set( - [ - "SUBSCRIPTION_PENDING", - "SUBSCRIPTION_ACTIVE", - "SUBSCRIPTION_INACTIVE", - "SUBSCRIPTION_CANCELLING", - "SUBSCRIPTION_CANCELLED", - "SUBSCRIPTION_REJECTED", - ] - ): - raise ValueError( - "must be one of enum values ('SUBSCRIPTION_PENDING', 'SUBSCRIPTION_ACTIVE', 'SUBSCRIPTION_INACTIVE', 'SUBSCRIPTION_CANCELLING', 'SUBSCRIPTION_CANCELLED', 'SUBSCRIPTION_REJECTED')" - ) - 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 RequestedSubscriptionStateResponse 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 RequestedSubscriptionStateResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"lifecycleState": obj.get("lifecycleState"), "subscriptionId": obj.get("subscriptionId")} - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_cancel_response.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_cancel_response.py deleted file mode 100644 index aaf1e9e5..00000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_cancel_response.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - STACKIT Marketplace API - - API to manage STACKIT Marketplace. - - The version of the OpenAPI document: 1 - Contact: marketplace@stackit.cloud - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 docstring might be too long - -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.stackitmarketplace.models.current_subscription_state_response import ( - CurrentSubscriptionStateResponse, -) -from stackit.stackitmarketplace.models.requested_subscription_state_response import ( - RequestedSubscriptionStateResponse, -) - - -class SubscriptionCancelResponse(BaseModel): - """ - SubscriptionCancelResponse - """ - - current_subscription: CurrentSubscriptionStateResponse = Field(alias="currentSubscription") - requested_subscription: RequestedSubscriptionStateResponse = Field(alias="requestedSubscription") - __properties: ClassVar[List[str]] = ["currentSubscription", "requestedSubscription"] - - 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 SubscriptionCancelResponse 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 current_subscription - if self.current_subscription: - _dict["currentSubscription"] = self.current_subscription.to_dict() - # override the default output from pydantic by calling `to_dict()` of requested_subscription - if self.requested_subscription: - _dict["requestedSubscription"] = self.requested_subscription.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of SubscriptionCancelResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "currentSubscription": ( - CurrentSubscriptionStateResponse.from_dict(obj["currentSubscription"]) - if obj.get("currentSubscription") is not None - else None - ), - "requestedSubscription": ( - RequestedSubscriptionStateResponse.from_dict(obj["requestedSubscription"]) - if obj.get("requestedSubscription") is not None - else None - ), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_lifecycle_state.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_lifecycle_state.py new file mode 100644 index 00000000..e5b835af --- /dev/null +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_lifecycle_state.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + STACKIT Marketplace API + + API to manage STACKIT Marketplace. + + The version of the OpenAPI document: 1 + Contact: marketplace@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +from enum import Enum + +from typing_extensions import Self + + +class SubscriptionLifecycleState(str, Enum): + """ + Lifecycle state of the subscription. + """ + + """ + allowed enum values + """ + SUBSCRIPTION_PENDING = "SUBSCRIPTION_PENDING" + SUBSCRIPTION_ACTIVE = "SUBSCRIPTION_ACTIVE" + SUBSCRIPTION_INACTIVE = "SUBSCRIPTION_INACTIVE" + SUBSCRIPTION_CANCELLING = "SUBSCRIPTION_CANCELLING" + SUBSCRIPTION_CANCELLED = "SUBSCRIPTION_CANCELLED" + SUBSCRIPTION_REJECTED = "SUBSCRIPTION_REJECTED" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SubscriptionLifecycleState from a JSON string""" + return cls(json.loads(json_str)) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_product.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_product.py index 8ac787f7..d571bdb1 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_product.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_product.py @@ -22,23 +22,35 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing_extensions import Annotated, Self +from stackit.stackitmarketplace.models.delivery_method import DeliveryMethod +from stackit.stackitmarketplace.models.price_type import PriceType +from stackit.stackitmarketplace.models.product_lifecycle_state import ( + ProductLifecycleState, +) + class SubscriptionProduct(BaseModel): """ - SubscriptionProduct + The product of a subscription """ - delivery_method: StrictStr = Field(description="The product's delivery method.", alias="deliveryMethod") - lifecycle_state: StrictStr = Field(description="The lifecycle state of the product.", alias="lifecycleState") - price_type: StrictStr = Field(description="The product's price type.", alias="priceType") - pricing_plan: StrictStr = Field(description="The product's pricing plan.", alias="pricingPlan") - product_id: StrictStr = Field(description="The product ID.", alias="productId") - product_name: StrictStr = Field(description="The name of the product.", alias="productName") - vendor_name: StrictStr = Field(description="The product's vendor name.", alias="vendorName") + delivery_method: DeliveryMethod = Field(alias="deliveryMethod") + lifecycle_state: ProductLifecycleState = Field(alias="lifecycleState") + price_type: PriceType = Field(alias="priceType") + pricing_plan: StrictStr = Field(description="Additional price type information.", alias="pricingPlan") + product_id: object = Field(alias="productId") + product_name: Annotated[str, Field(strict=True, max_length=512)] = Field( + description="The name of the product.", alias="productName" + ) + vendor_name: Annotated[str, Field(strict=True, max_length=512)] = Field( + description="The product's vendor name.", alias="vendorName" + ) vendor_product_id: Optional[Annotated[str, Field(strict=True)]] = Field( - default=None, description="The product ID provided by the Vendor.", alias="vendorProductId" + default=None, description="The vendor provided product ID.", alias="vendorProductId" + ) + vendor_website_url: Annotated[str, Field(strict=True, max_length=512)] = Field( + description="The vendor's website.", alias="vendorWebsiteUrl" ) - vendor_website_url: StrictStr = Field(description="The vendor's website.", alias="vendorWebsiteUrl") __properties: ClassVar[List[str]] = [ "deliveryMethod", "lifecycleState", @@ -51,25 +63,18 @@ class SubscriptionProduct(BaseModel): "vendorWebsiteUrl", ] - @field_validator("delivery_method") - def delivery_method_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["SAAS"]): - raise ValueError("must be one of enum values ('SAAS')") - return value - - @field_validator("lifecycle_state") - def lifecycle_state_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["PRODUCT_LIVE", "PRODUCT_PREVIEW"]): - raise ValueError("must be one of enum values ('PRODUCT_LIVE', 'PRODUCT_PREVIEW')") + @field_validator("product_name") + def product_name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$", value): + raise ValueError(r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$/") return value - @field_validator("price_type") - def price_type_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["CONTRACT", "FREE", "FREE_TRIAL", "BYOL", "PAYG"]): - raise ValueError("must be one of enum values ('CONTRACT', 'FREE', 'FREE_TRIAL', 'BYOL', 'PAYG')") + @field_validator("vendor_name") + def vendor_name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$", value): + raise ValueError(r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9,.!?()@\/:=\n\t -]+$/") return value @field_validator("vendor_product_id") @@ -82,6 +87,15 @@ def vendor_product_id_validate_regular_expression(cls, value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9](?:[a-zA-Z0-9_+&-]){0,39}$/") return value + @field_validator("vendor_website_url") + def vendor_website_url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", value): + raise ValueError( + r"must validate the regular expression /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/" + ) + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product.py index ce7902fa..8d052cf9 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product.py @@ -18,11 +18,12 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Self -from stackit.stackitmarketplace.models.suggest_product_suggest_product import ( - SuggestProductSuggestProduct, +from stackit.stackitmarketplace.models.inquiry_form_type import InquiryFormType +from stackit.stackitmarketplace.models.inquiry_suggest_product import ( + InquirySuggestProduct, ) @@ -31,17 +32,10 @@ class SuggestProduct(BaseModel): Suggest a product. """ - suggest_product: SuggestProductSuggestProduct = Field(alias="suggestProduct") - type: StrictStr = Field(description="The form type.") + suggest_product: InquirySuggestProduct = Field(alias="suggestProduct") + type: InquiryFormType __properties: ClassVar[List[str]] = ["suggestProduct", "type"] - @field_validator("type") - def type_validate_enum(cls, value): - """Validates the enum""" - if value not in set(["suggest_product"]): - raise ValueError("must be one of enum values ('suggest_product')") - return value - model_config = ConfigDict( populate_by_name=True, validate_assignment=True, @@ -96,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { "suggestProduct": ( - SuggestProductSuggestProduct.from_dict(obj["suggestProduct"]) + InquirySuggestProduct.from_dict(obj["suggestProduct"]) if obj.get("suggestProduct") is not None else None ), diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py index b00a1811..01961842 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py @@ -18,9 +18,12 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Self +from stackit.stackitmarketplace.models.subscription_lifecycle_state import ( + SubscriptionLifecycleState, +) from stackit.stackitmarketplace.models.subscription_product import SubscriptionProduct @@ -29,30 +32,12 @@ class VendorSubscription(BaseModel): VendorSubscription """ - lifecycle_state: StrictStr = Field(description="Lifecycle state of the subscription.", alias="lifecycleState") + lifecycle_state: SubscriptionLifecycleState = Field(alias="lifecycleState") product: SubscriptionProduct - project_id: StrictStr = Field(description="The associated consumer project ID.", alias="projectId") - subscription_id: StrictStr = Field(description="The subscription ID.", alias="subscriptionId") + project_id: object = Field(alias="projectId") + subscription_id: object = Field(alias="subscriptionId") __properties: ClassVar[List[str]] = ["lifecycleState", "product", "projectId", "subscriptionId"] - @field_validator("lifecycle_state") - def lifecycle_state_validate_enum(cls, value): - """Validates the enum""" - if value not in set( - [ - "SUBSCRIPTION_PENDING", - "SUBSCRIPTION_ACTIVE", - "SUBSCRIPTION_INACTIVE", - "SUBSCRIPTION_CANCELLING", - "SUBSCRIPTION_CANCELLED", - "SUBSCRIPTION_REJECTED", - ] - ): - raise ValueError( - "must be one of enum values ('SUBSCRIPTION_PENDING', 'SUBSCRIPTION_ACTIVE', 'SUBSCRIPTION_INACTIVE', 'SUBSCRIPTION_CANCELLING', 'SUBSCRIPTION_CANCELLED', 'SUBSCRIPTION_REJECTED')" - ) - return value - model_config = ConfigDict( populate_by_name=True, validate_assignment=True, From c77aa379360505feaca9b28f2de4cbdf8d556083 Mon Sep 17 00:00:00 2001 From: Alexander Dahmen Date: Fri, 11 Apr 2025 09:20:54 +0200 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 2 ++ services/stackitmarketplace/CHANGELOG.md | 3 +++ services/stackitmarketplace/pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81fd7e50..943634ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ ## Release (2025-XX-YY) +- `stackitmarketplace`: [0.4.0](services/stackitmarketplace/CHANGELOG.md#v040-2025-04-16) + - **Feature:** Add new `InquiryContactSales`, `InquirySuggestProduct`, `PriceType`, `PricingOption` and `DeliveryMethod` - `stackitmarketplace`: [0.3.0](services/stackitmarketplace/CHANGELOG.md#v030-2025-04-04) - **Feature:** Add new `VendorProductId` attribute for subscription products diff --git a/services/stackitmarketplace/CHANGELOG.md b/services/stackitmarketplace/CHANGELOG.md index 9654e108..0707e3b3 100644 --- a/services/stackitmarketplace/CHANGELOG.md +++ b/services/stackitmarketplace/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.4.0 (2025-04-16) +- **Feature:** Add new `InquiryContactSales`, `InquirySuggestProduct`, `PriceType`, `PricingOption` and `DeliveryMethod` + ## v0.3.0 (2025-04-04) - **Feature:** Add new `VendorProductId` attribute for subscription products diff --git a/services/stackitmarketplace/pyproject.toml b/services/stackitmarketplace/pyproject.toml index 022fb0c9..35adda94 100644 --- a/services/stackitmarketplace/pyproject.toml +++ b/services/stackitmarketplace/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-stackitmarketplace" [tool.poetry] name = "stackit-stackitmarketplace" -version = "v0.2.0" +version = "v0.4.0" authors = [ "STACKIT Developer Tools ", ]