Skip to content

Generator: Update SDK /services/serverupdate #637

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

Merged
merged 2 commits into from
Feb 6, 2025
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Release (2025-XX-XX)

- `serverupdate`: [v0.3.0](services/serverupdate/CHANGELOG.md#v030-2025-02-06)
- **Breaking Change:**: Remove field `BackupProperties` from `CreateUpdatePayload` model
- **Fix**: Remove field `Id` from `CreateUpdateSchedulePayload` model
- `authorization`: [v0.2.2](services/authorization/CHANGELOG.md#v022-2025-01-21)
- **Bugfix:** Revert back to global URL configuration
- `sqlserverflex`: [v0.3.0](services/sqlserverflex/CHANGELOG.md#v030-2025-01-21)
Expand Down
5 changes: 5 additions & 0 deletions services/serverupdate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.3.0 (2025-02-06)

- **Breaking Change:**: Remove field `BackupProperties` from `CreateUpdatePayload` model
- **Fix**: Remove field `Id` from `CreateUpdateSchedulePayload` model

## v0.2.0 (2025-01-13)

- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL.
Expand Down
2 changes: 1 addition & 1 deletion services/serverupdate/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-serverupdate"

[tool.poetry]
name = "stackit-serverupdate"
version = "v0.2.0"
version = "v0.3.0"
authors = [
"STACKIT Developer Tools <[email protected]>",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
)

# import models into sdk package
from stackit.serverupdate.models.backup_properties import BackupProperties
from stackit.serverupdate.models.create_update_payload import CreateUpdatePayload
from stackit.serverupdate.models.create_update_schedule_payload import (
CreateUpdateSchedulePayload,
Expand All @@ -49,10 +48,16 @@
from stackit.serverupdate.models.get_update_schedules_response import (
GetUpdateSchedulesResponse,
)
from stackit.serverupdate.models.get_update_service_response import (
GetUpdateServiceResponse,
)
from stackit.serverupdate.models.get_updates_list_response import GetUpdatesListResponse
from stackit.serverupdate.models.update import Update
from stackit.serverupdate.models.update_policy import UpdatePolicy
from stackit.serverupdate.models.update_schedule import UpdateSchedule
from stackit.serverupdate.models.update_schedule_create_request import (
UpdateScheduleCreateRequest,
)
from stackit.serverupdate.models.update_update_schedule_payload import (
UpdateUpdateSchedulePayload,
)
250 changes: 250 additions & 0 deletions services/serverupdate/src/stackit/serverupdate/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
from stackit.serverupdate.models.get_update_schedules_response import (
GetUpdateSchedulesResponse,
)
from stackit.serverupdate.models.get_update_service_response import (
GetUpdateServiceResponse,
)
from stackit.serverupdate.models.get_updates_list_response import GetUpdatesListResponse
from stackit.serverupdate.models.update import Update
from stackit.serverupdate.models.update_schedule import UpdateSchedule
Expand Down Expand Up @@ -1879,6 +1882,253 @@ def _enable_service_resource_serialize(
_request_auth=_request_auth,
)

@validate_call
def get_service_resource(
self,
project_id: Annotated[StrictStr, Field(description="project id")],
server_id: Annotated[StrictStr, Field(description="server id")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> GetUpdateServiceResponse:
"""get update service details


:param project_id: project id (required)
:type project_id: str
:param server_id: server id (required)
:type server_id: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501 docstring might be too long

_param = self._get_service_resource_serialize(
project_id=project_id,
server_id=server_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
)

_response_types_map: Dict[str, Optional[str]] = {
"200": "GetUpdateServiceResponse",
"400": None,
"401": None,
"404": None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data

@validate_call
def get_service_resource_with_http_info(
self,
project_id: Annotated[StrictStr, Field(description="project id")],
server_id: Annotated[StrictStr, Field(description="server id")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[GetUpdateServiceResponse]:
"""get update service details


:param project_id: project id (required)
:type project_id: str
:param server_id: server id (required)
:type server_id: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501 docstring might be too long

_param = self._get_service_resource_serialize(
project_id=project_id,
server_id=server_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
)

_response_types_map: Dict[str, Optional[str]] = {
"200": "GetUpdateServiceResponse",
"400": None,
"401": None,
"404": None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)

@validate_call
def get_service_resource_without_preload_content(
self,
project_id: Annotated[StrictStr, Field(description="project id")],
server_id: Annotated[StrictStr, Field(description="server id")],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""get update service details


:param project_id: project id (required)
:type project_id: str
:param server_id: server id (required)
:type server_id: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501 docstring might be too long

_param = self._get_service_resource_serialize(
project_id=project_id,
server_id=server_id,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
)

_response_types_map: Dict[str, Optional[str]] = {
"200": "GetUpdateServiceResponse",
"400": None,
"401": None,
"404": None,
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
return response_data.response

def _get_service_resource_serialize(
self,
project_id,
server_id,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:

_host = None

_collection_formats: Dict[str, str] = {}

_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, Union[str, bytes]] = {}
_body_params: Optional[bytes] = None

# process the path parameters
if project_id is not None:
_path_params["projectId"] = project_id
if server_id is not None:
_path_params["serverId"] = server_id
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter

# set the HTTP header `Accept`
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])

# authentication setting
_auth_settings: List[str] = []

return self.api_client.param_serialize(
method="GET",
resource_path="/v1/projects/{projectId}/servers/{serverId}/service",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
)

@validate_call
def get_update(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


# import models into model package
from stackit.serverupdate.models.backup_properties import BackupProperties
from stackit.serverupdate.models.create_update_payload import CreateUpdatePayload
from stackit.serverupdate.models.create_update_schedule_payload import (
CreateUpdateSchedulePayload,
Expand All @@ -30,10 +29,16 @@
from stackit.serverupdate.models.get_update_schedules_response import (
GetUpdateSchedulesResponse,
)
from stackit.serverupdate.models.get_update_service_response import (
GetUpdateServiceResponse,
)
from stackit.serverupdate.models.get_updates_list_response import GetUpdatesListResponse
from stackit.serverupdate.models.update import Update
from stackit.serverupdate.models.update_policy import UpdatePolicy
from stackit.serverupdate.models.update_schedule import UpdateSchedule
from stackit.serverupdate.models.update_schedule_create_request import (
UpdateScheduleCreateRequest,
)
from stackit.serverupdate.models.update_update_schedule_payload import (
UpdateUpdateSchedulePayload,
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@
from pydantic import BaseModel, ConfigDict, Field, StrictBool
from typing_extensions import Annotated, Self

from stackit.serverupdate.models.backup_properties import BackupProperties


class CreateUpdatePayload(BaseModel):
"""
CreateUpdatePayload
"""

backup_before_update: Optional[StrictBool] = Field(default=None, alias="backupBeforeUpdate")
backup_properties: Optional[BackupProperties] = Field(default=None, alias="backupProperties")
maintenance_window: Annotated[int, Field(le=24, strict=True, ge=1)] = Field(alias="maintenanceWindow")
__properties: ClassVar[List[str]] = ["backupBeforeUpdate", "backupProperties", "maintenanceWindow"]
__properties: ClassVar[List[str]] = ["backupBeforeUpdate", "maintenanceWindow"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -71,9 +68,6 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of backup_properties
if self.backup_properties:
_dict["backupProperties"] = self.backup_properties.to_dict()
return _dict

@classmethod
Expand All @@ -86,14 +80,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
return cls.model_validate(obj)

_obj = cls.model_validate(
{
"backupBeforeUpdate": obj.get("backupBeforeUpdate"),
"backupProperties": (
BackupProperties.from_dict(obj["backupProperties"])
if obj.get("backupProperties") is not None
else None
),
"maintenanceWindow": obj.get("maintenanceWindow"),
}
{"backupBeforeUpdate": obj.get("backupBeforeUpdate"), "maintenanceWindow": obj.get("maintenanceWindow")}
)
return _obj
Loading
Loading