Skip to content

Generator: Update SDK /services/git #1288

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
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
7 changes: 5 additions & 2 deletions services/git/src/stackit/git/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions services/git/src/stackit/git/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions services/git/src/stackit/git/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 5 additions & 2 deletions services/git/src/stackit/git/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Up @@ -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)

Expand All @@ -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):
Expand Down Expand Up @@ -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
Loading
Loading