diff --git a/services/sfs/oas_commit b/services/sfs/oas_commit index e3713dde3..a978700c7 100644 --- a/services/sfs/oas_commit +++ b/services/sfs/oas_commit @@ -1 +1 @@ -0e64886dd0847341800d7191ed193b75413be998 +467fe4d305e48699c34835e45fd1c7b486be01d2 diff --git a/services/sfs/src/stackit/sfs/__init__.py b/services/sfs/src/stackit/sfs/__init__.py index 01434e11b..484ab9be1 100644 --- a/services/sfs/src/stackit/sfs/__init__.py +++ b/services/sfs/src/stackit/sfs/__init__.py @@ -28,6 +28,7 @@ "ApiKeyError", "ApiAttributeError", "ApiException", + "CreateLockResponse", "CreateResourcePoolPayload", "CreateResourcePoolResponse", "CreateResourcePoolSnapshotPayload", @@ -40,22 +41,30 @@ "Error", "GetResourcePoolResponse", "GetResourcePoolSnapshotResponse", + "GetScheduleResponse", "GetShareExportPolicyResponse", "GetShareResponse", + "GetSnapshotPolicyResponse", "GoogleProtobufAny", "ListPerformanceClassesResponse", "ListResourcePoolSnapshotsResponse", "ListResourcePoolsResponse", + "ListSchedulesResponse", "ListShareExportPoliciesResponse", "ListSharesResponse", + "ListSnapshotPoliciesResponse", "PerformanceClass", "ResourcePool", "ResourcePoolPerformanceClass", "ResourcePoolSnapshot", + "ResourcePoolSnapshotPolicy", "ResourcePoolSpace", + "Schedule", "Share", "ShareExportPolicy", "ShareExportPolicyRule", + "SnapshotPolicy", + "SnapshotPolicySchedule", "Status", "UpdateResourcePoolPayload", "UpdateResourcePoolResponse", @@ -83,6 +92,9 @@ from stackit.sfs.exceptions import OpenApiException as OpenApiException # import models into sdk package +from stackit.sfs.models.create_lock_response import ( + CreateLockResponse as CreateLockResponse, +) from stackit.sfs.models.create_resource_pool_payload import ( CreateResourcePoolPayload as CreateResourcePoolPayload, ) @@ -117,10 +129,16 @@ from stackit.sfs.models.get_resource_pool_snapshot_response import ( GetResourcePoolSnapshotResponse as GetResourcePoolSnapshotResponse, ) +from stackit.sfs.models.get_schedule_response import ( + GetScheduleResponse as GetScheduleResponse, +) from stackit.sfs.models.get_share_export_policy_response import ( GetShareExportPolicyResponse as GetShareExportPolicyResponse, ) from stackit.sfs.models.get_share_response import GetShareResponse as GetShareResponse +from stackit.sfs.models.get_snapshot_policy_response import ( + GetSnapshotPolicyResponse as GetSnapshotPolicyResponse, +) from stackit.sfs.models.google_protobuf_any import ( GoogleProtobufAny as GoogleProtobufAny, ) @@ -133,12 +151,18 @@ from stackit.sfs.models.list_resource_pools_response import ( ListResourcePoolsResponse as ListResourcePoolsResponse, ) +from stackit.sfs.models.list_schedules_response import ( + ListSchedulesResponse as ListSchedulesResponse, +) from stackit.sfs.models.list_share_export_policies_response import ( ListShareExportPoliciesResponse as ListShareExportPoliciesResponse, ) from stackit.sfs.models.list_shares_response import ( ListSharesResponse as ListSharesResponse, ) +from stackit.sfs.models.list_snapshot_policies_response import ( + ListSnapshotPoliciesResponse as ListSnapshotPoliciesResponse, +) from stackit.sfs.models.performance_class import PerformanceClass as PerformanceClass from stackit.sfs.models.resource_pool import ResourcePool as ResourcePool from stackit.sfs.models.resource_pool_performance_class import ( @@ -147,9 +171,13 @@ from stackit.sfs.models.resource_pool_snapshot import ( ResourcePoolSnapshot as ResourcePoolSnapshot, ) +from stackit.sfs.models.resource_pool_snapshot_policy import ( + ResourcePoolSnapshotPolicy as ResourcePoolSnapshotPolicy, +) from stackit.sfs.models.resource_pool_space import ( ResourcePoolSpace as ResourcePoolSpace, ) +from stackit.sfs.models.schedule import Schedule as Schedule from stackit.sfs.models.share import Share as Share from stackit.sfs.models.share_export_policy import ( ShareExportPolicy as ShareExportPolicy, @@ -157,6 +185,10 @@ from stackit.sfs.models.share_export_policy_rule import ( ShareExportPolicyRule as ShareExportPolicyRule, ) +from stackit.sfs.models.snapshot_policy import SnapshotPolicy as SnapshotPolicy +from stackit.sfs.models.snapshot_policy_schedule import ( + SnapshotPolicySchedule as SnapshotPolicySchedule, +) from stackit.sfs.models.status import Status as Status from stackit.sfs.models.update_resource_pool_payload import ( UpdateResourcePoolPayload as UpdateResourcePoolPayload, diff --git a/services/sfs/src/stackit/sfs/api/default_api.py b/services/sfs/src/stackit/sfs/api/default_api.py index 5544d4eec..831bc2b32 100644 --- a/services/sfs/src/stackit/sfs/api/default_api.py +++ b/services/sfs/src/stackit/sfs/api/default_api.py @@ -13,12 +13,13 @@ from typing import Any, Dict, List, Optional, Tuple, Union -from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, validate_call from stackit.core.configuration import Configuration from typing_extensions import Annotated from stackit.sfs.api_client import ApiClient, RequestSerialized from stackit.sfs.api_response import ApiResponse +from stackit.sfs.models.create_lock_response import CreateLockResponse from stackit.sfs.models.create_resource_pool_payload import CreateResourcePoolPayload from stackit.sfs.models.create_resource_pool_response import CreateResourcePoolResponse from stackit.sfs.models.create_resource_pool_snapshot_payload import ( @@ -39,10 +40,12 @@ from stackit.sfs.models.get_resource_pool_snapshot_response import ( GetResourcePoolSnapshotResponse, ) +from stackit.sfs.models.get_schedule_response import GetScheduleResponse from stackit.sfs.models.get_share_export_policy_response import ( GetShareExportPolicyResponse, ) from stackit.sfs.models.get_share_response import GetShareResponse +from stackit.sfs.models.get_snapshot_policy_response import GetSnapshotPolicyResponse from stackit.sfs.models.list_performance_classes_response import ( ListPerformanceClassesResponse, ) @@ -50,10 +53,14 @@ ListResourcePoolSnapshotsResponse, ) from stackit.sfs.models.list_resource_pools_response import ListResourcePoolsResponse +from stackit.sfs.models.list_schedules_response import ListSchedulesResponse from stackit.sfs.models.list_share_export_policies_response import ( ListShareExportPoliciesResponse, ) from stackit.sfs.models.list_shares_response import ListSharesResponse +from stackit.sfs.models.list_snapshot_policies_response import ( + ListSnapshotPoliciesResponse, +) from stackit.sfs.models.update_resource_pool_payload import UpdateResourcePoolPayload from stackit.sfs.models.update_resource_pool_response import UpdateResourcePoolResponse from stackit.sfs.models.update_share_export_policy_payload import ( @@ -80,6 +87,247 @@ def __init__(self, configuration: Configuration = None) -> None: self.configuration = configuration self.api_client = ApiClient(self.configuration) + @validate_call + def create_lock( + self, + region: StrictStr, + project_id: StrictStr, + _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, + ) -> CreateLockResponse: + """create_lock + + Create Lock + + :param region: (required) + :type region: str + :param project_id: (required) + :type project_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 + + _param = self._create_lock_serialize( + region=region, + project_id=project_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateLockResponse", + } + 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 create_lock_with_http_info( + self, + region: StrictStr, + project_id: StrictStr, + _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[CreateLockResponse]: + """create_lock + + Create Lock + + :param region: (required) + :type region: str + :param project_id: (required) + :type project_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 + + _param = self._create_lock_serialize( + region=region, + project_id=project_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateLockResponse", + } + 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 create_lock_without_preload_content( + self, + region: StrictStr, + project_id: StrictStr, + _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: + """create_lock + + Create Lock + + :param region: (required) + :type region: str + :param project_id: (required) + :type project_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 + + _param = self._create_lock_serialize( + region=region, + project_id=project_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "CreateLockResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_lock_serialize( + self, + region, + project_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, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if region is not None: + _path_params["region"] = region + if project_id is not None: + _path_params["projectId"] = project_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="POST", + resource_path="/v1/regions/{region}/project/{projectId}/locks", + 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 create_resource_pool( self, @@ -1211,11 +1459,10 @@ def _create_share_export_policy_serialize( ) @validate_call - def delete_resource_pool( + def delete_lock( self, - project_id: StrictStr, region: StrictStr, - resource_pool_id: StrictStr, + project_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1226,16 +1473,14 @@ def delete_resource_pool( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> object: - """Delete Resource Pool + """delete_lock - Deletes a Resource Pool in a project. + Delete Lock - :param project_id: (required) - :type project_id: str :param region: (required) :type region: str - :param resource_pool_id: (required) - :type resource_pool_id: str + :param project_id: (required) + :type project_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 @@ -1258,10 +1503,9 @@ def delete_resource_pool( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_resource_pool_serialize( - project_id=project_id, + _param = self._delete_lock_serialize( region=region, - resource_pool_id=resource_pool_id, + project_id=project_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1270,9 +1514,6 @@ def delete_resource_pool( _response_types_map: Dict[str, Optional[str]] = { "200": "object", - "400": "ValidationError", - "401": "str", - "500": "Error", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1282,11 +1523,10 @@ def delete_resource_pool( ).data @validate_call - def delete_resource_pool_with_http_info( + def delete_lock_with_http_info( self, - project_id: StrictStr, region: StrictStr, - resource_pool_id: StrictStr, + project_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1297,16 +1537,14 @@ def delete_resource_pool_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[object]: - """Delete Resource Pool + """delete_lock - Deletes a Resource Pool in a project. + Delete Lock - :param project_id: (required) - :type project_id: str :param region: (required) :type region: str - :param resource_pool_id: (required) - :type resource_pool_id: str + :param project_id: (required) + :type project_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 @@ -1329,10 +1567,261 @@ def delete_resource_pool_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_resource_pool_serialize( - project_id=project_id, + _param = self._delete_lock_serialize( region=region, - resource_pool_id=resource_pool_id, + project_id=project_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "object", + } + 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 delete_lock_without_preload_content( + self, + region: StrictStr, + project_id: StrictStr, + _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: + """delete_lock + + Delete Lock + + :param region: (required) + :type region: str + :param project_id: (required) + :type project_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 + + _param = self._delete_lock_serialize( + region=region, + project_id=project_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "object", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_lock_serialize( + self, + region, + project_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, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if region is not None: + _path_params["region"] = region + if project_id is not None: + _path_params["projectId"] = project_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="DELETE", + resource_path="/v1/regions/{region}/project/{projectId}/locks", + 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 delete_resource_pool( + self, + project_id: StrictStr, + region: StrictStr, + resource_pool_id: StrictStr, + _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, + ) -> object: + """Delete Resource Pool + + Deletes a Resource Pool in a project. + + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: str + :param resource_pool_id: (required) + :type resource_pool_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 + + _param = self._delete_resource_pool_serialize( + project_id=project_id, + region=region, + resource_pool_id=resource_pool_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "object", + "400": "ValidationError", + "401": "str", + "500": "Error", + } + 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 delete_resource_pool_with_http_info( + self, + project_id: StrictStr, + region: StrictStr, + resource_pool_id: StrictStr, + _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[object]: + """Delete Resource Pool + + Deletes a Resource Pool in a project. + + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: str + :param resource_pool_id: (required) + :type resource_pool_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 + + _param = self._delete_resource_pool_serialize( + project_id=project_id, + region=region, + resource_pool_id=resource_pool_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2858,12 +3347,10 @@ def _get_resource_pool_snapshot_serialize( ) @validate_call - def get_share( + def get_schedule( self, project_id: StrictStr, - region: StrictStr, - resource_pool_id: StrictStr, - share_id: StrictStr, + id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2873,16 +3360,259 @@ def get_share( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> GetShareResponse: - """Get Share + ) -> GetScheduleResponse: + """get_schedule - Retrieves a Shares in a Resource Pool in a project. + Get Schedule :param project_id: (required) :type project_id: str - :param region: (required) - :type region: str - :param resource_pool_id: (required) + :param id: (required) + :type 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 + + _param = self._get_schedule_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetScheduleResponse", + } + 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_schedule_with_http_info( + self, + project_id: StrictStr, + id: StrictStr, + _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[GetScheduleResponse]: + """get_schedule + + Get Schedule + + :param project_id: (required) + :type project_id: str + :param id: (required) + :type 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 + + _param = self._get_schedule_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetScheduleResponse", + } + 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_schedule_without_preload_content( + self, + project_id: StrictStr, + id: StrictStr, + _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_schedule + + Get Schedule + + :param project_id: (required) + :type project_id: str + :param id: (required) + :type 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 + + _param = self._get_schedule_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetScheduleResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_schedule_serialize( + self, + project_id, + 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, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if id is not None: + _path_params["id"] = 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}/schedules/{id}", + 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_share( + self, + project_id: StrictStr, + region: StrictStr, + resource_pool_id: StrictStr, + share_id: StrictStr, + _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, + ) -> GetShareResponse: + """Get Share + + Retrieves a Shares in a Resource Pool in a project. + + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: str + :param resource_pool_id: (required) :type resource_pool_id: str :param share_id: (required) :type share_id: str @@ -3407,8 +4137,10 @@ def _get_share_export_policy_serialize( ) @validate_call - def list_performance_classes( + def get_snapshot_policy( self, + project_id: StrictStr, + id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3418,11 +4150,15 @@ def list_performance_classes( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListPerformanceClassesResponse: - """List Resource Pool Performance Classes + ) -> GetSnapshotPolicyResponse: + """get_snapshot_policy - Lists all performances classes available + Get Snapshot Policy + :param project_id: (required) + :type project_id: str + :param id: (required) + :type 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 @@ -3445,15 +4181,17 @@ def list_performance_classes( :return: Returns the result object. """ # noqa: E501 - _param = self._list_performance_classes_serialize( - _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._get_snapshot_policy_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListPerformanceClassesResponse", - "400": "ValidationError", - "401": "str", - "500": "Error", + "200": "GetSnapshotPolicyResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -3463,8 +4201,10 @@ def list_performance_classes( ).data @validate_call - def list_performance_classes_with_http_info( + def get_snapshot_policy_with_http_info( self, + project_id: StrictStr, + id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3474,11 +4214,15 @@ def list_performance_classes_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListPerformanceClassesResponse]: - """List Resource Pool Performance Classes + ) -> ApiResponse[GetSnapshotPolicyResponse]: + """get_snapshot_policy - Lists all performances classes available + Get Snapshot Policy + :param project_id: (required) + :type project_id: str + :param id: (required) + :type 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 @@ -3501,12 +4245,741 @@ def list_performance_classes_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_performance_classes_serialize( - _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._get_snapshot_policy_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetSnapshotPolicyResponse", + } + 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_snapshot_policy_without_preload_content( + self, + project_id: StrictStr, + id: StrictStr, + _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_snapshot_policy + + Get Snapshot Policy + + :param project_id: (required) + :type project_id: str + :param id: (required) + :type 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 + + _param = self._get_snapshot_policy_serialize( + project_id=project_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetSnapshotPolicyResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_snapshot_policy_serialize( + self, + project_id, + 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, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if id is not None: + _path_params["id"] = 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}/snapshotPolicies/{id}", + 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 list_performance_classes( + self, + _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, + ) -> ListPerformanceClassesResponse: + """List Resource Performance Classes + + Lists all performances classes available + + :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 + + _param = self._list_performance_classes_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPerformanceClassesResponse", + "400": "ValidationError", + "401": "str", + "500": "Error", + } + 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 list_performance_classes_with_http_info( + self, + _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[ListPerformanceClassesResponse]: + """List Resource Performance Classes + + Lists all performances classes available + + :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 + + _param = self._list_performance_classes_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPerformanceClassesResponse", + "400": "ValidationError", + "401": "str", + "500": "Error", + } + 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 list_performance_classes_without_preload_content( + self, + _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: + """List Resource Performance Classes + + Lists all performances classes available + + :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 + + _param = self._list_performance_classes_serialize( + _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListPerformanceClassesResponse", + "400": "ValidationError", + "401": "str", + "500": "Error", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _list_performance_classes_serialize( + self, + _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, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # 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", "application/problem+json", "text/plain"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/resourcePoolPerformanceClasses", + 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 list_resource_pool_snapshots( + self, + project_id: StrictStr, + region: StrictStr, + resource_pool_id: StrictStr, + _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, + ) -> ListResourcePoolSnapshotsResponse: + """List Resource Pool Snapshots + + Lists the Snapshots of a Resource Pool in a project. + + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: str + :param resource_pool_id: (required) + :type resource_pool_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 + + _param = self._list_resource_pool_snapshots_serialize( + project_id=project_id, + region=region, + resource_pool_id=resource_pool_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListResourcePoolSnapshotsResponse", + "400": "ValidationError", + "401": "str", + "500": "Error", + } + 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 list_resource_pool_snapshots_with_http_info( + self, + project_id: StrictStr, + region: StrictStr, + resource_pool_id: StrictStr, + _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[ListResourcePoolSnapshotsResponse]: + """List Resource Pool Snapshots + + Lists the Snapshots of a Resource Pool in a project. + + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: str + :param resource_pool_id: (required) + :type resource_pool_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 + + _param = self._list_resource_pool_snapshots_serialize( + project_id=project_id, + region=region, + resource_pool_id=resource_pool_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListResourcePoolSnapshotsResponse", + "400": "ValidationError", + "401": "str", + "500": "Error", + } + 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 list_resource_pool_snapshots_without_preload_content( + self, + project_id: StrictStr, + region: StrictStr, + resource_pool_id: StrictStr, + _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: + """List Resource Pool Snapshots + + Lists the Snapshots of a Resource Pool in a project. + + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: str + :param resource_pool_id: (required) + :type resource_pool_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 + + _param = self._list_resource_pool_snapshots_serialize( + project_id=project_id, + region=region, + resource_pool_id=resource_pool_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListResourcePoolSnapshotsResponse", + "400": "ValidationError", + "401": "str", + "500": "Error", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _list_resource_pool_snapshots_serialize( + self, + project_id, + region, + resource_pool_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, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if region is not None: + _path_params["region"] = region + if resource_pool_id is not None: + _path_params["resourcePoolId"] = resource_pool_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", "application/problem+json", "text/plain"] + ) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots", + 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 list_resource_pools( + self, + project_id: StrictStr, + region: StrictStr, + _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, + ) -> ListResourcePoolsResponse: + """List Resource Pools + + Lists Resource Pools in a project. + + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: 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 + + _param = self._list_resource_pools_serialize( + project_id=project_id, + region=region, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListResourcePoolsResponse", + "400": "ValidationError", + "401": "str", + "500": "Error", + } + 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 list_resource_pools_with_http_info( + self, + project_id: StrictStr, + region: StrictStr, + _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[ListResourcePoolsResponse]: + """List Resource Pools + + Lists Resource Pools in a project. + + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: 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 + + _param = self._list_resource_pools_serialize( + project_id=project_id, + region=region, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListPerformanceClassesResponse", + "200": "ListResourcePoolsResponse", "400": "ValidationError", "401": "str", "500": "Error", @@ -3519,8 +4992,10 @@ def list_performance_classes_with_http_info( ) @validate_call - def list_performance_classes_without_preload_content( + def list_resource_pools_without_preload_content( self, + project_id: StrictStr, + region: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3531,10 +5006,14 @@ def list_performance_classes_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List Resource Pool Performance Classes + """List Resource Pools - Lists all performances classes available + Lists Resource Pools in a project. + :param project_id: (required) + :type project_id: str + :param region: (required) + :type region: 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 @@ -3557,12 +5036,17 @@ def list_performance_classes_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_performance_classes_serialize( - _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._list_resource_pools_serialize( + project_id=project_id, + region=region, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListPerformanceClassesResponse", + "200": "ListResourcePoolsResponse", "400": "ValidationError", "401": "str", "500": "Error", @@ -3570,8 +5054,10 @@ def list_performance_classes_without_preload_content( response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_performance_classes_serialize( + def _list_resource_pools_serialize( self, + project_id, + region, _request_auth, _content_type, _headers, @@ -3590,6 +5076,10 @@ def _list_performance_classes_serialize( _body_params: Optional[bytes] = None # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if region is not None: + _path_params["region"] = region # process the query parameters # process the header parameters # process the form parameters @@ -3606,7 +5096,7 @@ def _list_performance_classes_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1/resourcePoolPerformanceClasses", + resource_path="/v1/projects/{projectId}/regions/{region}/resourcePools", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3620,11 +5110,9 @@ def _list_performance_classes_serialize( ) @validate_call - def list_resource_pool_snapshots( + def list_schedules( self, project_id: StrictStr, - region: StrictStr, - resource_pool_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3634,17 +5122,13 @@ def list_resource_pool_snapshots( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListResourcePoolSnapshotsResponse: - """List Resource Pool Snapshots + ) -> ListSchedulesResponse: + """list_schedules - Lists the Snapshots of a Resource Pool in a project. + List Schedules :param project_id: (required) :type project_id: str - :param region: (required) - :type region: str - :param resource_pool_id: (required) - :type resource_pool_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 @@ -3667,10 +5151,8 @@ def list_resource_pool_snapshots( :return: Returns the result object. """ # noqa: E501 - _param = self._list_resource_pool_snapshots_serialize( + _param = self._list_schedules_serialize( project_id=project_id, - region=region, - resource_pool_id=resource_pool_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3678,10 +5160,7 @@ def list_resource_pool_snapshots( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListResourcePoolSnapshotsResponse", - "400": "ValidationError", - "401": "str", - "500": "Error", + "200": "ListSchedulesResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -3691,11 +5170,9 @@ def list_resource_pool_snapshots( ).data @validate_call - def list_resource_pool_snapshots_with_http_info( + def list_schedules_with_http_info( self, project_id: StrictStr, - region: StrictStr, - resource_pool_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3705,17 +5182,13 @@ def list_resource_pool_snapshots_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListResourcePoolSnapshotsResponse]: - """List Resource Pool Snapshots + ) -> ApiResponse[ListSchedulesResponse]: + """list_schedules - Lists the Snapshots of a Resource Pool in a project. + List Schedules :param project_id: (required) :type project_id: str - :param region: (required) - :type region: str - :param resource_pool_id: (required) - :type resource_pool_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 @@ -3738,10 +5211,8 @@ def list_resource_pool_snapshots_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_resource_pool_snapshots_serialize( + _param = self._list_schedules_serialize( project_id=project_id, - region=region, - resource_pool_id=resource_pool_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3749,10 +5220,7 @@ def list_resource_pool_snapshots_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListResourcePoolSnapshotsResponse", - "400": "ValidationError", - "401": "str", - "500": "Error", + "200": "ListSchedulesResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -3762,11 +5230,9 @@ def list_resource_pool_snapshots_with_http_info( ) @validate_call - def list_resource_pool_snapshots_without_preload_content( + def list_schedules_without_preload_content( self, project_id: StrictStr, - region: StrictStr, - resource_pool_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3777,16 +5243,12 @@ def list_resource_pool_snapshots_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List Resource Pool Snapshots + """list_schedules - Lists the Snapshots of a Resource Pool in a project. + List Schedules :param project_id: (required) :type project_id: str - :param region: (required) - :type region: str - :param resource_pool_id: (required) - :type resource_pool_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 @@ -3809,10 +5271,8 @@ def list_resource_pool_snapshots_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_resource_pool_snapshots_serialize( + _param = self._list_schedules_serialize( project_id=project_id, - region=region, - resource_pool_id=resource_pool_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3820,19 +5280,14 @@ def list_resource_pool_snapshots_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListResourcePoolSnapshotsResponse", - "400": "ValidationError", - "401": "str", - "500": "Error", + "200": "ListSchedulesResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_resource_pool_snapshots_serialize( + def _list_schedules_serialize( self, project_id, - region, - resource_pool_id, _request_auth, _content_type, _headers, @@ -3853,10 +5308,6 @@ def _list_resource_pool_snapshots_serialize( # process the path parameters if project_id is not None: _path_params["projectId"] = project_id - if region is not None: - _path_params["region"] = region - if resource_pool_id is not None: - _path_params["resourcePoolId"] = resource_pool_id # process the query parameters # process the header parameters # process the form parameters @@ -3864,16 +5315,14 @@ def _list_resource_pool_snapshots_serialize( # set the HTTP header `Accept` if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json", "application/problem+json", "text/plain"] - ) + _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}/regions/{region}/resourcePools/{resourcePoolId}/snapshots", + resource_path="/v1/projects/{projectId}/schedules", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3887,7 +5336,7 @@ def _list_resource_pool_snapshots_serialize( ) @validate_call - def list_resource_pools( + def list_share_export_policies( self, project_id: StrictStr, region: StrictStr, @@ -3900,10 +5349,10 @@ def list_resource_pools( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListResourcePoolsResponse: - """List Resource Pools + ) -> ListShareExportPoliciesResponse: + """List Share Export Policies - Lists Resource Pools in a project. + Lists ShareExportPolicies in a Resource Pool in a project. :param project_id: (required) :type project_id: str @@ -3931,7 +5380,7 @@ def list_resource_pools( :return: Returns the result object. """ # noqa: E501 - _param = self._list_resource_pools_serialize( + _param = self._list_share_export_policies_serialize( project_id=project_id, region=region, _request_auth=_request_auth, @@ -3941,7 +5390,7 @@ def list_resource_pools( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListResourcePoolsResponse", + "200": "ListShareExportPoliciesResponse", "400": "ValidationError", "401": "str", "500": "Error", @@ -3954,7 +5403,7 @@ def list_resource_pools( ).data @validate_call - def list_resource_pools_with_http_info( + def list_share_export_policies_with_http_info( self, project_id: StrictStr, region: StrictStr, @@ -3967,10 +5416,10 @@ def list_resource_pools_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListResourcePoolsResponse]: - """List Resource Pools + ) -> ApiResponse[ListShareExportPoliciesResponse]: + """List Share Export Policies - Lists Resource Pools in a project. + Lists ShareExportPolicies in a Resource Pool in a project. :param project_id: (required) :type project_id: str @@ -3998,7 +5447,7 @@ def list_resource_pools_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_resource_pools_serialize( + _param = self._list_share_export_policies_serialize( project_id=project_id, region=region, _request_auth=_request_auth, @@ -4008,7 +5457,7 @@ def list_resource_pools_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListResourcePoolsResponse", + "200": "ListShareExportPoliciesResponse", "400": "ValidationError", "401": "str", "500": "Error", @@ -4021,7 +5470,7 @@ def list_resource_pools_with_http_info( ) @validate_call - def list_resource_pools_without_preload_content( + def list_share_export_policies_without_preload_content( self, project_id: StrictStr, region: StrictStr, @@ -4035,9 +5484,9 @@ def list_resource_pools_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List Resource Pools + """List Share Export Policies - Lists Resource Pools in a project. + Lists ShareExportPolicies in a Resource Pool in a project. :param project_id: (required) :type project_id: str @@ -4065,7 +5514,7 @@ def list_resource_pools_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_resource_pools_serialize( + _param = self._list_share_export_policies_serialize( project_id=project_id, region=region, _request_auth=_request_auth, @@ -4075,7 +5524,7 @@ def list_resource_pools_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListResourcePoolsResponse", + "200": "ListShareExportPoliciesResponse", "400": "ValidationError", "401": "str", "500": "Error", @@ -4083,7 +5532,7 @@ def list_resource_pools_without_preload_content( response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_resource_pools_serialize( + def _list_share_export_policies_serialize( self, project_id, region, @@ -4125,7 +5574,7 @@ def _list_resource_pools_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1/projects/{projectId}/regions/{region}/resourcePools", + resource_path="/v1/projects/{projectId}/regions/{region}/shareExportPolicies", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4139,10 +5588,11 @@ def _list_resource_pools_serialize( ) @validate_call - def list_share_export_policies( + def list_shares( self, project_id: StrictStr, region: StrictStr, + resource_pool_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4152,15 +5602,17 @@ def list_share_export_policies( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListShareExportPoliciesResponse: - """List Share Export Policies + ) -> ListSharesResponse: + """List Shares - Lists ShareExportPolicies in a Resource Pool in a project. + Lists Shares in a Resource Pool in a project. :param project_id: (required) :type project_id: str :param region: (required) :type region: str + :param resource_pool_id: (required) + :type resource_pool_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 @@ -4183,9 +5635,10 @@ def list_share_export_policies( :return: Returns the result object. """ # noqa: E501 - _param = self._list_share_export_policies_serialize( + _param = self._list_shares_serialize( project_id=project_id, region=region, + resource_pool_id=resource_pool_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4193,7 +5646,7 @@ def list_share_export_policies( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListShareExportPoliciesResponse", + "200": "ListSharesResponse", "400": "ValidationError", "401": "str", "500": "Error", @@ -4206,10 +5659,11 @@ def list_share_export_policies( ).data @validate_call - def list_share_export_policies_with_http_info( + def list_shares_with_http_info( self, project_id: StrictStr, region: StrictStr, + resource_pool_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4219,15 +5673,17 @@ def list_share_export_policies_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListShareExportPoliciesResponse]: - """List Share Export Policies + ) -> ApiResponse[ListSharesResponse]: + """List Shares - Lists ShareExportPolicies in a Resource Pool in a project. + Lists Shares in a Resource Pool in a project. :param project_id: (required) :type project_id: str :param region: (required) :type region: str + :param resource_pool_id: (required) + :type resource_pool_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 @@ -4250,9 +5706,10 @@ def list_share_export_policies_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_share_export_policies_serialize( + _param = self._list_shares_serialize( project_id=project_id, region=region, + resource_pool_id=resource_pool_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4260,7 +5717,7 @@ def list_share_export_policies_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListShareExportPoliciesResponse", + "200": "ListSharesResponse", "400": "ValidationError", "401": "str", "500": "Error", @@ -4273,10 +5730,11 @@ def list_share_export_policies_with_http_info( ) @validate_call - def list_share_export_policies_without_preload_content( + def list_shares_without_preload_content( self, project_id: StrictStr, region: StrictStr, + resource_pool_id: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4287,14 +5745,16 @@ def list_share_export_policies_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List Share Export Policies + """List Shares - Lists ShareExportPolicies in a Resource Pool in a project. + Lists Shares in a Resource Pool in a project. :param project_id: (required) :type project_id: str :param region: (required) :type region: str + :param resource_pool_id: (required) + :type resource_pool_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 @@ -4317,9 +5777,10 @@ def list_share_export_policies_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_share_export_policies_serialize( + _param = self._list_shares_serialize( project_id=project_id, region=region, + resource_pool_id=resource_pool_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4327,7 +5788,7 @@ def list_share_export_policies_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListShareExportPoliciesResponse", + "200": "ListSharesResponse", "400": "ValidationError", "401": "str", "500": "Error", @@ -4335,10 +5796,11 @@ def list_share_export_policies_without_preload_content( response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_share_export_policies_serialize( + def _list_shares_serialize( self, project_id, region, + resource_pool_id, _request_auth, _content_type, _headers, @@ -4361,6 +5823,8 @@ def _list_share_export_policies_serialize( _path_params["projectId"] = project_id if region is not None: _path_params["region"] = region + if resource_pool_id is not None: + _path_params["resourcePoolId"] = resource_pool_id # process the query parameters # process the header parameters # process the form parameters @@ -4377,7 +5841,7 @@ def _list_share_export_policies_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1/projects/{projectId}/regions/{region}/shareExportPolicies", + resource_path="/v1/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4391,11 +5855,10 @@ def _list_share_export_policies_serialize( ) @validate_call - def list_shares( + def list_snapshot_policies( self, project_id: StrictStr, - region: StrictStr, - resource_pool_id: StrictStr, + immutable: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4405,17 +5868,15 @@ def list_shares( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListSharesResponse: - """List Shares + ) -> ListSnapshotPoliciesResponse: + """list_snapshot_policies - Lists Shares in a Resource Pool in a project. + List Snapshot Policies :param project_id: (required) :type project_id: str - :param region: (required) - :type region: str - :param resource_pool_id: (required) - :type resource_pool_id: str + :param immutable: + :type immutable: bool :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 @@ -4438,10 +5899,9 @@ def list_shares( :return: Returns the result object. """ # noqa: E501 - _param = self._list_shares_serialize( + _param = self._list_snapshot_policies_serialize( project_id=project_id, - region=region, - resource_pool_id=resource_pool_id, + immutable=immutable, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4449,10 +5909,7 @@ def list_shares( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListSharesResponse", - "400": "ValidationError", - "401": "str", - "500": "Error", + "200": "ListSnapshotPoliciesResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -4462,11 +5919,10 @@ def list_shares( ).data @validate_call - def list_shares_with_http_info( + def list_snapshot_policies_with_http_info( self, project_id: StrictStr, - region: StrictStr, - resource_pool_id: StrictStr, + immutable: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4476,17 +5932,15 @@ def list_shares_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListSharesResponse]: - """List Shares + ) -> ApiResponse[ListSnapshotPoliciesResponse]: + """list_snapshot_policies - Lists Shares in a Resource Pool in a project. + List Snapshot Policies :param project_id: (required) :type project_id: str - :param region: (required) - :type region: str - :param resource_pool_id: (required) - :type resource_pool_id: str + :param immutable: + :type immutable: bool :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 @@ -4509,10 +5963,9 @@ def list_shares_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_shares_serialize( + _param = self._list_snapshot_policies_serialize( project_id=project_id, - region=region, - resource_pool_id=resource_pool_id, + immutable=immutable, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4520,10 +5973,7 @@ def list_shares_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListSharesResponse", - "400": "ValidationError", - "401": "str", - "500": "Error", + "200": "ListSnapshotPoliciesResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -4533,11 +5983,10 @@ def list_shares_with_http_info( ) @validate_call - def list_shares_without_preload_content( + def list_snapshot_policies_without_preload_content( self, project_id: StrictStr, - region: StrictStr, - resource_pool_id: StrictStr, + immutable: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4548,16 +5997,14 @@ def list_shares_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List Shares + """list_snapshot_policies - Lists Shares in a Resource Pool in a project. + List Snapshot Policies :param project_id: (required) :type project_id: str - :param region: (required) - :type region: str - :param resource_pool_id: (required) - :type resource_pool_id: str + :param immutable: + :type immutable: bool :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 @@ -4580,10 +6027,9 @@ def list_shares_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_shares_serialize( + _param = self._list_snapshot_policies_serialize( project_id=project_id, - region=region, - resource_pool_id=resource_pool_id, + immutable=immutable, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4591,19 +6037,15 @@ def list_shares_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListSharesResponse", - "400": "ValidationError", - "401": "str", - "500": "Error", + "200": "ListSnapshotPoliciesResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_shares_serialize( + def _list_snapshot_policies_serialize( self, project_id, - region, - resource_pool_id, + immutable, _request_auth, _content_type, _headers, @@ -4624,27 +6066,25 @@ def _list_shares_serialize( # process the path parameters if project_id is not None: _path_params["projectId"] = project_id - if region is not None: - _path_params["region"] = region - if resource_pool_id is not None: - _path_params["resourcePoolId"] = resource_pool_id # process the query parameters + if immutable is not None: + + _query_params.append(("immutable", immutable)) + # 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", "application/problem+json", "text/plain"] - ) + _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}/regions/{region}/resourcePools/{resourcePoolId}/shares", + resource_path="/v1/projects/{projectId}/snapshotPolicies", path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/services/sfs/src/stackit/sfs/models/__init__.py b/services/sfs/src/stackit/sfs/models/__init__.py index 444e6fdef..4cdde3437 100644 --- a/services/sfs/src/stackit/sfs/models/__init__.py +++ b/services/sfs/src/stackit/sfs/models/__init__.py @@ -13,6 +13,7 @@ """ # noqa: E501 # import models into model package +from stackit.sfs.models.create_lock_response import CreateLockResponse from stackit.sfs.models.create_resource_pool_payload import CreateResourcePoolPayload from stackit.sfs.models.create_resource_pool_response import CreateResourcePoolResponse from stackit.sfs.models.create_resource_pool_snapshot_payload import ( @@ -37,10 +38,12 @@ from stackit.sfs.models.get_resource_pool_snapshot_response import ( GetResourcePoolSnapshotResponse, ) +from stackit.sfs.models.get_schedule_response import GetScheduleResponse from stackit.sfs.models.get_share_export_policy_response import ( GetShareExportPolicyResponse, ) from stackit.sfs.models.get_share_response import GetShareResponse +from stackit.sfs.models.get_snapshot_policy_response import GetSnapshotPolicyResponse from stackit.sfs.models.google_protobuf_any import GoogleProtobufAny from stackit.sfs.models.list_performance_classes_response import ( ListPerformanceClassesResponse, @@ -49,20 +52,28 @@ ListResourcePoolSnapshotsResponse, ) from stackit.sfs.models.list_resource_pools_response import ListResourcePoolsResponse +from stackit.sfs.models.list_schedules_response import ListSchedulesResponse from stackit.sfs.models.list_share_export_policies_response import ( ListShareExportPoliciesResponse, ) from stackit.sfs.models.list_shares_response import ListSharesResponse +from stackit.sfs.models.list_snapshot_policies_response import ( + ListSnapshotPoliciesResponse, +) from stackit.sfs.models.performance_class import PerformanceClass from stackit.sfs.models.resource_pool import ResourcePool from stackit.sfs.models.resource_pool_performance_class import ( ResourcePoolPerformanceClass, ) from stackit.sfs.models.resource_pool_snapshot import ResourcePoolSnapshot +from stackit.sfs.models.resource_pool_snapshot_policy import ResourcePoolSnapshotPolicy from stackit.sfs.models.resource_pool_space import ResourcePoolSpace +from stackit.sfs.models.schedule import Schedule from stackit.sfs.models.share import Share from stackit.sfs.models.share_export_policy import ShareExportPolicy from stackit.sfs.models.share_export_policy_rule import ShareExportPolicyRule +from stackit.sfs.models.snapshot_policy import SnapshotPolicy +from stackit.sfs.models.snapshot_policy_schedule import SnapshotPolicySchedule from stackit.sfs.models.status import Status from stackit.sfs.models.update_resource_pool_payload import UpdateResourcePoolPayload from stackit.sfs.models.update_resource_pool_response import UpdateResourcePoolResponse diff --git a/services/sfs/src/stackit/sfs/models/create_lock_response.py b/services/sfs/src/stackit/sfs/models/create_lock_response.py new file mode 100644 index 000000000..8002f56df --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/create_lock_response.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing_extensions import Self + + +class CreateLockResponse(BaseModel): + """ + CreateLockResponse + """ # noqa: E501 + + lock_id: Optional[StrictStr] = Field(default=None, alias="lockId") + __properties: ClassVar[List[str]] = ["lockId"] + + 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 CreateLockResponse 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 CreateLockResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"lockId": obj.get("lockId")}) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/create_resource_pool_payload.py b/services/sfs/src/stackit/sfs/models/create_resource_pool_payload.py index 6ed2010f8..138038474 100644 --- a/services/sfs/src/stackit/sfs/models/create_resource_pool_payload.py +++ b/services/sfs/src/stackit/sfs/models/create_resource_pool_payload.py @@ -47,6 +47,9 @@ class CreateResourcePoolPayload(BaseModel): size_gigabytes: StrictInt = Field( description="Size of the Resource Pool (unit: gibibytes)", alias="sizeGigabytes" ) + snapshot_policy_id: Optional[StrictStr] = Field( + default=None, description="(optional) Id of the Snapshot Policy to use", alias="snapshotPolicyId" + ) snapshots_are_visible: Optional[StrictBool] = Field( default=None, description="Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares.", @@ -59,6 +62,7 @@ class CreateResourcePoolPayload(BaseModel): "name", "performanceClass", "sizeGigabytes", + "snapshotPolicyId", "snapshotsAreVisible", ] @@ -118,6 +122,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "name": obj.get("name"), "performanceClass": obj.get("performanceClass"), "sizeGigabytes": obj.get("sizeGigabytes"), + "snapshotPolicyId": obj.get("snapshotPolicyId"), "snapshotsAreVisible": obj.get("snapshotsAreVisible"), } ) diff --git a/services/sfs/src/stackit/sfs/models/create_resource_pool_snapshot_payload.py b/services/sfs/src/stackit/sfs/models/create_resource_pool_snapshot_payload.py index 71f34a940..6acfd64a1 100644 --- a/services/sfs/src/stackit/sfs/models/create_resource_pool_snapshot_payload.py +++ b/services/sfs/src/stackit/sfs/models/create_resource_pool_snapshot_payload.py @@ -17,7 +17,7 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing_extensions import Self @@ -30,7 +30,12 @@ class CreateResourcePoolSnapshotPayload(BaseModel): default=None, description="(optional) A comment to add more information about a snapshot" ) name: Optional[StrictStr] = Field(default=None, description="Name of the Resource Pool Snapshot") - __properties: ClassVar[List[str]] = ["comment", "name"] + snaplock_retention_hours: Optional[StrictInt] = Field( + default=None, + description="(optional) Time in hours after which snaplock on the snapshot expires", + alias="snaplockRetentionHours", + ) + __properties: ClassVar[List[str]] = ["comment", "name", "snaplockRetentionHours"] model_config = ConfigDict( populate_by_name=True, @@ -74,6 +79,11 @@ def to_dict(self) -> Dict[str, Any]: if self.comment is None and "comment" in self.model_fields_set: _dict["comment"] = None + # set to None if snaplock_retention_hours (nullable) is None + # and model_fields_set contains the field + if self.snaplock_retention_hours is None and "snaplock_retention_hours" in self.model_fields_set: + _dict["snaplockRetentionHours"] = None + return _dict @classmethod @@ -85,5 +95,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({"comment": obj.get("comment"), "name": obj.get("name")}) + _obj = cls.model_validate( + { + "comment": obj.get("comment"), + "name": obj.get("name"), + "snaplockRetentionHours": obj.get("snaplockRetentionHours"), + } + ) return _obj diff --git a/services/sfs/src/stackit/sfs/models/get_schedule_response.py b/services/sfs/src/stackit/sfs/models/get_schedule_response.py new file mode 100644 index 000000000..5e4d8f157 --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/get_schedule_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field +from typing_extensions import Self + +from stackit.sfs.models.schedule import Schedule + + +class GetScheduleResponse(BaseModel): + """ + GetScheduleResponse + """ # noqa: E501 + + schedule: Optional[Schedule] = Field(default=None, description="Schedule") + __properties: ClassVar[List[str]] = ["schedule"] + + 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 GetScheduleResponse 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 schedule + if self.schedule: + _dict["schedule"] = self.schedule.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetScheduleResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"schedule": Schedule.from_dict(obj["schedule"]) if obj.get("schedule") is not None else None} + ) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/get_snapshot_policy_response.py b/services/sfs/src/stackit/sfs/models/get_snapshot_policy_response.py new file mode 100644 index 000000000..3bc9d30a3 --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/get_snapshot_policy_response.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field +from typing_extensions import Self + +from stackit.sfs.models.snapshot_policy import SnapshotPolicy + + +class GetSnapshotPolicyResponse(BaseModel): + """ + GetSnapshotPolicyResponse + """ # noqa: E501 + + snapshot_policy: Optional[SnapshotPolicy] = Field( + default=None, description="Snapshot Policy", alias="snapshotPolicy" + ) + __properties: ClassVar[List[str]] = ["snapshotPolicy"] + + 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 GetSnapshotPolicyResponse 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 snapshot_policy + if self.snapshot_policy: + _dict["snapshotPolicy"] = self.snapshot_policy.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetSnapshotPolicyResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "snapshotPolicy": ( + SnapshotPolicy.from_dict(obj["snapshotPolicy"]) if obj.get("snapshotPolicy") is not None else None + ) + } + ) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/list_schedules_response.py b/services/sfs/src/stackit/sfs/models/list_schedules_response.py new file mode 100644 index 000000000..595a22ace --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/list_schedules_response.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field +from typing_extensions import Self + +from stackit.sfs.models.schedule import Schedule + + +class ListSchedulesResponse(BaseModel): + """ + ListSchedulesResponse + """ # noqa: E501 + + schedules: Optional[List[Schedule]] = Field(default=None, description="List of Schedules") + __properties: ClassVar[List[str]] = ["schedules"] + + 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 ListSchedulesResponse 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 schedules (list) + _items = [] + if self.schedules: + for _item_schedules in self.schedules: + if _item_schedules: + _items.append(_item_schedules.to_dict()) + _dict["schedules"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListSchedulesResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "schedules": ( + [Schedule.from_dict(_item) for _item in obj["schedules"]] + if obj.get("schedules") is not None + else None + ) + } + ) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/list_snapshot_policies_response.py b/services/sfs/src/stackit/sfs/models/list_snapshot_policies_response.py new file mode 100644 index 000000000..ef09717e9 --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/list_snapshot_policies_response.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field +from typing_extensions import Self + +from stackit.sfs.models.snapshot_policy import SnapshotPolicy + + +class ListSnapshotPoliciesResponse(BaseModel): + """ + ListSnapshotPoliciesResponse + """ # noqa: E501 + + snapshot_policies: Optional[List[SnapshotPolicy]] = Field( + default=None, description="List of Snapshot Policies", alias="snapshotPolicies" + ) + __properties: ClassVar[List[str]] = ["snapshotPolicies"] + + 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 ListSnapshotPoliciesResponse 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 snapshot_policies (list) + _items = [] + if self.snapshot_policies: + for _item_snapshot_policies in self.snapshot_policies: + if _item_snapshot_policies: + _items.append(_item_snapshot_policies.to_dict()) + _dict["snapshotPolicies"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListSnapshotPoliciesResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "snapshotPolicies": ( + [SnapshotPolicy.from_dict(_item) for _item in obj["snapshotPolicies"]] + if obj.get("snapshotPolicies") is not None + else None + ) + } + ) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/resource_pool.py b/services/sfs/src/stackit/sfs/models/resource_pool.py index 18bbeaaf9..8c1b2f3cc 100644 --- a/services/sfs/src/stackit/sfs/models/resource_pool.py +++ b/services/sfs/src/stackit/sfs/models/resource_pool.py @@ -33,6 +33,7 @@ from stackit.sfs.models.resource_pool_performance_class import ( ResourcePoolPerformanceClass, ) +from stackit.sfs.models.resource_pool_snapshot_policy import ResourcePoolSnapshotPolicy from stackit.sfs.models.resource_pool_space import ResourcePoolSpace @@ -72,6 +73,9 @@ class ResourcePool(BaseModel): size_reducible_at: Optional[datetime] = Field( default=None, description="Time when the size can be reduced again.", alias="sizeReducibleAt" ) + snapshot_policy: Optional[ResourcePoolSnapshotPolicy] = Field( + default=None, description="(optional) Snapshot Policy", alias="snapshotPolicy" + ) snapshots_are_visible: Optional[StrictBool] = Field( default=False, description="Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares.", @@ -94,6 +98,7 @@ class ResourcePool(BaseModel): "performanceClass", "performanceClassDowngradableAt", "sizeReducibleAt", + "snapshotPolicy", "snapshotsAreVisible", "space", "state", @@ -178,9 +183,17 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of performance_class if self.performance_class: _dict["performanceClass"] = self.performance_class.to_dict() + # override the default output from pydantic by calling `to_dict()` of snapshot_policy + if self.snapshot_policy: + _dict["snapshotPolicy"] = self.snapshot_policy.to_dict() # override the default output from pydantic by calling `to_dict()` of space if self.space: _dict["space"] = self.space.to_dict() + # set to None if snapshot_policy (nullable) is None + # and model_fields_set contains the field + if self.snapshot_policy is None and "snapshot_policy" in self.model_fields_set: + _dict["snapshotPolicy"] = None + return _dict @classmethod @@ -209,6 +222,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: ), "performanceClassDowngradableAt": obj.get("performanceClassDowngradableAt"), "sizeReducibleAt": obj.get("sizeReducibleAt"), + "snapshotPolicy": ( + ResourcePoolSnapshotPolicy.from_dict(obj["snapshotPolicy"]) + if obj.get("snapshotPolicy") is not None + else None + ), "snapshotsAreVisible": ( obj.get("snapshotsAreVisible") if obj.get("snapshotsAreVisible") is not None else False ), diff --git a/services/sfs/src/stackit/sfs/models/resource_pool_snapshot.py b/services/sfs/src/stackit/sfs/models/resource_pool_snapshot.py index 32920e169..e395a6488 100644 --- a/services/sfs/src/stackit/sfs/models/resource_pool_snapshot.py +++ b/services/sfs/src/stackit/sfs/models/resource_pool_snapshot.py @@ -45,6 +45,11 @@ class ResourcePoolSnapshot(BaseModel): description="Reflects the actual storage footprint in the backend at snapshot time in Gibibytes (e.g. how much storage from the Resource Pool does it use).", alias="sizeGigabytes", ) + snaplock_expiry_time: Optional[datetime] = Field( + default=None, + description="Represents the snaplock expiry time if snaplock is enabled for the resource pool", + alias="snaplockExpiryTime", + ) snapshot_name: Optional[StrictStr] = Field( default=None, description="Name of the Resource Pool Snapshot", alias="snapshotName" ) @@ -54,6 +59,7 @@ class ResourcePoolSnapshot(BaseModel): "logicalSizeGigabytes", "resourcePoolId", "sizeGigabytes", + "snaplockExpiryTime", "snapshotName", ] @@ -70,6 +76,19 @@ def created_at_change_year_zero_to_one(cls, value): return "0001" + value[4:] # Take "0001" and append the rest of the string return value + @field_validator("snaplock_expiry_time", mode="before") + def snaplock_expiry_time_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + model_config = ConfigDict( populate_by_name=True, validate_assignment=True, @@ -112,6 +131,11 @@ def to_dict(self) -> Dict[str, Any]: if self.comment is None and "comment" in self.model_fields_set: _dict["comment"] = None + # set to None if snaplock_expiry_time (nullable) is None + # and model_fields_set contains the field + if self.snaplock_expiry_time is None and "snaplock_expiry_time" in self.model_fields_set: + _dict["snaplockExpiryTime"] = None + return _dict @classmethod @@ -130,6 +154,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "logicalSizeGigabytes": obj.get("logicalSizeGigabytes"), "resourcePoolId": obj.get("resourcePoolId"), "sizeGigabytes": obj.get("sizeGigabytes"), + "snaplockExpiryTime": obj.get("snaplockExpiryTime"), "snapshotName": obj.get("snapshotName"), } ) diff --git a/services/sfs/src/stackit/sfs/models/resource_pool_snapshot_policy.py b/services/sfs/src/stackit/sfs/models/resource_pool_snapshot_policy.py new file mode 100644 index 000000000..33aab6217 --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/resource_pool_snapshot_policy.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing_extensions import Self + + +class ResourcePoolSnapshotPolicy(BaseModel): + """ + ResourcePoolSnapshotPolicy + """ # noqa: E501 + + id: Optional[StrictStr] = Field(default=None, description="ID of the Snapshot Policy") + name: Optional[StrictStr] = Field(default=None, description="Name of the Snapshot Policy") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 ResourcePoolSnapshotPolicy 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 ResourcePoolSnapshotPolicy from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"id": obj.get("id"), "name": obj.get("name")}) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/resource_pool_space.py b/services/sfs/src/stackit/sfs/models/resource_pool_space.py index ad5e757c3..85b67770e 100644 --- a/services/sfs/src/stackit/sfs/models/resource_pool_space.py +++ b/services/sfs/src/stackit/sfs/models/resource_pool_space.py @@ -40,12 +40,22 @@ class ResourcePoolSpace(BaseModel): size_gigabytes: Optional[StrictInt] = Field( default=None, description="Size of the Resource Pool in Gibibytes.", alias="sizeGigabytes" ) + used_by_snapshots_gigabytes: Optional[Union[StrictFloat, StrictInt]] = Field( + default=None, + description="Used space by snapshots (only available when retrieving a single Resource Pool by ID)", + alias="usedBySnapshotsGigabytes", + ) used_gigabytes: Optional[Union[StrictFloat, StrictInt]] = Field( default=None, description="Used space of the Resource Pool (only available when retrieving a single Resource Pool by ID)", alias="usedGigabytes", ) - __properties: ClassVar[List[str]] = ["availableGigabytes", "sizeGigabytes", "usedGigabytes"] + __properties: ClassVar[List[str]] = [ + "availableGigabytes", + "sizeGigabytes", + "usedBySnapshotsGigabytes", + "usedGigabytes", + ] model_config = ConfigDict( populate_by_name=True, @@ -89,6 +99,11 @@ def to_dict(self) -> Dict[str, Any]: if self.available_gigabytes is None and "available_gigabytes" in self.model_fields_set: _dict["availableGigabytes"] = None + # set to None if used_by_snapshots_gigabytes (nullable) is None + # and model_fields_set contains the field + if self.used_by_snapshots_gigabytes is None and "used_by_snapshots_gigabytes" in self.model_fields_set: + _dict["usedBySnapshotsGigabytes"] = None + # set to None if used_gigabytes (nullable) is None # and model_fields_set contains the field if self.used_gigabytes is None and "used_gigabytes" in self.model_fields_set: @@ -109,6 +124,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: { "availableGigabytes": obj.get("availableGigabytes"), "sizeGigabytes": obj.get("sizeGigabytes"), + "usedBySnapshotsGigabytes": obj.get("usedBySnapshotsGigabytes"), "usedGigabytes": obj.get("usedGigabytes"), } ) diff --git a/services/sfs/src/stackit/sfs/models/schedule.py b/services/sfs/src/stackit/sfs/models/schedule.py new file mode 100644 index 000000000..3c7e08d64 --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/schedule.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from datetime import datetime +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing_extensions import Self + + +class Schedule(BaseModel): + """ + Schedule + """ # noqa: E501 + + created_at: Optional[datetime] = Field(default=None, description="created at timestamp", alias="createdAt") + id: Optional[StrictStr] = Field(default=None, description="ID of the Schedule") + interval: Optional[StrictStr] = Field( + default=None, description="Interval of the Schedule (follows the cron schedule expression in Unix-like systems)" + ) + name: Optional[StrictStr] = Field(default=None, description="Name of the Schedule") + __properties: ClassVar[List[str]] = ["createdAt", "id", "interval", "name"] + + @field_validator("created_at", mode="before") + def created_at_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + 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 Schedule 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 Schedule from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "createdAt": obj.get("createdAt"), + "id": obj.get("id"), + "interval": obj.get("interval"), + "name": obj.get("name"), + } + ) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/snapshot_policy.py b/services/sfs/src/stackit/sfs/models/snapshot_policy.py new file mode 100644 index 000000000..a73a9061e --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/snapshot_policy.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from datetime import datetime +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing_extensions import Self + +from stackit.sfs.models.snapshot_policy_schedule import SnapshotPolicySchedule + + +class SnapshotPolicy(BaseModel): + """ + SnapshotPolicy + """ # noqa: E501 + + comment: Optional[StrictStr] = Field(default=None, description="Comment of the Snapshot Policy") + created_at: Optional[datetime] = Field(default=None, description="created at timestamp", alias="createdAt") + enabled: Optional[StrictBool] = Field(default=None, description="Wether the Snapshot Policy is enabled") + id: Optional[StrictStr] = Field(default=None, description="ID of the Snapshot Policy") + name: Optional[StrictStr] = Field(default=None, description="Name of the Snapshot Policy") + schedules: Optional[List[SnapshotPolicySchedule]] = Field(default=None, description="associated schedules") + __properties: ClassVar[List[str]] = ["comment", "createdAt", "enabled", "id", "name", "schedules"] + + @field_validator("created_at", mode="before") + def created_at_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + 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 SnapshotPolicy 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 schedules (list) + _items = [] + if self.schedules: + for _item_schedules in self.schedules: + if _item_schedules: + _items.append(_item_schedules.to_dict()) + _dict["schedules"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SnapshotPolicy from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "comment": obj.get("comment"), + "createdAt": obj.get("createdAt"), + "enabled": obj.get("enabled"), + "id": obj.get("id"), + "name": obj.get("name"), + "schedules": ( + [SnapshotPolicySchedule.from_dict(_item) for _item in obj["schedules"]] + if obj.get("schedules") is not None + else None + ), + } + ) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/snapshot_policy_schedule.py b/services/sfs/src/stackit/sfs/models/snapshot_policy_schedule.py new file mode 100644 index 000000000..675f2a6e8 --- /dev/null +++ b/services/sfs/src/stackit/sfs/models/snapshot_policy_schedule.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + STACKIT File Storage (SFS) + + API used to create and manage NFS Shares. + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing_extensions import Self + + +class SnapshotPolicySchedule(BaseModel): + """ + SnapshotPolicySchedule + """ # noqa: E501 + + count: Optional[StrictInt] = None + prefix: Optional[StrictStr] = None + retention_period: Optional[StrictStr] = Field(default=None, alias="retentionPeriod") + schedule_id: Optional[StrictStr] = Field(default=None, alias="scheduleId") + __properties: ClassVar[List[str]] = ["count", "prefix", "retentionPeriod", "scheduleId"] + + 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 SnapshotPolicySchedule 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 SnapshotPolicySchedule from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "count": obj.get("count"), + "prefix": obj.get("prefix"), + "retentionPeriod": obj.get("retentionPeriod"), + "scheduleId": obj.get("scheduleId"), + } + ) + return _obj diff --git a/services/sfs/src/stackit/sfs/models/update_resource_pool_payload.py b/services/sfs/src/stackit/sfs/models/update_resource_pool_payload.py index 93531d73e..54ccbc930 100644 --- a/services/sfs/src/stackit/sfs/models/update_resource_pool_payload.py +++ b/services/sfs/src/stackit/sfs/models/update_resource_pool_payload.py @@ -48,12 +48,24 @@ class UpdateResourcePoolPayload(BaseModel): size_gigabytes: Optional[StrictInt] = Field( default=None, description="(optional) Size of the Resource Pool (unit: gigabytes)", alias="sizeGigabytes" ) + snapshot_policy_id: Optional[StrictStr] = Field( + default=None, + description="(optional) Id of the Snapshot Policy to use If not set, the Snapshot Policy is not updated If set to an empty string, the Snapshot Policy is removed", + alias="snapshotPolicyId", + ) snapshots_are_visible: Optional[StrictBool] = Field( default=None, description="Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares.", alias="snapshotsAreVisible", ) - __properties: ClassVar[List[str]] = ["ipAcl", "labels", "performanceClass", "sizeGigabytes", "snapshotsAreVisible"] + __properties: ClassVar[List[str]] = [ + "ipAcl", + "labels", + "performanceClass", + "sizeGigabytes", + "snapshotPolicyId", + "snapshotsAreVisible", + ] model_config = ConfigDict( populate_by_name=True, @@ -114,6 +126,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "labels": obj.get("labels"), "performanceClass": obj.get("performanceClass"), "sizeGigabytes": obj.get("sizeGigabytes"), + "snapshotPolicyId": obj.get("snapshotPolicyId"), "snapshotsAreVisible": obj.get("snapshotsAreVisible"), } )