stackit-stackitmarketplace 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stackit/stackitmarketplace/__init__.py +84 -0
- stackit/stackitmarketplace/api/__init__.py +4 -0
- stackit/stackitmarketplace/api/default_api.py +1719 -0
- stackit/stackitmarketplace/api_client.py +627 -0
- stackit/stackitmarketplace/api_response.py +23 -0
- stackit/stackitmarketplace/configuration.py +138 -0
- stackit/stackitmarketplace/exceptions.py +199 -0
- stackit/stackitmarketplace/models/__init__.py +65 -0
- stackit/stackitmarketplace/models/catalog_pricing_option_highlight.py +84 -0
- stackit/stackitmarketplace/models/catalog_product_detail.py +246 -0
- stackit/stackitmarketplace/models/catalog_product_details_vendor.py +96 -0
- stackit/stackitmarketplace/models/catalog_product_highlight.py +94 -0
- stackit/stackitmarketplace/models/catalog_product_overview.py +132 -0
- stackit/stackitmarketplace/models/catalog_product_overview_vendor.py +86 -0
- stackit/stackitmarketplace/models/catalog_product_pricing_option.py +146 -0
- stackit/stackitmarketplace/models/catalog_product_support_resource.py +89 -0
- stackit/stackitmarketplace/models/catalog_product_vendor_terms.py +86 -0
- stackit/stackitmarketplace/models/current_subscription_state_response.py +103 -0
- stackit/stackitmarketplace/models/error_response.py +95 -0
- stackit/stackitmarketplace/models/list_catalog_products_response.py +109 -0
- stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py +107 -0
- stackit/stackitmarketplace/models/requested_subscription_state_response.py +103 -0
- stackit/stackitmarketplace/models/resolve_customer_payload.py +82 -0
- stackit/stackitmarketplace/models/subscription_cancel_response.py +109 -0
- stackit/stackitmarketplace/models/subscription_product.py +130 -0
- stackit/stackitmarketplace/models/vendor_subscription.py +115 -0
- stackit/stackitmarketplace/py.typed +0 -0
- stackit/stackitmarketplace/rest.py +149 -0
- stackit_stackitmarketplace-0.1.0.dist-info/METADATA +44 -0
- stackit_stackitmarketplace-0.1.0.dist-info/RECORD +31 -0
- stackit_stackitmarketplace-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Marketplace API
|
|
5
|
+
|
|
6
|
+
API to manage STACKIT Marketplace.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1
|
|
9
|
+
Contact: marketplace@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501 docstring might be too long
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing_extensions import Annotated, Self
|
|
23
|
+
|
|
24
|
+
from stackit.stackitmarketplace.models.vendor_subscription import VendorSubscription
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ListVendorSubscriptionsResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ListVendorSubscriptionsResponse
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
cursor: StrictStr = Field(
|
|
33
|
+
description="A pagination cursor that represents a position in the dataset. Use it in subsequent requests to continue retrieving data from this position. If `null`, there are no more results to retrieve."
|
|
34
|
+
)
|
|
35
|
+
items: List[VendorSubscription] = Field(description="List of subscriptions.")
|
|
36
|
+
limit: Annotated[int, Field(le=100, strict=True, ge=0)] = Field(
|
|
37
|
+
description="Number of subscriptions returned for a single request."
|
|
38
|
+
)
|
|
39
|
+
__properties: ClassVar[List[str]] = ["cursor", "items", "limit"]
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of ListVendorSubscriptionsResponse from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
79
|
+
_items = []
|
|
80
|
+
if self.items:
|
|
81
|
+
for _item in self.items:
|
|
82
|
+
if _item:
|
|
83
|
+
_items.append(_item.to_dict())
|
|
84
|
+
_dict["items"] = _items
|
|
85
|
+
return _dict
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
89
|
+
"""Create an instance of ListVendorSubscriptionsResponse from a dict"""
|
|
90
|
+
if obj is None:
|
|
91
|
+
return None
|
|
92
|
+
|
|
93
|
+
if not isinstance(obj, dict):
|
|
94
|
+
return cls.model_validate(obj)
|
|
95
|
+
|
|
96
|
+
_obj = cls.model_validate(
|
|
97
|
+
{
|
|
98
|
+
"cursor": obj.get("cursor"),
|
|
99
|
+
"items": (
|
|
100
|
+
[VendorSubscription.from_dict(_item) for _item in obj["items"]]
|
|
101
|
+
if obj.get("items") is not None
|
|
102
|
+
else None
|
|
103
|
+
),
|
|
104
|
+
"limit": obj.get("limit") if obj.get("limit") is not None else 50,
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
return _obj
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Marketplace API
|
|
5
|
+
|
|
6
|
+
API to manage STACKIT Marketplace.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1
|
|
9
|
+
Contact: marketplace@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501 docstring might be too long
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RequestedSubscriptionStateResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
RequestedSubscriptionStateResponse
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
lifecycle_state: StrictStr = Field(description="Lifecycle state of the subscription.", alias="lifecycleState")
|
|
31
|
+
subscription_id: StrictStr = Field(description="The subscription ID.", alias="subscriptionId")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["lifecycleState", "subscriptionId"]
|
|
33
|
+
|
|
34
|
+
@field_validator("lifecycle_state")
|
|
35
|
+
def lifecycle_state_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(
|
|
38
|
+
[
|
|
39
|
+
"SUBSCRIPTION_PENDING",
|
|
40
|
+
"SUBSCRIPTION_ACTIVE",
|
|
41
|
+
"SUBSCRIPTION_INACTIVE",
|
|
42
|
+
"SUBSCRIPTION_CANCELLING",
|
|
43
|
+
"SUBSCRIPTION_CANCELLED",
|
|
44
|
+
"SUBSCRIPTION_REJECTED",
|
|
45
|
+
]
|
|
46
|
+
):
|
|
47
|
+
raise ValueError(
|
|
48
|
+
"must be one of enum values ('SUBSCRIPTION_PENDING', 'SUBSCRIPTION_ACTIVE', 'SUBSCRIPTION_INACTIVE', 'SUBSCRIPTION_CANCELLING', 'SUBSCRIPTION_CANCELLED', 'SUBSCRIPTION_REJECTED')"
|
|
49
|
+
)
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
model_config = ConfigDict(
|
|
53
|
+
populate_by_name=True,
|
|
54
|
+
validate_assignment=True,
|
|
55
|
+
protected_namespaces=(),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
65
|
+
return json.dumps(self.to_dict())
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
69
|
+
"""Create an instance of RequestedSubscriptionStateResponse from a JSON string"""
|
|
70
|
+
return cls.from_dict(json.loads(json_str))
|
|
71
|
+
|
|
72
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
73
|
+
"""Return the dictionary representation of the model using alias.
|
|
74
|
+
|
|
75
|
+
This has the following differences from calling pydantic's
|
|
76
|
+
`self.model_dump(by_alias=True)`:
|
|
77
|
+
|
|
78
|
+
* `None` is only added to the output dict for nullable fields that
|
|
79
|
+
were set at model initialization. Other fields with value `None`
|
|
80
|
+
are ignored.
|
|
81
|
+
"""
|
|
82
|
+
excluded_fields: Set[str] = set([])
|
|
83
|
+
|
|
84
|
+
_dict = self.model_dump(
|
|
85
|
+
by_alias=True,
|
|
86
|
+
exclude=excluded_fields,
|
|
87
|
+
exclude_none=True,
|
|
88
|
+
)
|
|
89
|
+
return _dict
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of RequestedSubscriptionStateResponse from a dict"""
|
|
94
|
+
if obj is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
if not isinstance(obj, dict):
|
|
98
|
+
return cls.model_validate(obj)
|
|
99
|
+
|
|
100
|
+
_obj = cls.model_validate(
|
|
101
|
+
{"lifecycleState": obj.get("lifecycleState"), "subscriptionId": obj.get("subscriptionId")}
|
|
102
|
+
)
|
|
103
|
+
return _obj
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Marketplace API
|
|
5
|
+
|
|
6
|
+
API to manage STACKIT Marketplace.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1
|
|
9
|
+
Contact: marketplace@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501 docstring might be too long
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ResolveCustomerPayload(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
ResolveCustomerPayload
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
token: StrictStr = Field(description="Opaque token exchangeable for subscription details.")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["token"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of ResolveCustomerPayload from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([])
|
|
64
|
+
|
|
65
|
+
_dict = self.model_dump(
|
|
66
|
+
by_alias=True,
|
|
67
|
+
exclude=excluded_fields,
|
|
68
|
+
exclude_none=True,
|
|
69
|
+
)
|
|
70
|
+
return _dict
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
74
|
+
"""Create an instance of ResolveCustomerPayload from a dict"""
|
|
75
|
+
if obj is None:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
if not isinstance(obj, dict):
|
|
79
|
+
return cls.model_validate(obj)
|
|
80
|
+
|
|
81
|
+
_obj = cls.model_validate({"token": obj.get("token")})
|
|
82
|
+
return _obj
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Marketplace API
|
|
5
|
+
|
|
6
|
+
API to manage STACKIT Marketplace.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1
|
|
9
|
+
Contact: marketplace@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501 docstring might be too long
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from stackit.stackitmarketplace.models.current_subscription_state_response import (
|
|
25
|
+
CurrentSubscriptionStateResponse,
|
|
26
|
+
)
|
|
27
|
+
from stackit.stackitmarketplace.models.requested_subscription_state_response import (
|
|
28
|
+
RequestedSubscriptionStateResponse,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class SubscriptionCancelResponse(BaseModel):
|
|
33
|
+
"""
|
|
34
|
+
SubscriptionCancelResponse
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
current_subscription: CurrentSubscriptionStateResponse = Field(alias="currentSubscription")
|
|
38
|
+
requested_subscription: RequestedSubscriptionStateResponse = Field(alias="requestedSubscription")
|
|
39
|
+
__properties: ClassVar[List[str]] = ["currentSubscription", "requestedSubscription"]
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of SubscriptionCancelResponse from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of current_subscription
|
|
79
|
+
if self.current_subscription:
|
|
80
|
+
_dict["currentSubscription"] = self.current_subscription.to_dict()
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of requested_subscription
|
|
82
|
+
if self.requested_subscription:
|
|
83
|
+
_dict["requestedSubscription"] = self.requested_subscription.to_dict()
|
|
84
|
+
return _dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
88
|
+
"""Create an instance of SubscriptionCancelResponse from a dict"""
|
|
89
|
+
if obj is None:
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
if not isinstance(obj, dict):
|
|
93
|
+
return cls.model_validate(obj)
|
|
94
|
+
|
|
95
|
+
_obj = cls.model_validate(
|
|
96
|
+
{
|
|
97
|
+
"currentSubscription": (
|
|
98
|
+
CurrentSubscriptionStateResponse.from_dict(obj["currentSubscription"])
|
|
99
|
+
if obj.get("currentSubscription") is not None
|
|
100
|
+
else None
|
|
101
|
+
),
|
|
102
|
+
"requestedSubscription": (
|
|
103
|
+
RequestedSubscriptionStateResponse.from_dict(obj["requestedSubscription"])
|
|
104
|
+
if obj.get("requestedSubscription") is not None
|
|
105
|
+
else None
|
|
106
|
+
),
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
return _obj
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Marketplace API
|
|
5
|
+
|
|
6
|
+
API to manage STACKIT Marketplace.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1
|
|
9
|
+
Contact: marketplace@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501 docstring might be too long
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class SubscriptionProduct(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
SubscriptionProduct
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
delivery_method: StrictStr = Field(description="The product's delivery method.", alias="deliveryMethod")
|
|
31
|
+
lifecycle_state: StrictStr = Field(description="The lifecycle state of the product.", alias="lifecycleState")
|
|
32
|
+
price_type: StrictStr = Field(description="The product's price type.", alias="priceType")
|
|
33
|
+
pricing_plan: StrictStr = Field(description="The product's pricing plan.", alias="pricingPlan")
|
|
34
|
+
product_id: StrictStr = Field(description="The product ID.", alias="productId")
|
|
35
|
+
product_name: StrictStr = Field(description="The name of the product.", alias="productName")
|
|
36
|
+
vendor_name: StrictStr = Field(description="The product's vendor name.", alias="vendorName")
|
|
37
|
+
vendor_website_url: StrictStr = Field(description="The vendor's website.", alias="vendorWebsiteUrl")
|
|
38
|
+
__properties: ClassVar[List[str]] = [
|
|
39
|
+
"deliveryMethod",
|
|
40
|
+
"lifecycleState",
|
|
41
|
+
"priceType",
|
|
42
|
+
"pricingPlan",
|
|
43
|
+
"productId",
|
|
44
|
+
"productName",
|
|
45
|
+
"vendorName",
|
|
46
|
+
"vendorWebsiteUrl",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
@field_validator("delivery_method")
|
|
50
|
+
def delivery_method_validate_enum(cls, value):
|
|
51
|
+
"""Validates the enum"""
|
|
52
|
+
if value not in set(["SAAS"]):
|
|
53
|
+
raise ValueError("must be one of enum values ('SAAS')")
|
|
54
|
+
return value
|
|
55
|
+
|
|
56
|
+
@field_validator("lifecycle_state")
|
|
57
|
+
def lifecycle_state_validate_enum(cls, value):
|
|
58
|
+
"""Validates the enum"""
|
|
59
|
+
if value not in set(["PRODUCT_LIVE", "PRODUCT_PREVIEW"]):
|
|
60
|
+
raise ValueError("must be one of enum values ('PRODUCT_LIVE', 'PRODUCT_PREVIEW')")
|
|
61
|
+
return value
|
|
62
|
+
|
|
63
|
+
@field_validator("price_type")
|
|
64
|
+
def price_type_validate_enum(cls, value):
|
|
65
|
+
"""Validates the enum"""
|
|
66
|
+
if value not in set(["CONTRACT", "FREE", "FREE_TRIAL", "BYOL", "PAYG"]):
|
|
67
|
+
raise ValueError("must be one of enum values ('CONTRACT', 'FREE', 'FREE_TRIAL', 'BYOL', 'PAYG')")
|
|
68
|
+
return value
|
|
69
|
+
|
|
70
|
+
model_config = ConfigDict(
|
|
71
|
+
populate_by_name=True,
|
|
72
|
+
validate_assignment=True,
|
|
73
|
+
protected_namespaces=(),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
def to_str(self) -> str:
|
|
77
|
+
"""Returns the string representation of the model using alias"""
|
|
78
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
79
|
+
|
|
80
|
+
def to_json(self) -> str:
|
|
81
|
+
"""Returns the JSON representation of the model using alias"""
|
|
82
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
83
|
+
return json.dumps(self.to_dict())
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
87
|
+
"""Create an instance of SubscriptionProduct from a JSON string"""
|
|
88
|
+
return cls.from_dict(json.loads(json_str))
|
|
89
|
+
|
|
90
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
91
|
+
"""Return the dictionary representation of the model using alias.
|
|
92
|
+
|
|
93
|
+
This has the following differences from calling pydantic's
|
|
94
|
+
`self.model_dump(by_alias=True)`:
|
|
95
|
+
|
|
96
|
+
* `None` is only added to the output dict for nullable fields that
|
|
97
|
+
were set at model initialization. Other fields with value `None`
|
|
98
|
+
are ignored.
|
|
99
|
+
"""
|
|
100
|
+
excluded_fields: Set[str] = set([])
|
|
101
|
+
|
|
102
|
+
_dict = self.model_dump(
|
|
103
|
+
by_alias=True,
|
|
104
|
+
exclude=excluded_fields,
|
|
105
|
+
exclude_none=True,
|
|
106
|
+
)
|
|
107
|
+
return _dict
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
111
|
+
"""Create an instance of SubscriptionProduct from a dict"""
|
|
112
|
+
if obj is None:
|
|
113
|
+
return None
|
|
114
|
+
|
|
115
|
+
if not isinstance(obj, dict):
|
|
116
|
+
return cls.model_validate(obj)
|
|
117
|
+
|
|
118
|
+
_obj = cls.model_validate(
|
|
119
|
+
{
|
|
120
|
+
"deliveryMethod": obj.get("deliveryMethod"),
|
|
121
|
+
"lifecycleState": obj.get("lifecycleState"),
|
|
122
|
+
"priceType": obj.get("priceType"),
|
|
123
|
+
"pricingPlan": obj.get("pricingPlan"),
|
|
124
|
+
"productId": obj.get("productId"),
|
|
125
|
+
"productName": obj.get("productName"),
|
|
126
|
+
"vendorName": obj.get("vendorName"),
|
|
127
|
+
"vendorWebsiteUrl": obj.get("vendorWebsiteUrl"),
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
return _obj
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Marketplace API
|
|
5
|
+
|
|
6
|
+
API to manage STACKIT Marketplace.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1
|
|
9
|
+
Contact: marketplace@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501 docstring might be too long
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from stackit.stackitmarketplace.models.subscription_product import SubscriptionProduct
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class VendorSubscription(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
VendorSubscription
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
lifecycle_state: StrictStr = Field(description="Lifecycle state of the subscription.", alias="lifecycleState")
|
|
33
|
+
product: SubscriptionProduct
|
|
34
|
+
project_id: StrictStr = Field(description="The associated consumer project ID.", alias="projectId")
|
|
35
|
+
subscription_id: StrictStr = Field(description="The subscription ID.", alias="subscriptionId")
|
|
36
|
+
__properties: ClassVar[List[str]] = ["lifecycleState", "product", "projectId", "subscriptionId"]
|
|
37
|
+
|
|
38
|
+
@field_validator("lifecycle_state")
|
|
39
|
+
def lifecycle_state_validate_enum(cls, value):
|
|
40
|
+
"""Validates the enum"""
|
|
41
|
+
if value not in set(
|
|
42
|
+
[
|
|
43
|
+
"SUBSCRIPTION_PENDING",
|
|
44
|
+
"SUBSCRIPTION_ACTIVE",
|
|
45
|
+
"SUBSCRIPTION_INACTIVE",
|
|
46
|
+
"SUBSCRIPTION_CANCELLING",
|
|
47
|
+
"SUBSCRIPTION_CANCELLED",
|
|
48
|
+
"SUBSCRIPTION_REJECTED",
|
|
49
|
+
]
|
|
50
|
+
):
|
|
51
|
+
raise ValueError(
|
|
52
|
+
"must be one of enum values ('SUBSCRIPTION_PENDING', 'SUBSCRIPTION_ACTIVE', 'SUBSCRIPTION_INACTIVE', 'SUBSCRIPTION_CANCELLING', 'SUBSCRIPTION_CANCELLED', 'SUBSCRIPTION_REJECTED')"
|
|
53
|
+
)
|
|
54
|
+
return value
|
|
55
|
+
|
|
56
|
+
model_config = ConfigDict(
|
|
57
|
+
populate_by_name=True,
|
|
58
|
+
validate_assignment=True,
|
|
59
|
+
protected_namespaces=(),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def to_str(self) -> str:
|
|
63
|
+
"""Returns the string representation of the model using alias"""
|
|
64
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
65
|
+
|
|
66
|
+
def to_json(self) -> str:
|
|
67
|
+
"""Returns the JSON representation of the model using alias"""
|
|
68
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
69
|
+
return json.dumps(self.to_dict())
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
73
|
+
"""Create an instance of VendorSubscription from a JSON string"""
|
|
74
|
+
return cls.from_dict(json.loads(json_str))
|
|
75
|
+
|
|
76
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
77
|
+
"""Return the dictionary representation of the model using alias.
|
|
78
|
+
|
|
79
|
+
This has the following differences from calling pydantic's
|
|
80
|
+
`self.model_dump(by_alias=True)`:
|
|
81
|
+
|
|
82
|
+
* `None` is only added to the output dict for nullable fields that
|
|
83
|
+
were set at model initialization. Other fields with value `None`
|
|
84
|
+
are ignored.
|
|
85
|
+
"""
|
|
86
|
+
excluded_fields: Set[str] = set([])
|
|
87
|
+
|
|
88
|
+
_dict = self.model_dump(
|
|
89
|
+
by_alias=True,
|
|
90
|
+
exclude=excluded_fields,
|
|
91
|
+
exclude_none=True,
|
|
92
|
+
)
|
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of product
|
|
94
|
+
if self.product:
|
|
95
|
+
_dict["product"] = self.product.to_dict()
|
|
96
|
+
return _dict
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
100
|
+
"""Create an instance of VendorSubscription from a dict"""
|
|
101
|
+
if obj is None:
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
if not isinstance(obj, dict):
|
|
105
|
+
return cls.model_validate(obj)
|
|
106
|
+
|
|
107
|
+
_obj = cls.model_validate(
|
|
108
|
+
{
|
|
109
|
+
"lifecycleState": obj.get("lifecycleState"),
|
|
110
|
+
"product": SubscriptionProduct.from_dict(obj["product"]) if obj.get("product") is not None else None,
|
|
111
|
+
"projectId": obj.get("projectId"),
|
|
112
|
+
"subscriptionId": obj.get("subscriptionId"),
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
return _obj
|
|
File without changes
|