Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Release (2025-xx-xx)
- `stackitmarketplace`: [v1.10.0](services/stackitmarketplace/CHANGELOG.md#v1100)
- **Feature:** Added `PlanId` to `CatalogProductPricingOption`and `SubscriptionProduct`

## Release (2025-09-11)
- `cdn`: [v1.6.0](services/cdn/CHANGELOG.md#v160)
- **Feature:** Added Attribute `LogSink` to `ConfigPatch`
Expand Down
3 changes: 3 additions & 0 deletions services/stackitmarketplace/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v1.10.0
- **Feature:** Added `PlanId` to `CatalogProductPricingOption`and `SubscriptionProduct`

## v1.9.0
- **Feature:** Added `RequestPrivatePlan` to `InquiriesCreateInquiryPayload`

Expand Down
2 changes: 1 addition & 1 deletion services/stackitmarketplace/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-stackitmarketplace"

[tool.poetry]
name = "stackit-stackitmarketplace"
version = "v1.9.0"
version = "v1.10.0"
authors = [
"STACKIT Developer Tools <[email protected]>",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +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, StrictStr
from typing_extensions import Self
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,
Expand All @@ -38,6 +39,9 @@ class CatalogProductPricingOption(BaseModel):
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"
Expand All @@ -54,6 +58,7 @@ class CatalogProductPricingOption(BaseModel):
"highlights",
"name",
"noticePeriod",
"planId",
"priceType",
"pricingPlan",
"rate",
Expand All @@ -63,6 +68,13 @@ class CatalogProductPricingOption(BaseModel):
"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,
Expand Down Expand Up @@ -133,6 +145,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class SubscriptionProduct(BaseModel):
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(
Expand All @@ -62,6 +65,7 @@ class SubscriptionProduct(BaseModel):
"assets",
"deliveryMethod",
"lifecycleState",
"planId",
"priceType",
"pricingPlan",
"productId",
Expand All @@ -72,6 +76,13 @@ class SubscriptionProduct(BaseModel):
"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"""
Expand Down Expand Up @@ -178,6 +189,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"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"),
Expand Down