From 6f81850eb33bdb626a214805c9641dac95306266 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 22 Apr 2025 10:15:27 +0000 Subject: [PATCH] Generate resourcemanager --- .../src/stackit/resourcemanager/__init__.py | 8 + .../resourcemanager/api/default_api.py | 1368 ++++++++++++++++- .../resourcemanager/models/__init__.py | 8 + .../models/create_folder_payload.py | 123 ++ .../resourcemanager/models/folder_response.py | 114 ++ .../models/get_folder_details_response.py | 129 ++ .../models/partial_update_folder_payload.py | 108 ++ 7 files changed, 1821 insertions(+), 37 deletions(-) create mode 100644 services/resourcemanager/src/stackit/resourcemanager/models/create_folder_payload.py create mode 100644 services/resourcemanager/src/stackit/resourcemanager/models/folder_response.py create mode 100644 services/resourcemanager/src/stackit/resourcemanager/models/get_folder_details_response.py create mode 100644 services/resourcemanager/src/stackit/resourcemanager/models/partial_update_folder_payload.py diff --git a/services/resourcemanager/src/stackit/resourcemanager/__init__.py b/services/resourcemanager/src/stackit/resourcemanager/__init__.py index 517d2352..58afb876 100644 --- a/services/resourcemanager/src/stackit/resourcemanager/__init__.py +++ b/services/resourcemanager/src/stackit/resourcemanager/__init__.py @@ -33,8 +33,13 @@ ) # import models into sdk package +from stackit.resourcemanager.models.create_folder_payload import CreateFolderPayload from stackit.resourcemanager.models.create_project_payload import CreateProjectPayload from stackit.resourcemanager.models.error_response import ErrorResponse +from stackit.resourcemanager.models.folder_response import FolderResponse +from stackit.resourcemanager.models.get_folder_details_response import ( + GetFolderDetailsResponse, +) from stackit.resourcemanager.models.get_project_response import GetProjectResponse from stackit.resourcemanager.models.lifecycle_state import LifecycleState from stackit.resourcemanager.models.list_organizations_response import ( @@ -48,6 +53,9 @@ from stackit.resourcemanager.models.organization_response import OrganizationResponse from stackit.resourcemanager.models.parent import Parent from stackit.resourcemanager.models.parent_list_inner import ParentListInner +from stackit.resourcemanager.models.partial_update_folder_payload import ( + PartialUpdateFolderPayload, +) from stackit.resourcemanager.models.partial_update_project_payload import ( PartialUpdateProjectPayload, ) diff --git a/services/resourcemanager/src/stackit/resourcemanager/api/default_api.py b/services/resourcemanager/src/stackit/resourcemanager/api/default_api.py index e3526a49..a8c98698 100644 --- a/services/resourcemanager/src/stackit/resourcemanager/api/default_api.py +++ b/services/resourcemanager/src/stackit/resourcemanager/api/default_api.py @@ -20,13 +20,21 @@ from stackit.resourcemanager.api_client import ApiClient, RequestSerialized from stackit.resourcemanager.api_response import ApiResponse +from stackit.resourcemanager.models.create_folder_payload import CreateFolderPayload from stackit.resourcemanager.models.create_project_payload import CreateProjectPayload +from stackit.resourcemanager.models.folder_response import FolderResponse +from stackit.resourcemanager.models.get_folder_details_response import ( + GetFolderDetailsResponse, +) from stackit.resourcemanager.models.get_project_response import GetProjectResponse from stackit.resourcemanager.models.list_organizations_response import ( ListOrganizationsResponse, ) from stackit.resourcemanager.models.list_projects_response import ListProjectsResponse from stackit.resourcemanager.models.organization_response import OrganizationResponse +from stackit.resourcemanager.models.partial_update_folder_payload import ( + PartialUpdateFolderPayload, +) from stackit.resourcemanager.models.partial_update_project_payload import ( PartialUpdateProjectPayload, ) @@ -47,6 +55,249 @@ def __init__(self, configuration: Configuration = None) -> None: self.configuration = configuration self.api_client = ApiClient(self.configuration) + @validate_call + def create_folder( + self, + create_folder_payload: Optional[CreateFolderPayload] = None, + _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, + ) -> FolderResponse: + """Create Folder + + Create a new folder. + + :param create_folder_payload: + :type create_folder_payload: CreateFolderPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._create_folder_serialize( + create_folder_payload=create_folder_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "FolderResponse", + "400": "ErrorResponse", + "403": "ErrorResponse", + "409": "ErrorResponse", + } + 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_folder_with_http_info( + self, + create_folder_payload: Optional[CreateFolderPayload] = None, + _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[FolderResponse]: + """Create Folder + + Create a new folder. + + :param create_folder_payload: + :type create_folder_payload: CreateFolderPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._create_folder_serialize( + create_folder_payload=create_folder_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "FolderResponse", + "400": "ErrorResponse", + "403": "ErrorResponse", + "409": "ErrorResponse", + } + 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_folder_without_preload_content( + self, + create_folder_payload: Optional[CreateFolderPayload] = None, + _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 Folder + + Create a new folder. + + :param create_folder_payload: + :type create_folder_payload: CreateFolderPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._create_folder_serialize( + create_folder_payload=create_folder_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "201": "FolderResponse", + "400": "ErrorResponse", + "403": "ErrorResponse", + "409": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_folder_serialize( + self, + create_folder_payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_folder_payload is not None: + _body_params = create_folder_payload + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v2/folders", + 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_project( self, @@ -291,11 +542,17 @@ def _create_project_serialize( ) @validate_call - def delete_project( + def delete_folder( self, - id: Annotated[ - StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") ], + force: Annotated[ + Optional[StrictBool], + Field( + description="If true, all nested, empty folders are deleted recursively - if no project is attached!" + ), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -306,12 +563,14 @@ def delete_project( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> None: - """Delete Project + """Delete Folder - Triggers the deletion of a project. - The request is synchronous, but the workflow-based deletion is asynchronous - Lifecycle state remains in DELETING, until workflow completes + Delete a folder and its metadata. - Folder must not be parent of any other container - A force flag may be set, deleting all underlying folders recursively - if no project is attached! - :param id: Project identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param force: If true, all nested, empty folders are deleted recursively - if no project is attached! + :type force: 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 @@ -334,12 +593,18 @@ def delete_project( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._delete_project_serialize( - id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._delete_folder_serialize( + container_id=container_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) _response_types_map: Dict[str, Optional[str]] = { "202": None, + "404": "ErrorResponse", "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -350,11 +615,17 @@ def delete_project( ).data @validate_call - def delete_project_with_http_info( + def delete_folder_with_http_info( self, - id: Annotated[ - StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") ], + force: Annotated[ + Optional[StrictBool], + Field( + description="If true, all nested, empty folders are deleted recursively - if no project is attached!" + ), + ] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -365,12 +636,751 @@ def delete_project_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[None]: - """Delete Project + """Delete Folder - Triggers the deletion of a project. - The request is synchronous, but the workflow-based deletion is asynchronous - Lifecycle state remains in DELETING, until workflow completes + Delete a folder and its metadata. - Folder must not be parent of any other container - A force flag may be set, deleting all underlying folders recursively - if no project is attached! - :param id: Project identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param force: If true, all nested, empty folders are deleted recursively - if no project is attached! + :type force: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._delete_folder_serialize( + container_id=container_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "404": "ErrorResponse", + "409": "ErrorResponse", + } + 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_folder_without_preload_content( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + force: Annotated[ + Optional[StrictBool], + Field( + description="If true, all nested, empty folders are deleted recursively - if no project is attached!" + ), + ] = None, + _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 Folder + + Delete a folder and its metadata. - Folder must not be parent of any other container - A force flag may be set, deleting all underlying folders recursively - if no project is attached! + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param force: If true, all nested, empty folders are deleted recursively - if no project is attached! + :type force: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._delete_folder_serialize( + container_id=container_id, + force=force, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "404": "ErrorResponse", + "409": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_folder_serialize( + self, + container_id, + force, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if container_id is not None: + _path_params["containerId"] = container_id + # process the query parameters + if force is not None: + + _query_params.append(("force", force)) + + # 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="/v2/folders/{containerId}", + 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_folder_labels( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + keys: Annotated[Optional[List[StrictStr]], Field(description="Label name.")] = None, + _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, + ) -> None: + """Delete Folder Labels + + Deletes all folder labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param keys: Label name. + :type keys: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._delete_folder_labels_serialize( + container_id=container_id, + keys=keys, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "409": "ErrorResponse", + } + 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_folder_labels_with_http_info( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + keys: Annotated[Optional[List[StrictStr]], Field(description="Label name.")] = None, + _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[None]: + """Delete Folder Labels + + Deletes all folder labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param keys: Label name. + :type keys: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._delete_folder_labels_serialize( + container_id=container_id, + keys=keys, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "409": "ErrorResponse", + } + 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_folder_labels_without_preload_content( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + keys: Annotated[Optional[List[StrictStr]], Field(description="Label name.")] = None, + _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 Folder Labels + + Deletes all folder labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param keys: Label name. + :type keys: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._delete_folder_labels_serialize( + container_id=container_id, + keys=keys, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "409": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_folder_labels_serialize( + self, + container_id, + keys, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + "keys": "multi", + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if container_id is not None: + _path_params["containerId"] = container_id + # process the query parameters + if keys is not None: + + _query_params.append(("keys", keys)) + + # 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="/v2/folders/{containerId}/labels", + 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_project( + self, + id: Annotated[ + StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") + ], + _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, + ) -> None: + """Delete Project + + Triggers the deletion of a project. - The request is synchronous, but the workflow-based deletion is asynchronous - Lifecycle state remains in DELETING, until workflow completes + + :param id: Project identifier - containerId as well as UUID identifier is supported. (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 docstring might be too long + + _param = self._delete_project_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "409": "ErrorResponse", + } + 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_project_with_http_info( + self, + id: Annotated[ + StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") + ], + _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[None]: + """Delete Project + + Triggers the deletion of a project. - The request is synchronous, but the workflow-based deletion is asynchronous - Lifecycle state remains in DELETING, until workflow completes + + :param id: Project identifier - containerId as well as UUID identifier is supported. (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 docstring might be too long + + _param = self._delete_project_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "409": "ErrorResponse", + } + 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_project_without_preload_content( + self, + id: Annotated[ + StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") + ], + _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 Project + + Triggers the deletion of a project. - The request is synchronous, but the workflow-based deletion is asynchronous - Lifecycle state remains in DELETING, until workflow completes + + :param id: Project identifier - containerId as well as UUID identifier is supported. (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 docstring might be too long + + _param = self._delete_project_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": None, + "409": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_project_serialize( + self, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if 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="DELETE", + resource_path="/v2/projects/{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_folder_details( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + include_parents: Optional[StrictBool] = None, + _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, + ) -> GetFolderDetailsResponse: + """Get Folder Details + + Returns all metadata for a specific folder. + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param include_parents: + :type include_parents: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._get_folder_details_serialize( + container_id=container_id, + include_parents=include_parents, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "GetFolderDetailsResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", + } + 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_folder_details_with_http_info( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + include_parents: Optional[StrictBool] = None, + _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[GetFolderDetailsResponse]: + """Get Folder Details + + Returns all metadata for a specific folder. + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param include_parents: + :type include_parents: 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 @@ -393,13 +1403,19 @@ def delete_project_with_http_info( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._delete_project_serialize( - id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._get_folder_details_serialize( + container_id=container_id, + include_parents=include_parents, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) _response_types_map: Dict[str, Optional[str]] = { - "202": None, - "409": "ErrorResponse", + "200": "GetFolderDetailsResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -409,11 +1425,12 @@ def delete_project_with_http_info( ) @validate_call - def delete_project_without_preload_content( + def get_folder_details_without_preload_content( self, - id: Annotated[ - StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") ], + include_parents: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -424,12 +1441,14 @@ def delete_project_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Delete Project + """Get Folder Details - Triggers the deletion of a project. - The request is synchronous, but the workflow-based deletion is asynchronous - Lifecycle state remains in DELETING, until workflow completes + Returns all metadata for a specific folder. - :param id: Project identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param include_parents: + :type include_parents: 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 @@ -452,20 +1471,27 @@ def delete_project_without_preload_content( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._delete_project_serialize( - id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._get_folder_details_serialize( + container_id=container_id, + include_parents=include_parents, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) _response_types_map: Dict[str, Optional[str]] = { - "202": None, - "409": "ErrorResponse", + "200": "GetFolderDetailsResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _delete_project_serialize( + def _get_folder_details_serialize( self, - id, + container_id, + include_parents, _request_auth, _content_type, _headers, @@ -484,9 +1510,13 @@ def _delete_project_serialize( _body_params: Optional[bytes] = None # process the path parameters - if id is not None: - _path_params["id"] = id + if container_id is not None: + _path_params["containerId"] = container_id # process the query parameters + if include_parents is not None: + + _query_params.append(("includeParents", include_parents)) + # process the header parameters # process the form parameters # process the body parameter @@ -499,8 +1529,8 @@ def _delete_project_serialize( _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="DELETE", - resource_path="/v2/projects/{id}", + method="GET", + resource_path="/v2/folders/{containerId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1798,6 +2828,270 @@ def _list_projects_serialize( _request_auth=_request_auth, ) + @validate_call + def partial_update_folder( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + partial_update_folder_payload: Optional[PartialUpdateFolderPayload] = None, + _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, + ) -> FolderResponse: + """Update Folder + + Update the folder and its metadata. - Update folder name - Update folder labels - Update folder parent (folder or organization) + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param partial_update_folder_payload: + :type partial_update_folder_payload: PartialUpdateFolderPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._partial_update_folder_serialize( + container_id=container_id, + partial_update_folder_payload=partial_update_folder_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "FolderResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", + "409": "ErrorResponse", + } + 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 partial_update_folder_with_http_info( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + partial_update_folder_payload: Optional[PartialUpdateFolderPayload] = None, + _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[FolderResponse]: + """Update Folder + + Update the folder and its metadata. - Update folder name - Update folder labels - Update folder parent (folder or organization) + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param partial_update_folder_payload: + :type partial_update_folder_payload: PartialUpdateFolderPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._partial_update_folder_serialize( + container_id=container_id, + partial_update_folder_payload=partial_update_folder_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "FolderResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", + "409": "ErrorResponse", + } + 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 partial_update_folder_without_preload_content( + self, + container_id: Annotated[ + StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + ], + partial_update_folder_payload: Optional[PartialUpdateFolderPayload] = None, + _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: + """Update Folder + + Update the folder and its metadata. - Update folder name - Update folder labels - Update folder parent (folder or organization) + + :param container_id: Folder identifier - containerId as well as UUID identifier is supported. (required) + :type container_id: str + :param partial_update_folder_payload: + :type partial_update_folder_payload: PartialUpdateFolderPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 docstring might be too long + + _param = self._partial_update_folder_serialize( + container_id=container_id, + partial_update_folder_payload=partial_update_folder_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "FolderResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", + "409": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _partial_update_folder_serialize( + self, + container_id, + partial_update_folder_payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if container_id is not None: + _path_params["containerId"] = container_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if partial_update_folder_payload is not None: + _body_params = partial_update_folder_payload + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PATCH", + resource_path="/v2/folders/{containerId}", + 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 partial_update_project( self, diff --git a/services/resourcemanager/src/stackit/resourcemanager/models/__init__.py b/services/resourcemanager/src/stackit/resourcemanager/models/__init__.py index c49d0928..d99cecf3 100644 --- a/services/resourcemanager/src/stackit/resourcemanager/models/__init__.py +++ b/services/resourcemanager/src/stackit/resourcemanager/models/__init__.py @@ -14,8 +14,13 @@ # import models into model package +from stackit.resourcemanager.models.create_folder_payload import CreateFolderPayload from stackit.resourcemanager.models.create_project_payload import CreateProjectPayload from stackit.resourcemanager.models.error_response import ErrorResponse +from stackit.resourcemanager.models.folder_response import FolderResponse +from stackit.resourcemanager.models.get_folder_details_response import ( + GetFolderDetailsResponse, +) from stackit.resourcemanager.models.get_project_response import GetProjectResponse from stackit.resourcemanager.models.lifecycle_state import LifecycleState from stackit.resourcemanager.models.list_organizations_response import ( @@ -29,6 +34,9 @@ from stackit.resourcemanager.models.organization_response import OrganizationResponse from stackit.resourcemanager.models.parent import Parent from stackit.resourcemanager.models.parent_list_inner import ParentListInner +from stackit.resourcemanager.models.partial_update_folder_payload import ( + PartialUpdateFolderPayload, +) from stackit.resourcemanager.models.partial_update_project_payload import ( PartialUpdateProjectPayload, ) diff --git a/services/resourcemanager/src/stackit/resourcemanager/models/create_folder_payload.py b/services/resourcemanager/src/stackit/resourcemanager/models/create_folder_payload.py new file mode 100644 index 00000000..f8b3c415 --- /dev/null +++ b/services/resourcemanager/src/stackit/resourcemanager/models/create_folder_payload.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Resource Manager API + + API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists + + The version of the OpenAPI document: 2.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +import pprint +import re +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing_extensions import Annotated, Self + +from stackit.resourcemanager.models.member import Member + + +class CreateFolderPayload(BaseModel): + """ + CreateFolderPayload + """ + + container_parent_id: StrictStr = Field( + description="Identifier of the parent resource container - containerId as well as UUID identifier is supported.", + alias="containerParentId", + ) + labels: Optional[Dict[str, StrictStr]] = Field( + default=None, + description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.", + ) + members: Optional[Annotated[List[Member], Field(min_length=1)]] = Field( + default=None, + description="The initial members assigned to the project. At least one subject needs to be a user, and not a client or service account.", + ) + name: Annotated[str, Field(strict=True)] = Field( + description="The name of the folder matching the regex `^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$`." + ) + __properties: ClassVar[List[str]] = ["containerParentId", "labels", "members", "name"] + + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$", value): + raise ValueError( + r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$/" + ) + 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 CreateFolderPayload 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 members (list) + _items = [] + if self.members: + for _item in self.members: + if _item: + _items.append(_item.to_dict()) + _dict["members"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateFolderPayload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "containerParentId": obj.get("containerParentId"), + "labels": obj.get("labels"), + "members": ( + [Member.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None + ), + "name": obj.get("name"), + } + ) + return _obj diff --git a/services/resourcemanager/src/stackit/resourcemanager/models/folder_response.py b/services/resourcemanager/src/stackit/resourcemanager/models/folder_response.py new file mode 100644 index 00000000..0b9e41f7 --- /dev/null +++ b/services/resourcemanager/src/stackit/resourcemanager/models/folder_response.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Resource Manager API + + API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists + + The version of the OpenAPI document: 2.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +import pprint +from datetime import datetime +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing_extensions import Self + +from stackit.resourcemanager.models.parent import Parent + + +class FolderResponse(BaseModel): + """ + FolderResponse + """ + + container_id: StrictStr = Field(description="Globally unique, user-friendly identifier.", alias="containerId") + creation_time: datetime = Field(description="Timestamp at which the folder was created.", alias="creationTime") + folder_id: StrictStr = Field(description="Globally unique folder identifier.", alias="folderId") + labels: Optional[Dict[str, StrictStr]] = Field( + default=None, + description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.", + ) + name: StrictStr = Field(description="Folder name.") + parent: Parent + update_time: datetime = Field(description="Timestamp at which the folder was last modified.", alias="updateTime") + __properties: ClassVar[List[str]] = [ + "containerId", + "creationTime", + "folderId", + "labels", + "name", + "parent", + "updateTime", + ] + + 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 FolderResponse 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 parent + if self.parent: + _dict["parent"] = self.parent.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FolderResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "containerId": obj.get("containerId"), + "creationTime": obj.get("creationTime"), + "folderId": obj.get("folderId"), + "labels": obj.get("labels"), + "name": obj.get("name"), + "parent": Parent.from_dict(obj["parent"]) if obj.get("parent") is not None else None, + "updateTime": obj.get("updateTime"), + } + ) + return _obj diff --git a/services/resourcemanager/src/stackit/resourcemanager/models/get_folder_details_response.py b/services/resourcemanager/src/stackit/resourcemanager/models/get_folder_details_response.py new file mode 100644 index 00000000..69258c45 --- /dev/null +++ b/services/resourcemanager/src/stackit/resourcemanager/models/get_folder_details_response.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + Resource Manager API + + API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists + + The version of the OpenAPI document: 2.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +import pprint +from datetime import datetime +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing_extensions import Self + +from stackit.resourcemanager.models.parent import Parent +from stackit.resourcemanager.models.parent_list_inner import ParentListInner + + +class GetFolderDetailsResponse(BaseModel): + """ + GetFolderDetailsResponse + """ + + container_id: StrictStr = Field(description="Globally unique user-friendly identifier.", alias="containerId") + creation_time: datetime = Field(description="Timestamp at which the folder was created.", alias="creationTime") + folder_id: StrictStr = Field(description="Globally unique folder identifier.", alias="folderId") + labels: Optional[Dict[str, StrictStr]] = Field( + default=None, + description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.", + ) + name: StrictStr = Field(description="Folder name.") + parent: Parent + parents: Optional[List[ParentListInner]] = None + update_time: datetime = Field(description="Timestamp at which the folder was last modified.", alias="updateTime") + __properties: ClassVar[List[str]] = [ + "containerId", + "creationTime", + "folderId", + "labels", + "name", + "parent", + "parents", + "updateTime", + ] + + 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 GetFolderDetailsResponse 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 parent + if self.parent: + _dict["parent"] = self.parent.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in parents (list) + _items = [] + if self.parents: + for _item in self.parents: + if _item: + _items.append(_item.to_dict()) + _dict["parents"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetFolderDetailsResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "containerId": obj.get("containerId"), + "creationTime": obj.get("creationTime"), + "folderId": obj.get("folderId"), + "labels": obj.get("labels"), + "name": obj.get("name"), + "parent": Parent.from_dict(obj["parent"]) if obj.get("parent") is not None else None, + "parents": ( + [ParentListInner.from_dict(_item) for _item in obj["parents"]] + if obj.get("parents") is not None + else None + ), + "updateTime": obj.get("updateTime"), + } + ) + return _obj diff --git a/services/resourcemanager/src/stackit/resourcemanager/models/partial_update_folder_payload.py b/services/resourcemanager/src/stackit/resourcemanager/models/partial_update_folder_payload.py new file mode 100644 index 00000000..4f62d928 --- /dev/null +++ b/services/resourcemanager/src/stackit/resourcemanager/models/partial_update_folder_payload.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Resource Manager API + + API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists + + The version of the OpenAPI document: 2.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +import pprint +import re +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing_extensions import Annotated, Self + + +class PartialUpdateFolderPayload(BaseModel): + """ + PartialUpdateFolderPayload + """ + + container_parent_id: Optional[StrictStr] = Field( + default=None, + description="New parent identifier for the resource container - containerId as well as UUID identifier is supported.", + alias="containerParentId", + ) + labels: Optional[Dict[str, StrictStr]] = Field( + default=None, + description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.", + ) + name: Optional[Annotated[str, Field(strict=True)]] = Field( + default=None, + description="New name for the resource container matching the regex `^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$`.", + ) + __properties: ClassVar[List[str]] = ["containerParentId", "labels", "name"] + + @field_validator("name") + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$", value): + raise ValueError( + r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$/" + ) + 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 PartialUpdateFolderPayload 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 PartialUpdateFolderPayload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + {"containerParentId": obj.get("containerParentId"), "labels": obj.get("labels"), "name": obj.get("name")} + ) + return _obj