From 9453ba52fda2a0add241c45f7e5d3c04265dbd21 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 25 Jun 2026 15:27:02 +0000 Subject: [PATCH] Generate stackitmarketplace --- services/stackitmarketplace/oas_commit | 1 + .../stackit/stackitmarketplace/__init__.py | 164 +- .../stackitmarketplace/api/default_api.py | 2114 +++++++++++++---- .../stackit/stackitmarketplace/api_client.py | 61 +- .../stackit/stackitmarketplace/exceptions.py | 2 +- .../stackitmarketplace/models/__init__.py | 92 +- .../models/approve_subscription_payload.py | 26 +- .../models/assets_product_description.py | 89 - .../models/assets_service_level_agreement.py | 89 - .../models/become_vendor.py | 96 - .../models/catalog_product_detail.py | 328 --- .../models/catalog_product_details_vendor.py | 137 -- .../models/catalog_product_overview.py | 150 -- .../models/catalog_product_overview_vendor.py | 116 - .../models/catalog_product_pricing_option.py | 162 -- .../catalog_product_support_resource.py | 102 - .../models/catalog_product_vendor_terms.py | 96 - ...consumers_subscriptions_create_payload.py} | 35 +- .../models/contact_sales.py | 96 - .../models/delivery_method.py | 39 - .../models/error_response.py | 7 +- .../stackitmarketplace/models/free_trial.py | 82 - .../inquiries_create_inquiry_payload.py | 209 -- .../models/inquiry_become_vendor.py | 91 - .../models/inquiry_contact_sales.py | 129 - .../models/inquiry_form_type.py | 40 - .../models/inquiry_register_testing.py | 103 - .../models/inquiry_request_private_plan.py | 129 - .../models/inquiry_suggest_product.py | 130 - .../models/list_catalog_products_response.py | 126 - .../models/localized_version.py | 112 - ... => marketplace_subscription_v1_assets.py} | 44 +- ...py => marketplace_subscription_v1_file.py} | 29 +- ...subscription_v1_file_localized_version.py} | 25 +- ...ription_v1_list_subscriptions_response.py} | 43 +- ...arketplace_subscription_v1_subscription.py | 198 ++ ...ce_subscription_v1_subscription_product.py | 170 ++ ..._subscription_v1_subscription_redirect.py} | 24 +- .../models/notice_period.py | 95 - .../stackitmarketplace/models/offer_type.py | 37 - .../stackitmarketplace/models/price_type.py | 40 - .../models/pricing_option_unit.py | 36 - .../models/product_lifecycle_state.py | 37 - .../models/register_testing.py | 100 - .../models/request_private_plan.py | 100 - .../models/resolve_customer_payload.py | 7 +- .../stackitmarketplace/models/scope.py | 38 - .../models/service_certificate.py | 89 - .../models/subscription_lifecycle_state.py | 41 - .../models/subscription_product.py | 203 -- .../models/suggest_product.py | 100 - .../models/vendor_subscription.py | 136 -- .../src/stackit/stackitmarketplace/rest.py | 22 +- 53 files changed, 2182 insertions(+), 4585 deletions(-) create mode 100644 services/stackitmarketplace/oas_commit delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_product_description.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_service_level_agreement.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_details_vendor.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview_vendor.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_pricing_option.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_support_resource.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_vendor_terms.py rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{catalog_product_highlight.py => consumers_subscriptions_create_payload.py} (64%) delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/delivery_method.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/free_trial.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiries_create_inquiry_payload.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_become_vendor.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_contact_sales.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_form_type.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_register_testing.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_request_private_plan.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_suggest_product.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_catalog_products_response.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/localized_version.py rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{assets.py => marketplace_subscription_v1_assets.py} (71%) rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{assets_end_user_license_agreement.py => marketplace_subscription_v1_file.py} (71%) rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{catalog_product_facets_value_inner.py => marketplace_subscription_v1_file_localized_version.py} (67%) rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{list_vendor_subscriptions_response.py => marketplace_subscription_v1_list_subscriptions_response.py} (62%) create mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription.py create mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription_product.py rename services/stackitmarketplace/src/stackit/stackitmarketplace/models/{catalog_pricing_option_highlight.py => marketplace_subscription_v1_subscription_redirect.py} (70%) delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/notice_period.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/offer_type.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/price_type.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/pricing_option_unit.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/product_lifecycle_state.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/request_private_plan.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/scope.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/service_certificate.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_lifecycle_state.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_product.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product.py delete mode 100644 services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py diff --git a/services/stackitmarketplace/oas_commit b/services/stackitmarketplace/oas_commit new file mode 100644 index 000000000..5c05d0ead --- /dev/null +++ b/services/stackitmarketplace/oas_commit @@ -0,0 +1 @@ +58dbd39e05f1ddc2d44b191eb3476225130c4ded diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py index 7a2ac8aa1..cf8524fa0 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py @@ -30,49 +30,16 @@ "ApiAttributeError", "ApiException", "ApproveSubscriptionPayload", - "Assets", - "AssetsEndUserLicenseAgreement", - "AssetsProductDescription", - "AssetsServiceLevelAgreement", - "BecomeVendor", - "CatalogPricingOptionHighlight", - "CatalogProductDetail", - "CatalogProductDetailsVendor", - "CatalogProductFacetsValueInner", - "CatalogProductHighlight", - "CatalogProductOverview", - "CatalogProductOverviewVendor", - "CatalogProductPricingOption", - "CatalogProductSupportResource", - "CatalogProductVendorTerms", - "ContactSales", - "DeliveryMethod", + "ConsumersSubscriptionsCreatePayload", "ErrorResponse", - "FreeTrial", - "InquiriesCreateInquiryPayload", - "InquiryBecomeVendor", - "InquiryContactSales", - "InquiryFormType", - "InquiryRegisterTesting", - "InquiryRequestPrivatePlan", - "InquirySuggestProduct", - "ListCatalogProductsResponse", - "ListVendorSubscriptionsResponse", - "LocalizedVersion", - "NoticePeriod", - "OfferType", - "PriceType", - "PricingOptionUnit", - "ProductLifecycleState", - "RegisterTesting", - "RequestPrivatePlan", + "MarketplaceSubscriptionV1Assets", + "MarketplaceSubscriptionV1File", + "MarketplaceSubscriptionV1FileLocalizedVersion", + "MarketplaceSubscriptionV1ListSubscriptionsResponse", + "MarketplaceSubscriptionV1Subscription", + "MarketplaceSubscriptionV1SubscriptionProduct", + "MarketplaceSubscriptionV1SubscriptionRedirect", "ResolveCustomerPayload", - "Scope", - "ServiceCertificate", - "SubscriptionLifecycleState", - "SubscriptionProduct", - "SuggestProduct", - "VendorSubscription", ] # import apis into sdk package @@ -95,116 +62,33 @@ from stackit.stackitmarketplace.models.approve_subscription_payload import ( ApproveSubscriptionPayload as ApproveSubscriptionPayload, ) -from stackit.stackitmarketplace.models.assets import Assets as Assets -from stackit.stackitmarketplace.models.assets_end_user_license_agreement import ( - AssetsEndUserLicenseAgreement as AssetsEndUserLicenseAgreement, -) -from stackit.stackitmarketplace.models.assets_product_description import ( - AssetsProductDescription as AssetsProductDescription, -) -from stackit.stackitmarketplace.models.assets_service_level_agreement import ( - AssetsServiceLevelAgreement as AssetsServiceLevelAgreement, -) -from stackit.stackitmarketplace.models.become_vendor import BecomeVendor as BecomeVendor -from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import ( - CatalogPricingOptionHighlight as CatalogPricingOptionHighlight, -) -from stackit.stackitmarketplace.models.catalog_product_detail import ( - CatalogProductDetail as CatalogProductDetail, -) -from stackit.stackitmarketplace.models.catalog_product_details_vendor import ( - CatalogProductDetailsVendor as CatalogProductDetailsVendor, -) -from stackit.stackitmarketplace.models.catalog_product_facets_value_inner import ( - CatalogProductFacetsValueInner as CatalogProductFacetsValueInner, -) -from stackit.stackitmarketplace.models.catalog_product_highlight import ( - CatalogProductHighlight as CatalogProductHighlight, -) -from stackit.stackitmarketplace.models.catalog_product_overview import ( - CatalogProductOverview as CatalogProductOverview, -) -from stackit.stackitmarketplace.models.catalog_product_overview_vendor import ( - CatalogProductOverviewVendor as CatalogProductOverviewVendor, -) -from stackit.stackitmarketplace.models.catalog_product_pricing_option import ( - CatalogProductPricingOption as CatalogProductPricingOption, -) -from stackit.stackitmarketplace.models.catalog_product_support_resource import ( - CatalogProductSupportResource as CatalogProductSupportResource, -) -from stackit.stackitmarketplace.models.catalog_product_vendor_terms import ( - CatalogProductVendorTerms as CatalogProductVendorTerms, -) -from stackit.stackitmarketplace.models.contact_sales import ContactSales as ContactSales -from stackit.stackitmarketplace.models.delivery_method import ( - DeliveryMethod as DeliveryMethod, +from stackit.stackitmarketplace.models.consumers_subscriptions_create_payload import ( + ConsumersSubscriptionsCreatePayload as ConsumersSubscriptionsCreatePayload, ) from stackit.stackitmarketplace.models.error_response import ( ErrorResponse as ErrorResponse, ) -from stackit.stackitmarketplace.models.free_trial import FreeTrial as FreeTrial -from stackit.stackitmarketplace.models.inquiries_create_inquiry_payload import ( - InquiriesCreateInquiryPayload as InquiriesCreateInquiryPayload, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_assets import ( + MarketplaceSubscriptionV1Assets as MarketplaceSubscriptionV1Assets, ) -from stackit.stackitmarketplace.models.inquiry_become_vendor import ( - InquiryBecomeVendor as InquiryBecomeVendor, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_file import ( + MarketplaceSubscriptionV1File as MarketplaceSubscriptionV1File, ) -from stackit.stackitmarketplace.models.inquiry_contact_sales import ( - InquiryContactSales as InquiryContactSales, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_file_localized_version import ( + MarketplaceSubscriptionV1FileLocalizedVersion as MarketplaceSubscriptionV1FileLocalizedVersion, ) -from stackit.stackitmarketplace.models.inquiry_form_type import ( - InquiryFormType as InquiryFormType, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_list_subscriptions_response import ( + MarketplaceSubscriptionV1ListSubscriptionsResponse as MarketplaceSubscriptionV1ListSubscriptionsResponse, ) -from stackit.stackitmarketplace.models.inquiry_register_testing import ( - InquiryRegisterTesting as InquiryRegisterTesting, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription import ( + MarketplaceSubscriptionV1Subscription as MarketplaceSubscriptionV1Subscription, ) -from stackit.stackitmarketplace.models.inquiry_request_private_plan import ( - InquiryRequestPrivatePlan as InquiryRequestPrivatePlan, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription_product import ( + MarketplaceSubscriptionV1SubscriptionProduct as MarketplaceSubscriptionV1SubscriptionProduct, ) -from stackit.stackitmarketplace.models.inquiry_suggest_product import ( - InquirySuggestProduct as InquirySuggestProduct, -) -from stackit.stackitmarketplace.models.list_catalog_products_response import ( - ListCatalogProductsResponse as ListCatalogProductsResponse, -) -from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import ( - ListVendorSubscriptionsResponse as ListVendorSubscriptionsResponse, -) -from stackit.stackitmarketplace.models.localized_version import ( - LocalizedVersion as LocalizedVersion, -) -from stackit.stackitmarketplace.models.notice_period import NoticePeriod as NoticePeriod -from stackit.stackitmarketplace.models.offer_type import OfferType as OfferType -from stackit.stackitmarketplace.models.price_type import PriceType as PriceType -from stackit.stackitmarketplace.models.pricing_option_unit import ( - PricingOptionUnit as PricingOptionUnit, -) -from stackit.stackitmarketplace.models.product_lifecycle_state import ( - ProductLifecycleState as ProductLifecycleState, -) -from stackit.stackitmarketplace.models.register_testing import ( - RegisterTesting as RegisterTesting, -) -from stackit.stackitmarketplace.models.request_private_plan import ( - RequestPrivatePlan as RequestPrivatePlan, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription_redirect import ( + MarketplaceSubscriptionV1SubscriptionRedirect as MarketplaceSubscriptionV1SubscriptionRedirect, ) from stackit.stackitmarketplace.models.resolve_customer_payload import ( ResolveCustomerPayload as ResolveCustomerPayload, ) -from stackit.stackitmarketplace.models.scope import Scope as Scope -from stackit.stackitmarketplace.models.service_certificate import ( - ServiceCertificate as ServiceCertificate, -) -from stackit.stackitmarketplace.models.subscription_lifecycle_state import ( - SubscriptionLifecycleState as SubscriptionLifecycleState, -) -from stackit.stackitmarketplace.models.subscription_product import ( - SubscriptionProduct as SubscriptionProduct, -) -from stackit.stackitmarketplace.models.suggest_product import ( - SuggestProduct as SuggestProduct, -) -from stackit.stackitmarketplace.models.vendor_subscription import ( - VendorSubscription as VendorSubscription, -) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py index d7eb46949..01ec104a3 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py @@ -12,16 +12,9 @@ Do not edit the class manually. """ # noqa: E501 -import warnings from typing import Any, Dict, List, Optional, Tuple, Union -from pydantic import ( - Field, - StrictFloat, - StrictInt, - StrictStr, - validate_call, -) +from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, validate_call from stackit.core.configuration import Configuration from typing_extensions import Annotated @@ -30,22 +23,21 @@ from stackit.stackitmarketplace.models.approve_subscription_payload import ( ApproveSubscriptionPayload, ) -from stackit.stackitmarketplace.models.catalog_product_detail import ( - CatalogProductDetail, +from stackit.stackitmarketplace.models.consumers_subscriptions_create_payload import ( + ConsumersSubscriptionsCreatePayload, ) -from stackit.stackitmarketplace.models.inquiries_create_inquiry_payload import ( - InquiriesCreateInquiryPayload, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_list_subscriptions_response import ( + MarketplaceSubscriptionV1ListSubscriptionsResponse, ) -from stackit.stackitmarketplace.models.list_catalog_products_response import ( - ListCatalogProductsResponse, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription import ( + MarketplaceSubscriptionV1Subscription, ) -from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import ( - ListVendorSubscriptionsResponse, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription_redirect import ( + MarketplaceSubscriptionV1SubscriptionRedirect, ) from stackit.stackitmarketplace.models.resolve_customer_payload import ( ResolveCustomerPayload, ) -from stackit.stackitmarketplace.models.vendor_subscription import VendorSubscription from stackit.stackitmarketplace.rest import RESTResponseType @@ -65,11 +57,9 @@ def __init__(self, configuration: Configuration = None) -> None: @validate_call def approve_subscription( self, - 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, + project_id: StrictStr, + subscription_id: StrictStr, + approve_subscription_payload: ApproveSubscriptionPayload, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -80,15 +70,15 @@ def approve_subscription( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> None: - """Approve a subscription + """Approve a pending subscription. Approve a pending subscription. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) + :param subscription_id: (required) :type subscription_id: str - :param approve_subscription_payload: + :param approve_subscription_payload: (required) :type approve_subscription_payload: ApproveSubscriptionPayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -139,11 +129,9 @@ def approve_subscription( @validate_call def approve_subscription_with_http_info( self, - 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, + project_id: StrictStr, + subscription_id: StrictStr, + approve_subscription_payload: ApproveSubscriptionPayload, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -154,15 +142,15 @@ def approve_subscription_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[None]: - """Approve a subscription + """Approve a pending subscription. Approve a pending subscription. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) + :param subscription_id: (required) :type subscription_id: str - :param approve_subscription_payload: + :param approve_subscription_payload: (required) :type approve_subscription_payload: ApproveSubscriptionPayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -213,11 +201,9 @@ def approve_subscription_with_http_info( @validate_call def approve_subscription_without_preload_content( self, - 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, + project_id: StrictStr, + subscription_id: StrictStr, + approve_subscription_payload: ApproveSubscriptionPayload, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -228,15 +214,15 @@ def approve_subscription_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Approve a subscription + """Approve a pending subscription. Approve a pending subscription. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) + :param subscription_id: (required) :type subscription_id: str - :param approve_subscription_payload: + :param approve_subscription_payload: (required) :type approve_subscription_payload: ApproveSubscriptionPayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -345,10 +331,10 @@ def _approve_subscription_serialize( ) @validate_call - def get_catalog_product( + def consumers_subscriptions_cancel( self, - product_id: Annotated[str, Field(min_length=10, strict=True, max_length=29, description="The product ID.")], - locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, + project_id: StrictStr, + subscription_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -358,15 +344,15 @@ def get_catalog_product( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> CatalogProductDetail: - """(Deprecated) Get a product + ) -> None: + """Cancel a subscription. - Get a product. + Cancel a subscription. - :param product_id: The product ID. (required) - :type product_id: str - :param locale: The language of the response. - :type locale: str + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -388,11 +374,10 @@ def get_catalog_product( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /v1/catalog/products/{productId} is deprecated.", DeprecationWarning) - _param = self._get_catalog_product_serialize( - product_id=product_id, - locale=locale, + _param = self._consumers_subscriptions_cancel_serialize( + project_id=project_id, + subscription_id=subscription_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -400,11 +385,12 @@ def get_catalog_product( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "CatalogProductDetail", + "202": None, "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", "404": "ErrorResponse", + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -414,10 +400,10 @@ def get_catalog_product( ).data @validate_call - def get_catalog_product_with_http_info( + def consumers_subscriptions_cancel_with_http_info( self, - product_id: Annotated[str, Field(min_length=10, strict=True, max_length=29, description="The product ID.")], - locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, + project_id: StrictStr, + subscription_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -427,15 +413,15 @@ def get_catalog_product_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[CatalogProductDetail]: - """(Deprecated) Get a product + ) -> ApiResponse[None]: + """Cancel a subscription. - Get a product. + Cancel a subscription. - :param product_id: The product ID. (required) - :type product_id: str - :param locale: The language of the response. - :type locale: str + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -457,11 +443,10 @@ def get_catalog_product_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /v1/catalog/products/{productId} is deprecated.", DeprecationWarning) - _param = self._get_catalog_product_serialize( - product_id=product_id, - locale=locale, + _param = self._consumers_subscriptions_cancel_serialize( + project_id=project_id, + subscription_id=subscription_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -469,11 +454,12 @@ def get_catalog_product_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "CatalogProductDetail", + "202": None, "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", "404": "ErrorResponse", + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -483,10 +469,10 @@ def get_catalog_product_with_http_info( ) @validate_call - def get_catalog_product_without_preload_content( + def consumers_subscriptions_cancel_without_preload_content( self, - product_id: Annotated[str, Field(min_length=10, strict=True, max_length=29, description="The product ID.")], - locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, + project_id: StrictStr, + subscription_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -497,14 +483,14 @@ def get_catalog_product_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """(Deprecated) Get a product + """Cancel a subscription. - Get a product. + Cancel a subscription. - :param product_id: The product ID. (required) - :type product_id: str - :param locale: The language of the response. - :type locale: str + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -526,11 +512,10 @@ def get_catalog_product_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /v1/catalog/products/{productId} is deprecated.", DeprecationWarning) - _param = self._get_catalog_product_serialize( - product_id=product_id, - locale=locale, + _param = self._consumers_subscriptions_cancel_serialize( + project_id=project_id, + subscription_id=subscription_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -538,19 +523,20 @@ def get_catalog_product_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "CatalogProductDetail", + "202": None, "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", "404": "ErrorResponse", + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _get_catalog_product_serialize( + def _consumers_subscriptions_cancel_serialize( self, - product_id, - locale, + project_id, + subscription_id, _request_auth, _content_type, _headers, @@ -569,13 +555,11 @@ def _get_catalog_product_serialize( _body_params: Optional[bytes] = None # process the path parameters - if product_id is not None: - _path_params["productId"] = product_id + if project_id is not None: + _path_params["projectId"] = project_id + if subscription_id is not None: + _path_params["subscriptionId"] = subscription_id # process the query parameters - if locale is not None: - - _query_params.append(("locale", locale)) - # process the header parameters # process the form parameters # process the body parameter @@ -588,8 +572,8 @@ def _get_catalog_product_serialize( _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/catalog/products/{productId}", + method="DELETE", + resource_path="/v1/consumers/projects/{projectId}/subscriptions/{subscriptionId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -603,12 +587,10 @@ def _get_catalog_product_serialize( ) @validate_call - def get_vendor_subscription( + def consumers_subscriptions_create( self, - 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.") - ], + project_id: StrictStr, + consumers_subscriptions_create_payload: ConsumersSubscriptionsCreatePayload, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -618,15 +600,15 @@ def get_vendor_subscription( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> VendorSubscription: - """Get a subscription + ) -> MarketplaceSubscriptionV1Subscription: + """Create a new subscription. - Get a subscription. + Create a new subscription. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) - :type subscription_id: str + :param consumers_subscriptions_create_payload: (required) + :type consumers_subscriptions_create_payload: ConsumersSubscriptionsCreatePayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -649,9 +631,9 @@ def get_vendor_subscription( :return: Returns the result object. """ # noqa: E501 - _param = self._get_vendor_subscription_serialize( + _param = self._consumers_subscriptions_create_serialize( project_id=project_id, - subscription_id=subscription_id, + consumers_subscriptions_create_payload=consumers_subscriptions_create_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -659,11 +641,11 @@ def get_vendor_subscription( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "VendorSubscription", + "201": "MarketplaceSubscriptionV1Subscription", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", - "404": "ErrorResponse", + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -673,12 +655,10 @@ def get_vendor_subscription( ).data @validate_call - def get_vendor_subscription_with_http_info( + def consumers_subscriptions_create_with_http_info( self, - 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.") - ], + project_id: StrictStr, + consumers_subscriptions_create_payload: ConsumersSubscriptionsCreatePayload, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -688,15 +668,15 @@ def get_vendor_subscription_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[VendorSubscription]: - """Get a subscription + ) -> ApiResponse[MarketplaceSubscriptionV1Subscription]: + """Create a new subscription. - Get a subscription. + Create a new subscription. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) - :type subscription_id: str + :param consumers_subscriptions_create_payload: (required) + :type consumers_subscriptions_create_payload: ConsumersSubscriptionsCreatePayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -719,9 +699,9 @@ def get_vendor_subscription_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_vendor_subscription_serialize( + _param = self._consumers_subscriptions_create_serialize( project_id=project_id, - subscription_id=subscription_id, + consumers_subscriptions_create_payload=consumers_subscriptions_create_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -729,11 +709,11 @@ def get_vendor_subscription_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "VendorSubscription", + "201": "MarketplaceSubscriptionV1Subscription", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", - "404": "ErrorResponse", + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -743,12 +723,10 @@ def get_vendor_subscription_with_http_info( ) @validate_call - def get_vendor_subscription_without_preload_content( + def consumers_subscriptions_create_without_preload_content( self, - 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.") - ], + project_id: StrictStr, + consumers_subscriptions_create_payload: ConsumersSubscriptionsCreatePayload, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -759,14 +737,14 @@ def get_vendor_subscription_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get a subscription + """Create a new subscription. - Get a subscription. + Create a new subscription. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) - :type subscription_id: str + :param consumers_subscriptions_create_payload: (required) + :type consumers_subscriptions_create_payload: ConsumersSubscriptionsCreatePayload :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -789,9 +767,9 @@ def get_vendor_subscription_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_vendor_subscription_serialize( + _param = self._consumers_subscriptions_create_serialize( project_id=project_id, - subscription_id=subscription_id, + consumers_subscriptions_create_payload=consumers_subscriptions_create_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -799,19 +777,19 @@ def get_vendor_subscription_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "VendorSubscription", + "201": "MarketplaceSubscriptionV1Subscription", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", - "404": "ErrorResponse", + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _get_vendor_subscription_serialize( + def _consumers_subscriptions_create_serialize( self, project_id, - subscription_id, + consumers_subscriptions_create_payload, _request_auth, _content_type, _headers, @@ -832,23 +810,31 @@ def _get_vendor_subscription_serialize( # process the path parameters if project_id is not None: _path_params["projectId"] = project_id - if subscription_id is not None: - _path_params["subscriptionId"] = subscription_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter + if consumers_subscriptions_create_payload is not None: + _body_params = consumers_subscriptions_create_payload # set the HTTP header `Accept` if "Accept" not in _header_params: _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + # authentication setting _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="GET", - resource_path="/v1/vendors/projects/{projectId}/subscriptions/{subscriptionId}", + method="POST", + resource_path="/v1/consumers/projects/{projectId}/subscriptions", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -862,9 +848,14 @@ def _get_vendor_subscription_serialize( ) @validate_call - def inquiries_create_inquiry( + def consumers_subscriptions_get( self, - inquiries_create_inquiry_payload: InquiriesCreateInquiryPayload, + project_id: StrictStr, + subscription_id: StrictStr, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -874,13 +865,17 @@ def inquiries_create_inquiry( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> None: - """(Deprecated) Create inquiry + ) -> MarketplaceSubscriptionV1Subscription: + """Get a subscription. - Create an inquiry to contact sales, become a vendor, request a private plan, register for testing, or suggest a product. Requests are limited to 10 per 5 minutes. + Get a subscription. - :param inquiries_create_inquiry_payload: (required) - :type inquiries_create_inquiry_payload: InquiriesCreateInquiryPayload + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -902,10 +897,11 @@ def inquiries_create_inquiry( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("POST /v1/inquiries is deprecated.", DeprecationWarning) - _param = self._inquiries_create_inquiry_serialize( - inquiries_create_inquiry_payload=inquiries_create_inquiry_payload, + _param = self._consumers_subscriptions_get_serialize( + project_id=project_id, + subscription_id=subscription_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -913,7 +909,7 @@ def inquiries_create_inquiry( ) _response_types_map: Dict[str, Optional[str]] = { - "202": None, + "200": "MarketplaceSubscriptionV1Subscription", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -927,9 +923,14 @@ def inquiries_create_inquiry( ).data @validate_call - def inquiries_create_inquiry_with_http_info( + def consumers_subscriptions_get_with_http_info( self, - inquiries_create_inquiry_payload: InquiriesCreateInquiryPayload, + project_id: StrictStr, + subscription_id: StrictStr, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -939,13 +940,17 @@ def inquiries_create_inquiry_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: - """(Deprecated) Create inquiry + ) -> ApiResponse[MarketplaceSubscriptionV1Subscription]: + """Get a subscription. - Create an inquiry to contact sales, become a vendor, request a private plan, register for testing, or suggest a product. Requests are limited to 10 per 5 minutes. + Get a subscription. - :param inquiries_create_inquiry_payload: (required) - :type inquiries_create_inquiry_payload: InquiriesCreateInquiryPayload + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -967,10 +972,11 @@ def inquiries_create_inquiry_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("POST /v1/inquiries is deprecated.", DeprecationWarning) - _param = self._inquiries_create_inquiry_serialize( - inquiries_create_inquiry_payload=inquiries_create_inquiry_payload, + _param = self._consumers_subscriptions_get_serialize( + project_id=project_id, + subscription_id=subscription_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -978,7 +984,7 @@ def inquiries_create_inquiry_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "202": None, + "200": "MarketplaceSubscriptionV1Subscription", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -992,9 +998,14 @@ def inquiries_create_inquiry_with_http_info( ) @validate_call - def inquiries_create_inquiry_without_preload_content( + def consumers_subscriptions_get_without_preload_content( self, - inquiries_create_inquiry_payload: InquiriesCreateInquiryPayload, + project_id: StrictStr, + subscription_id: StrictStr, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1005,12 +1016,16 @@ def inquiries_create_inquiry_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """(Deprecated) Create inquiry + """Get a subscription. - Create an inquiry to contact sales, become a vendor, request a private plan, register for testing, or suggest a product. Requests are limited to 10 per 5 minutes. + Get a subscription. - :param inquiries_create_inquiry_payload: (required) - :type inquiries_create_inquiry_payload: InquiriesCreateInquiryPayload + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1032,10 +1047,11 @@ def inquiries_create_inquiry_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("POST /v1/inquiries is deprecated.", DeprecationWarning) - _param = self._inquiries_create_inquiry_serialize( - inquiries_create_inquiry_payload=inquiries_create_inquiry_payload, + _param = self._consumers_subscriptions_get_serialize( + project_id=project_id, + subscription_id=subscription_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1043,7 +1059,7 @@ def inquiries_create_inquiry_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "202": None, + "200": "MarketplaceSubscriptionV1Subscription", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -1052,9 +1068,11 @@ def inquiries_create_inquiry_without_preload_content( response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _inquiries_create_inquiry_serialize( + def _consumers_subscriptions_get_serialize( self, - inquiries_create_inquiry_payload, + project_id, + subscription_id, + include_expired, _request_auth, _content_type, _headers, @@ -1073,31 +1091,29 @@ def _inquiries_create_inquiry_serialize( _body_params: Optional[bytes] = None # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if subscription_id is not None: + _path_params["subscriptionId"] = subscription_id # process the query parameters + if include_expired is not None: + + _query_params.append(("includeExpired", include_expired)) + # process the header parameters # process the form parameters # process the body parameter - if inquiries_create_inquiry_payload is not None: - _body_params = inquiries_create_inquiry_payload # set the HTTP header `Accept` if "Accept" not in _header_params: _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) - # set the HTTP header `Content-Type` - if _content_type: - _header_params["Content-Type"] = _content_type - else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) - if _default_content_type is not None: - _header_params["Content-Type"] = _default_content_type - # authentication setting _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/inquiries", + method="GET", + resource_path="/v1/consumers/projects/{projectId}/subscriptions/{subscriptionId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1111,36 +1127,15 @@ def _inquiries_create_inquiry_serialize( ) @validate_call - def list_catalog_products( + def consumers_subscriptions_list_by_organization( self, - cursor: Annotated[ - Optional[StrictStr], - Field( - 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." - ), - ] = None, - limit: Annotated[ - Optional[ - Union[ - Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] - ] - ], - Field( - description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." - ), - ] = None, - locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, - filter: Annotated[ - Optional[StrictStr], - Field( - description='Filter the products based on attributes, e.g., `deliveryMethod eq "SAAS"`. The supported operators are: - `PR` (present; `name pr`) - `EQ` (equal) - `NE` (not equal) - `CO` (contains; `text co "searching"`) - `SW` (starts with) - `EW` (ends with) - `GT` (greater than) - `LT` (less than) - `GE` (greater than or equal) - `LE` (less than or equal). These expressions can be logically linked with `AND` and `OR`. All attributes (and the special `text` attribute) can be used as filters, if the attribute type allows the operator. ' - ), - ] = None, - sort: Annotated[ - Optional[StrictStr], - Field( - description="Sort the products based on attributes and order e.g. `name:asc`. Attributes with scalar types (`createdAt`, `isProductListing`) or keywords (`name`, `deliveryMethod`, `lifecycleState`, `vendor.name`) can be used as sort criteria. To set the sort order, append `asc` (ascending) or `desc` (descending) to the attribute, e.g. `name:asc`. To sort by multiple attributes, separate them with a comma. E.g `name:asc,price:desc`." - ), + organization_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), ] = None, _request_timeout: Union[ None, @@ -1151,21 +1146,21 @@ def list_catalog_products( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListCatalogProductsResponse: - """(Deprecated) List all products + ) -> MarketplaceSubscriptionV1ListSubscriptionsResponse: + """List all subscriptions of an organization. - List all products. + List all subscriptions of an organization. - :param cursor: 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. + :param organization_id: (required) + :type organization_id: str + :param cursor: :type cursor: str - :param limit: The maximum number of items to return in the response. If maximum is exceeded, maximum is used. - :type limit: float - :param locale: The language of the response. - :type locale: str - :param filter: Filter the products based on attributes, e.g., `deliveryMethod eq \"SAAS\"`. The supported operators are: - `PR` (present; `name pr`) - `EQ` (equal) - `NE` (not equal) - `CO` (contains; `text co \"searching\"`) - `SW` (starts with) - `EW` (ends with) - `GT` (greater than) - `LT` (less than) - `GE` (greater than or equal) - `LE` (less than or equal). These expressions can be logically linked with `AND` and `OR`. All attributes (and the special `text` attribute) can be used as filters, if the attribute type allows the operator. - :type filter: str - :param sort: Sort the products based on attributes and order e.g. `name:asc`. Attributes with scalar types (`createdAt`, `isProductListing`) or keywords (`name`, `deliveryMethod`, `lifecycleState`, `vendor.name`) can be used as sort criteria. To set the sort order, append `asc` (ascending) or `desc` (descending) to the attribute, e.g. `name:asc`. To sort by multiple attributes, separate them with a comma. E.g `name:asc,price:desc`. - :type sort: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1187,14 +1182,13 @@ def list_catalog_products( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /v1/catalog/products is deprecated.", DeprecationWarning) - _param = self._list_catalog_products_serialize( + _param = self._consumers_subscriptions_list_by_organization_serialize( + organization_id=organization_id, cursor=cursor, limit=limit, - locale=locale, - filter=filter, - sort=sort, + product_id=product_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1202,7 +1196,7 @@ def list_catalog_products( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListCatalogProductsResponse", + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -1215,36 +1209,15 @@ def list_catalog_products( ).data @validate_call - def list_catalog_products_with_http_info( + def consumers_subscriptions_list_by_organization_with_http_info( self, - cursor: Annotated[ - Optional[StrictStr], - Field( - 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." - ), - ] = None, - limit: Annotated[ - Optional[ - Union[ - Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] - ] - ], - Field( - description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." - ), - ] = None, - locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, - filter: Annotated[ - Optional[StrictStr], - Field( - description='Filter the products based on attributes, e.g., `deliveryMethod eq "SAAS"`. The supported operators are: - `PR` (present; `name pr`) - `EQ` (equal) - `NE` (not equal) - `CO` (contains; `text co "searching"`) - `SW` (starts with) - `EW` (ends with) - `GT` (greater than) - `LT` (less than) - `GE` (greater than or equal) - `LE` (less than or equal). These expressions can be logically linked with `AND` and `OR`. All attributes (and the special `text` attribute) can be used as filters, if the attribute type allows the operator. ' - ), - ] = None, - sort: Annotated[ - Optional[StrictStr], - Field( - description="Sort the products based on attributes and order e.g. `name:asc`. Attributes with scalar types (`createdAt`, `isProductListing`) or keywords (`name`, `deliveryMethod`, `lifecycleState`, `vendor.name`) can be used as sort criteria. To set the sort order, append `asc` (ascending) or `desc` (descending) to the attribute, e.g. `name:asc`. To sort by multiple attributes, separate them with a comma. E.g `name:asc,price:desc`." - ), + organization_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), ] = None, _request_timeout: Union[ None, @@ -1255,21 +1228,21 @@ def list_catalog_products_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListCatalogProductsResponse]: - """(Deprecated) List all products + ) -> ApiResponse[MarketplaceSubscriptionV1ListSubscriptionsResponse]: + """List all subscriptions of an organization. - List all products. + List all subscriptions of an organization. - :param cursor: 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. + :param organization_id: (required) + :type organization_id: str + :param cursor: :type cursor: str - :param limit: The maximum number of items to return in the response. If maximum is exceeded, maximum is used. - :type limit: float - :param locale: The language of the response. - :type locale: str - :param filter: Filter the products based on attributes, e.g., `deliveryMethod eq \"SAAS\"`. The supported operators are: - `PR` (present; `name pr`) - `EQ` (equal) - `NE` (not equal) - `CO` (contains; `text co \"searching\"`) - `SW` (starts with) - `EW` (ends with) - `GT` (greater than) - `LT` (less than) - `GE` (greater than or equal) - `LE` (less than or equal). These expressions can be logically linked with `AND` and `OR`. All attributes (and the special `text` attribute) can be used as filters, if the attribute type allows the operator. - :type filter: str - :param sort: Sort the products based on attributes and order e.g. `name:asc`. Attributes with scalar types (`createdAt`, `isProductListing`) or keywords (`name`, `deliveryMethod`, `lifecycleState`, `vendor.name`) can be used as sort criteria. To set the sort order, append `asc` (ascending) or `desc` (descending) to the attribute, e.g. `name:asc`. To sort by multiple attributes, separate them with a comma. E.g `name:asc,price:desc`. - :type sort: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1291,14 +1264,13 @@ def list_catalog_products_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /v1/catalog/products is deprecated.", DeprecationWarning) - _param = self._list_catalog_products_serialize( + _param = self._consumers_subscriptions_list_by_organization_serialize( + organization_id=organization_id, cursor=cursor, limit=limit, - locale=locale, - filter=filter, - sort=sort, + product_id=product_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1306,7 +1278,7 @@ def list_catalog_products_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListCatalogProductsResponse", + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -1319,36 +1291,15 @@ def list_catalog_products_with_http_info( ) @validate_call - def list_catalog_products_without_preload_content( + def consumers_subscriptions_list_by_organization_without_preload_content( self, - cursor: Annotated[ - Optional[StrictStr], - Field( - 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." - ), - ] = None, - limit: Annotated[ - Optional[ - Union[ - Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] - ] - ], - Field( - description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." - ), - ] = None, - locale: Annotated[Optional[StrictStr], Field(description="The language of the response.")] = None, - filter: Annotated[ - Optional[StrictStr], - Field( - description='Filter the products based on attributes, e.g., `deliveryMethod eq "SAAS"`. The supported operators are: - `PR` (present; `name pr`) - `EQ` (equal) - `NE` (not equal) - `CO` (contains; `text co "searching"`) - `SW` (starts with) - `EW` (ends with) - `GT` (greater than) - `LT` (less than) - `GE` (greater than or equal) - `LE` (less than or equal). These expressions can be logically linked with `AND` and `OR`. All attributes (and the special `text` attribute) can be used as filters, if the attribute type allows the operator. ' - ), - ] = None, - sort: Annotated[ - Optional[StrictStr], - Field( - description="Sort the products based on attributes and order e.g. `name:asc`. Attributes with scalar types (`createdAt`, `isProductListing`) or keywords (`name`, `deliveryMethod`, `lifecycleState`, `vendor.name`) can be used as sort criteria. To set the sort order, append `asc` (ascending) or `desc` (descending) to the attribute, e.g. `name:asc`. To sort by multiple attributes, separate them with a comma. E.g `name:asc,price:desc`." - ), + organization_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), ] = None, _request_timeout: Union[ None, @@ -1360,20 +1311,20 @@ def list_catalog_products_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """(Deprecated) List all products + """List all subscriptions of an organization. - List all products. + List all subscriptions of an organization. - :param cursor: 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. + :param organization_id: (required) + :type organization_id: str + :param cursor: :type cursor: str - :param limit: The maximum number of items to return in the response. If maximum is exceeded, maximum is used. - :type limit: float - :param locale: The language of the response. - :type locale: str - :param filter: Filter the products based on attributes, e.g., `deliveryMethod eq \"SAAS\"`. The supported operators are: - `PR` (present; `name pr`) - `EQ` (equal) - `NE` (not equal) - `CO` (contains; `text co \"searching\"`) - `SW` (starts with) - `EW` (ends with) - `GT` (greater than) - `LT` (less than) - `GE` (greater than or equal) - `LE` (less than or equal). These expressions can be logically linked with `AND` and `OR`. All attributes (and the special `text` attribute) can be used as filters, if the attribute type allows the operator. - :type filter: str - :param sort: Sort the products based on attributes and order e.g. `name:asc`. Attributes with scalar types (`createdAt`, `isProductListing`) or keywords (`name`, `deliveryMethod`, `lifecycleState`, `vendor.name`) can be used as sort criteria. To set the sort order, append `asc` (ascending) or `desc` (descending) to the attribute, e.g. `name:asc`. To sort by multiple attributes, separate them with a comma. E.g `name:asc,price:desc`. - :type sort: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1395,14 +1346,13 @@ def list_catalog_products_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /v1/catalog/products is deprecated.", DeprecationWarning) - _param = self._list_catalog_products_serialize( + _param = self._consumers_subscriptions_list_by_organization_serialize( + organization_id=organization_id, cursor=cursor, limit=limit, - locale=locale, - filter=filter, - sort=sort, + product_id=product_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1410,7 +1360,7 @@ def list_catalog_products_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListCatalogProductsResponse", + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -1418,13 +1368,13 @@ def list_catalog_products_without_preload_content( response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_catalog_products_serialize( + def _consumers_subscriptions_list_by_organization_serialize( self, + organization_id, cursor, limit, - locale, - filter, - sort, + product_id, + include_expired, _request_auth, _content_type, _headers, @@ -1443,6 +1393,8 @@ def _list_catalog_products_serialize( _body_params: Optional[bytes] = None # process the path parameters + if organization_id is not None: + _path_params["organizationId"] = organization_id # process the query parameters if cursor is not None: @@ -1452,17 +1404,13 @@ def _list_catalog_products_serialize( _query_params.append(("limit", limit)) - if locale is not None: - - _query_params.append(("locale", locale)) - - if filter is not None: + if product_id is not None: - _query_params.append(("filter", filter)) + _query_params.append(("productId", product_id)) - if sort is not None: + if include_expired is not None: - _query_params.append(("sort", sort)) + _query_params.append(("includeExpired", include_expired)) # process the header parameters # process the form parameters @@ -1477,7 +1425,7 @@ def _list_catalog_products_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1/catalog/products", + resource_path="/v1/consumers/organizations/{organizationId}/subscriptions", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1491,28 +1439,15 @@ def _list_catalog_products_serialize( ) @validate_call - def list_vendor_subscriptions( + def consumers_subscriptions_list_by_project( self, - project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], - cursor: Annotated[ - Optional[StrictStr], - Field( - 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." - ), - ] = None, - limit: Annotated[ - Optional[ - Union[ - Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] - ] - ], - Field( - description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." - ), - ] = None, - product_id: Annotated[ - Optional[Annotated[str, Field(min_length=10, strict=True, max_length=29)]], - Field(description="The product ID."), + project_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), ] = None, _request_timeout: Union[ None, @@ -1523,19 +1458,21 @@ def list_vendor_subscriptions( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListVendorSubscriptionsResponse: - """List all subscriptions of a project. + ) -> MarketplaceSubscriptionV1ListSubscriptionsResponse: + """List all subscriptions of an project. - List all subscriptions of a project. + List all subscriptions of an project. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param cursor: 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. + :param cursor: :type cursor: str - :param limit: The maximum number of items to return in the response. If maximum is exceeded, maximum is used. - :type limit: float - :param product_id: The product ID. + :param limit: + :type limit: int + :param product_id: :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1558,11 +1495,12 @@ def list_vendor_subscriptions( :return: Returns the result object. """ # noqa: E501 - _param = self._list_vendor_subscriptions_serialize( + _param = self._consumers_subscriptions_list_by_project_serialize( project_id=project_id, cursor=cursor, limit=limit, product_id=product_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1570,7 +1508,7 @@ def list_vendor_subscriptions( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListVendorSubscriptionsResponse", + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -1583,28 +1521,15 @@ def list_vendor_subscriptions( ).data @validate_call - def list_vendor_subscriptions_with_http_info( + def consumers_subscriptions_list_by_project_with_http_info( self, - project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], - cursor: Annotated[ - Optional[StrictStr], - Field( - 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." - ), - ] = None, - limit: Annotated[ - Optional[ - Union[ - Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] - ] - ], - Field( - description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." - ), - ] = None, - product_id: Annotated[ - Optional[Annotated[str, Field(min_length=10, strict=True, max_length=29)]], - Field(description="The product ID."), + project_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), ] = None, _request_timeout: Union[ None, @@ -1615,19 +1540,21 @@ def list_vendor_subscriptions_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListVendorSubscriptionsResponse]: - """List all subscriptions of a project. + ) -> ApiResponse[MarketplaceSubscriptionV1ListSubscriptionsResponse]: + """List all subscriptions of an project. - List all subscriptions of a project. + List all subscriptions of an project. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param cursor: 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. + :param cursor: :type cursor: str - :param limit: The maximum number of items to return in the response. If maximum is exceeded, maximum is used. - :type limit: float - :param product_id: The product ID. + :param limit: + :type limit: int + :param product_id: :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1650,11 +1577,12 @@ def list_vendor_subscriptions_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_vendor_subscriptions_serialize( + _param = self._consumers_subscriptions_list_by_project_serialize( project_id=project_id, cursor=cursor, limit=limit, product_id=product_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1662,7 +1590,7 @@ def list_vendor_subscriptions_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListVendorSubscriptionsResponse", + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -1675,28 +1603,15 @@ def list_vendor_subscriptions_with_http_info( ) @validate_call - def list_vendor_subscriptions_without_preload_content( + def consumers_subscriptions_list_by_project_without_preload_content( self, - project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], - cursor: Annotated[ - Optional[StrictStr], - Field( - 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." - ), - ] = None, - limit: Annotated[ - Optional[ - Union[ - Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] - ] - ], - Field( - description="The maximum number of items to return in the response. If maximum is exceeded, maximum is used." - ), - ] = None, - product_id: Annotated[ - Optional[Annotated[str, Field(min_length=10, strict=True, max_length=29)]], - Field(description="The product ID."), + project_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), ] = None, _request_timeout: Union[ None, @@ -1708,18 +1623,20 @@ def list_vendor_subscriptions_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List all subscriptions of a project. + """List all subscriptions of an project. - List all subscriptions of a project. + List all subscriptions of an project. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param cursor: 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. + :param cursor: :type cursor: str - :param limit: The maximum number of items to return in the response. If maximum is exceeded, maximum is used. - :type limit: float - :param product_id: The product ID. + :param limit: + :type limit: int + :param product_id: :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1742,11 +1659,12 @@ def list_vendor_subscriptions_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_vendor_subscriptions_serialize( + _param = self._consumers_subscriptions_list_by_project_serialize( project_id=project_id, cursor=cursor, limit=limit, product_id=product_id, + include_expired=include_expired, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1754,7 +1672,7 @@ def list_vendor_subscriptions_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListVendorSubscriptionsResponse", + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", @@ -1762,12 +1680,13 @@ def list_vendor_subscriptions_without_preload_content( response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_vendor_subscriptions_serialize( + def _consumers_subscriptions_list_by_project_serialize( self, project_id, cursor, limit, product_id, + include_expired, _request_auth, _content_type, _headers, @@ -1801,6 +1720,10 @@ def _list_vendor_subscriptions_serialize( _query_params.append(("productId", product_id)) + if include_expired is not None: + + _query_params.append(("includeExpired", include_expired)) + # process the header parameters # process the form parameters # process the body parameter @@ -1814,7 +1737,7 @@ def _list_vendor_subscriptions_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1/vendors/projects/{projectId}/subscriptions", + resource_path="/v1/consumers/projects/{projectId}/subscriptions", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1828,10 +1751,11 @@ def _list_vendor_subscriptions_serialize( ) @validate_call - def resolve_customer( + def consumers_subscriptions_redirects_get( self, - project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], - resolve_customer_payload: ResolveCustomerPayload, + project_id: StrictStr, + subscription_id: StrictStr, + redirect_target: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1841,15 +1765,17 @@ def resolve_customer( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> VendorSubscription: - """Resolve customer + ) -> MarketplaceSubscriptionV1SubscriptionRedirect: + """Get a subscription redirect. - Get details about the requested subscription. + Get a subscription redirect. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param resolve_customer_payload: (required) - :type resolve_customer_payload: ResolveCustomerPayload + :param subscription_id: (required) + :type subscription_id: str + :param redirect_target: + :type redirect_target: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1872,9 +1798,10 @@ def resolve_customer( :return: Returns the result object. """ # noqa: E501 - _param = self._resolve_customer_serialize( + _param = self._consumers_subscriptions_redirects_get_serialize( project_id=project_id, - resolve_customer_payload=resolve_customer_payload, + subscription_id=subscription_id, + redirect_target=redirect_target, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1882,11 +1809,10 @@ def resolve_customer( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "VendorSubscription", + "200": "MarketplaceSubscriptionV1SubscriptionRedirect", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", - "404": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1896,10 +1822,11 @@ def resolve_customer( ).data @validate_call - def resolve_customer_with_http_info( + def consumers_subscriptions_redirects_get_with_http_info( self, - project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], - resolve_customer_payload: ResolveCustomerPayload, + project_id: StrictStr, + subscription_id: StrictStr, + redirect_target: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1909,15 +1836,17 @@ def resolve_customer_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[VendorSubscription]: - """Resolve customer + ) -> ApiResponse[MarketplaceSubscriptionV1SubscriptionRedirect]: + """Get a subscription redirect. - Get details about the requested subscription. + Get a subscription redirect. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param resolve_customer_payload: (required) - :type resolve_customer_payload: ResolveCustomerPayload + :param subscription_id: (required) + :type subscription_id: str + :param redirect_target: + :type redirect_target: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1940,9 +1869,10 @@ def resolve_customer_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._resolve_customer_serialize( + _param = self._consumers_subscriptions_redirects_get_serialize( project_id=project_id, - resolve_customer_payload=resolve_customer_payload, + subscription_id=subscription_id, + redirect_target=redirect_target, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1950,11 +1880,10 @@ def resolve_customer_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "VendorSubscription", + "200": "MarketplaceSubscriptionV1SubscriptionRedirect", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", - "404": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1964,10 +1893,11 @@ def resolve_customer_with_http_info( ) @validate_call - def resolve_customer_without_preload_content( + def consumers_subscriptions_redirects_get_without_preload_content( self, - project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The project ID.")], - resolve_customer_payload: ResolveCustomerPayload, + project_id: StrictStr, + subscription_id: StrictStr, + redirect_target: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1978,14 +1908,16 @@ def resolve_customer_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Resolve customer + """Get a subscription redirect. - Get details about the requested subscription. + Get a subscription redirect. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param resolve_customer_payload: (required) - :type resolve_customer_payload: ResolveCustomerPayload + :param subscription_id: (required) + :type subscription_id: str + :param redirect_target: + :type redirect_target: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2008,9 +1940,10 @@ def resolve_customer_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._resolve_customer_serialize( + _param = self._consumers_subscriptions_redirects_get_serialize( project_id=project_id, - resolve_customer_payload=resolve_customer_payload, + subscription_id=subscription_id, + redirect_target=redirect_target, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2018,19 +1951,19 @@ def resolve_customer_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "VendorSubscription", + "200": "MarketplaceSubscriptionV1SubscriptionRedirect", "400": "ErrorResponse", "401": "ErrorResponse", "403": "ErrorResponse", - "404": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _resolve_customer_serialize( + def _consumers_subscriptions_redirects_get_serialize( self, project_id, - resolve_customer_payload, + subscription_id, + redirect_target, _request_auth, _content_type, _headers, @@ -2051,31 +1984,1188 @@ def _resolve_customer_serialize( # process the path parameters if project_id is not None: _path_params["projectId"] = project_id + if subscription_id is not None: + _path_params["subscriptionId"] = subscription_id # process the query parameters + if redirect_target is not None: + + _query_params.append(("redirectTarget", redirect_target)) + # process the header parameters # process the form parameters # process the body parameter - if resolve_customer_payload is not None: - _body_params = resolve_customer_payload # set the HTTP header `Accept` if "Accept" not in _header_params: _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) - # set the HTTP header `Content-Type` - if _content_type: - _header_params["Content-Type"] = _content_type - else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) - if _default_content_type is not None: - _header_params["Content-Type"] = _default_content_type - # authentication setting _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="POST", - resource_path="/v1/vendors/projects/{projectId}/resolve-customer", + method="GET", + resource_path="/v1/consumers/projects/{projectId}/subscriptions/{subscriptionId}/redirects", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def resolve_customer( + self, + project_id: StrictStr, + resolve_customer_payload: ResolveCustomerPayload, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MarketplaceSubscriptionV1Subscription: + """Resolve customer. + + Resolve customer. + + :param project_id: (required) + :type project_id: str + :param resolve_customer_payload: (required) + :type resolve_customer_payload: ResolveCustomerPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._resolve_customer_serialize( + project_id=project_id, + resolve_customer_payload=resolve_customer_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1Subscription", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def resolve_customer_with_http_info( + self, + project_id: StrictStr, + resolve_customer_payload: ResolveCustomerPayload, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MarketplaceSubscriptionV1Subscription]: + """Resolve customer. + + Resolve customer. + + :param project_id: (required) + :type project_id: str + :param resolve_customer_payload: (required) + :type resolve_customer_payload: ResolveCustomerPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._resolve_customer_serialize( + project_id=project_id, + resolve_customer_payload=resolve_customer_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1Subscription", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def resolve_customer_without_preload_content( + self, + project_id: StrictStr, + resolve_customer_payload: ResolveCustomerPayload, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Resolve customer. + + Resolve customer. + + :param project_id: (required) + :type project_id: str + :param resolve_customer_payload: (required) + :type resolve_customer_payload: ResolveCustomerPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._resolve_customer_serialize( + project_id=project_id, + resolve_customer_payload=resolve_customer_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1Subscription", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _resolve_customer_serialize( + self, + project_id, + resolve_customer_payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if resolve_customer_payload is not None: + _body_params = resolve_customer_payload + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1/vendors/projects/{projectId}/resolve-customer", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def vendors_subscriptions_get( + self, + project_id: StrictStr, + subscription_id: StrictStr, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MarketplaceSubscriptionV1Subscription: + """Get a subscription. + + Get a subscription. + + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_get_serialize( + project_id=project_id, + subscription_id=subscription_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1Subscription", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def vendors_subscriptions_get_with_http_info( + self, + project_id: StrictStr, + subscription_id: StrictStr, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MarketplaceSubscriptionV1Subscription]: + """Get a subscription. + + Get a subscription. + + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_get_serialize( + project_id=project_id, + subscription_id=subscription_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1Subscription", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def vendors_subscriptions_get_without_preload_content( + self, + project_id: StrictStr, + subscription_id: StrictStr, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a subscription. + + Get a subscription. + + :param project_id: (required) + :type project_id: str + :param subscription_id: (required) + :type subscription_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_get_serialize( + project_id=project_id, + subscription_id=subscription_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1Subscription", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _vendors_subscriptions_get_serialize( + self, + project_id, + subscription_id, + include_expired, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if subscription_id is not None: + _path_params["subscriptionId"] = subscription_id + # process the query parameters + if include_expired is not None: + + _query_params.append(("includeExpired", include_expired)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/vendors/projects/{projectId}/subscriptions/{subscriptionId}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def vendors_subscriptions_list_by_organization( + self, + organization_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MarketplaceSubscriptionV1ListSubscriptionsResponse: + """List all subscriptions of an organization. + + List all subscriptions of an organization. + + :param organization_id: (required) + :type organization_id: str + :param cursor: + :type cursor: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_list_by_organization_serialize( + organization_id=organization_id, + cursor=cursor, + limit=limit, + product_id=product_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def vendors_subscriptions_list_by_organization_with_http_info( + self, + organization_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MarketplaceSubscriptionV1ListSubscriptionsResponse]: + """List all subscriptions of an organization. + + List all subscriptions of an organization. + + :param organization_id: (required) + :type organization_id: str + :param cursor: + :type cursor: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_list_by_organization_serialize( + organization_id=organization_id, + cursor=cursor, + limit=limit, + product_id=product_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def vendors_subscriptions_list_by_organization_without_preload_content( + self, + organization_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all subscriptions of an organization. + + List all subscriptions of an organization. + + :param organization_id: (required) + :type organization_id: str + :param cursor: + :type cursor: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_list_by_organization_serialize( + organization_id=organization_id, + cursor=cursor, + limit=limit, + product_id=product_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _vendors_subscriptions_list_by_organization_serialize( + self, + organization_id, + cursor, + limit, + product_id, + include_expired, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if organization_id is not None: + _path_params["organizationId"] = organization_id + # process the query parameters + if cursor is not None: + + _query_params.append(("cursor", cursor)) + + if limit is not None: + + _query_params.append(("limit", limit)) + + if product_id is not None: + + _query_params.append(("productId", product_id)) + + if include_expired is not None: + + _query_params.append(("includeExpired", include_expired)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/vendors/organizations/{organizationId}/subscriptions", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def vendors_subscriptions_list_by_project( + self, + project_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MarketplaceSubscriptionV1ListSubscriptionsResponse: + """List all subscriptions of an project. + + List all subscriptions of an project. + + :param project_id: (required) + :type project_id: str + :param cursor: + :type cursor: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_list_by_project_serialize( + project_id=project_id, + cursor=cursor, + limit=limit, + product_id=product_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def vendors_subscriptions_list_by_project_with_http_info( + self, + project_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MarketplaceSubscriptionV1ListSubscriptionsResponse]: + """List all subscriptions of an project. + + List all subscriptions of an project. + + :param project_id: (required) + :type project_id: str + :param cursor: + :type cursor: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_list_by_project_serialize( + project_id=project_id, + cursor=cursor, + limit=limit, + product_id=product_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def vendors_subscriptions_list_by_project_without_preload_content( + self, + project_id: StrictStr, + cursor: Optional[StrictStr] = None, + limit: Optional[StrictInt] = None, + product_id: Optional[StrictStr] = None, + include_expired: Annotated[ + Optional[StrictBool], + Field(description="Flag to control if cancelled or rejected subscriptions should be returned."), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all subscriptions of an project. + + List all subscriptions of an project. + + :param project_id: (required) + :type project_id: str + :param cursor: + :type cursor: str + :param limit: + :type limit: int + :param product_id: + :type product_id: str + :param include_expired: Flag to control if cancelled or rejected subscriptions should be returned. + :type include_expired: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._vendors_subscriptions_list_by_project_serialize( + project_id=project_id, + cursor=cursor, + limit=limit, + product_id=product_id, + include_expired=include_expired, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "MarketplaceSubscriptionV1ListSubscriptionsResponse", + "400": "ErrorResponse", + "401": "ErrorResponse", + "403": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _vendors_subscriptions_list_by_project_serialize( + self, + project_id, + cursor, + limit, + product_id, + include_expired, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + # process the query parameters + if cursor is not None: + + _query_params.append(("cursor", cursor)) + + if limit is not None: + + _query_params.append(("limit", limit)) + + if product_id is not None: + + _query_params.append(("productId", product_id)) + + if include_expired is not None: + + _query_params.append(("includeExpired", include_expired)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/vendors/projects/{projectId}/subscriptions", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2091,10 +3181,8 @@ def _resolve_customer_serialize( @validate_call def vendors_subscriptions_reject( self, - 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.") - ], + project_id: StrictStr, + subscription_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2105,13 +3193,13 @@ def vendors_subscriptions_reject( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> None: - """Reject a subscription + """Reject a subscription. Reject a subscription (in any lifecycle state). Only available for subscriptions to products with lifecycle state `PRODUCT_PREVIEW`. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) + :param subscription_id: (required) :type subscription_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -2161,10 +3249,8 @@ def vendors_subscriptions_reject( @validate_call def vendors_subscriptions_reject_with_http_info( self, - 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.") - ], + project_id: StrictStr, + subscription_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2175,13 +3261,13 @@ def vendors_subscriptions_reject_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[None]: - """Reject a subscription + """Reject a subscription. Reject a subscription (in any lifecycle state). Only available for subscriptions to products with lifecycle state `PRODUCT_PREVIEW`. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) + :param subscription_id: (required) :type subscription_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -2231,10 +3317,8 @@ def vendors_subscriptions_reject_with_http_info( @validate_call def vendors_subscriptions_reject_without_preload_content( self, - 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.") - ], + project_id: StrictStr, + subscription_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2245,13 +3329,13 @@ def vendors_subscriptions_reject_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Reject a subscription + """Reject a subscription. Reject a subscription (in any lifecycle state). Only available for subscriptions to products with lifecycle state `PRODUCT_PREVIEW`. - :param project_id: The project ID. (required) + :param project_id: (required) :type project_id: str - :param subscription_id: The subscription ID. (required) + :param subscription_id: (required) :type subscription_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/api_client.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/api_client.py index a1bf16fc9..383cca329 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/api_client.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/api_client.py @@ -13,11 +13,13 @@ """ # noqa: E501 import datetime +import decimal import json import mimetypes import os import re import tempfile +import uuid from enum import Enum from typing import Dict, List, Optional, Tuple, Union from urllib.parse import quote @@ -64,8 +66,11 @@ class ApiClient: "bool": bool, "date": datetime.date, "datetime": datetime.datetime, + "decimal": decimal.Decimal, + "UUID": uuid.UUID, "object": object, } + _pool = None def __init__(self, configuration, header_name=None, header_value=None, cookie=None) -> None: self.config: Configuration = configuration @@ -262,13 +267,13 @@ def response_deserialize( response_text = None return_data = None try: - if response_type == "bytearray": + if response_type in ("bytearray", "bytes"): return_data = response_data.data elif response_type == "file": return_data = self.__deserialize_file(response_data) elif response_type is not None: match = None - content_type = response_data.getheader("content-type") + content_type = response_data.headers.get("content-type") if content_type is not None: match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) encoding = match.group(1) if match else "utf-8" @@ -285,7 +290,7 @@ def response_deserialize( return ApiResponse( status_code=response_data.status, data=return_data, - headers=response_data.getheaders(), + headers=response_data.headers, raw_data=response_data.data, ) @@ -297,6 +302,7 @@ def sanitize_for_serialization(self, obj): If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. @@ -312,31 +318,30 @@ def sanitize_for_serialization(self, obj): return obj.get_secret_value() elif isinstance(obj, self.PRIMITIVE_TYPES): return obj + elif isinstance(obj, uuid.UUID): + return str(obj) elif isinstance(obj, list): return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] elif isinstance(obj, tuple): return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() - + elif isinstance(obj, decimal.Decimal): + return str(obj) elif isinstance(obj, dict): - obj_dict = obj + return {key: self.sanitize_for_serialization(val) for key, val in obj.items()} + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009 + obj_dict = obj.to_dict() else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - if hasattr(obj, "to_dict") and callable(obj.to_dict): - obj_dict = obj.to_dict() - else: - obj_dict = obj.__dict__ - - if isinstance(obj_dict, list): - # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501 - return self.sanitize_for_serialization(obj_dict) + obj_dict = obj.__dict__ - return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} + return self.sanitize_for_serialization(obj_dict) def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. @@ -355,7 +360,7 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE): + elif re.match(r"^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE): if response_text == "": data = "" else: @@ -401,12 +406,16 @@ def __deserialize(self, data, klass): if klass in self.PRIMITIVE_TYPES: return self.__deserialize_primitive(data, klass) - elif klass == object: + elif klass is object: return self.__deserialize_object(data) - elif klass == datetime.date: + elif klass is datetime.date: return self.__deserialize_date(data) - elif klass == datetime.datetime: + elif klass is datetime.datetime: return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: @@ -554,12 +563,14 @@ def __deserialize_file(self, response): os.close(fd) os.remove(path) - content_disposition = response.getheader("Content-Disposition") + content_disposition = response.headers.get("Content-Disposition") if content_disposition: m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition) if m is None: raise ValueError("Unexpected 'content-disposition' header value") - filename = m.group(1) + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/exceptions.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/exceptions.py index b6368ea89..26f4e636c 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/exceptions.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/exceptions.py @@ -130,7 +130,7 @@ def __init__( self.body = http_resp.data.decode("utf-8") except Exception: # noqa: S110 pass - self.headers = http_resp.getheaders() + self.headers = http_resp.headers @classmethod def from_response( diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py index 903487230..59bbbeb72 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py @@ -13,95 +13,35 @@ Do not edit the class manually. """ # noqa: E501 - # import models into model package from stackit.stackitmarketplace.models.approve_subscription_payload import ( ApproveSubscriptionPayload, ) -from stackit.stackitmarketplace.models.assets import Assets -from stackit.stackitmarketplace.models.assets_end_user_license_agreement import ( - AssetsEndUserLicenseAgreement, -) -from stackit.stackitmarketplace.models.assets_product_description import ( - AssetsProductDescription, -) -from stackit.stackitmarketplace.models.assets_service_level_agreement import ( - AssetsServiceLevelAgreement, -) -from stackit.stackitmarketplace.models.become_vendor import BecomeVendor -from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import ( - CatalogPricingOptionHighlight, -) -from stackit.stackitmarketplace.models.catalog_product_detail import ( - CatalogProductDetail, -) -from stackit.stackitmarketplace.models.catalog_product_details_vendor import ( - CatalogProductDetailsVendor, -) -from stackit.stackitmarketplace.models.catalog_product_facets_value_inner import ( - CatalogProductFacetsValueInner, +from stackit.stackitmarketplace.models.consumers_subscriptions_create_payload import ( + ConsumersSubscriptionsCreatePayload, ) -from stackit.stackitmarketplace.models.catalog_product_highlight import ( - CatalogProductHighlight, -) -from stackit.stackitmarketplace.models.catalog_product_overview import ( - CatalogProductOverview, -) -from stackit.stackitmarketplace.models.catalog_product_overview_vendor import ( - CatalogProductOverviewVendor, -) -from stackit.stackitmarketplace.models.catalog_product_pricing_option import ( - CatalogProductPricingOption, -) -from stackit.stackitmarketplace.models.catalog_product_support_resource import ( - CatalogProductSupportResource, -) -from stackit.stackitmarketplace.models.catalog_product_vendor_terms import ( - CatalogProductVendorTerms, -) -from stackit.stackitmarketplace.models.contact_sales import ContactSales -from stackit.stackitmarketplace.models.delivery_method import DeliveryMethod from stackit.stackitmarketplace.models.error_response import ErrorResponse -from stackit.stackitmarketplace.models.free_trial import FreeTrial -from stackit.stackitmarketplace.models.inquiries_create_inquiry_payload import ( - InquiriesCreateInquiryPayload, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_assets import ( + MarketplaceSubscriptionV1Assets, ) -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.marketplace_subscription_v1_file import ( + MarketplaceSubscriptionV1File, ) -from stackit.stackitmarketplace.models.inquiry_request_private_plan import ( - InquiryRequestPrivatePlan, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_file_localized_version import ( + MarketplaceSubscriptionV1FileLocalizedVersion, ) -from stackit.stackitmarketplace.models.inquiry_suggest_product import ( - InquirySuggestProduct, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_list_subscriptions_response import ( + MarketplaceSubscriptionV1ListSubscriptionsResponse, ) -from stackit.stackitmarketplace.models.list_catalog_products_response import ( - ListCatalogProductsResponse, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription import ( + MarketplaceSubscriptionV1Subscription, ) -from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import ( - ListVendorSubscriptionsResponse, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription_product import ( + MarketplaceSubscriptionV1SubscriptionProduct, ) -from stackit.stackitmarketplace.models.localized_version import LocalizedVersion -from stackit.stackitmarketplace.models.notice_period import NoticePeriod -from stackit.stackitmarketplace.models.offer_type import OfferType -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.marketplace_subscription_v1_subscription_redirect import ( + MarketplaceSubscriptionV1SubscriptionRedirect, ) -from stackit.stackitmarketplace.models.register_testing import RegisterTesting -from stackit.stackitmarketplace.models.request_private_plan import RequestPrivatePlan from stackit.stackitmarketplace.models.resolve_customer_payload import ( ResolveCustomerPayload, ) -from stackit.stackitmarketplace.models.scope import Scope -from stackit.stackitmarketplace.models.service_certificate import ServiceCertificate -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.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 1745229e8..66d9a5068 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/approve_subscription_payload.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/approve_subscription_payload.py @@ -16,11 +16,11 @@ import json import pprint -import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, field_validator -from typing_extensions import Annotated, Self +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python +from typing_extensions import Self class ApproveSubscriptionPayload(BaseModel): @@ -28,27 +28,16 @@ class ApproveSubscriptionPayload(BaseModel): ApproveSubscriptionPayload """ # noqa: E501 - instance_target: Optional[Annotated[str, Field(strict=True, max_length=512)]] = Field( + instance_target: Optional[StrictStr] = 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_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -59,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_product_description.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_product_description.py deleted file mode 100644 index 28c27e1f6..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_product_description.py +++ /dev/null @@ -1,89 +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 - -from __future__ import annotations - -import json -import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - -from stackit.stackitmarketplace.models.localized_version import LocalizedVersion - - -class AssetsProductDescription(BaseModel): - """ - The related product description of the (subscription) product. - """ # noqa: E501 - - version: Optional[LocalizedVersion] = None - __properties: ClassVar[List[str]] = ["version"] - - 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 AssetsProductDescription 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 version - if self.version: - _dict["version"] = self.version.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AssetsProductDescription from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"version": LocalizedVersion.from_dict(obj["version"]) if obj.get("version") is not None else None} - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_service_level_agreement.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_service_level_agreement.py deleted file mode 100644 index 7c5a9f475..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_service_level_agreement.py +++ /dev/null @@ -1,89 +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 - -from __future__ import annotations - -import json -import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - -from stackit.stackitmarketplace.models.localized_version import LocalizedVersion - - -class AssetsServiceLevelAgreement(BaseModel): - """ - The related service level agreement of the (subscription) product. - """ # noqa: E501 - - version: Optional[LocalizedVersion] = None - __properties: ClassVar[List[str]] = ["version"] - - 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 AssetsServiceLevelAgreement 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 version - if self.version: - _dict["version"] = self.version.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AssetsServiceLevelAgreement from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"version": LocalizedVersion.from_dict(obj["version"]) if obj.get("version") is not None else None} - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor.py deleted file mode 100644 index f6bda7972..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/become_vendor.py +++ /dev/null @@ -1,96 +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 - -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.inquiry_become_vendor import InquiryBecomeVendor -from stackit.stackitmarketplace.models.inquiry_form_type import InquiryFormType - - -class BecomeVendor(BaseModel): - """ - Become a Vendor. - """ # noqa: E501 - - become_vendor: InquiryBecomeVendor = Field(alias="becomeVendor") - type: InquiryFormType - __properties: ClassVar[List[str]] = ["becomeVendor", "type"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of BecomeVendor 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 become_vendor - if self.become_vendor: - _dict["becomeVendor"] = self.become_vendor.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of BecomeVendor from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "becomeVendor": ( - InquiryBecomeVendor.from_dict(obj["becomeVendor"]) if obj.get("becomeVendor") is not None else None - ), - "type": obj.get("type"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py deleted file mode 100644 index b225a6b69..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py +++ /dev/null @@ -1,328 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import ( - BaseModel, - ConfigDict, - Field, - StrictBool, - StrictStr, - field_validator, -) -from typing_extensions import Annotated, Self - -from stackit.stackitmarketplace.models.assets import Assets -from stackit.stackitmarketplace.models.catalog_product_details_vendor import ( - CatalogProductDetailsVendor, -) -from stackit.stackitmarketplace.models.catalog_product_highlight import ( - CatalogProductHighlight, -) -from stackit.stackitmarketplace.models.catalog_product_pricing_option import ( - CatalogProductPricingOption, -) -from stackit.stackitmarketplace.models.catalog_product_support_resource import ( - CatalogProductSupportResource, -) -from stackit.stackitmarketplace.models.catalog_product_vendor_terms import ( - CatalogProductVendorTerms, -) -from stackit.stackitmarketplace.models.delivery_method import DeliveryMethod -from stackit.stackitmarketplace.models.offer_type import OfferType -from stackit.stackitmarketplace.models.product_lifecycle_state import ( - ProductLifecycleState, -) - - -class CatalogProductDetail(BaseModel): - """ - CatalogProductDetail - """ # noqa: E501 - - assets: Optional[Assets] = None - categories: Optional[List[StrictStr]] = Field( - default=None, description="The list of categories associated to the product." - ) - delivery_method: DeliveryMethod = Field(alias="deliveryMethod") - demo_url: Optional[Annotated[str, Field(strict=True, max_length=512)]] = Field( - default=None, description="The URL to a demo if available.", alias="demoUrl" - ) - description: StrictStr = Field(description="The product description.") - 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.") - has_demo: Optional[StrictBool] = Field( - default=None, description="If the product has a demoUrl available.", alias="hasDemo" - ) - has_private_plan_option: Optional[StrictBool] = Field( - default=None, description="If the product has a private plan option.", alias="hasPrivatePlanOption" - ) - highlights: List[CatalogProductHighlight] = Field(description="The list of highlights.") - industries: Optional[List[StrictStr]] = Field( - default=None, description="The list of industries associated to the product." - ) - is_product_listing: Optional[StrictBool] = Field( - default=None, - description="If true, the product is not fully integrated but only listed. Product listings may not have prices and support information. Deprecated: Will be removed after 16.12.2025. Please use `offerType` as replacement.", - alias="isProductListing", - ) - lifecycle_state: ProductLifecycleState = Field(alias="lifecycleState") - logo: StrictStr = Field(description="The logo information.") - name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The name of the product.") - offer_type: OfferType = Field(alias="offerType") - pricing_options: List[CatalogProductPricingOption] = Field( - description="The list of pricing options.", alias="pricingOptions" - ) - product_id: Annotated[str, Field(min_length=10, strict=True, max_length=29)] = Field( - description="The user-readable product ID.", alias="productId" - ) - summary: StrictStr = Field(description="The short summary of the product.") - support_faq: Optional[Annotated[str, Field(strict=True, max_length=512)]] = 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" - ) - support_resources: Optional[List[CatalogProductSupportResource]] = Field( - default=None, description="The list of support resources.", alias="supportResources" - ) - vendor: CatalogProductDetailsVendor - vendor_terms: Optional[List[CatalogProductVendorTerms]] = Field( - default=None, description="The list of terms of use.", alias="vendorTerms" - ) - video_url: Annotated[str, Field(strict=True, max_length=512)] = Field( - description="The video URL.", alias="videoUrl" - ) - __properties: ClassVar[List[str]] = [ - "assets", - "categories", - "deliveryMethod", - "demoUrl", - "description", - "documentationUrl", - "email", - "hasDemo", - "hasPrivatePlanOption", - "highlights", - "industries", - "isProductListing", - "lifecycleState", - "logo", - "name", - "offerType", - "pricingOptions", - "productId", - "summary", - "supportFaq", - "supportPhone", - "supportResources", - "vendor", - "vendorTerms", - "videoUrl", - ] - - @field_validator("demo_url") - def demo_url_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("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("product_id") - def product_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[a-z0-9-]{1,20}-[0-9a-f]{8}$", value): - raise ValueError(r"must validate the regular expression /^[a-z0-9-]{1,20}-[0-9a-f]{8}$/") - 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("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( - 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 CatalogProductDetail 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 assets - if self.assets: - _dict["assets"] = self.assets.to_dict() - # override the default output from pydantic by calling `to_dict()` of each item in highlights (list) - _items = [] - if self.highlights: - for _item in self.highlights: - if _item: - _items.append(_item.to_dict()) - _dict["highlights"] = _items - # override the default output from pydantic by calling `to_dict()` of each item in pricing_options (list) - _items = [] - if self.pricing_options: - for _item in self.pricing_options: - if _item: - _items.append(_item.to_dict()) - _dict["pricingOptions"] = _items - # override the default output from pydantic by calling `to_dict()` of each item in support_resources (list) - _items = [] - if self.support_resources: - for _item in self.support_resources: - if _item: - _items.append(_item.to_dict()) - _dict["supportResources"] = _items - # override the default output from pydantic by calling `to_dict()` of vendor - if self.vendor: - _dict["vendor"] = self.vendor.to_dict() - # override the default output from pydantic by calling `to_dict()` of each item in vendor_terms (list) - _items = [] - if self.vendor_terms: - for _item in self.vendor_terms: - if _item: - _items.append(_item.to_dict()) - _dict["vendorTerms"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CatalogProductDetail from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "assets": Assets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, - "categories": obj.get("categories"), - "deliveryMethod": obj.get("deliveryMethod"), - "demoUrl": obj.get("demoUrl"), - "description": obj.get("description"), - "documentationUrl": obj.get("documentationUrl"), - "email": obj.get("email"), - "hasDemo": obj.get("hasDemo"), - "hasPrivatePlanOption": obj.get("hasPrivatePlanOption"), - "highlights": ( - [CatalogProductHighlight.from_dict(_item) for _item in obj["highlights"]] - if obj.get("highlights") is not None - else None - ), - "industries": obj.get("industries"), - "isProductListing": obj.get("isProductListing"), - "lifecycleState": obj.get("lifecycleState"), - "logo": obj.get("logo"), - "name": obj.get("name"), - "offerType": obj.get("offerType"), - "pricingOptions": ( - [CatalogProductPricingOption.from_dict(_item) for _item in obj["pricingOptions"]] - if obj.get("pricingOptions") is not None - else None - ), - "productId": obj.get("productId"), - "summary": obj.get("summary"), - "supportFaq": obj.get("supportFaq"), - "supportPhone": obj.get("supportPhone"), - "supportResources": ( - [CatalogProductSupportResource.from_dict(_item) for _item in obj["supportResources"]] - if obj.get("supportResources") is not None - else None - ), - "vendor": ( - CatalogProductDetailsVendor.from_dict(obj["vendor"]) if obj.get("vendor") is not None else None - ), - "vendorTerms": ( - [CatalogProductVendorTerms.from_dict(_item) for _item in obj["vendorTerms"]] - if obj.get("vendorTerms") is not None - else None - ), - "videoUrl": obj.get("videoUrl"), - } - ) - return _obj 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 deleted file mode 100644 index be367953b..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_details_vendor.py +++ /dev/null @@ -1,137 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - - -class CatalogProductDetailsVendor(BaseModel): - """ - CatalogProductDetailsVendor - """ # noqa: E501 - - description: StrictStr = Field(description="The vendor description.") - logo: StrictStr = Field(description="The logo information.") - name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The product's vendor name.") - vendor_id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field( - description="Universally Unique Identifier (UUID).", 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("vendor_id") - def vendor_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value): - raise ValueError( - r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/" - ) - 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, - 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 CatalogProductDetailsVendor 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 CatalogProductDetailsVendor from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "description": obj.get("description"), - "logo": obj.get("logo"), - "name": obj.get("name"), - "vendorId": obj.get("vendorId"), - "videoUrl": obj.get("videoUrl"), - "websiteUrl": obj.get("websiteUrl"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview.py deleted file mode 100644 index 71a47beb9..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview.py +++ /dev/null @@ -1,150 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, 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.free_trial import FreeTrial -from stackit.stackitmarketplace.models.product_lifecycle_state import ( - ProductLifecycleState, -) - - -class CatalogProductOverview(BaseModel): - """ - CatalogProductOverview - """ # noqa: E501 - - delivery_method: DeliveryMethod = Field(alias="deliveryMethod") - free_trial: Optional[FreeTrial] = Field(default=None, alias="freeTrial") - lifecycle_state: ProductLifecycleState = Field(alias="lifecycleState") - logo: Optional[StrictStr] = Field(default=None, description="The logo information.") - name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The name of the product.") - product_id: Annotated[str, Field(min_length=10, strict=True, max_length=29)] = Field( - description="The user-readable product ID.", 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", - "freeTrial", - "lifecycleState", - "logo", - "name", - "productId", - "summary", - "vendor", - ] - - @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("product_id") - def product_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[a-z0-9-]{1,20}-[0-9a-f]{8}$", value): - raise ValueError(r"must validate the regular expression /^[a-z0-9-]{1,20}-[0-9a-f]{8}$/") - return value - - @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( - 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 CatalogProductOverview 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 free_trial - if self.free_trial: - _dict["freeTrial"] = self.free_trial.to_dict() - # override the default output from pydantic by calling `to_dict()` of vendor - if self.vendor: - _dict["vendor"] = self.vendor.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CatalogProductOverview from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "deliveryMethod": obj.get("deliveryMethod"), - "freeTrial": FreeTrial.from_dict(obj["freeTrial"]) if obj.get("freeTrial") is not None else None, - "lifecycleState": obj.get("lifecycleState"), - "logo": obj.get("logo"), - "name": obj.get("name"), - "productId": obj.get("productId"), - "summary": obj.get("summary"), - "vendor": ( - CatalogProductOverviewVendor.from_dict(obj["vendor"]) if obj.get("vendor") is not None else None - ), - } - ) - return _obj 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 deleted file mode 100644 index 0a2eeb48e..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_overview_vendor.py +++ /dev/null @@ -1,116 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, field_validator -from typing_extensions import Annotated, Self - - -class CatalogProductOverviewVendor(BaseModel): - """ - CatalogProductOverviewVendor - """ # noqa: E501 - - name: Annotated[str, Field(strict=True, max_length=512)] = Field(description="The product's vendor name.") - vendor_id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field( - description="Universally Unique Identifier (UUID).", 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("vendor_id") - def vendor_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value): - raise ValueError( - r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/" - ) - 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, - 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 CatalogProductOverviewVendor 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 CatalogProductOverviewVendor from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"name": obj.get("name"), "vendorId": obj.get("vendorId"), "websiteUrl": obj.get("websiteUrl")} - ) - return _obj 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 deleted file mode 100644 index c429dba6b..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_pricing_option.py +++ /dev/null @@ -1,162 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - -from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import ( - CatalogPricingOptionHighlight, -) -from stackit.stackitmarketplace.models.notice_period import NoticePeriod -from stackit.stackitmarketplace.models.price_type import PriceType -from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit -from stackit.stackitmarketplace.models.scope import Scope - - -class CatalogProductPricingOption(BaseModel): - """ - CatalogProductPricingOption - """ # noqa: E501 - - 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.") - notice_period: Optional[NoticePeriod] = Field(default=None, alias="noticePeriod") - plan_id: Annotated[str, Field(min_length=10, strict=True, max_length=29)] = Field( - description="The user-readable plan ID of a pricing option.", alias="planId" - ) - price_type: Optional[PriceType] = Field(default=None, alias="priceType") - pricing_plan: Optional[StrictStr] = Field( - default=None, description="Additional price type information.", alias="pricingPlan" - ) - rate: Optional[StrictStr] = Field(default=None, description="The price of the product (per unit).") - scope: Scope - sku: StrictStr = Field(description="The concrete variant of the product.") - sku_info: StrictStr = Field(description="Short description of this offering.", alias="skuInfo") - sku_info_details: StrictStr = Field( - description="More details about what this offering entails.", alias="skuInfoDetails" - ) - unit: Optional[PricingOptionUnit] = None - __properties: ClassVar[List[str]] = [ - "description", - "highlights", - "name", - "noticePeriod", - "planId", - "priceType", - "pricingPlan", - "rate", - "scope", - "sku", - "skuInfo", - "skuInfoDetails", - "unit", - ] - - @field_validator("plan_id") - def plan_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[a-z0-9-]{1,20}-[0-9a-f]{8}$", value): - raise ValueError(r"must validate the regular expression /^[a-z0-9-]{1,20}-[0-9a-f]{8}$/") - 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 CatalogProductPricingOption from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in highlights (list) - _items = [] - if self.highlights: - for _item in self.highlights: - if _item: - _items.append(_item.to_dict()) - _dict["highlights"] = _items - # override the default output from pydantic by calling `to_dict()` of notice_period - if self.notice_period: - _dict["noticePeriod"] = self.notice_period.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CatalogProductPricingOption from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "description": obj.get("description"), - "highlights": ( - [CatalogPricingOptionHighlight.from_dict(_item) for _item in obj["highlights"]] - if obj.get("highlights") is not None - else None - ), - "name": obj.get("name"), - "noticePeriod": ( - NoticePeriod.from_dict(obj["noticePeriod"]) if obj.get("noticePeriod") is not None else None - ), - "planId": obj.get("planId"), - "priceType": obj.get("priceType"), - "pricingPlan": obj.get("pricingPlan"), - "rate": obj.get("rate"), - "scope": obj.get("scope"), - "sku": obj.get("sku"), - "skuInfo": obj.get("skuInfo"), - "skuInfoDetails": obj.get("skuInfoDetails"), - "unit": obj.get("unit"), - } - ) - return _obj 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 deleted file mode 100644 index c6d41fe02..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_support_resource.py +++ /dev/null @@ -1,102 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - - -class CatalogProductSupportResource(BaseModel): - """ - CatalogProductSupportResource - """ # noqa: E501 - - 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( - default=None, description="The support resource link title.", alias="supportLinkTitle" - ) - __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, - 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 CatalogProductSupportResource 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 CatalogProductSupportResource from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"supportLink": obj.get("supportLink"), "supportLinkTitle": obj.get("supportLinkTitle")} - ) - return _obj 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 deleted file mode 100644 index 4ce8c6ba5..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_vendor_terms.py +++ /dev/null @@ -1,96 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - - -class CatalogProductVendorTerms(BaseModel): - """ - CatalogProductVendorTerms - """ # noqa: E501 - - 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, - 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 CatalogProductVendorTerms 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 CatalogProductVendorTerms from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"description": obj.get("description"), "title": obj.get("title"), "url": obj.get("url")} - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_highlight.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/consumers_subscriptions_create_payload.py similarity index 64% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_highlight.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/consumers_subscriptions_create_payload.py index da37abb74..a8b5abaa3 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_highlight.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/consumers_subscriptions_create_payload.py @@ -19,25 +19,27 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self -class CatalogProductHighlight(BaseModel): +class ConsumersSubscriptionsCreatePayload(BaseModel): """ - CatalogProductHighlight + ConsumersSubscriptionsCreatePayload """ # noqa: E501 - highlight_content: Optional[StrictStr] = Field( - default=None, description="The highlight content.", alias="highlightContent" + consumer_notification_email: Optional[StrictStr] = Field( + default=None, + description="An E-Mail address the vendor can reach the consuer about subscription updates.", + alias="consumerNotificationEmail", ) - highlight_icon: Optional[StrictStr] = Field(default=None, description="The highlight icon.", alias="highlightIcon") - highlight_title: Optional[StrictStr] = Field( - default=None, description="The highlight title.", alias="highlightTitle" - ) - __properties: ClassVar[List[str]] = ["highlightContent", "highlightIcon", "highlightTitle"] + product_id: StrictStr = Field(description="The user-readable ID of the product.", alias="productId") + sku: StrictStr = Field(description="The concrete variant of the product.") + __properties: ClassVar[List[str]] = ["consumerNotificationEmail", "productId", "sku"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,12 +50,11 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CatalogProductHighlight from a JSON string""" + """Create an instance of ConsumersSubscriptionsCreatePayload from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -77,7 +78,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CatalogProductHighlight from a dict""" + """Create an instance of ConsumersSubscriptionsCreatePayload from a dict""" if obj is None: return None @@ -86,9 +87,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { - "highlightContent": obj.get("highlightContent"), - "highlightIcon": obj.get("highlightIcon"), - "highlightTitle": obj.get("highlightTitle"), + "consumerNotificationEmail": obj.get("consumerNotificationEmail"), + "productId": obj.get("productId"), + "sku": obj.get("sku"), } ) return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales.py deleted file mode 100644 index 4fdc2c655..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/contact_sales.py +++ /dev/null @@ -1,96 +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 - -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.inquiry_contact_sales import InquiryContactSales -from stackit.stackitmarketplace.models.inquiry_form_type import InquiryFormType - - -class ContactSales(BaseModel): - """ - Contact sales. - """ # noqa: E501 - - contact_sales: InquiryContactSales = Field(alias="contactSales") - type: InquiryFormType - __properties: ClassVar[List[str]] = ["contactSales", "type"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ContactSales 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 contact_sales - if self.contact_sales: - _dict["contactSales"] = self.contact_sales.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ContactSales from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "contactSales": ( - InquiryContactSales.from_dict(obj["contactSales"]) if obj.get("contactSales") is not None else None - ), - "type": obj.get("type"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/delivery_method.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/delivery_method.py deleted file mode 100644 index 4b594f3d5..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/delivery_method.py +++ /dev/null @@ -1,39 +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 - -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/error_response.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/error_response.py index 37d82a26c..9a3f8e49a 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/error_response.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/error_response.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -50,7 +51,8 @@ def time_stamp_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -61,8 +63,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/free_trial.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/free_trial.py deleted file mode 100644 index f8f76d4e1..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/free_trial.py +++ /dev/null @@ -1,82 +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 - -from __future__ import annotations - -import json -import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, StrictInt -from typing_extensions import Self - - -class FreeTrial(BaseModel): - """ - The amount of days of free trial highlighted in the product card. - """ # noqa: E501 - - value: Optional[StrictInt] = None - __properties: ClassVar[List[str]] = ["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 FreeTrial 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 FreeTrial from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({"value": obj.get("value")}) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiries_create_inquiry_payload.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiries_create_inquiry_payload.py deleted file mode 100644 index 23b837d48..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiries_create_inquiry_payload.py +++ /dev/null @@ -1,209 +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 - -from __future__ import annotations - -import json -import pprint -from typing import Any, Dict, Optional, Set, Union - -from pydantic import ( - BaseModel, - ConfigDict, - ValidationError, - field_validator, -) -from typing_extensions import Self - -from stackit.stackitmarketplace.models.become_vendor import BecomeVendor -from stackit.stackitmarketplace.models.contact_sales import ContactSales -from stackit.stackitmarketplace.models.register_testing import RegisterTesting -from stackit.stackitmarketplace.models.request_private_plan import RequestPrivatePlan -from stackit.stackitmarketplace.models.suggest_product import SuggestProduct - - -INQUIRIESCREATEINQUIRYPAYLOAD_ONE_OF_SCHEMAS = [ - "BecomeVendor", - "ContactSales", - "RegisterTesting", - "RequestPrivatePlan", - "SuggestProduct", -] - - -class InquiriesCreateInquiryPayload(BaseModel): - """ - InquiriesCreateInquiryPayload - """ - - # data type: SuggestProduct - oneof_schema_1_validator: Optional[SuggestProduct] = None - # data type: ContactSales - oneof_schema_2_validator: Optional[ContactSales] = None - # data type: BecomeVendor - oneof_schema_3_validator: Optional[BecomeVendor] = None - # data type: RequestPrivatePlan - oneof_schema_4_validator: Optional[RequestPrivatePlan] = None - # data type: RegisterTesting - oneof_schema_5_validator: Optional[RegisterTesting] = None - actual_instance: Optional[ - Union[BecomeVendor, ContactSales, RegisterTesting, RequestPrivatePlan, SuggestProduct] - ] = None - one_of_schemas: Set[str] = { - "BecomeVendor", - "ContactSales", - "RegisterTesting", - "RequestPrivatePlan", - "SuggestProduct", - } - - model_config = ConfigDict( - validate_assignment=True, - protected_namespaces=(), - ) - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @field_validator("actual_instance") - def actual_instance_must_validate_oneof(cls, v): - instance = InquiriesCreateInquiryPayload.model_construct() - error_messages = [] - match = 0 - # validate data type: SuggestProduct - if not isinstance(v, SuggestProduct): - error_messages.append(f"Error! Input type `{type(v)}` is not `SuggestProduct`") - else: - match += 1 - # validate data type: ContactSales - if not isinstance(v, ContactSales): - error_messages.append(f"Error! Input type `{type(v)}` is not `ContactSales`") - else: - match += 1 - # validate data type: BecomeVendor - if not isinstance(v, BecomeVendor): - error_messages.append(f"Error! Input type `{type(v)}` is not `BecomeVendor`") - else: - match += 1 - # validate data type: RequestPrivatePlan - if not isinstance(v, RequestPrivatePlan): - error_messages.append(f"Error! Input type `{type(v)}` is not `RequestPrivatePlan`") - else: - match += 1 - # validate data type: RegisterTesting - if not isinstance(v, RegisterTesting): - error_messages.append(f"Error! Input type `{type(v)}` is not `RegisterTesting`") - else: - match += 1 - if match == 0: - # no match - raise ValueError( - "No match found when setting `actual_instance` in InquiriesCreateInquiryPayload with oneOf schemas: BecomeVendor, ContactSales, RegisterTesting, RequestPrivatePlan, SuggestProduct. Details: " - + ", ".join(error_messages) - ) - else: - return v - - @classmethod - def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Returns the object represented by the json string""" - instance = cls.model_construct() - error_messages = [] - match = 0 - - # deserialize data into SuggestProduct - try: - instance.actual_instance = SuggestProduct.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into ContactSales - try: - instance.actual_instance = ContactSales.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into BecomeVendor - try: - instance.actual_instance = BecomeVendor.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into RequestPrivatePlan - try: - instance.actual_instance = RequestPrivatePlan.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into RegisterTesting - try: - instance.actual_instance = RegisterTesting.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into InquiriesCreateInquiryPayload with oneOf schemas: BecomeVendor, ContactSales, RegisterTesting, RequestPrivatePlan, SuggestProduct. Details: " - + ", ".join(error_messages) - ) - elif match == 0: - # no match - raise ValueError( - "No match found when deserializing the JSON string into InquiriesCreateInquiryPayload with oneOf schemas: BecomeVendor, ContactSales, RegisterTesting, RequestPrivatePlan, SuggestProduct. Details: " - + ", ".join(error_messages) - ) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict( - self, - ) -> Optional[ - Union[Dict[str, Any], BecomeVendor, ContactSales, RegisterTesting, RequestPrivatePlan, SuggestProduct] - ]: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.model_dump()) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_become_vendor.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_become_vendor.py deleted file mode 100644 index e7a6ca2f9..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_become_vendor.py +++ /dev/null @@ -1,91 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - - -class InquiryBecomeVendor(BaseModel): - """ - Become a vendor. - """ # noqa: E501 - - 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") - def message_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( - 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 InquiryBecomeVendor 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 InquiryBecomeVendor from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({"contactEmail": obj.get("contactEmail"), "message": obj.get("message")}) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_contact_sales.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_contact_sales.py deleted file mode 100644 index 0b8ed7e21..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_contact_sales.py +++ /dev/null @@ -1,129 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - - -class InquiryContactSales(BaseModel): - """ - Contact sales. - """ # noqa: E501 - - company_name: Annotated[str, Field(strict=True, max_length=512)] = Field( - description="The company name.", alias="companyName" - ) - 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="A custom message.") - product_id: Annotated[str, Field(min_length=10, strict=True, max_length=29)] = Field( - description="The user-readable product ID.", alias="productId" - ) - __properties: ClassVar[List[str]] = ["companyName", "contactEmail", "fullName", "message", "productId"] - - @field_validator("company_name") - def company_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("full_name") - def full_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("message") - def message_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("product_id") - def product_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[a-z0-9-]{1,20}-[0-9a-f]{8}$", value): - raise ValueError(r"must validate the regular expression /^[a-z0-9-]{1,20}-[0-9a-f]{8}$/") - 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 InquiryContactSales 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 InquiryContactSales from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "companyName": obj.get("companyName"), - "contactEmail": obj.get("contactEmail"), - "fullName": obj.get("fullName"), - "message": obj.get("message"), - "productId": obj.get("productId"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_form_type.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_form_type.py deleted file mode 100644 index a7a2ece99..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_form_type.py +++ /dev/null @@ -1,40 +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 - -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 - """ - SUGGEST_PRODUCT = "SUGGEST_PRODUCT" - CONTACT_SALES = "CONTACT_SALES" - BECOME_VENDOR = "BECOME_VENDOR" - REGISTER_TESTING = "REGISTER_TESTING" - REQUEST_PRIVATE_PLAN = "REQUEST_PRIVATE_PLAN" - - @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/inquiry_register_testing.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_register_testing.py deleted file mode 100644 index eb69fc2d5..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_register_testing.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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - - -class InquiryRegisterTesting(BaseModel): - """ - Register for testing. - """ # noqa: E501 - - 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="A custom message.") - __properties: ClassVar[List[str]] = ["contactEmail", "fullName", "message"] - - @field_validator("full_name") - def full_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("message") - def message_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( - 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 InquiryRegisterTesting 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 InquiryRegisterTesting from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"contactEmail": obj.get("contactEmail"), "fullName": obj.get("fullName"), "message": obj.get("message")} - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_request_private_plan.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_request_private_plan.py deleted file mode 100644 index f4ca93c2e..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_request_private_plan.py +++ /dev/null @@ -1,129 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - - -class InquiryRequestPrivatePlan(BaseModel): - """ - Request a private plan. - """ # noqa: E501 - - company_name: Annotated[str, Field(strict=True, max_length=512)] = Field( - description="The company name.", alias="companyName" - ) - 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="A custom message.") - product_id: Annotated[str, Field(min_length=10, strict=True, max_length=29)] = Field( - description="The user-readable product ID.", alias="productId" - ) - __properties: ClassVar[List[str]] = ["companyName", "contactEmail", "fullName", "message", "productId"] - - @field_validator("company_name") - def company_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("full_name") - def full_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("message") - def message_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("product_id") - def product_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[a-z0-9-]{1,20}-[0-9a-f]{8}$", value): - raise ValueError(r"must validate the regular expression /^[a-z0-9-]{1,20}-[0-9a-f]{8}$/") - 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 InquiryRequestPrivatePlan 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 InquiryRequestPrivatePlan from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "companyName": obj.get("companyName"), - "contactEmail": obj.get("contactEmail"), - "fullName": obj.get("fullName"), - "message": obj.get("message"), - "productId": obj.get("productId"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_suggest_product.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_suggest_product.py deleted file mode 100644 index e24bed89e..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/inquiry_suggest_product.py +++ /dev/null @@ -1,130 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, field_validator -from typing_extensions import Annotated, Self - - -class InquirySuggestProduct(BaseModel): - """ - Suggest a product. - """ # noqa: E501 - - 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="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.") - __properties: ClassVar[List[str]] = ["companyName", "message", "name", "url"] - - @field_validator("company_name") - def company_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("message") - def message_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - 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("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("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, - 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 InquirySuggestProduct 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 InquirySuggestProduct from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "companyName": obj.get("companyName"), - "message": obj.get("message"), - "name": obj.get("name"), - "url": obj.get("url"), - } - ) - return _obj 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 deleted file mode 100644 index 4d2f4af38..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_catalog_products_response.py +++ /dev/null @@ -1,126 +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 - -from __future__ import annotations - -import json -import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set, Union - -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Annotated, Self - -from stackit.stackitmarketplace.models.catalog_product_facets_value_inner import ( - CatalogProductFacetsValueInner, -) -from stackit.stackitmarketplace.models.catalog_product_overview import ( - CatalogProductOverview, -) - - -class ListCatalogProductsResponse(BaseModel): - """ - ListCatalogProductsResponse - """ # noqa: E501 - - cursor: StrictStr = Field( - 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." - ) - facets: Optional[Dict[str, List[CatalogProductFacetsValueInner]]] = Field( - default=None, description="A collection of facets, where each key represents a facet category." - ) - items: List[CatalogProductOverview] - 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", "facets", "items", "limit"] - - 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 ListCatalogProductsResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each value in facets (dict of array) - _field_dict_of_array = {} - if self.facets: - for _key in self.facets: - if self.facets[_key] is not None: - _field_dict_of_array[_key] = [_item.to_dict() for _item in self.facets[_key]] - _dict["facets"] = _field_dict_of_array - # override the default output from pydantic by calling `to_dict()` of each item in items (list) - _items = [] - if self.items: - for _item in self.items: - if _item: - _items.append(_item.to_dict()) - _dict["items"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ListCatalogProductsResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "cursor": obj.get("cursor"), - "facets": dict( - (_k, [CatalogProductFacetsValueInner.from_dict(_item) for _item in _v] if _v is not None else None) - for _k, _v in obj.get("facets", {}).items() - ), - "items": ( - [CatalogProductOverview.from_dict(_item) for _item in obj["items"]] - if obj.get("items") is not None - else None - ), - "limit": obj.get("limit"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/localized_version.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/localized_version.py deleted file mode 100644 index abd4fc52b..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/localized_version.py +++ /dev/null @@ -1,112 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, field_validator -from typing_extensions import Annotated, Self - - -class LocalizedVersion(BaseModel): - """ - The localized version (file name) of a file. - """ # noqa: E501 - - de: Optional[Annotated[str, Field(strict=True)]] = Field( - default=None, description="The file version matching the file name (localized)." - ) - en: Optional[Annotated[str, Field(strict=True)]] = Field( - default=None, description="The file version matching the file name (localized)." - ) - __properties: ClassVar[List[str]] = ["de", "en"] - - @field_validator("de") - def de_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$", value): - raise ValueError( - r"must validate the regular expression /^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$/" - ) - return value - - @field_validator("en") - def en_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$", value): - raise ValueError( - r"must validate the regular expression /^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$/" - ) - 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 LocalizedVersion 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 LocalizedVersion from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({"de": obj.get("de"), "en": obj.get("en")}) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_assets.py similarity index 71% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_assets.py index 0461be18b..63e625f70 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_assets.py @@ -19,31 +19,27 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Self -from stackit.stackitmarketplace.models.assets_end_user_license_agreement import ( - AssetsEndUserLicenseAgreement, +from stackit.stackitmarketplace.models.marketplace_subscription_v1_file import ( + MarketplaceSubscriptionV1File, ) -from stackit.stackitmarketplace.models.assets_product_description import ( - AssetsProductDescription, -) -from stackit.stackitmarketplace.models.assets_service_level_agreement import ( - AssetsServiceLevelAgreement, -) -from stackit.stackitmarketplace.models.service_certificate import ServiceCertificate -class Assets(BaseModel): +class MarketplaceSubscriptionV1Assets(BaseModel): """ - The assets associated with the product. + MarketplaceSubscriptionV1Assets """ # noqa: E501 - end_user_license_agreement: Optional[AssetsEndUserLicenseAgreement] = Field( + end_user_license_agreement: Optional[MarketplaceSubscriptionV1File] = Field( default=None, alias="endUserLicenseAgreement" ) - product_description: Optional[AssetsProductDescription] = Field(default=None, alias="productDescription") - service_certificate: Optional[ServiceCertificate] = Field(default=None, alias="serviceCertificate") - service_level_agreement: Optional[AssetsServiceLevelAgreement] = Field(default=None, alias="serviceLevelAgreement") + product_description: Optional[MarketplaceSubscriptionV1File] = Field(default=None, alias="productDescription") + service_certificate: Optional[MarketplaceSubscriptionV1File] = Field(default=None, alias="serviceCertificate") + service_level_agreement: Optional[MarketplaceSubscriptionV1File] = Field( + default=None, alias="serviceLevelAgreement" + ) __properties: ClassVar[List[str]] = [ "endUserLicenseAgreement", "productDescription", @@ -52,7 +48,8 @@ class Assets(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,12 +60,11 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Assets from a JSON string""" + """Create an instance of MarketplaceSubscriptionV1Assets from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -104,7 +100,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Assets from a dict""" + """Create an instance of MarketplaceSubscriptionV1Assets from a dict""" if obj is None: return None @@ -114,22 +110,22 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { "endUserLicenseAgreement": ( - AssetsEndUserLicenseAgreement.from_dict(obj["endUserLicenseAgreement"]) + MarketplaceSubscriptionV1File.from_dict(obj["endUserLicenseAgreement"]) if obj.get("endUserLicenseAgreement") is not None else None ), "productDescription": ( - AssetsProductDescription.from_dict(obj["productDescription"]) + MarketplaceSubscriptionV1File.from_dict(obj["productDescription"]) if obj.get("productDescription") is not None else None ), "serviceCertificate": ( - ServiceCertificate.from_dict(obj["serviceCertificate"]) + MarketplaceSubscriptionV1File.from_dict(obj["serviceCertificate"]) if obj.get("serviceCertificate") is not None else None ), "serviceLevelAgreement": ( - AssetsServiceLevelAgreement.from_dict(obj["serviceLevelAgreement"]) + MarketplaceSubscriptionV1File.from_dict(obj["serviceLevelAgreement"]) if obj.get("serviceLevelAgreement") is not None else None ), diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_end_user_license_agreement.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_file.py similarity index 71% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_end_user_license_agreement.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_file.py index 500978368..7c04cf7a1 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/assets_end_user_license_agreement.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_file.py @@ -19,21 +19,25 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self -from stackit.stackitmarketplace.models.localized_version import LocalizedVersion +from stackit.stackitmarketplace.models.marketplace_subscription_v1_file_localized_version import ( + MarketplaceSubscriptionV1FileLocalizedVersion, +) -class AssetsEndUserLicenseAgreement(BaseModel): +class MarketplaceSubscriptionV1File(BaseModel): """ - The related end user license agreement of the (subscription) product. + MarketplaceSubscriptionV1File """ # noqa: E501 - version: Optional[LocalizedVersion] = None + version: Optional[MarketplaceSubscriptionV1FileLocalizedVersion] = None __properties: ClassVar[List[str]] = ["version"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,12 +48,11 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of AssetsEndUserLicenseAgreement from a JSON string""" + """Create an instance of MarketplaceSubscriptionV1File from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -76,7 +79,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of AssetsEndUserLicenseAgreement from a dict""" + """Create an instance of MarketplaceSubscriptionV1File from a dict""" if obj is None: return None @@ -84,6 +87,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate( - {"version": LocalizedVersion.from_dict(obj["version"]) if obj.get("version") is not None else None} + { + "version": ( + MarketplaceSubscriptionV1FileLocalizedVersion.from_dict(obj["version"]) + if obj.get("version") is not None + else None + ) + } ) return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_facets_value_inner.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_file_localized_version.py similarity index 67% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_facets_value_inner.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_file_localized_version.py index d3f5ad784..434f168e4 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_facets_value_inner.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_file_localized_version.py @@ -18,21 +18,23 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self -class CatalogProductFacetsValueInner(BaseModel): +class MarketplaceSubscriptionV1FileLocalizedVersion(BaseModel): """ - CatalogProductFacetsValueInner + MarketplaceSubscriptionV1FileLocalizedVersion """ # noqa: E501 - count: StrictInt = Field(description="The number of items associated with this facet value.") - value: StrictStr = Field(description="The value of the facet.") - __properties: ClassVar[List[str]] = ["count", "value"] + de: Optional[StrictStr] = Field(default=None, description="The file version matching the file name (localized).") + en: Optional[StrictStr] = Field(default=None, description="The file version matching the file name (localized).") + __properties: ClassVar[List[str]] = ["de", "en"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,12 +45,11 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CatalogProductFacetsValueInner from a JSON string""" + """Create an instance of MarketplaceSubscriptionV1FileLocalizedVersion from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -72,12 +73,12 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CatalogProductFacetsValueInner from a dict""" + """Create an instance of MarketplaceSubscriptionV1FileLocalizedVersion from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"count": obj.get("count"), "value": obj.get("value")}) + _obj = cls.model_validate({"de": obj.get("de"), "en": obj.get("en")}) return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_list_subscriptions_response.py similarity index 62% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_list_subscriptions_response.py index 940b4bcab..42083bad8 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_list_subscriptions_response.py @@ -16,30 +16,30 @@ import json import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set, Union +from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Annotated, Self +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python +from typing_extensions import Self -from stackit.stackitmarketplace.models.vendor_subscription import VendorSubscription +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription import ( + MarketplaceSubscriptionV1Subscription, +) -class ListVendorSubscriptionsResponse(BaseModel): +class MarketplaceSubscriptionV1ListSubscriptionsResponse(BaseModel): """ - ListVendorSubscriptionsResponse + MarketplaceSubscriptionV1ListSubscriptionsResponse """ # noqa: E501 - cursor: StrictStr = Field( - 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: 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.") + cursor: Optional[StrictStr] = None + items: Optional[List[MarketplaceSubscriptionV1Subscription]] = None + limit: Optional[StrictInt] = None __properties: ClassVar[List[str]] = ["cursor", "items", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,12 +50,11 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ListVendorSubscriptionsResponse from a JSON string""" + """Create an instance of MarketplaceSubscriptionV1ListSubscriptionsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -78,15 +77,15 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in items (list) _items = [] if self.items: - for _item in self.items: - if _item: - _items.append(_item.to_dict()) + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) _dict["items"] = _items return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ListVendorSubscriptionsResponse from a dict""" + """Create an instance of MarketplaceSubscriptionV1ListSubscriptionsResponse from a dict""" if obj is None: return None @@ -97,7 +96,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: { "cursor": obj.get("cursor"), "items": ( - [VendorSubscription.from_dict(_item) for _item in obj["items"]] + [MarketplaceSubscriptionV1Subscription.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None ), diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription.py new file mode 100644 index 000000000..b76e90d13 --- /dev/null +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription.py @@ -0,0 +1,198 @@ +# 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 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from pydantic_core import to_jsonable_python +from typing_extensions import Self + +from stackit.stackitmarketplace.models.marketplace_subscription_v1_subscription_product import ( + MarketplaceSubscriptionV1SubscriptionProduct, +) + + +class MarketplaceSubscriptionV1Subscription(BaseModel): + """ + MarketplaceSubscriptionV1Subscription + """ # noqa: E501 + + approval_timeout: Optional[StrictStr] = Field( + default=None, + description="Period between the subscription was created until the approval needs to happen.", + alias="approvalTimeout", + ) + auto_renewal: Optional[StrictBool] = Field( + default=None, + description="If true, the the subscription will extend its validity automatically at the end of the current period.", + alias="autoRenewal", + ) + lifecycle_state: StrictStr = Field(alias="lifecycleState") + ordered_at: StrictStr = Field(description="When the subscription was ordered.", alias="orderedAt") + organization_id: StrictStr = Field(description="The UUID of the organization.", alias="organizationId") + product: MarketplaceSubscriptionV1SubscriptionProduct = Field(description="The product to the subscription.") + project_id: StrictStr = Field(description="The UUID of the project.", alias="projectId") + subscription_id: StrictStr = Field(description="The UUID of the subscription.", alias="subscriptionId") + terminates_at: Optional[StrictStr] = Field( + default=None, description="Timestamp when the subscription will finally terminate.", alias="terminatesAt" + ) + valid_from: Optional[StrictStr] = Field( + default=None, description="Timestamp when the subscription validity has started.", alias="validFrom" + ) + valid_until: Optional[StrictStr] = Field( + default=None, + description="Timestamp when the current subscription validity will end. May be automatically renewed.", + alias="validUntil", + ) + __properties: ClassVar[List[str]] = [ + "approvalTimeout", + "autoRenewal", + "lifecycleState", + "orderedAt", + "organizationId", + "product", + "projectId", + "subscriptionId", + "terminatesAt", + "validFrom", + "validUntil", + ] + + @field_validator("lifecycle_state") + def lifecycle_state_validate_enum(cls, value): + """Validates the enum""" + if value not in set( + [ + "STATE_UNSPECIFIED", + "SUBSCRIPTION_PENDING", + "SUBSCRIPTION_ACTIVE", + "SUBSCRIPTION_INACTIVE", + "SUBSCRIPTION_CANCELLING", + "SUBSCRIPTION_CANCELLED", + "SUBSCRIPTION_REJECTED", + "SUBSCRIPTION_APPROVAL_TIMED_OUT", + ] + ): + raise ValueError( + "must be one of enum values ('STATE_UNSPECIFIED', 'SUBSCRIPTION_PENDING', 'SUBSCRIPTION_ACTIVE', 'SUBSCRIPTION_INACTIVE', 'SUBSCRIPTION_CANCELLING', 'SUBSCRIPTION_CANCELLED', 'SUBSCRIPTION_REJECTED', 'SUBSCRIPTION_APPROVAL_TIMED_OUT')" + ) + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MarketplaceSubscriptionV1Subscription 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set( + [ + "approval_timeout", + "auto_renewal", + "lifecycle_state", + "ordered_at", + "organization_id", + "product", + "project_id", + "subscription_id", + "terminates_at", + "valid_from", + "valid_until", + ] + ) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of product + if self.product: + _dict["product"] = self.product.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MarketplaceSubscriptionV1Subscription from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "approvalTimeout": obj.get("approvalTimeout"), + "autoRenewal": obj.get("autoRenewal"), + "lifecycleState": obj.get("lifecycleState"), + "orderedAt": obj.get("orderedAt"), + "organizationId": obj.get("organizationId"), + "product": ( + MarketplaceSubscriptionV1SubscriptionProduct.from_dict(obj["product"]) + if obj.get("product") is not None + else None + ), + "projectId": obj.get("projectId"), + "subscriptionId": obj.get("subscriptionId"), + "terminatesAt": obj.get("terminatesAt"), + "validFrom": obj.get("validFrom"), + "validUntil": obj.get("validUntil"), + } + ) + return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription_product.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription_product.py new file mode 100644 index 000000000..995252370 --- /dev/null +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription_product.py @@ -0,0 +1,170 @@ +# 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 + +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 pydantic_core import to_jsonable_python +from typing_extensions import Self + +from stackit.stackitmarketplace.models.marketplace_subscription_v1_assets import ( + MarketplaceSubscriptionV1Assets, +) + + +class MarketplaceSubscriptionV1SubscriptionProduct(BaseModel): + """ + MarketplaceSubscriptionV1SubscriptionProduct + """ # noqa: E501 + + assets: Optional[MarketplaceSubscriptionV1Assets] = None + delivery_method: StrictStr = Field( + description="The product delivery method/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") + plan_id: StrictStr = Field(description="The user-readable plan ID of a pricing option.", alias="planId") + price_type: StrictStr = Field(description="The product's price type.", alias="priceType") + pricing_plan: StrictStr = Field(description="Additional price type information.", alias="pricingPlan") + product_id: StrictStr = Field(description="The user-readable ID of the product.", alias="productId") + product_name: StrictStr = Field(description="The name of the product.", alias="productName") + vendor_name: StrictStr = Field(description="The product vendor's name.", alias="vendorName") + vendor_plan_id: Optional[StrictStr] = Field( + default=None, description="The vendor provided plan ID.", alias="vendorPlanId" + ) + vendor_product_id: Optional[StrictStr] = Field( + default=None, description="The vendor provided prduct ID.", alias="vendorProductId" + ) + vendor_website_url: StrictStr = Field(description="The vendor's website.", alias="vendorWebsiteUrl") + __properties: ClassVar[List[str]] = [ + "assets", + "deliveryMethod", + "lifecycleState", + "planId", + "priceType", + "pricingPlan", + "productId", + "productName", + "vendorName", + "vendorPlanId", + "vendorProductId", + "vendorWebsiteUrl", + ] + + @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')") + return value + + @field_validator("lifecycle_state") + def lifecycle_state_validate_enum(cls, value): + """Validates the enum""" + if value not in set(["PRODUCT_LIVE", "PRODUCT_PENDING_APPROVAL", "PRODUCT_PREVIEW"]): + raise ValueError( + "must be one of enum values ('PRODUCT_LIVE', 'PRODUCT_PENDING_APPROVAL', 'PRODUCT_PREVIEW')" + ) + 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')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MarketplaceSubscriptionV1SubscriptionProduct 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. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set( + [ + "delivery_method", + "lifecycle_state", + "price_type", + ] + ) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of assets + if self.assets: + _dict["assets"] = self.assets.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MarketplaceSubscriptionV1SubscriptionProduct from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "assets": ( + MarketplaceSubscriptionV1Assets.from_dict(obj["assets"]) if obj.get("assets") is not None else None + ), + "deliveryMethod": obj.get("deliveryMethod"), + "lifecycleState": obj.get("lifecycleState"), + "planId": obj.get("planId"), + "priceType": obj.get("priceType"), + "pricingPlan": obj.get("pricingPlan"), + "productId": obj.get("productId"), + "productName": obj.get("productName"), + "vendorName": obj.get("vendorName"), + "vendorPlanId": obj.get("vendorPlanId"), + "vendorProductId": obj.get("vendorProductId"), + "vendorWebsiteUrl": obj.get("vendorWebsiteUrl"), + } + ) + return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_pricing_option_highlight.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription_redirect.py similarity index 70% rename from services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_pricing_option_highlight.py rename to services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription_redirect.py index 85016fb2c..f35666bba 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_pricing_option_highlight.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/marketplace_subscription_v1_subscription_redirect.py @@ -19,21 +19,22 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self -class CatalogPricingOptionHighlight(BaseModel): +class MarketplaceSubscriptionV1SubscriptionRedirect(BaseModel): """ - CatalogPricingOptionHighlight + MarketplaceSubscriptionV1SubscriptionRedirect """ # noqa: E501 - highlight_content: Optional[StrictStr] = Field( - default=None, description="The highlight content.", alias="highlightContent" - ) - __properties: ClassVar[List[str]] = ["highlightContent"] + redirect_target: StrictStr = Field(alias="redirectTarget") + redirect_url: StrictStr = Field(alias="redirectUrl") + __properties: ClassVar[List[str]] = ["redirectTarget", "redirectUrl"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,12 +45,11 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CatalogPricingOptionHighlight from a JSON string""" + """Create an instance of MarketplaceSubscriptionV1SubscriptionRedirect from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,12 +73,12 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CatalogPricingOptionHighlight from a dict""" + """Create an instance of MarketplaceSubscriptionV1SubscriptionRedirect from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"highlightContent": obj.get("highlightContent")}) + _obj = cls.model_validate({"redirectTarget": obj.get("redirectTarget"), "redirectUrl": obj.get("redirectUrl")}) return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/notice_period.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/notice_period.py deleted file mode 100644 index 3c9989417..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/notice_period.py +++ /dev/null @@ -1,95 +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 - -from __future__ import annotations - -import json -import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator -from typing_extensions import Self - - -class NoticePeriod(BaseModel): - """ - The notice period for a product and plan. - """ # noqa: E501 - - type: Optional[StrictStr] = Field(default=None, description="The notice period type.") - value: Optional[StrictInt] = Field( - default=None, description="The value of the corresponding type. Omitted for _SAME_DAY_." - ) - __properties: ClassVar[List[str]] = ["type", "value"] - - @field_validator("type") - def type_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set(["SAME_DAY", "DAYS", "MONTHS"]): - raise ValueError("must be one of enum values ('SAME_DAY', 'DAYS', 'MONTHS')") - 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 NoticePeriod 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 NoticePeriod from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({"type": obj.get("type"), "value": obj.get("value")}) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/offer_type.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/offer_type.py deleted file mode 100644 index aff8a29d8..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/offer_type.py +++ /dev/null @@ -1,37 +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 - -from __future__ import annotations - -import json -from enum import Enum - -from typing_extensions import Self - - -class OfferType(str, Enum): - """ - The offer type of a product reflecting the business model. - """ - - """ - allowed enum values - """ - OFFER_LISTING = "OFFER_LISTING" - OFFER_RESELLING = "OFFER_RESELLING" - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of OfferType from a JSON string""" - return cls(json.loads(json_str)) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/price_type.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/price_type.py deleted file mode 100644 index 6cfe91176..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/price_type.py +++ /dev/null @@ -1,40 +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 - -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 deleted file mode 100644 index dcc9b2ecd..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/pricing_option_unit.py +++ /dev/null @@ -1,36 +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 - -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 deleted file mode 100644 index 3f14671e4..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/product_lifecycle_state.py +++ /dev/null @@ -1,37 +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 - -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 deleted file mode 100644 index 4bc59deb5..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/register_testing.py +++ /dev/null @@ -1,100 +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 - -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.inquiry_form_type import InquiryFormType -from stackit.stackitmarketplace.models.inquiry_register_testing import ( - InquiryRegisterTesting, -) - - -class RegisterTesting(BaseModel): - """ - Register for testing. - """ # noqa: E501 - - register_testing: InquiryRegisterTesting = Field(alias="registerTesting") - type: InquiryFormType - __properties: ClassVar[List[str]] = ["registerTesting", "type"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of RegisterTesting 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 register_testing - if self.register_testing: - _dict["registerTesting"] = self.register_testing.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of RegisterTesting from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "registerTesting": ( - InquiryRegisterTesting.from_dict(obj["registerTesting"]) - if obj.get("registerTesting") is not None - else None - ), - "type": obj.get("type"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/request_private_plan.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/request_private_plan.py deleted file mode 100644 index e5cfb65e9..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/request_private_plan.py +++ /dev/null @@ -1,100 +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 - -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.inquiry_form_type import InquiryFormType -from stackit.stackitmarketplace.models.inquiry_request_private_plan import ( - InquiryRequestPrivatePlan, -) - - -class RequestPrivatePlan(BaseModel): - """ - Request a private plan. - """ # noqa: E501 - - request_private_plan: InquiryRequestPrivatePlan = Field(alias="requestPrivatePlan") - type: InquiryFormType - __properties: ClassVar[List[str]] = ["requestPrivatePlan", "type"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of RequestPrivatePlan 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 request_private_plan - if self.request_private_plan: - _dict["requestPrivatePlan"] = self.request_private_plan.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of RequestPrivatePlan from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "requestPrivatePlan": ( - InquiryRequestPrivatePlan.from_dict(obj["requestPrivatePlan"]) - if obj.get("requestPrivatePlan") is not None - else None - ), - "type": obj.get("type"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/resolve_customer_payload.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/resolve_customer_payload.py index 4ca7cedaf..541b68413 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/resolve_customer_payload.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/resolve_customer_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class ResolveCustomerPayload(BaseModel): __properties: ClassVar[List[str]] = ["token"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/scope.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/scope.py deleted file mode 100644 index cca1be50b..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/scope.py +++ /dev/null @@ -1,38 +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 - -from __future__ import annotations - -import json -from enum import Enum - -from typing_extensions import Self - - -class Scope(str, Enum): - """ - The (visibility) scope. - """ - - """ - allowed enum values - """ - PUBLIC = "PUBLIC" - AUTHENTICATED = "AUTHENTICATED" - PRIVATE_PROJECT = "PRIVATE_PROJECT" - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of Scope from a JSON string""" - return cls(json.loads(json_str)) diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/service_certificate.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/service_certificate.py deleted file mode 100644 index 8ab713d24..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/service_certificate.py +++ /dev/null @@ -1,89 +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 - -from __future__ import annotations - -import json -import pprint -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict -from typing_extensions import Self - -from stackit.stackitmarketplace.models.localized_version import LocalizedVersion - - -class ServiceCertificate(BaseModel): - """ - The related service certificate of the (subscription) product. - """ # noqa: E501 - - version: Optional[LocalizedVersion] = None - __properties: ClassVar[List[str]] = ["version"] - - 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 ServiceCertificate 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 version - if self.version: - _dict["version"] = self.version.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ServiceCertificate from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - {"version": LocalizedVersion.from_dict(obj["version"]) if obj.get("version") 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 deleted file mode 100644 index 2de1988d0..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_lifecycle_state.py +++ /dev/null @@ -1,41 +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 - -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 deleted file mode 100644 index fe3b7275b..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/subscription_product.py +++ /dev/null @@ -1,203 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Annotated, Self - -from stackit.stackitmarketplace.models.assets import Assets -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): - """ - The product of a subscription - """ # noqa: E501 - - assets: Optional[Assets] = None - delivery_method: DeliveryMethod = Field(alias="deliveryMethod") - lifecycle_state: ProductLifecycleState = Field(alias="lifecycleState") - plan_id: Annotated[str, Field(min_length=10, strict=True, max_length=29)] = Field( - description="The user-readable plan ID of a pricing option.", alias="planId" - ) - price_type: PriceType = Field(alias="priceType") - pricing_plan: StrictStr = Field(description="Additional price type information.", alias="pricingPlan") - product_id: Annotated[str, Field(min_length=10, strict=True, max_length=29)] = Field( - description="The user-readable product ID.", 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_plan_id: Optional[Annotated[str, Field(strict=True)]] = Field( - default=None, description="The vendor provided plan ID.", alias="vendorPlanId" - ) - vendor_product_id: Optional[Annotated[str, Field(strict=True)]] = Field( - 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" - ) - __properties: ClassVar[List[str]] = [ - "assets", - "deliveryMethod", - "lifecycleState", - "planId", - "priceType", - "pricingPlan", - "productId", - "productName", - "vendorName", - "vendorPlanId", - "vendorProductId", - "vendorWebsiteUrl", - ] - - @field_validator("plan_id") - def plan_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[a-z0-9-]{1,20}-[0-9a-f]{8}$", value): - raise ValueError(r"must validate the regular expression /^[a-z0-9-]{1,20}-[0-9a-f]{8}$/") - return value - - @field_validator("product_id") - def product_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[a-z0-9-]{1,20}-[0-9a-f]{8}$", value): - raise ValueError(r"must validate the regular expression /^[a-z0-9-]{1,20}-[0-9a-f]{8}$/") - return value - - @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("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_plan_id") - def vendor_plan_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"^[a-zA-Z0-9](?:[a-zA-Z0-9_+&-]){0,39}$", value): - raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9](?:[a-zA-Z0-9_+&-]){0,39}$/") - return value - - @field_validator("vendor_product_id") - def vendor_product_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"^[a-zA-Z0-9](?:[a-zA-Z0-9_+&-]){0,39}$", 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, - 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 SubscriptionProduct 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 assets - if self.assets: - _dict["assets"] = self.assets.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of SubscriptionProduct from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "assets": Assets.from_dict(obj["assets"]) if obj.get("assets") is not None else None, - "deliveryMethod": obj.get("deliveryMethod"), - "lifecycleState": obj.get("lifecycleState"), - "planId": obj.get("planId"), - "priceType": obj.get("priceType"), - "pricingPlan": obj.get("pricingPlan"), - "productId": obj.get("productId"), - "productName": obj.get("productName"), - "vendorName": obj.get("vendorName"), - "vendorPlanId": obj.get("vendorPlanId"), - "vendorProductId": obj.get("vendorProductId"), - "vendorWebsiteUrl": obj.get("vendorWebsiteUrl"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product.py deleted file mode 100644 index eded19831..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/suggest_product.py +++ /dev/null @@ -1,100 +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 - -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.inquiry_form_type import InquiryFormType -from stackit.stackitmarketplace.models.inquiry_suggest_product import ( - InquirySuggestProduct, -) - - -class SuggestProduct(BaseModel): - """ - Suggest a product. - """ # noqa: E501 - - suggest_product: InquirySuggestProduct = Field(alias="suggestProduct") - type: InquiryFormType - __properties: ClassVar[List[str]] = ["suggestProduct", "type"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of SuggestProduct 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 suggest_product - if self.suggest_product: - _dict["suggestProduct"] = self.suggest_product.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of SuggestProduct from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "suggestProduct": ( - InquirySuggestProduct.from_dict(obj["suggestProduct"]) - if obj.get("suggestProduct") is not None - else None - ), - "type": obj.get("type"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py deleted file mode 100644 index e8ed999d0..000000000 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py +++ /dev/null @@ -1,136 +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 - -from __future__ import annotations - -import json -import pprint -import re # noqa: F401 -from typing import Any, ClassVar, Dict, List, Optional, Set - -from pydantic import BaseModel, ConfigDict, Field, field_validator -from typing_extensions import Annotated, Self - -from stackit.stackitmarketplace.models.subscription_lifecycle_state import ( - SubscriptionLifecycleState, -) -from stackit.stackitmarketplace.models.subscription_product import SubscriptionProduct - - -class VendorSubscription(BaseModel): - """ - VendorSubscription - """ # noqa: E501 - - lifecycle_state: SubscriptionLifecycleState = Field(alias="lifecycleState") - organization_id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field( - description="Universally Unique Identifier (UUID).", alias="organizationId" - ) - product: SubscriptionProduct - project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field( - description="Universally Unique Identifier (UUID).", alias="projectId" - ) - subscription_id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field( - description="Universally Unique Identifier (UUID).", alias="subscriptionId" - ) - __properties: ClassVar[List[str]] = ["lifecycleState", "organizationId", "product", "projectId", "subscriptionId"] - - @field_validator("organization_id") - def organization_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value): - raise ValueError( - r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/" - ) - return value - - @field_validator("project_id") - def project_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value): - raise ValueError( - r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/" - ) - return value - - @field_validator("subscription_id") - def subscription_id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value): - raise ValueError( - r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/" - ) - 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 VendorSubscription 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 product - if self.product: - _dict["product"] = self.product.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of VendorSubscription 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"), - "organizationId": obj.get("organizationId"), - "product": SubscriptionProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, - "projectId": obj.get("projectId"), - "subscriptionId": obj.get("subscriptionId"), - } - ) - return _obj diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/rest.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/rest.py index fe03dba8a..cc422f2df 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/rest.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/rest.py @@ -39,12 +39,17 @@ def read(self): self.data = self.response.content return self.data + @property + def headers(self): + """Returns a dictionary of response headers.""" + return self.response.headers + def getheaders(self): - """Returns a dictionary of the response headers.""" + """Returns a dictionary of the response headers; use ``headers`` instead.""" return self.response.headers def getheader(self, name, default=None): - """Returns a given response header.""" + """Returns a given response header; use ``headers.get()`` instead.""" return self.response.headers.get(name, default) @@ -94,6 +99,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, data=request_body, headers=headers, + timeout=_request_timeout, ) elif content_type == "application/x-www-form-urlencoded": r = self.session.request( @@ -101,6 +107,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, params=post_params, headers=headers, + timeout=_request_timeout, ) elif content_type == "multipart/form-data": # must del headers['Content-Type'], or the correct @@ -114,6 +121,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, files=post_params, headers=headers, + timeout=_request_timeout, ) # Pass a `string` parameter directly in the body to support # other content types than JSON when `body` argument is @@ -124,10 +132,17 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, data=body, headers=headers, + timeout=_request_timeout, ) elif headers["Content-Type"].startswith("text/") and isinstance(body, bool): request_body = "true" if body else "false" - r = self.session.request(method, url, data=request_body, headers=headers) + r = self.session.request( + method, + url, + data=request_body, + headers=headers, + timeout=_request_timeout, + ) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -141,6 +156,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, params={}, headers=headers, + timeout=_request_timeout, ) except requests.exceptions.SSLError as e: msg = "\n".join([type(e).__name__, str(e)])