stackit-postgresflex 0.0.1a0__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
@@ -4438,7 +4438,7 @@ class DefaultApi:
4438
4438
  metric: Annotated[
4439
4439
  StrictStr,
4440
4440
  Field(
4441
- description="The name of the metric. Valid metrics are 'cpu', 'memory', 'max-connections', 'connections' and 'disk-use'."
4441
+ description="The name of the metric. Valid metrics are 'cpu', 'memory', 'disk-use', 'disk-size' and 'connections'."
4442
4442
  ),
4443
4443
  ],
4444
4444
  granularity: Annotated[StrictStr, Field(description="The granularity in ISO8601 e.g. 5 minutes are 'PT5M'.")],
@@ -4472,13 +4472,13 @@ class DefaultApi:
4472
4472
  ) -> InstanceMetricsResponse:
4473
4473
  """Get Metric
4474
4474
 
4475
- 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.
4475
+ 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 connections and disk-use. If you provide start time, you have to provide end time as well and vice versa.
4476
4476
 
4477
4477
  :param project_id: The UUID of the project. (required)
4478
4478
  :type project_id: str
4479
4479
  :param instance_id: The UUID of the instance. (required)
4480
4480
  :type instance_id: str
4481
- :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'max-connections', 'connections' and 'disk-use'. (required)
4481
+ :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'disk-use', 'disk-size' and 'connections'. (required)
4482
4482
  :type metric: str
4483
4483
  :param granularity: The granularity in ISO8601 e.g. 5 minutes are 'PT5M'. (required)
4484
4484
  :type granularity: str
@@ -4545,7 +4545,7 @@ class DefaultApi:
4545
4545
  metric: Annotated[
4546
4546
  StrictStr,
4547
4547
  Field(
4548
- description="The name of the metric. Valid metrics are 'cpu', 'memory', 'max-connections', 'connections' and 'disk-use'."
4548
+ description="The name of the metric. Valid metrics are 'cpu', 'memory', 'disk-use', 'disk-size' and 'connections'."
4549
4549
  ),
4550
4550
  ],
4551
4551
  granularity: Annotated[StrictStr, Field(description="The granularity in ISO8601 e.g. 5 minutes are 'PT5M'.")],
@@ -4579,13 +4579,13 @@ class DefaultApi:
4579
4579
  ) -> ApiResponse[InstanceMetricsResponse]:
4580
4580
  """Get Metric
4581
4581
 
4582
- 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.
4582
+ 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 connections and disk-use. If you provide start time, you have to provide end time as well and vice versa.
4583
4583
 
4584
4584
  :param project_id: The UUID of the project. (required)
4585
4585
  :type project_id: str
4586
4586
  :param instance_id: The UUID of the instance. (required)
4587
4587
  :type instance_id: str
4588
- :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'max-connections', 'connections' and 'disk-use'. (required)
4588
+ :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'disk-use', 'disk-size' and 'connections'. (required)
4589
4589
  :type metric: str
4590
4590
  :param granularity: The granularity in ISO8601 e.g. 5 minutes are 'PT5M'. (required)
4591
4591
  :type granularity: str
@@ -4652,7 +4652,7 @@ class DefaultApi:
4652
4652
  metric: Annotated[
4653
4653
  StrictStr,
4654
4654
  Field(
4655
- description="The name of the metric. Valid metrics are 'cpu', 'memory', 'max-connections', 'connections' and 'disk-use'."
4655
+ description="The name of the metric. Valid metrics are 'cpu', 'memory', 'disk-use', 'disk-size' and 'connections'."
4656
4656
  ),
4657
4657
  ],
4658
4658
  granularity: Annotated[StrictStr, Field(description="The granularity in ISO8601 e.g. 5 minutes are 'PT5M'.")],
@@ -4686,13 +4686,13 @@ class DefaultApi:
4686
4686
  ) -> RESTResponseType:
4687
4687
  """Get Metric
4688
4688
 
4689
- 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.
4689
+ 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 connections and disk-use. If you provide start time, you have to provide end time as well and vice versa.
4690
4690
 
4691
4691
  :param project_id: The UUID of the project. (required)
4692
4692
  :type project_id: str
4693
4693
  :param instance_id: The UUID of the instance. (required)
4694
4694
  :type instance_id: str
4695
- :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'max-connections', 'connections' and 'disk-use'. (required)
4695
+ :param metric: The name of the metric. Valid metrics are 'cpu', 'memory', 'disk-use', 'disk-size' and 'connections'. (required)
4696
4696
  :type metric: str
4697
4697
  :param granularity: The granularity in ISO8601 e.g. 5 minutes are 'PT5M'. (required)
4698
4698
  :type granularity: str
@@ -12,6 +12,8 @@
12
12
  Do not edit the class manually.
13
13
  """ # noqa: E501 docstring might be too long
14
14
 
15
+ import os
16
+
15
17
 
16
18
  class HostConfiguration:
17
19
  def __init__(
@@ -23,7 +25,14 @@ class HostConfiguration:
23
25
  server_operation_variables=None,
24
26
  ignore_operation_servers=False,
25
27
  ) -> None:
