Skip to content

Generator: Update SDK /services/git #1302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 5 additions & 2 deletions services/git/src/stackit/git/__init__.py
Original file line number Diff line number Diff line change
@@ -5,9 +5,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -35,9 +35,12 @@

# import models into sdk package
from stackit.git.models.create_instance_payload import CreateInstancePayload
from stackit.git.models.flavor import Flavor
from stackit.git.models.generic_error_response import GenericErrorResponse
from stackit.git.models.instance import Instance
from stackit.git.models.internal_server_error_response import (
InternalServerErrorResponse,
)
from stackit.git.models.list_flavors import ListFlavors
from stackit.git.models.list_instances import ListInstances
from stackit.git.models.unauthorized_response import UnauthorizedResponse
504 changes: 346 additions & 158 deletions services/git/src/stackit/git/api/default_api.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions services/git/src/stackit/git/api_client.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
4 changes: 2 additions & 2 deletions services/git/src/stackit/git/configuration.py
Original file line number Diff line number Diff line change
@@ -8,9 +8,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
4 changes: 2 additions & 2 deletions services/git/src/stackit/git/exceptions.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
7 changes: 5 additions & 2 deletions services/git/src/stackit/git/models/__init__.py
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -16,9 +16,12 @@

# import models into model package
from stackit.git.models.create_instance_payload import CreateInstancePayload
from stackit.git.models.flavor import Flavor
from stackit.git.models.generic_error_response import GenericErrorResponse
from stackit.git.models.instance import Instance
from stackit.git.models.internal_server_error_response import (
InternalServerErrorResponse,
)
from stackit.git.models.list_flavors import ListFlavors
from stackit.git.models.list_instances import ListInstances
from stackit.git.models.unauthorized_response import UnauthorizedResponse
24 changes: 18 additions & 6 deletions services/git/src/stackit/git/models/create_instance_payload.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: [email protected]
Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -19,19 +19,25 @@
import re
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, field_validator
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from typing_extensions import Annotated, Self


class CreateInstancePayload(BaseModel):
"""
Request a STACKIT Git instance to be created with these properties.
Instance creation configuration options.
"""

acl: Optional[Annotated[List[StrictStr], Field(max_length=5)]] = Field(
default=None, description="Restricted ACL for instance access."
)
flavor: Optional[StrictStr] = Field(
default="git-100", description="Instance flavor. Defaults to git-100 if not specified."
)
name: Annotated[str, Field(min_length=5, strict=True, max_length=32)] = Field(
description="A user chosen name to distinguish multiple STACKIT Git instances."
)
__properties: ClassVar[List[str]] = ["name"]
__properties: ClassVar[List[str]] = ["acl", "flavor", "name"]

@field_validator("name")
def name_validate_regular_expression(cls, value):
@@ -88,5 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({"name": obj.get("name")})
_obj = cls.model_validate(
{
"acl": obj.get("acl"),
"flavor": obj.get("flavor") if obj.get("flavor") is not None else "git-100",
"name": obj.get("name"),
}
)
return _obj
99 changes: 99 additions & 0 deletions services/git/src/stackit/git/models/flavor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# coding: utf-8

"""
STACKIT Git API
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.4
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
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 Flavor(BaseModel):
"""
Describes a STACKIT Git Flavor.
"""

availability: StrictStr = Field(description="Defines the flavor availability.")
description: StrictStr = Field(description="Flavor description.")
display_name: StrictStr = Field(description="The display name that will be shown in the Portal.")
id: Annotated[str, Field(strict=True, max_length=36)] = Field(description="Flavor id.")
__properties: ClassVar[List[str]] = ["availability", "description", "display_name", "id"]

@field_validator("availability")
def availability_validate_enum(cls, value):
"""Validates the enum"""
if value not in set(["available", "unavailable", "internal", "deprecated"]):
raise ValueError("must be one of enum values ('available', 'unavailable', 'internal', 'deprecated')")
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 Flavor 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 Flavor from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate(
{
"availability": obj.get("availability"),
"description": obj.get("description"),
"display_name": obj.get("display_name"),
"id": obj.get("id"),
}
)
return _obj
83 changes: 83 additions & 0 deletions services/git/src/stackit/git/models/generic_error_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# coding: utf-8

"""
STACKIT Git API
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.4
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
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, StrictStr
from typing_extensions import Self


class GenericErrorResponse(BaseModel):
"""
Generic Error Response.
"""

details: Optional[List[StrictStr]] = None
message: StrictStr
__properties: ClassVar[List[str]] = ["details", "message"]

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 GenericErrorResponse 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 GenericErrorResponse from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate({"details": obj.get("details"), "message": obj.get("message")})
return _obj
59 changes: 40 additions & 19 deletions services/git/src/stackit/git/models/instance.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: git@stackit.cloud
Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -16,35 +16,52 @@

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, field_validator
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
from typing_extensions import Annotated, Self


