diff --git a/CHANGELOG.md b/CHANGELOG.md index e0a8f38d..93f9d82f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## Release (2025-XX-YY) +- `resourcemanager`: [v0.5.0](services/resourcemanager/CHANGELOG.md#v050-2025-06-04) + - **Feature:** Delete Organization labels using the new method `DeleteOrganizationLabels` + - **Feature:** Delete Project labels using the new method `DeleteProjectLabels` + - **Feature:** List folders using the new method `ListFolders` + - **Feature:** Partial Update Organization using the new method `PartialUpdateOrganization` + ## Release (2025-06-03) - `loadbalancer`: [v0.2.4](services/loadbalancer/CHANGELOG.md#v024-2025-06-02) diff --git a/services/resourcemanager/CHANGELOG.md b/services/resourcemanager/CHANGELOG.md index 922c0d92..e8427a2d 100644 --- a/services/resourcemanager/CHANGELOG.md +++ b/services/resourcemanager/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.5.0 (2025-06-04) +- **Feature:** Delete Organization labels using the new method `DeleteOrganizationLabels` +- **Feature:** Delete Project labels using the new method `DeleteProjectLabels` +- **Feature:** List folders using the new method `ListFolders` +- **Feature:** Partial Update Organization using the new method `PartialUpdateOrganization` + ## v0.4.0 (2025-05-14) - **Breaking change:** Fields `ContainerParentId` and `ParentId` are no longer required in `ParentListInner` diff --git a/services/resourcemanager/pyproject.toml b/services/resourcemanager/pyproject.toml index 6ed93bcf..a8f7246d 100644 --- a/services/resourcemanager/pyproject.toml +++ b/services/resourcemanager/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-resourcemanager" [tool.poetry] name = "stackit-resourcemanager" -version = "v0.4.0" +version = "v0.5.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/resourcemanager/src/stackit/resourcemanager/__init__.py b/services/resourcemanager/src/stackit/resourcemanager/__init__.py index 58afb876..3542fb2c 100644 --- a/services/resourcemanager/src/stackit/resourcemanager/__init__.py +++ b/services/resourcemanager/src/stackit/resourcemanager/__init__.py @@ -42,6 +42,10 @@ ) from stackit.resourcemanager.models.get_project_response import GetProjectResponse from stackit.resourcemanager.models.lifecycle_state import LifecycleState +from stackit.resourcemanager.models.list_folders_response import ListFoldersResponse +from stackit.resourcemanager.models.list_folders_response_items_inner import ( + ListFoldersResponseItemsInner, +) from stackit.resourcemanager.models.list_organizations_response import ( ListOrganizationsResponse, ) @@ -56,6 +60,9 @@ from stackit.resourcemanager.models.partial_update_folder_payload import ( PartialUpdateFolderPayload, ) +from stackit.resourcemanager.models.partial_update_organization_payload import ( + PartialUpdateOrganizationPayload, +) 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 a8c98698..69764841 100644 --- a/services/resourcemanager/src/stackit/resourcemanager/api/default_api.py +++ b/services/resourcemanager/src/stackit/resourcemanager/api/default_api.py @@ -27,6 +27,7 @@ GetFolderDetailsResponse, ) from stackit.resourcemanager.models.get_project_response import GetProjectResponse +from stackit.resourcemanager.models.list_folders_response import ListFoldersResponse from stackit.resourcemanager.models.list_organizations_response import ( ListOrganizationsResponse, ) @@ -35,6 +36,9 @@ from stackit.resourcemanager.models.partial_update_folder_payload import ( PartialUpdateFolderPayload, ) +from stackit.resourcemanager.models.partial_update_organization_payload import ( + PartialUpdateOrganizationPayload, +) from stackit.resourcemanager.models.partial_update_project_payload import ( PartialUpdateProjectPayload, ) @@ -1066,11 +1070,13 @@ def _delete_folder_labels_serialize( ) @validate_call - def delete_project( + def delete_organization_labels( self, - id: Annotated[ - StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") + container_id: Annotated[ + StrictStr, + Field(description="Organization 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)], @@ -1081,12 +1087,14 @@ def delete_project( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> None: - """Delete Project + """Delete Organization Labels - 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 + Deletes all organization labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! - :param id: Project identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Organization 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 @@ -1109,8 +1117,13 @@ 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_organization_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]] = { @@ -1125,11 +1138,13 @@ def delete_project( ).data @validate_call - def delete_project_with_http_info( + def delete_organization_labels_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="Organization 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)], @@ -1140,12 +1155,14 @@ 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 Organization Labels - 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 + Deletes all organization labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! - :param id: Project identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Organization 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 @@ -1168,8 +1185,13 @@ 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._delete_organization_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]] = { @@ -1184,11 +1206,13 @@ def delete_project_with_http_info( ) @validate_call - def delete_project_without_preload_content( + def delete_organization_labels_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="Organization 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)], @@ -1199,12 +1223,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 + """Delete Organization Labels - 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 + Deletes all organization labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! - :param id: Project identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Organization 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 @@ -1227,8 +1253,13 @@ 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._delete_organization_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]] = { @@ -1238,9 +1269,10 @@ def delete_project_without_preload_content( response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _delete_project_serialize( + def _delete_organization_labels_serialize( self, - id, + container_id, + keys, _request_auth, _content_type, _headers, @@ -1249,7 +1281,9 @@ def _delete_project_serialize( _host = None - _collection_formats: Dict[str, str] = {} + _collection_formats: Dict[str, str] = { + "keys": "multi", + } _path_params: Dict[str, str] = {} _query_params: List[Tuple[str, str]] = [] @@ -1259,9 +1293,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 keys is not None: + + _query_params.append(("keys", keys)) + # process the header parameters # process the form parameters # process the body parameter @@ -1275,7 +1313,7 @@ def _delete_project_serialize( return self.api_client.param_serialize( method="DELETE", - resource_path="/v2/projects/{id}", + resource_path="/v2/organizations/{containerId}/labels", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1289,12 +1327,11 @@ def _delete_project_serialize( ) @validate_call - def get_folder_details( + def delete_project( self, - container_id: Annotated[ - StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + id: Annotated[ + StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") ], - include_parents: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1304,15 +1341,13 @@ def get_folder_details( _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 + ) -> None: + """Delete Project - Returns all metadata for a specific 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 - :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 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 @@ -1335,19 +1370,13 @@ def get_folder_details( :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, + _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]] = { - "200": "GetFolderDetailsResponse", - "403": "ErrorResponse", - "404": "ErrorResponse", + "202": None, + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1357,12 +1386,11 @@ def get_folder_details( ).data @validate_call - def get_folder_details_with_http_info( + def delete_project_with_http_info( self, - container_id: Annotated[ - StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + id: Annotated[ + StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") ], - include_parents: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1372,15 +1400,13 @@ def get_folder_details_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[GetFolderDetailsResponse]: - """Get Folder Details + ) -> ApiResponse[None]: + """Delete Project - Returns all metadata for a specific 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 - :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 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 @@ -1403,19 +1429,13 @@ def get_folder_details_with_http_info( :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, + _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]] = { - "200": "GetFolderDetailsResponse", - "403": "ErrorResponse", - "404": "ErrorResponse", + "202": None, + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1425,12 +1445,11 @@ def get_folder_details_with_http_info( ) @validate_call - def get_folder_details_without_preload_content( + def delete_project_without_preload_content( self, - container_id: Annotated[ - StrictStr, Field(description="Folder identifier - containerId as well as UUID identifier is supported.") + id: Annotated[ + StrictStr, Field(description="Project identifier - containerId as well as UUID identifier is supported.") ], - include_parents: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1441,14 +1460,12 @@ def get_folder_details_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get Folder Details + """Delete Project - Returns all metadata for a specific 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 - :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 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 @@ -1471,27 +1488,20 @@ def get_folder_details_without_preload_content( :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, + _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]] = { - "200": "GetFolderDetailsResponse", - "403": "ErrorResponse", - "404": "ErrorResponse", + "202": None, + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _get_folder_details_serialize( + def _delete_project_serialize( self, - container_id, - include_parents, + id, _request_auth, _content_type, _headers, @@ -1510,13 +1520,9 @@ def _get_folder_details_serialize( _body_params: Optional[bytes] = None # process the path parameters - if container_id is not None: - _path_params["containerId"] = container_id + if id is not None: + _path_params["id"] = 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 @@ -1529,8 +1535,8 @@ def _get_folder_details_serialize( _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="GET", - resource_path="/v2/folders/{containerId}", + method="DELETE", + resource_path="/v2/projects/{id}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1544,12 +1550,12 @@ def _get_folder_details_serialize( ) @validate_call - def get_organization( + def delete_project_labels( self, - id: Annotated[ - StrictStr, - Field(description="Organization identifier - containerId as well as UUID identifier is supported."), + container_id: Annotated[ + StrictStr, Field(description="Project 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)], @@ -1559,13 +1565,15 @@ def get_organization( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> OrganizationResponse: - """Get Organization Details + ) -> None: + """Delete Project Labels - Returns the organization and its metadata. + Deletes all project labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! - :param id: Organization identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Project 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 @@ -1588,13 +1596,18 @@ def get_organization( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._get_organization_serialize( - id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._delete_project_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]] = { - "200": "OrganizationResponse", - "404": "ErrorResponse", + "202": None, + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1604,12 +1617,12 @@ def get_organization( ).data @validate_call - def get_organization_with_http_info( + def delete_project_labels_with_http_info( self, - id: Annotated[ - StrictStr, - Field(description="Organization identifier - containerId as well as UUID identifier is supported."), + container_id: Annotated[ + StrictStr, Field(description="Project 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)], @@ -1619,13 +1632,15 @@ def get_organization_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[OrganizationResponse]: - """Get Organization Details + ) -> ApiResponse[None]: + """Delete Project Labels - Returns the organization and its metadata. + Deletes all project labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! - :param id: Organization identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Project 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 @@ -1648,13 +1663,18 @@ def get_organization_with_http_info( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._get_organization_serialize( - id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._delete_project_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]] = { - "200": "OrganizationResponse", - "404": "ErrorResponse", + "202": None, + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -1664,12 +1684,12 @@ def get_organization_with_http_info( ) @validate_call - def get_organization_without_preload_content( + def delete_project_labels_without_preload_content( self, - id: Annotated[ - StrictStr, - Field(description="Organization identifier - containerId as well as UUID identifier is supported."), + container_id: Annotated[ + StrictStr, Field(description="Project 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)], @@ -1680,12 +1700,14 @@ def get_organization_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get Organization Details + """Delete Project Labels - Returns the organization and its metadata. + Deletes all project labels by given keys. - Specific labels may be deleted by key(s) - If no key is specified, all labels will be deleted! - :param id: Organization identifier - containerId as well as UUID identifier is supported. (required) - :type id: str + :param container_id: Project 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 @@ -1708,20 +1730,26 @@ def get_organization_without_preload_content( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._get_organization_serialize( - id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + _param = self._delete_project_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]] = { - "200": "OrganizationResponse", - "404": "ErrorResponse", + "202": None, + "409": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _get_organization_serialize( + def _delete_project_labels_serialize( self, - id, + container_id, + keys, _request_auth, _content_type, _headers, @@ -1730,7 +1758,9 @@ def _get_organization_serialize( _host = None - _collection_formats: Dict[str, str] = {} + _collection_formats: Dict[str, str] = { + "keys": "multi", + } _path_params: Dict[str, str] = {} _query_params: List[Tuple[str, str]] = [] @@ -1740,9 +1770,13 @@ def _get_organization_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 keys is not None: + + _query_params.append(("keys", keys)) + # process the header parameters # process the form parameters # process the body parameter @@ -1755,8 +1789,8 @@ def _get_organization_serialize( _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="GET", - resource_path="/v2/organizations/{id}", + method="DELETE", + resource_path="/v2/projects/{containerId}/labels", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1770,10 +1804,10 @@ def _get_organization_serialize( ) @validate_call - def get_project( + def get_folder_details( 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[ @@ -1785,13 +1819,13 @@ def get_project( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> GetProjectResponse: - """Get Project Details + ) -> GetFolderDetailsResponse: + """Get Folder Details - Returns the project and its metadata. + 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 @@ -1816,8 +1850,8 @@ def get_project( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._get_project_serialize( - id=id, + _param = self._get_folder_details_serialize( + container_id=container_id, include_parents=include_parents, _request_auth=_request_auth, _content_type=_content_type, @@ -1826,7 +1860,7 @@ def get_project( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "GetProjectResponse", + "200": "GetFolderDetailsResponse", "403": "ErrorResponse", "404": "ErrorResponse", } @@ -1838,10 +1872,10 @@ def get_project( ).data @validate_call - def get_project_with_http_info( + def get_folder_details_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.") ], include_parents: Optional[StrictBool] = None, _request_timeout: Union[ @@ -1853,13 +1887,13 @@ def get_project_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[GetProjectResponse]: - """Get Project Details + ) -> ApiResponse[GetFolderDetailsResponse]: + """Get Folder Details - Returns the project and its metadata. + 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 @@ -1884,8 +1918,8 @@ def get_project_with_http_info( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._get_project_serialize( - id=id, + _param = self._get_folder_details_serialize( + container_id=container_id, include_parents=include_parents, _request_auth=_request_auth, _content_type=_content_type, @@ -1894,7 +1928,7 @@ def get_project_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "GetProjectResponse", + "200": "GetFolderDetailsResponse", "403": "ErrorResponse", "404": "ErrorResponse", } @@ -1906,10 +1940,10 @@ def get_project_with_http_info( ) @validate_call - def get_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[ @@ -1922,12 +1956,12 @@ def get_project_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get Project Details + """Get Folder Details - Returns the project and its metadata. + 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 @@ -1952,8 +1986,8 @@ def get_project_without_preload_content( :return: Returns the result object. """ # noqa: E501 docstring might be too long - _param = self._get_project_serialize( - id=id, + _param = self._get_folder_details_serialize( + container_id=container_id, include_parents=include_parents, _request_auth=_request_auth, _content_type=_content_type, @@ -1962,16 +1996,16 @@ def get_project_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "GetProjectResponse", + "200": "GetFolderDetailsResponse", "403": "ErrorResponse", "404": "ErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _get_project_serialize( + def _get_folder_details_serialize( self, - id, + container_id, include_parents, _request_auth, _content_type, @@ -1990,13 +2024,912 @@ def _get_project_serialize( _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 - if include_parents is not None: + # process the path parameters + 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 + + # 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="/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 get_organization( + self, + id: Annotated[ + StrictStr, + Field(description="Organization 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, + ) -> OrganizationResponse: + """Get Organization Details + + Returns the organization and its metadata. + + :param id: Organization 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._get_organization_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "OrganizationResponse", + "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_organization_with_http_info( + self, + id: Annotated[ + StrictStr, + Field(description="Organization 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[OrganizationResponse]: + """Get Organization Details + + Returns the organization and its metadata. + + :param id: Organization 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._get_organization_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "OrganizationResponse", + "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, + ) + + @validate_call + def get_organization_without_preload_content( + self, + id: Annotated[ + StrictStr, + Field(description="Organization 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: + """Get Organization Details + + Returns the organization and its metadata. + + :param id: Organization 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._get_organization_serialize( + id=id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "OrganizationResponse", + "404": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_organization_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="GET", + resource_path="/v2/organizations/{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_project( + self, + id: Annotated[ + StrictStr, Field(description="Project 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, + ) -> GetProjectResponse: + """Get Project Details + + Returns the project and its metadata. + + :param id: Project identifier - containerId as well as UUID identifier is supported. (required) + :type 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_project_serialize( + id=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": "GetProjectResponse", + "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_project_with_http_info( + self, + id: Annotated[ + StrictStr, Field(description="Project 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[GetProjectResponse]: + """Get Project Details + + Returns the project and its metadata. + + :param id: Project identifier - containerId as well as UUID identifier is supported. (required) + :type 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_project_serialize( + id=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": "GetProjectResponse", + "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, + ) + + @validate_call + def get_project_without_preload_content( + self, + id: Annotated[ + StrictStr, Field(description="Project 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, + ) -> RESTResponseType: + """Get Project Details + + Returns the project and its metadata. + + :param id: Project identifier - containerId as well as UUID identifier is supported. (required) + :type 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_project_serialize( + id=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": "GetProjectResponse", + "403": "ErrorResponse", + "404": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_project_serialize( + self, + id, + include_parents, + _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 + if include_parents is not None: + + _query_params.append(("includeParents", include_parents)) + + # 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="/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 list_folders( + self, + container_parent_id: Annotated[ + Optional[StrictStr], + Field( + description="Identifier of the parent resource container - containerId as well as UUID identifier is supported." + ), + ] = None, + container_ids: Annotated[ + Optional[List[StrictStr]], + Field(description="List of container identifiers - containerId as well as UUID identifier is supported."), + ] = None, + member: Annotated[ + Optional[StrictStr], + Field( + description="E-Mail address of the user for whom the visible resource containers should be filtered." + ), + ] = None, + limit: Annotated[ + Optional[ + Union[ + Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] + ] + ], + Field( + description="The maximum number of projects to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used." + ), + ] = None, + offset: Annotated[ + Optional[Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]], + Field(description="The offset of the first item in the collection to return."), + ] = None, + creation_time_start: Annotated[ + Optional[datetime], + Field( + description="A timestamp to specify the beginning of the creationTime from which entries should be returned. If not given, defaults to the beginning of time." + ), + ] = 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, + ) -> ListFoldersResponse: + """Get All Folders + + Returns all folders and their metadata that: - Are children of the specific containerParentId - Match the given containerIds - User is member of
Filter: - Either containerParentId OR containerIds OR member must be passed - If containerId and containerParentId are given, both are used for filtering - containers must point to the same parent - If member and containerParentId are given, both are used for filtering - If member is given, containers must not point to the same container parent + + :param container_parent_id: Identifier of the parent resource container - containerId as well as UUID identifier is supported. + :type container_parent_id: str + :param container_ids: List of container identifiers - containerId as well as UUID identifier is supported. + :type container_ids: List[str] + :param member: E-Mail address of the user for whom the visible resource containers should be filtered. + :type member: str + :param limit: The maximum number of projects to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used. + :type limit: float + :param offset: The offset of the first item in the collection to return. + :type offset: float + :param creation_time_start: A timestamp to specify the beginning of the creationTime from which entries should be returned. If not given, defaults to the beginning of time. + :type creation_time_start: datetime + :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._list_folders_serialize( + container_parent_id=container_parent_id, + container_ids=container_ids, + member=member, + limit=limit, + offset=offset, + creation_time_start=creation_time_start, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListFoldersResponse", + "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 list_folders_with_http_info( + self, + container_parent_id: Annotated[ + Optional[StrictStr], + Field( + description="Identifier of the parent resource container - containerId as well as UUID identifier is supported." + ), + ] = None, + container_ids: Annotated[ + Optional[List[StrictStr]], + Field(description="List of container identifiers - containerId as well as UUID identifier is supported."), + ] = None, + member: Annotated[ + Optional[StrictStr], + Field( + description="E-Mail address of the user for whom the visible resource containers should be filtered." + ), + ] = None, + limit: Annotated[ + Optional[ + Union[ + Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] + ] + ], + Field( + description="The maximum number of projects to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used." + ), + ] = None, + offset: Annotated[ + Optional[Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]], + Field(description="The offset of the first item in the collection to return."), + ] = None, + creation_time_start: Annotated[ + Optional[datetime], + Field( + description="A timestamp to specify the beginning of the creationTime from which entries should be returned. If not given, defaults to the beginning of time." + ), + ] = 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[ListFoldersResponse]: + """Get All Folders + + Returns all folders and their metadata that: - Are children of the specific containerParentId - Match the given containerIds - User is member of
Filter: - Either containerParentId OR containerIds OR member must be passed - If containerId and containerParentId are given, both are used for filtering - containers must point to the same parent - If member and containerParentId are given, both are used for filtering - If member is given, containers must not point to the same container parent + + :param container_parent_id: Identifier of the parent resource container - containerId as well as UUID identifier is supported. + :type container_parent_id: str + :param container_ids: List of container identifiers - containerId as well as UUID identifier is supported. + :type container_ids: List[str] + :param member: E-Mail address of the user for whom the visible resource containers should be filtered. + :type member: str + :param limit: The maximum number of projects to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used. + :type limit: float + :param offset: The offset of the first item in the collection to return. + :type offset: float + :param creation_time_start: A timestamp to specify the beginning of the creationTime from which entries should be returned. If not given, defaults to the beginning of time. + :type creation_time_start: datetime + :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._list_folders_serialize( + container_parent_id=container_parent_id, + container_ids=container_ids, + member=member, + limit=limit, + offset=offset, + creation_time_start=creation_time_start, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListFoldersResponse", + "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 list_folders_without_preload_content( + self, + container_parent_id: Annotated[ + Optional[StrictStr], + Field( + description="Identifier of the parent resource container - containerId as well as UUID identifier is supported." + ), + ] = None, + container_ids: Annotated[ + Optional[List[StrictStr]], + Field(description="List of container identifiers - containerId as well as UUID identifier is supported."), + ] = None, + member: Annotated[ + Optional[StrictStr], + Field( + description="E-Mail address of the user for whom the visible resource containers should be filtered." + ), + ] = None, + limit: Annotated[ + Optional[ + Union[ + Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] + ] + ], + Field( + description="The maximum number of projects to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used." + ), + ] = None, + offset: Annotated[ + Optional[Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]]], + Field(description="The offset of the first item in the collection to return."), + ] = None, + creation_time_start: Annotated[ + Optional[datetime], + Field( + description="A timestamp to specify the beginning of the creationTime from which entries should be returned. If not given, defaults to the beginning of time." + ), + ] = 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: + """Get All Folders + + Returns all folders and their metadata that: - Are children of the specific containerParentId - Match the given containerIds - User is member of
Filter: - Either containerParentId OR containerIds OR member must be passed - If containerId and containerParentId are given, both are used for filtering - containers must point to the same parent - If member and containerParentId are given, both are used for filtering - If member is given, containers must not point to the same container parent + + :param container_parent_id: Identifier of the parent resource container - containerId as well as UUID identifier is supported. + :type container_parent_id: str + :param container_ids: List of container identifiers - containerId as well as UUID identifier is supported. + :type container_ids: List[str] + :param member: E-Mail address of the user for whom the visible resource containers should be filtered. + :type member: str + :param limit: The maximum number of projects to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used. + :type limit: float + :param offset: The offset of the first item in the collection to return. + :type offset: float + :param creation_time_start: A timestamp to specify the beginning of the creationTime from which entries should be returned. If not given, defaults to the beginning of time. + :type creation_time_start: datetime + :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._list_folders_serialize( + container_parent_id=container_parent_id, + container_ids=container_ids, + member=member, + limit=limit, + offset=offset, + creation_time_start=creation_time_start, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "ListFoldersResponse", + "400": "ErrorResponse", + "403": "ErrorResponse", + "409": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _list_folders_serialize( + self, + container_parent_id, + container_ids, + member, + limit, + offset, + creation_time_start, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + "containerIds": "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 + # process the query parameters + if container_parent_id is not None: + + _query_params.append(("containerParentId", container_parent_id)) + + if container_ids is not None: + + _query_params.append(("containerIds", container_ids)) + + if member is not None: + + _query_params.append(("member", member)) + + if limit is not None: + + _query_params.append(("limit", limit)) - _query_params.append(("includeParents", include_parents)) + if offset is not None: + + _query_params.append(("offset", offset)) + + if creation_time_start is not None: + if isinstance(creation_time_start, datetime): + _query_params.append( + ("creation-time-start", creation_time_start.strftime(self.api_client.configuration.datetime_format)) + ) + else: + _query_params.append(("creation-time-start", creation_time_start)) # process the header parameters # process the form parameters @@ -2011,7 +2944,7 @@ def _get_project_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v2/projects/{id}", + resource_path="/v2/folders", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3092,6 +4025,270 @@ def _partial_update_folder_serialize( _request_auth=_request_auth, ) + @validate_call + def partial_update_organization( + self, + id: Annotated[ + StrictStr, + Field(description="Organization identifier - containerId as well as UUID identifier is supported."), + ], + partial_update_organization_payload: Optional[PartialUpdateOrganizationPayload] = 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, + ) -> OrganizationResponse: + """Update Organization + + Update the organization and its metadata. - Update organization name - Update organization labels + + :param id: Organization identifier - containerId as well as UUID identifier is supported. (required) + :type id: str + :param partial_update_organization_payload: + :type partial_update_organization_payload: PartialUpdateOrganizationPayload + :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_organization_serialize( + id=id, + partial_update_organization_payload=partial_update_organization_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "OrganizationResponse", + "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_organization_with_http_info( + self, + id: Annotated[ + StrictStr, + Field(description="Organization identifier - containerId as well as UUID identifier is supported."), + ], + partial_update_organization_payload: Optional[PartialUpdateOrganizationPayload] = 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[OrganizationResponse]: + """Update Organization + + Update the organization and its metadata. - Update organization name - Update organization labels + + :param id: Organization identifier - containerId as well as UUID identifier is supported. (required) + :type id: str + :param partial_update_organization_payload: + :type partial_update_organization_payload: PartialUpdateOrganizationPayload + :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_organization_serialize( + id=id, + partial_update_organization_payload=partial_update_organization_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "OrganizationResponse", + "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_organization_without_preload_content( + self, + id: Annotated[ + StrictStr, + Field(description="Organization identifier - containerId as well as UUID identifier is supported."), + ], + partial_update_organization_payload: Optional[PartialUpdateOrganizationPayload] = 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 Organization + + Update the organization and its metadata. - Update organization name - Update organization labels + + :param id: Organization identifier - containerId as well as UUID identifier is supported. (required) + :type id: str + :param partial_update_organization_payload: + :type partial_update_organization_payload: PartialUpdateOrganizationPayload + :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_organization_serialize( + id=id, + partial_update_organization_payload=partial_update_organization_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "OrganizationResponse", + "404": "ErrorResponse", + "409": "ErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _partial_update_organization_serialize( + self, + id, + partial_update_organization_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 id is not None: + _path_params["id"] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if partial_update_organization_payload is not None: + _body_params = partial_update_organization_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/organizations/{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 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 d99cecf3..ded70b65 100644 --- a/services/resourcemanager/src/stackit/resourcemanager/models/__init__.py +++ b/services/resourcemanager/src/stackit/resourcemanager/models/__init__.py @@ -23,6 +23,10 @@ ) from stackit.resourcemanager.models.get_project_response import GetProjectResponse from stackit.resourcemanager.models.lifecycle_state import LifecycleState +from stackit.resourcemanager.models.list_folders_response import ListFoldersResponse +from stackit.resourcemanager.models.list_folders_response_items_inner import ( + ListFoldersResponseItemsInner, +) from stackit.resourcemanager.models.list_organizations_response import ( ListOrganizationsResponse, ) @@ -37,6 +41,9 @@ from stackit.resourcemanager.models.partial_update_folder_payload import ( PartialUpdateFolderPayload, ) +from stackit.resourcemanager.models.partial_update_organization_payload import ( + PartialUpdateOrganizationPayload, +) from stackit.resourcemanager.models.partial_update_project_payload import ( PartialUpdateProjectPayload, ) diff --git a/services/resourcemanager/src/stackit/resourcemanager/models/list_folders_response.py b/services/resourcemanager/src/stackit/resourcemanager/models/list_folders_response.py new file mode 100644 index 00000000..132de13f --- /dev/null +++ b/services/resourcemanager/src/stackit/resourcemanager/models/list_folders_response.py @@ -0,0 +1,110 @@ +# 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 typing import Any, ClassVar, Dict, List, Optional, Set, Union + +from pydantic import BaseModel, ConfigDict, Field +from typing_extensions import Annotated, Self + +from stackit.resourcemanager.models.list_folders_response_items_inner import ( + ListFoldersResponseItemsInner, +) + + +class ListFoldersResponse(BaseModel): + """ + ListFoldersResponse + """ + + items: List[ListFoldersResponseItemsInner] + limit: Union[ + Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)] + ] = Field( + description="The maximum number of projects to return in the response. If not present, an appropriate default will be used." + ) + offset: Union[Annotated[float, Field(strict=True, ge=0)], Annotated[int, Field(strict=True, ge=0)]] = Field( + description="The offset of the first item in the collection to return." + ) + __properties: ClassVar[List[str]] = ["items", "limit", "offset"] + + 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 ListFoldersResponse 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 items (list) + _items = [] + if self.items: + for _item in self.items: + if _item: + _items.append(_item.to_dict()) + _dict["items"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListFoldersResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "items": ( + [ListFoldersResponseItemsInner.from_dict(_item) for _item in obj["items"]] + if obj.get("items") is not None + else None + ), + "limit": obj.get("limit") if obj.get("limit") is not None else 50, + "offset": obj.get("offset") if obj.get("offset") is not None else 0, + } + ) + return _obj diff --git a/services/resourcemanager/src/stackit/resourcemanager/models/list_folders_response_items_inner.py b/services/resourcemanager/src/stackit/resourcemanager/models/list_folders_response_items_inner.py new file mode 100644 index 00000000..b569c03a --- /dev/null +++ b/services/resourcemanager/src/stackit/resourcemanager/models/list_folders_response_items_inner.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 ListFoldersResponseItemsInner(BaseModel): + """ + ListFoldersResponseItemsInner + """ + + container_id: StrictStr = Field(description="Globally unique folder 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="Name of the folder.") + parent: Parent + update_time: datetime = Field(description="Timestamp at which the folder was created.", 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 ListFoldersResponseItemsInner 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 ListFoldersResponseItemsInner 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/partial_update_organization_payload.py b/services/resourcemanager/src/stackit/resourcemanager/models/partial_update_organization_payload.py new file mode 100644 index 00000000..8346b5e3 --- /dev/null +++ b/services/resourcemanager/src/stackit/resourcemanager/models/partial_update_organization_payload.py @@ -0,0 +1,101 @@ +# 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 PartialUpdateOrganizationPayload(BaseModel): + """ + PartialUpdateOrganizationPayload + """ + + 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="The new name of the organization matching the regex `^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$`.", + ) + __properties: ClassVar[List[str]] = ["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 PartialUpdateOrganizationPayload 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 PartialUpdateOrganizationPayload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"labels": obj.get("labels"), "name": obj.get("name")}) + return _obj