26
- """Constructor"""
28
+ print(
29
+ "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n",
30
+ "as a function argument instead of being set in the client configuration.\n"
31
+ "Once all services have migrated, the methods to specify the region in the client configuration "
32
+ "will be removed.",
33
+ )
34
+ """Constructor
35
+ """
27
36
  self._base_path = "https://postgres-flex-service.api.eu01.stackit.cloud"
28
37
  """Default Base url
29
38
  """
@@ -65,6 +74,7 @@ class HostConfiguration:
65
74
  :param index: array index of the host settings
66
75
  :param variables: hash of variable and the corresponding value
67
76
  :param servers: an array of host settings or None
77
+ :error: if a region is given for a global url
68
78
  :return: URL based on host settings
69
79
  """
70
80
  if index is None:
@@ -83,8 +93,25 @@ class HostConfiguration:
83
93
 
84
94
  url = server["url"]
85
95
 
96
+ # check if environment variable was provided for region
97
+ # if nothing was set this is None
98
+ region_env = os.environ.get("STACKIT_REGION")
99
+
86
100
  # go through variables and replace placeholders
87
101
  for variable_name, variable in server.get("variables", {}).items():
102
+ # If a region is provided by the user for a global url
103
+ # return an error (except for providing via environment variable).
104
+ # The region is provided as a function argument instead of being set in the client configuration.
105
+ if (
106
+ variable_name == "region"
107
+ and (variable["default_value"] == "global" or variable["default_value"] == "")
108
+ and region_env is None
109
+ and variables.get(variable_name) is not None
110
+ ):
111
+ raise ValueError(
112
+ "this API does not support setting a region in the the client configuration, "
113
+ "please check if the region can be specified as a function parameter"
114
+ )
88
115
  used_value = variables.get(variable_name, variable["default_value"])
89
116
 
90
117
  if "enum_values" in variable and used_value not in variable["enum_values"]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stackit-postgresflex
3
- Version: 0.0.1a0
3
+ Version: 0.2.0
4
4
  Summary: STACKIT PostgreSQL Flex API
5
5
  Author: STACKIT Developer Tools
6
6
  Author-email: developer-tools@stackit.cloud
@@ -1,9 +1,9 @@
1
1
  stackit/postgresflex/__init__.py,sha256=sgC36333ZzQOgfDH0E8BBe7QJ-wHSQONOL7BaT0GTUc,5444
2
2
  stackit/postgresflex/api/__init__.py,sha256=o9Yn39BawyTTsTGsVzVPZ5-Or_0CKwHlAAAIUMqtxjc,107
3
- stackit/postgresflex/api/default_api.py,sha256=1RNSPZ4WhjYfZHsi6zjFgeP039k4WTuKXF0_JNGXLk0,315794
3
+ stackit/postgresflex/api/default_api.py,sha256=EN7ueK2Rbo2JLdwo07-s4W3SLHGiGk1YZOUNVVHT8K8,315746
4
4
  stackit/postgresflex/api_client.py,sha256=yLk2TUBNmwIRPrxPum8gYm73lpESfWtv2E49U9SLsbs,22747
5
5
  stackit/postgresflex/api_response.py,sha256=HRYkVqMNIlfODacTQPTbiVj2YdcnutpQrKJdeAoCSpM,642
6
- stackit/postgresflex/configuration.py,sha256=YM8y-TcMLohWXPbOZ7czW0e6Uk4-a-siPAz4RnH7ZfQ,3885
6
+ stackit/postgresflex/configuration.py,sha256=-5roiM-_HJShkc28rKOWgCNayWi8hNRHbfZkL6qQXHg,5251
7
7
  stackit/postgresflex/exceptions.py,sha256=yXv-AlWSGyOQN7weaYmyvtPp3phOCrg_hNLqXq_2hHg,5956
8
8
  stackit/postgresflex/models/__init__.py,sha256=euUErwGFnq4LTITJWeohEtsBpfzQQjbZtqZ2yjRbPi4,4968
9
9
  stackit/postgresflex/models/acl.py,sha256=hMTxIXKtTzmpkDvyjqgK3NCwUWpYdor8q-hlQzIXXeo,2403
@@ -62,6 +62,6 @@ stackit/postgresflex/models/user.py,sha256=vaG90-dxinO9Rz576O2OtlBiVFlSUxAq94Z0_
62
62
  stackit/postgresflex/models/user_response.py,sha256=5g-HMSP-Kh9hBM1Sf5LVl8irQRP6U5_lR0ZkDrHLZzM,2855
63
63
  stackit/postgresflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  stackit/postgresflex/rest.py,sha256=NxPlTct-__5AsE_wJCprOKr-PqevXft5Mo8EEbxR2ok,5841
65
- stackit_postgresflex-0.0.1a0.dist-info/METADATA,sha256=PfII6GvwGGlTOKDHid_ITAMv7DTHvQmsopZQwlChXOI,1622
66
- stackit_postgresflex-0.0.1a0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
67
- stackit_postgresflex-0.0.1a0.dist-info/RECORD,,
65
+ stackit_postgresflex-0.2.0.dist-info/METADATA,sha256=RK_Fc1a8JaODFjh60PWJrb2L333TIhn0UiDH7-632I8,1620
66
+ stackit_postgresflex-0.2.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
67
+ stackit_postgresflex-0.2.0.dist-info/RECORD,,