stackit-sqlserverflex 1.0.1__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/PKG-INFO +1 -1
  2. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/pyproject.toml +1 -1
  3. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/__init__.py +4 -0
  4. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/api/default_api.py +394 -0
  5. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/__init__.py +4 -0
  6. stackit_sqlserverflex-1.0.2/src/stackit/sqlserverflex/models/data_point.py +83 -0
  7. stackit_sqlserverflex-1.0.2/src/stackit/sqlserverflex/models/host.py +101 -0
  8. stackit_sqlserverflex-1.0.2/src/stackit/sqlserverflex/models/host_metric.py +103 -0
  9. stackit_sqlserverflex-1.0.2/src/stackit/sqlserverflex/models/list_metrics_response.py +93 -0
  10. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/LICENSE.md +0 -0
  11. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/NOTICE.txt +0 -0
  12. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/README.md +0 -0
  13. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/api/__init__.py +0 -0
  14. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/api_client.py +0 -0
  15. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/api_response.py +0 -0
  16. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/configuration.py +0 -0
  17. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/exceptions.py +0 -0
  18. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/acl.py +0 -0
  19. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/backup.py +0 -0
  20. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/backup_list_backups_response_grouped.py +0 -0
  21. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/create_database_payload.py +0 -0
  22. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/create_database_response.py +0 -0
  23. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/create_instance_payload.py +0 -0
  24. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/create_instance_response.py +0 -0
  25. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/create_user_payload.py +0 -0
  26. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/create_user_response.py +0 -0
  27. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/database.py +0 -0
  28. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/database_documentation_create_database_request_options.py +0 -0
  29. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/database_options.py +0 -0
  30. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/flavor.py +0 -0
  31. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/get_backup_response.py +0 -0
  32. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/get_database_response.py +0 -0
  33. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/get_instance_response.py +0 -0
  34. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/get_user_response.py +0 -0
  35. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/instance.py +0 -0
  36. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/instance_documentation_acl.py +0 -0
  37. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/instance_documentation_options.py +0 -0
  38. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/instance_documentation_storage.py +0 -0
  39. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/instance_error.py +0 -0
  40. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/instance_flavor_entry.py +0 -0
  41. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/instance_list_instance.py +0 -0
  42. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/instance_list_user.py +0 -0
  43. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_backups_response.py +0 -0
  44. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_collations_response.py +0 -0
  45. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_compatibility_response.py +0 -0
  46. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_databases_response.py +0 -0
  47. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_flavors_response.py +0 -0
  48. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_instances_response.py +0 -0
  49. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_restore_jobs_response.py +0 -0
  50. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_roles_response.py +0 -0
  51. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_storages_response.py +0 -0
  52. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_users_response.py +0 -0
  53. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/list_versions_response.py +0 -0
  54. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/mssql_database_collation.py +0 -0
  55. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/mssql_database_compatibility.py +0 -0
  56. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/partial_update_instance_payload.py +0 -0
  57. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/reset_user_response.py +0 -0
  58. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/restore_running_restore.py +0 -0
  59. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/single_database.py +0 -0
  60. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/single_user.py +0 -0
  61. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/storage.py +0 -0
  62. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/storage_range.py +0 -0
  63. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/trigger_database_restore_payload.py +0 -0
  64. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/type.py +0 -0
  65. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/update_instance_payload.py +0 -0
  66. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/update_instance_response.py +0 -0
  67. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/user.py +0 -0
  68. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/models/user_response_user.py +0 -0
  69. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/py.typed +0 -0
  70. {stackit_sqlserverflex-1.0.1 → stackit_sqlserverflex-1.0.2}/src/stackit/sqlserverflex/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stackit-sqlserverflex
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: STACKIT MSSQL Service API
5
5
  Author: STACKIT Developer Tools
6
6
  Author-email: developer-tools@stackit.cloud
@@ -3,7 +3,7 @@ name = "stackit-sqlserverflex"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "stackit-sqlserverflex"
6
- version = "v1.0.1"
6
+ version = "v1.0.2"
7
7
  authors = [
8
8
  "STACKIT Developer Tools <developer-tools@stackit.cloud>",
9
9
  ]
@@ -45,6 +45,7 @@ from stackit.sqlserverflex.models.create_instance_payload import CreateInstanceP
45
45
  from stackit.sqlserverflex.models.create_instance_response import CreateInstanceResponse
