qontract-reconcile 0.10.1rc752__py3-none-any.whl → 0.10.1rc754__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.
@@ -0,0 +1,70 @@
1
+ """
2
+ Generated by qenerate plugin=pydantic_v1. DO NOT MODIFY MANUALLY!
3
+ """
4
+ from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
5
+ from datetime import datetime # noqa: F401 # pylint: disable=W0611
6
+ from enum import Enum # noqa: F401 # pylint: disable=W0611
7
+ from typing import ( # noqa: F401 # pylint: disable=W0611
8
+ Any,
9
+ Optional,
10
+ Union,
11
+ )
12
+
13
+ from pydantic import ( # noqa: F401 # pylint: disable=W0611
14
+ BaseModel,
15
+ Extra,
16
+ Field,
17
+ Json,
18
+ )
19
+
20
+
21
+ DEFINITION = """
22
+ query ExternalResourcesSettings {
23
+ settings: external_resources_settings_v1 {
24
+ state_dynamodb_table
25
+ state_dynamodb_index
26
+ state_dynamodb_region
27
+ tf_state_bucket
28
+ tf_state_region
29
+ tf_state_dynamodb_table
30
+ }
31
+ }
32
+ """
33
+
34
+
35
+ class ConfiguredBaseModel(BaseModel):
36
+ class Config:
37
+ smart_union=True
38
+ extra=Extra.forbid
39
+
40
+
41
+ class ExternalResourcesSettingsV1(ConfiguredBaseModel):
42
+ state_dynamodb_table: str = Field(..., alias="state_dynamodb_table")
43
+ state_dynamodb_index: str = Field(..., alias="state_dynamodb_index")
44
+ state_dynamodb_region: str = Field(..., alias="state_dynamodb_region")
45
+ tf_state_bucket: Optional[str] = Field(..., alias="tf_state_bucket")
46
+ tf_state_region: Optional[str] = Field(..., alias="tf_state_region")
47
+ tf_state_dynamodb_table: Optional[str] = Field(..., alias="tf_state_dynamodb_table")
48
+
49
+
50
+ class ExternalResourcesSettingsQueryData(ConfiguredBaseModel):
51
+ settings: Optional[list[ExternalResourcesSettingsV1]] = Field(..., alias="settings")
52
+
53
+
54
+ def query(query_func: Callable, **kwargs: Any) -> ExternalResourcesSettingsQueryData:
55
+ """
56
+ This is a convenience function which queries and parses the data into
57
+ concrete types. It should be compatible with most GQL clients.
58
+ You do not have to use it to consume the generated data classes.
59
+ Alternatively, you can also mime and alternate the behavior
60
+ of this function in the caller.
61
+
62
+ Parameters:
63
+ query_func (Callable): Function which queries your GQL Server
64
+ kwargs: optional arguments that will be passed to the query function
65
+
66
+ Returns:
67
+ ExternalResourcesSettingsQueryData: queried data parsed into generated classes
68
+ """
69
+ raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
70
+ return ExternalResourcesSettingsQueryData(**raw_data)
@@ -0,0 +1,47 @@
1
+ from collections.abc import Callable
2
+ from typing import Optional
3
+
4
+ from reconcile.gql_definitions.external_resources.external_resources_modules import (
5
+ ExternalResourcesModuleV1,
6
+ )
7
+ from reconcile.gql_definitions.external_resources.external_resources_modules import (
8
+ query as query_modules,
9
+ )
10
+ from reconcile.gql_definitions.external_resources.external_resources_namespaces import (
11
+ NamespaceV1,
12
+ )
13
+ from reconcile.gql_definitions.external_resources.external_resources_namespaces import (
14
+ query as query_namespaces,
15
+ )
16
+ from reconcile.gql_definitions.external_resources.external_resources_settings import (
17
+ ExternalResourcesSettingsV1,
18
+ )
19
+ from reconcile.gql_definitions.external_resources.external_resources_settings import (
20
+ query as query_settings,
21
+ )
22
+ from reconcile.utils import gql
23
+
24
+
25
+ def get_namespaces(query_func: Optional[Callable] = None) -> list[NamespaceV1]:
26
+ if not query_func:
27
+ query_func = gql.get_api().query
28
+ data = query_namespaces(query_func=query_func)
29
+ return list(data.namespaces or [])
30
+
31
+
32
+ def get_settings(
33
+ query_func: Optional[Callable] = None,
34
+ ) -> list[ExternalResourcesSettingsV1]:
35
+ if not query_func:
36
+ query_func = gql.get_api().query
37
+ data = query_settings(query_func=query_func)
38
+ return list(data.settings or [])
39
+
40
+
41
+ def get_modules(
42
+ query_func: Optional[Callable] = None,
43
+ ) -> list[ExternalResourcesModuleV1]:
44
+ if not query_func:
45
+ query_func = gql.get_api().query
46
+ data = query_modules(query_func=query_func)
47
+ return list(data.modules or [])