class Instance(BaseModel):
"""
Describes a STACKIT Git instance.
Information about an Instance.
"""

created: datetime = Field(description="The date and time the creation of the STACKIT Git instance was triggered.")
id: Annotated[str, Field(strict=True, max_length=36)] = Field(
description="A auto generated unique id which identifies the STACKIT Git instances."
)
name: Annotated[str, Field(strict=True, max_length=32)] = Field(
description="A user chosen name to distinguish multiple STACKIT Git instances."
)
acl: List[StrictStr] = Field(description="Restricted ACL for instance access.")
consumed_disk: StrictStr = Field(description="How many bytes of disk space is consumed. Read Only.")
consumed_object_storage: StrictStr = Field(description="How many bytes of Object Storage is consumed. Read Only.")
created: datetime = Field(description="Instance creation timestamp in RFC3339 format.")
flavor: StrictStr = Field(description="Instance flavor.")
id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field(description="Instance identifier.")
name: Annotated[str, Field(strict=True, max_length=32)] = Field(description="Instance name.")
state: Annotated[str, Field(strict=True, max_length=32)] = Field(
description="The current state of the STACKIT Git instance."
)
url: Annotated[str, Field(strict=True, max_length=2048)] = Field(
description="The URL for reaching the STACKIT Git instance."
)
version: Annotated[str, Field(strict=True, max_length=20)] = Field(
description="The current version of STACKIT Git deployed to the instance."
description="Indicate the readiness state of the instance."
)
__properties: ClassVar[List[str]] = ["created", "id", "name", "state", "url", "version"]
url: Annotated[str, Field(strict=True, max_length=512)] = Field(description="Instance url.")
version: Annotated[str, Field(strict=True, max_length=20)] = Field(description="STACKIT Git version indicator.")
__properties: ClassVar[List[str]] = [
"acl",
"consumed_disk",
"consumed_object_storage",
"created",
"flavor",
"id",
"name",
"state",
"url",
"version",
]

@field_validator("id")
def 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("state")
def state_validate_enum(cls, value):
@@ -105,7 +122,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate(
{
"acl": obj.get("acl"),
"consumed_disk": obj.get("consumed_disk"),
"consumed_object_storage": obj.get("consumed_object_storage"),
"created": obj.get("created"),
"flavor": obj.get("flavor"),
"id": obj.get("id"),
"name": obj.get("name"),
"state": obj.get("state"),
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: git@stackit.cloud
Generated by OpenAPI Generator (https://openapi-generator.tech)
97 changes: 97 additions & 0 deletions services/git/src/stackit/git/models/list_flavors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# coding: utf-8

"""
STACKIT Git API
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.4
Contact: git@stackit.cloud
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501 docstring might be too long

from __future__ import annotations

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

from pydantic import BaseModel, ConfigDict
from typing_extensions import Self

from stackit.git.models.flavor import Flavor


class ListFlavors(BaseModel):
"""
A list of STACKIT Git flavors.
"""

flavors: List[Flavor]
__properties: ClassVar[List[str]] = ["flavors"]

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 ListFlavors 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 flavors (list)
_items = []
if self.flavors:
for _item in self.flavors:
if _item:
_items.append(_item.to_dict())
_dict["flavors"] = _items
return _dict

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

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

_obj = cls.model_validate(
{
"flavors": (
[Flavor.from_dict(_item) for _item in obj["flavors"]] if obj.get("flavors") is not None else None
)
}
)
return _obj
8 changes: 4 additions & 4 deletions services/git/src/stackit/git/models/list_instances.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: git@stackit.cloud
Generated by OpenAPI Generator (https://openapi-generator.tech)
@@ -26,10 +26,10 @@

class ListInstances(BaseModel):
"""
A list of STACKIT Git instances.
List of Instances.
"""

instances: Annotated[List[Instance], Field(max_length=50)]
instances: Annotated[List[Instance], Field(max_length=100)]
__properties: ClassVar[List[str]] = ["instances"]

model_config = ConfigDict(
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: git@stackit.cloud
Generated by OpenAPI Generator (https://openapi-generator.tech)
4 changes: 2 additions & 2 deletions services/git/src/stackit/git/rest.py
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"""
STACKIT Git API
Manage STACKIT Git instances.
STACKIT Git management API.
The version of the OpenAPI document: 1beta.0.3
The version of the OpenAPI document: 1beta.0.4
Contact: git@stackit.cloud
Generated by OpenAPI Generator (https://openapi-generator.tech)