46
46
  from stackit.sqlserverflex.models.create_user_payload import CreateUserPayload
47
47
  from stackit.sqlserverflex.models.create_user_response import CreateUserResponse
48
+ from stackit.sqlserverflex.models.data_point import DataPoint
48
49
  from stackit.sqlserverflex.models.database import Database
49
50
  from stackit.sqlserverflex.models.database_documentation_create_database_request_options import (
50
51
  DatabaseDocumentationCreateDatabaseRequestOptions,
@@ -55,6 +56,8 @@ from stackit.sqlserverflex.models.get_backup_response import GetBackupResponse
55
56
  from stackit.sqlserverflex.models.get_database_response import GetDatabaseResponse
56
57
  from stackit.sqlserverflex.models.get_instance_response import GetInstanceResponse
57
58
  from stackit.sqlserverflex.models.get_user_response import GetUserResponse
59
+ from stackit.sqlserverflex.models.host import Host
60
+ from stackit.sqlserverflex.models.host_metric import HostMetric
58
61
  from stackit.sqlserverflex.models.instance import Instance
59
62
  from stackit.sqlserverflex.models.instance_documentation_acl import (
60
63
  InstanceDocumentationACL,
@@ -77,6 +80,7 @@ from stackit.sqlserverflex.models.list_compatibility_response import (
77
80
  from stackit.sqlserverflex.models.list_databases_response import ListDatabasesResponse
78
81
  from stackit.sqlserverflex.models.list_flavors_response import ListFlavorsResponse
79
82
  from stackit.sqlserverflex.models.list_instances_response import ListInstancesResponse
83
+ from stackit.sqlserverflex.models.list_metrics_response import ListMetricsResponse
80
84
  from stackit.sqlserverflex.models.list_restore_jobs_response import (
81
85
  ListRestoreJobsResponse,
82
86
  )
@@ -44,6 +44,7 @@ from stackit.sqlserverflex.models.list_compatibility_response import (
44
44
  from stackit.sqlserverflex.models.list_databases_response import ListDatabasesResponse
45
45
  from stackit.sqlserverflex.models.list_flavors_response import ListFlavorsResponse
46
46
  from stackit.sqlserverflex.models.list_instances_response import ListInstancesResponse
47
+ from stackit.sqlserverflex.models.list_metrics_response import ListMetricsResponse
47
48
  from stackit.sqlserverflex.models.list_restore_jobs_response import (
48
49
  ListRestoreJobsResponse,
49
50
  )
@@ -4481,6 +4482,399 @@ class DefaultApi:
4481
4482
  _request_auth=_request_auth,
4482
4483
  )
4483
4484
 
4485
+ @validate_call
4486
+ def list_metrics(
4487
+ self,
4488
+ project_id: Annotated[StrictStr, Field(description="The UUID of the project.")],
4489
+ instance_id: Annotated[StrictStr, Field(description="The UUID of the instance.")],
4490
+ metric: Annotated[
4491
+ StrictStr,
4492
+ Field(
4493
+ description="The name of the metric. Valid metrics are 'cpu', 'memory', 'data-disk-size', 'data-disk-use','log-disk-size', 'log-disk-use', 'life-expectancy' and 'connections'."
4494
+ ),
4495
+ ],
4496
+ granularity: Annotated[StrictStr, Field(description="The granularity in ISO8601 e.g. 5 minutes are 'PT5M'.")],
4497
+ period: Annotated[
4498
+ Optional[StrictStr],
4499
+ Field(
4500
+ description="The period in ISO8601 format e.g. 5 minutes are 'PT5M'. If no period is provided, the standard value of 5 minutes is used."
4501
+ ),
4502
+ ] = None,
4503
+ start: Annotated[
4504
+ Optional[StrictStr],
4505
+ Field(
4506
+ description="The start of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'. If no start time is provided, current server time as UTC is used."
4507
+ ),
4508
+ ] = None,
4509
+ end: Annotated[
4510
+ Optional[StrictStr],
4511
+ Field(
4512
+ description="The end of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'."
4513
+ ),
4514
+ ] = None,
4515
+ _request_timeout: Union[
4516
+ None,
4517
+ Annotated[StrictFloat, Field(gt=0)],
4518
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4519
+ ] = None,
4520
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4521
+ _content_type: Optional[StrictStr] = None,
4522
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4523
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4524
+ ) -> ListMetricsResponse:
4525
+ """Get Metric
4526
+
4527
+ Returns a metric for an instance. The metric will only be for the master pod if needed. Granularity parameter is always needed. If start and end time is provided, period is not considered in max-connections and disk-use. If you provide start time, you have to provide end time as well and vice versa.
4528
+
4529
+ :param project_id: The UUID of the project. (required)
4530
+ :type project_id: str
4531
+ :param instance_id: The UUID of the instance. (required)
4532
+ :type instance_id: str
4533
+ :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'data-disk-size', 'data-disk-use','log-disk-size', 'log-disk-use', 'life-expectancy' and 'connections'. (required)
4534
+ :type metric: str
4535
+ :param granularity: The granularity in ISO8601 e.g. 5 minutes are 'PT5M'. (required)
4536
+ :type granularity: str
4537
+ :param period: The period in ISO8601 format e.g. 5 minutes are 'PT5M'. If no period is provided, the standard value of 5 minutes is used.
4538
+ :type period: str
4539
+ :param start: The start of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'. If no start time is provided, current server time as UTC is used.
4540
+ :type start: str
4541
+ :param end: The end of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'.
4542
+ :type end: str
4543
+ :param _request_timeout: timeout setting for this request. If one
4544
+ number provided, it will be total request
4545
+ timeout. It can also be a pair (tuple) of
4546
+ (connection, read) timeouts.
4547
+ :type _request_timeout: int, tuple(int, int), optional
4548
+ :param _request_auth: set to override the auth_settings for an a single
4549
+ request; this effectively ignores the
4550
+ authentication in the spec for a single request.
4551
+ :type _request_auth: dict, optional
4552
+ :param _content_type: force content-type for the request.
4553
+ :type _content_type: str, Optional
4554
+ :param _headers: set to override the headers for a single
4555
+ request; this effectively ignores the headers
4556
+ in the spec for a single request.
4557
+ :type _headers: dict, optional
4558
+ :param _host_index: set to override the host_index for a single
4559
+ request; this effectively ignores the host_index
4560
+ in the spec for a single request.
4561
+ :type _host_index: int, optional
4562
+ :return: Returns the result object.
4563
+ """ # noqa: E501 docstring might be too long
4564
+
4565
+ _param = self._list_metrics_serialize(
4566
+ project_id=project_id,
4567
+ instance_id=instance_id,
4568
+ metric=metric,
4569
+ granularity=granularity,
4570
+ period=period,
4571
+ start=start,
4572
+ end=end,
4573
+ _request_auth=_request_auth,
4574
+ _content_type=_content_type,
4575
+ _headers=_headers,
4576
+ _host_index=_host_index,
4577
+ )
4578
+
4579
+ _response_types_map: Dict[str, Optional[str]] = {
4580
+ "200": "ListMetricsResponse",
4581
+ "400": "InstanceError",
4582
+ "405": "InstanceError",
4583
+ "500": "InstanceError",
4584
+ }
4585
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4586
+ response_data.read()
4587
+ return self.api_client.response_deserialize(
4588
+ response_data=response_data,
4589
+ response_types_map=_response_types_map,
4590
+ ).data
4591
+
4592
+ @validate_call
4593
+ def list_metrics_with_http_info(
4594
+ self,
4595
+ project_id: Annotated[StrictStr, Field(description="The UUID of the project.")],
4596
+ instance_id: Annotated[StrictStr, Field(description="The UUID of the instance.")],
4597
+ metric: Annotated[
4598
+ StrictStr,
4599
+ Field(
4600
+ description="The name of the metric. Valid metrics are 'cpu', 'memory', 'data-disk-size', 'data-disk-use','log-disk-size', 'log-disk-use', 'life-expectancy' and 'connections'."
4601
+ ),
4602
+ ],
4603
+ granularity: Annotated[StrictStr, Field(description="The granularity in ISO8601 e.g. 5 minutes are 'PT5M'.")],
4604
+ period: Annotated[
4605
+ Optional[StrictStr],
4606
+ Field(
4607
+ description="The period in ISO8601 format e.g. 5 minutes are 'PT5M'. If no period is provided, the standard value of 5 minutes is used."
4608
+ ),
4609
+ ] = None,
4610
+ start: Annotated[
4611
+ Optional[StrictStr],
4612
+ Field(
4613
+ description="The start of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'. If no start time is provided, current server time as UTC is used."
4614
+ ),
4615
+ ] = None,
4616
+ end: Annotated[
4617
+ Optional[StrictStr],
4618
+ Field(
4619
+ description="The end of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'."
4620
+ ),
4621
+ ] = None,
4622
+ _request_timeout: Union[
4623
+ None,
4624
+ Annotated[StrictFloat, Field(gt=0)],
4625
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4626
+ ] = None,
4627
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4628
+ _content_type: Optional[StrictStr] = None,
4629
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4630
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4631
+ ) -> ApiResponse[ListMetricsResponse]:
4632
+ """Get Metric
4633
+
4634
+ Returns a metric for an instance. The metric will only be for the master pod if needed. Granularity parameter is always needed. If start and end time is provided, period is not considered in max-connections and disk-use. If you provide start time, you have to provide end time as well and vice versa.
4635
+
4636
+ :param project_id: The UUID of the project. (required)
4637
+ :type project_id: str
4638
+ :param instance_id: The UUID of the instance. (required)
4639
+ :type instance_id: str
4640
+ :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'data-disk-size', 'data-disk-use','log-disk-size', 'log-disk-use', 'life-expectancy' and 'connections'. (required)
4641
+ :type metric: str
4642
+ :param granularity: The granularity in ISO8601 e.g. 5 minutes are 'PT5M'. (required)
4643
+ :type granularity: str
4644
+ :param period: The period in ISO8601 format e.g. 5 minutes are 'PT5M'. If no period is provided, the standard value of 5 minutes is used.
4645
+ :type period: str
4646
+ :param start: The start of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'. If no start time is provided, current server time as UTC is used.
4647
+ :type start: str
4648
+ :param end: The end of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'.
4649
+ :type end: str
4650
+ :param _request_timeout: timeout setting for this request. If one
4651
+ number provided, it will be total request
4652
+ timeout. It can also be a pair (tuple) of
4653
+ (connection, read) timeouts.
4654
+ :type _request_timeout: int, tuple(int, int), optional
4655
+ :param _request_auth: set to override the auth_settings for an a single
4656
+ request; this effectively ignores the
4657
+ authentication in the spec for a single request.
4658
+ :type _request_auth: dict, optional
4659
+ :param _content_type: force content-type for the request.
4660
+ :type _content_type: str, Optional
4661
+ :param _headers: set to override the headers for a single
4662
+ request; this effectively ignores the headers
4663
+ in the spec for a single request.
4664
+ :type _headers: dict, optional
4665
+ :param _host_index: set to override the host_index for a single
4666
+ request; this effectively ignores the host_index
4667
+ in the spec for a single request.
4668
+ :type _host_index: int, optional
4669
+ :return: Returns the result object.
4670
+ """ # noqa: E501 docstring might be too long
4671
+
4672
+ _param = self._list_metrics_serialize(
4673
+ project_id=project_id,
4674
+ instance_id=instance_id,
4675
+ metric=metric,
4676
+ granularity=granularity,
4677
+ period=period,
4678
+ start=start,
4679
+ end=end,
4680
+ _request_auth=_request_auth,
4681
+ _content_type=_content_type,
4682
+ _headers=_headers,
4683
+ _host_index=_host_index,
4684
+ )
4685
+
4686
+ _response_types_map: Dict[str, Optional[str]] = {
4687
+ "200": "ListMetricsResponse",
4688
+ "400": "InstanceError",
4689
+ "405": "InstanceError",
4690
+ "500": "InstanceError",
4691
+ }
4692
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4693
+ response_data.read()
4694
+ return self.api_client.response_deserialize(
4695
+ response_data=response_data,
4696
+ response_types_map=_response_types_map,
4697
+ )
4698
+
4699
+ @validate_call
4700
+ def list_metrics_without_preload_content(
4701
+ self,
4702
+ project_id: Annotated[StrictStr, Field(description="The UUID of the project.")],
4703
+ instance_id: Annotated[StrictStr, Field(description="The UUID of the instance.")],
4704
+ metric: Annotated[
4705
+ StrictStr,
4706
+ Field(
4707
+ description="The name of the metric. Valid metrics are 'cpu', 'memory', 'data-disk-size', 'data-disk-use','log-disk-size', 'log-disk-use', 'life-expectancy' and 'connections'."
4708
+ ),
4709
+ ],
4710
+ granularity: Annotated[StrictStr, Field(description="The granularity in ISO8601 e.g. 5 minutes are 'PT5M'.")],
4711
+ period: Annotated[
4712
+ Optional[StrictStr],
4713
+ Field(
4714
+ description="The period in ISO8601 format e.g. 5 minutes are 'PT5M'. If no period is provided, the standard value of 5 minutes is used."
4715
+ ),
4716
+ ] = None,
4717
+ start: Annotated[
4718
+ Optional[StrictStr],
4719
+ Field(
4720
+ description="The start of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'. If no start time is provided, current server time as UTC is used."
4721
+ ),
4722
+ ] = None,
4723
+ end: Annotated[
4724
+ Optional[StrictStr],
4725
+ Field(
4726
+ description="The end of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'."
4727
+ ),
4728
+ ] = None,
4729
+ _request_timeout: Union[
4730
+ None,
4731
+ Annotated[StrictFloat, Field(gt=0)],
4732
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4733
+ ] = None,
4734
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4735
+ _content_type: Optional[StrictStr] = None,
4736
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4737
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4738
+ ) -> RESTResponseType:
4739
+ """Get Metric
4740
+
4741
+ Returns a metric for an instance. The metric will only be for the master pod if needed. Granularity parameter is always needed. If start and end time is provided, period is not considered in max-connections and disk-use. If you provide start time, you have to provide end time as well and vice versa.
4742
+
4743
+ :param project_id: The UUID of the project. (required)
4744
+ :type project_id: str
4745
+ :param instance_id: The UUID of the instance. (required)
4746
+ :type instance_id: str
4747
+ :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'data-disk-size', 'data-disk-use','log-disk-size', 'log-disk-use', 'life-expectancy' and 'connections'. (required)
4748
+ :type metric: str
4749
+ :param granularity: The granularity in ISO8601 e.g. 5 minutes are 'PT5M'. (required)
4750
+ :type granularity: str
4751
+ :param period: The period in ISO8601 format e.g. 5 minutes are 'PT5M'. If no period is provided, the standard value of 5 minutes is used.
4752
+ :type period: str
4753
+ :param start: The start of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'. If no start time is provided, current server time as UTC is used.
4754
+ :type start: str
4755
+ :param end: The end of the timeframe as timestamp in ISO8601 (RFC3339) e.g. '2023-08-28T07:10:52.536Z'.
4756
+ :type end: str
4757
+ :param _request_timeout: timeout setting for this request. If one
4758
+ number provided, it will be total request
4759
+ timeout. It can also be a pair (tuple) of
4760
+ (connection, read) timeouts.
4761
+ :type _request_timeout: int, tuple(int, int), optional
4762
+ :param _request_auth: set to override the auth_settings for an a single
4763
+ request; this effectively ignores the
4764
+ authentication in the spec for a single request.
4765
+ :type _request_auth: dict, optional
4766
+ :param _content_type: force content-type for the request.
4767
+ :type _content_type: str, Optional
4768
+ :param _headers: set to override the headers for a single
4769
+ request; this effectively ignores the headers
4770
+ in the spec for a single request.
4771
+ :type _headers: dict, optional
4772
+ :param _host_index: set to override the host_index for a single
4773
+ request; this effectively ignores the host_index
4774
+ in the spec for a single request.
4775
+ :type _host_index: int, optional
4776
+ :return: Returns the result object.
4777
+ """ # noqa: E501 docstring might be too long
4778
+
4779
+ _param = self._list_metrics_serialize(
4780
+ project_id=project_id,
4781
+ instance_id=instance_id,
4782
+ metric=metric,
4783
+ granularity=granularity,
4784
+ period=period,
4785
+ start=start,
4786
+ end=end,
4787
+ _request_auth=_request_auth,
4788
+ _content_type=_content_type,
4789
+ _headers=_headers,
4790
+ _host_index=_host_index,
4791
+ )
4792
+
4793
+ _response_types_map: Dict[str, Optional[str]] = {
4794
+ "200": "ListMetricsResponse",
4795
+ "400": "InstanceError",
4796
+ "405": "InstanceError",
4797
+ "500": "InstanceError",
4798
+ }
4799
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4800
+ return response_data.response
4801
+
4802
+ def _list_metrics_serialize(
4803
+ self,
4804
+ project_id,
4805
+ instance_id,
4806
+ metric,
4807
+ granularity,
4808
+ period,
4809
+ start,
4810
+ end,
4811
+ _request_auth,
4812
+ _content_type,
4813
+ _headers,
4814
+ _host_index,
4815
+ ) -> RequestSerialized:
4816
+
4817
+ _host = None
4818
+
4819
+ _collection_formats: Dict[str, str] = {}
4820
+
4821
+ _path_params: Dict[str, str] = {}
4822
+ _query_params: List[Tuple[str, str]] = []
4823
+ _header_params: Dict[str, Optional[str]] = _headers or {}
4824
+ _form_params: List[Tuple[str, str]] = []
4825
+ _files: Dict[str, Union[str, bytes]] = {}
4826
+ _body_params: Optional[bytes] = None
4827
+
4828
+ # process the path parameters
4829
+ if project_id is not None:
4830
+ _path_params["projectId"] = project_id
4831
+ if instance_id is not None:
4832
+ _path_params["instanceId"] = instance_id
4833
+ if metric is not None:
4834
+ _path_params["metric"] = metric
4835
+ # process the query parameters
4836
+ if granularity is not None:
4837
+
4838
+ _query_params.append(("granularity", granularity))
4839
+
4840
+ if period is not None:
4841
+
4842
+ _query_params.append(("period", period))
4843
+
4844
+ if start is not None:
4845
+
4846
+ _query_params.append(("start", start))
4847
+
4848
+ if end is not None:
4849
+
4850
+ _query_params.append(("end", end))
4851
+
4852
+ # process the header parameters
4853
+ # process the form parameters
4854
+ # process the body parameter
4855
+
4856
+ # set the HTTP header `Accept`
4857
+ if "Accept" not in _header_params:
4858
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
4859
+
4860
+ # authentication setting
4861
+ _auth_settings: List[str] = []
4862
+
4863
+ return self.api_client.param_serialize(
4864
+ method="GET",
4865
+ resource_path="/v2/projects/{projectId}/instances/{instanceId}/metrics/{metric}",
4866
+ path_params=_path_params,
4867
+ query_params=_query_params,
4868
+ header_params=_header_params,
4869
+ body=_body_params,
4870
+ post_params=_form_params,
4871
+ files=_files,
4872
+ auth_settings=_auth_settings,
4873
+ collection_formats=_collection_formats,
4874
+ _host=_host,
4875
+ _request_auth=_request_auth,
4876
+ )
4877
+
4484
4878
  @validate_call
4485
4879
  def list_restore_jobs(
4486
4880
  self,
@@ -26,6 +26,7 @@ from stackit.sqlserverflex.models.create_instance_payload import CreateInstanceP
26
26
  from stackit.sqlserverflex.models.create_instance_response import CreateInstanceResponse
27
27
  from stackit.sqlserverflex.models.create_user_payload import CreateUserPayload
28
28
  from stackit.sqlserverflex.models.create_user_response import CreateUserResponse
29
+ from stackit.sqlserverflex.models.data_point import DataPoint
29
30
  from stackit.sqlserverflex.models.database import Database
30
31
  from stackit.sqlserverflex.models.database_documentation_create_database_request_options import (
31
32
  DatabaseDocumentationCreateDatabaseRequestOptions,
@@ -36,6 +37,8 @@ from stackit.sqlserverflex.models.get_backup_response import GetBackupResponse
36
37
  from stackit.sqlserverflex.models.get_database_response import GetDatabaseResponse
37
38
  from stackit.sqlserverflex.models.get_instance_response import GetInstanceResponse
38
39
  from stackit.sqlserverflex.models.get_user_response import GetUserResponse
40
+ from stackit.sqlserverflex.models.host import Host
41
+ from stackit.sqlserverflex.models.host_metric import HostMetric
39
42
  from stackit.sqlserverflex.models.instance import Instance
40
43
  from stackit.sqlserverflex.models.instance_documentation_acl import (
41
44
  InstanceDocumentationACL,
@@ -58,6 +61,7 @@ from stackit.sqlserverflex.models.list_compatibility_response import (
58
61
  from stackit.sqlserverflex.models.list_databases_response import ListDatabasesResponse
59
62
  from stackit.sqlserverflex.models.list_flavors_response import ListFlavorsResponse
60
63
  from stackit.sqlserverflex.models.list_instances_response import ListInstancesResponse
64
+ from stackit.sqlserverflex.models.list_metrics_response import ListMetricsResponse
61
65
  from stackit.sqlserverflex.models.list_restore_jobs_response import (
62
66
  ListRestoreJobsResponse,
63
67
  )
@@ -0,0 +1,83 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MSSQL Service API
5
+
6
+ This is the documentation for the STACKIT MSSQL service
7
+
8
+ The version of the OpenAPI document: 2.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set, Union
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class DataPoint(BaseModel):
26
+ """
27
+ DataPoint
28
+ """
29
+
30
+ timestamp: Optional[StrictStr] = None
31
+ value: Optional[Union[StrictFloat, StrictInt]] = None
32
+ __properties: ClassVar[List[str]] = ["timestamp", "value"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of DataPoint from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of DataPoint from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({"timestamp": obj.get("timestamp"), "value": obj.get("value")})
83
+ return _obj
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MSSQL Service API
5
+
6
+ This is the documentation for the STACKIT MSSQL service
7
+
8
+ The version of the OpenAPI document: 2.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing_extensions import Self
23
+
24
+ from stackit.sqlserverflex.models.host_metric import HostMetric
25
+
26
+
27
+ class Host(BaseModel):
28
+ """
29
+ Host
30
+ """
31
+
32
+ host_metrics: Optional[List[HostMetric]] = Field(default=None, alias="hostMetrics")
33
+ id: Optional[StrictStr] = None
34
+ __properties: ClassVar[List[str]] = ["hostMetrics", "id"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of Host from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of each item in host_metrics (list)
74
+ _items = []
75
+ if self.host_metrics:
76
+ for _item in self.host_metrics:
77
+ if _item:
78
+ _items.append(_item.to_dict())
79
+ _dict["hostMetrics"] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of Host from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate(
92
+ {
93
+ "hostMetrics": (
94
+ [HostMetric.from_dict(_item) for _item in obj["hostMetrics"]]
95
+ if obj.get("hostMetrics") is not None
96
+ else None
97
+ ),
98
+ "id": obj.get("id"),
99
+ }
100
+ )
101
+ return _obj
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MSSQL Service API
5
+
6
+ This is the documentation for the STACKIT MSSQL service
7
+
8
+ The version of the OpenAPI document: 2.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
+ from typing_extensions import Self
23
+
24
+ from stackit.sqlserverflex.models.data_point import DataPoint
25
+
26
+
27
+ class HostMetric(BaseModel):
28
+ """
29
+ HostMetric
30
+ """
31
+
32
+ datapoints: Optional[List[DataPoint]] = None
33
+ name: Optional[StrictStr] = None
34
+ units: Optional[StrictStr] = None
35
+ __properties: ClassVar[List[str]] = ["datapoints", "name", "units"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of HostMetric from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of each item in datapoints (list)
75
+ _items = []
76
+ if self.datapoints:
77
+ for _item in self.datapoints:
78
+ if _item:
79
+ _items.append(_item.to_dict())
80
+ _dict["datapoints"] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of HostMetric from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate(
93
+ {
94
+ "datapoints": (
95
+ [DataPoint.from_dict(_item) for _item in obj["datapoints"]]
96
+ if obj.get("datapoints") is not None
97
+ else None
98
+ ),
99
+ "name": obj.get("name"),
100
+ "units": obj.get("units"),
101
+ }
102
+ )
103
+ return _obj
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MSSQL Service API
5
+
6
+ This is the documentation for the STACKIT MSSQL service
7
+
8
+ The version of the OpenAPI document: 2.0.0
9
+ Contact: support@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ from typing import Any, ClassVar, Dict, List, Optional, Set
20
+
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing_extensions import Self
23
+
24
+ from stackit.sqlserverflex.models.host import Host
25
+
26
+
27
+ class ListMetricsResponse(BaseModel):
28
+ """
29
+ ListMetricsResponse
30
+ """
31
+
32
+ hosts: Optional[List[Host]] = None
33
+ __properties: ClassVar[List[str]] = ["hosts"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of ListMetricsResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of each item in hosts (list)
73
+ _items = []
74
+ if self.hosts:
75
+ for _item in self.hosts:
76
+ if _item:
77
+ _items.append(_item.to_dict())
78
+ _dict["hosts"] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of ListMetricsResponse from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate(
91
+ {"hosts": [Host.from_dict(_item) for _item in obj["hosts"]] if obj.get("hosts") is not None else None}
92
+ )
93
+ return _obj