Skip to content

Commit

Permalink
Merge branch 'main' into generator-bot-11744492443/iaas
Browse files Browse the repository at this point in the history
  • Loading branch information
MelvinKl authored Nov 11, 2024
2 parents 7a5c5d9 + 0363266 commit 231ea3c
Show file tree
Hide file tree
Showing 21 changed files with 3,918 additions and 914 deletions.
12 changes: 10 additions & 2 deletions services/iaasalpha/src/stackit/iaasalpha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@
from stackit.iaasalpha.models.boot_volume_source import BootVolumeSource
from stackit.iaasalpha.models.create_area_address_family import CreateAreaAddressFamily
from stackit.iaasalpha.models.create_area_ipv4 import CreateAreaIPv4
from stackit.iaasalpha.models.create_image_payload import CreateImagePayload
from stackit.iaasalpha.models.create_key_pair_payload import CreateKeyPairPayload
from stackit.iaasalpha.models.create_nic_payload import CreateNICPayload
from stackit.iaasalpha.models.create_nic_payload import CreateNicPayload
from stackit.iaasalpha.models.create_protocol import CreateProtocol
from stackit.iaasalpha.models.create_public_ip_payload import CreatePublicIPPayload
from stackit.iaasalpha.models.create_security_group_payload import (
Expand All @@ -77,8 +78,14 @@
from stackit.iaasalpha.models.get_server_log200_response import GetServerLog200Response
from stackit.iaasalpha.models.get_server_log_request import GetServerLogRequest
from stackit.iaasalpha.models.icmp_parameters import ICMPParameters
from stackit.iaasalpha.models.image import Image
from stackit.iaasalpha.models.image_config import ImageConfig
from stackit.iaasalpha.models.image_create_response import ImageCreateResponse
from stackit.iaasalpha.models.image_list_response import ImageListResponse
from stackit.iaasalpha.models.key_pair_list_response import KeyPairListResponse
from stackit.iaasalpha.models.keypair import Keypair
from stackit.iaasalpha.models.machine_type import MachineType
from stackit.iaasalpha.models.machine_type_list_response import MachineTypeListResponse
from stackit.iaasalpha.models.network import Network
from stackit.iaasalpha.models.network_area import NetworkArea
from stackit.iaasalpha.models.network_area_ipv4 import NetworkAreaIPv4
Expand Down Expand Up @@ -131,8 +138,9 @@
from stackit.iaasalpha.models.update_attached_volume_payload import (
UpdateAttachedVolumePayload,
)
from stackit.iaasalpha.models.update_image_payload import UpdateImagePayload
from stackit.iaasalpha.models.update_key_pair_payload import UpdateKeyPairPayload
from stackit.iaasalpha.models.update_nic_payload import UpdateNICPayload
from stackit.iaasalpha.models.update_nic_payload import UpdateNicPayload
from stackit.iaasalpha.models.update_public_ip_payload import UpdatePublicIPPayload
from stackit.iaasalpha.models.update_security_group_payload import (
UpdateSecurityGroupPayload,
Expand Down
3,685 changes: 2,793 additions & 892 deletions services/iaasalpha/src/stackit/iaasalpha/api/default_api.py

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions services/iaasalpha/src/stackit/iaasalpha/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
from stackit.iaasalpha.models.boot_volume_source import BootVolumeSource
from stackit.iaasalpha.models.create_area_address_family import CreateAreaAddressFamily
from stackit.iaasalpha.models.create_area_ipv4 import CreateAreaIPv4
from stackit.iaasalpha.models.create_image_payload import CreateImagePayload
from stackit.iaasalpha.models.create_key_pair_payload import CreateKeyPairPayload
from stackit.iaasalpha.models.create_nic_payload import CreateNICPayload
from stackit.iaasalpha.models.create_nic_payload import CreateNicPayload
from stackit.iaasalpha.models.create_protocol import CreateProtocol
from stackit.iaasalpha.models.create_public_ip_payload import CreatePublicIPPayload
from stackit.iaasalpha.models.create_security_group_payload import (
Expand All @@ -58,8 +59,14 @@
from stackit.iaasalpha.models.get_server_log200_response import GetServerLog200Response
from stackit.iaasalpha.models.get_server_log_request import GetServerLogRequest
from stackit.iaasalpha.models.icmp_parameters import ICMPParameters
from stackit.iaasalpha.models.image import Image
from stackit.iaasalpha.models.image_config import ImageConfig
from stackit.iaasalpha.models.image_create_response import ImageCreateResponse
from stackit.iaasalpha.models.image_list_response import ImageListResponse
from stackit.iaasalpha.models.key_pair_list_response import KeyPairListResponse
from stackit.iaasalpha.models.keypair import Keypair
from stackit.iaasalpha.models.machine_type import MachineType
from stackit.iaasalpha.models.machine_type_list_response import MachineTypeListResponse
from stackit.iaasalpha.models.network import Network
from stackit.iaasalpha.models.network_area import NetworkArea
from stackit.iaasalpha.models.network_area_ipv4 import NetworkAreaIPv4
Expand Down Expand Up @@ -112,8 +119,9 @@
from stackit.iaasalpha.models.update_attached_volume_payload import (
UpdateAttachedVolumePayload,
)
from stackit.iaasalpha.models.update_image_payload import UpdateImagePayload
from stackit.iaasalpha.models.update_key_pair_payload import UpdateKeyPairPayload
from stackit.iaasalpha.models.update_nic_payload import UpdateNICPayload
from stackit.iaasalpha.models.update_nic_payload import UpdateNicPayload
from stackit.iaasalpha.models.update_public_ip_payload import UpdatePublicIPPayload
from stackit.iaasalpha.models.update_security_group_payload import (
UpdateSecurityGroupPayload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AreaPrefixConfigIPv4(BaseModel):
max_prefix_len: Optional[Annotated[int, Field(le=29, strict=True, ge=24)]] = Field(
default=None, description="The maximal prefix length for networks in the network area.", alias="maxPrefixLen"
)
min_prefix_len: Optional[Annotated[int, Field(le=29, strict=True, ge=22)]] = Field(
min_prefix_len: Optional[Annotated[int, Field(le=29, strict=True, ge=8)]] = Field(
default=None, description="The minimal prefix length for networks in the network area.", alias="minPrefixLen"
)
__properties: ClassVar[List[str]] = ["defaultPrefixLen", "maxPrefixLen", "minPrefixLen"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CreateAreaIPv4(BaseModel):
max_prefix_len: Optional[Annotated[int, Field(le=29, strict=True, ge=24)]] = Field(
default=None, description="The maximal prefix length for networks in the network area.", alias="maxPrefixLen"
)
min_prefix_len: Optional[Annotated[int, Field(le=29, strict=True, ge=22)]] = Field(
min_prefix_len: Optional[Annotated[int, Field(le=29, strict=True, ge=8)]] = Field(
default=None, description="The minimal prefix length for networks in the network area.", alias="minPrefixLen"
)
__properties: ClassVar[List[str]] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# coding: utf-8

"""
IaaS-API
This API allows you to create and modify IaaS resources.
The version of the OpenAPI document: 1alpha1
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501 docstring might be too long

from __future__ import annotations

import json
import pprint
import re
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import (
BaseModel,
ConfigDict,
Field,
StrictBool,
StrictInt,
StrictStr,
field_validator,
)
from typing_extensions import Annotated, Self

from stackit.iaasalpha.models.image_config import ImageConfig


class CreateImagePayload(BaseModel):
"""
Object that represents an Image and its parameters. Used for Creating and returning (get/list).
"""

config: Optional[ImageConfig] = None
created_at: Optional[datetime] = Field(
default=None, description="Date-time when resource was created.", alias="createdAt"
)
disk_format: StrictStr = Field(description="Object that represents a disk format.", alias="diskFormat")
id: Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]] = Field(
default=None, description="Universally Unique Identifier (UUID)."
)
labels: Optional[Dict[str, Any]] = Field(
default=None, description="Object that represents the labels of an object."
)
min_disk_size: Optional[StrictInt] = Field(default=None, description="Size in Gigabyte.", alias="minDiskSize")
min_ram: Optional[StrictInt] = Field(default=None, description="Size in Megabyte.", alias="minRam")
name: Annotated[str, Field(strict=True, max_length=63)] = Field(
description="The name for a General Object. Matches Names and also UUIDs."
)
protected: Optional[StrictBool] = None
status: Optional[StrictStr] = Field(default=None, description="The status of an image object.")
updated_at: Optional[datetime] = Field(
default=None, description="Date-time when resource was last updated.", alias="updatedAt"
)
__properties: ClassVar[List[str]] = [
"config",
"createdAt",
"diskFormat",
"id",
"labels",
"minDiskSize",
"minRam",
"name",
"protected",
"status",
"updatedAt",
]

@field_validator("id")
def id_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

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("name")
def name_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if not re.match(r"^[A-Za-z0-9]+((-|_|\s|\.)[A-Za-z0-9]+)*$", value):
raise ValueError(r"must validate the regular expression /^[A-Za-z0-9]+((-|_|\s|\.)[A-Za-z0-9]+)*$/")
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 CreateImagePayload 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.
"""
excluded_fields: Set[str] = set(
[
"created_at",
"id",
"status",
"updated_at",
]
)

_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of config
if self.config:
_dict["config"] = self.config.to_dict()
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of CreateImagePayload from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate(
{
"config": ImageConfig.from_dict(obj["config"]) if obj.get("config") is not None else None,
"createdAt": obj.get("createdAt"),
"diskFormat": obj.get("diskFormat"),
"id": obj.get("id"),
"labels": obj.get("labels"),
"minDiskSize": obj.get("minDiskSize"),
"minRam": obj.get("minRam"),
"name": obj.get("name"),
"protected": obj.get("protected"),
"status": obj.get("status"),
"updatedAt": obj.get("updatedAt"),
}
)
return _obj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from stackit.iaasalpha.models.allowed_addresses_inner import AllowedAddressesInner


class CreateNICPayload(BaseModel):
class CreateNicPayload(BaseModel):
"""
Object that represents a network interface.
"""
Expand Down Expand Up @@ -193,7 +193,7 @@ def to_json(self) -> str:

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of CreateNICPayload from a JSON string"""
"""Create an instance of CreateNicPayload from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
Expand Down Expand Up @@ -239,7 +239,7 @@ def to_dict(self) -> Dict[str, Any]:

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of CreateNICPayload from a dict"""
"""Create an instance of CreateNicPayload from a dict"""
if obj is None:
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
from pydantic import (
BaseModel,
ConfigDict,
Field,
StrictBool,
StrictInt,
StrictStr,
field_validator,
)
from typing_extensions import Annotated, Self

from stackit.iaasalpha.models.volume_source import VolumeSource
Expand All @@ -34,6 +42,7 @@ class CreateVolumePayload(BaseModel):
availability_zone: StrictStr = Field(
description="Object that represents an availability zone.", alias="availabilityZone"
)
bootable: Optional[StrictBool] = Field(default=None, description="Indicates if a volume is bootable.")
created_at: Optional[datetime] = Field(
default=None, description="Date-time when resource was created.", alias="createdAt"
)
Expand Down Expand Up @@ -65,6 +74,7 @@ class CreateVolumePayload(BaseModel):
)
__properties: ClassVar[List[str]] = [
"availabilityZone",
"bootable",
"createdAt",
"description",
"id",
Expand Down Expand Up @@ -189,6 +199,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
_obj = cls.model_validate(
{
"availabilityZone": obj.get("availabilityZone"),
"bootable": obj.get("bootable"),
"createdAt": obj.get("createdAt"),
"description": obj.get("description"),
"id": obj.get("id"),
Expand Down
Loading

0 comments on commit 231ea3c

Please sign in to comment.