infrahub-server 1.7.0__py3-none-any.whl → 1.7.0rc0__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.
- infrahub/core/migrations/schema/attribute_kind_update.py +4 -5
- infrahub/core/schema/attribute_parameters.py +1 -28
- infrahub/core/schema/attribute_schema.py +2 -9
- infrahub/core/validators/attribute/kind.py +2 -5
- infrahub/graphql/manager.py +2 -8
- infrahub/lock.py +0 -7
- infrahub/services/adapters/cache/redis.py +0 -7
- infrahub_sdk/analyzer.py +2 -2
- infrahub_sdk/branch.py +39 -12
- infrahub_sdk/checks.py +4 -4
- infrahub_sdk/client.py +0 -36
- infrahub_sdk/ctl/cli_commands.py +1 -2
- infrahub_sdk/ctl/graphql.py +4 -15
- infrahub_sdk/ctl/utils.py +2 -2
- infrahub_sdk/graphql/renderers.py +0 -21
- infrahub_sdk/graphql/utils.py +0 -85
- infrahub_sdk/node/attribute.py +2 -12
- infrahub_sdk/node/constants.py +0 -11
- infrahub_sdk/node/node.py +14 -65
- infrahub_sdk/node/property.py +0 -3
- infrahub_sdk/node/related_node.py +1 -24
- infrahub_sdk/node/relationship.py +1 -10
- infrahub_sdk/operation.py +2 -2
- infrahub_sdk/schema/repository.py +2 -1
- infrahub_sdk/transforms.py +2 -2
- infrahub_sdk/types.py +2 -18
- {infrahub_server-1.7.0.dist-info → infrahub_server-1.7.0rc0.dist-info}/METADATA +1 -1
- {infrahub_server-1.7.0.dist-info → infrahub_server-1.7.0rc0.dist-info}/RECORD +32 -34
- infrahub_testcontainers/performance_test.py +1 -1
- infrahub_sdk/enums.py +0 -6
- infrahub_sdk/node/metadata.py +0 -69
- {infrahub_server-1.7.0.dist-info → infrahub_server-1.7.0rc0.dist-info}/WHEEL +0 -0
- {infrahub_server-1.7.0.dist-info → infrahub_server-1.7.0rc0.dist-info}/entry_points.txt +0 -0
- {infrahub_server-1.7.0.dist-info → infrahub_server-1.7.0rc0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -40,7 +40,7 @@ class AttributeKindUpdateMigrationQuery(AttributeMigrationQuery):
|
|
|
40
40
|
// ------------
|
|
41
41
|
// start with all the Attribute vertices we might care about
|
|
42
42
|
// ------------
|
|
43
|
-
MATCH (n:%(
|
|
43
|
+
MATCH (n:%(schema_kind)s)-[:HAS_ATTRIBUTE]->(attr:Attribute)
|
|
44
44
|
WHERE attr.name = $attr_name
|
|
45
45
|
WITH DISTINCT n, attr
|
|
46
46
|
|
|
@@ -76,7 +76,7 @@ CALL (av_is_default, av_value) {
|
|
|
76
76
|
// ------------
|
|
77
77
|
WITH 1 AS one
|
|
78
78
|
LIMIT 1
|
|
79
|
-
MATCH (n:%(
|
|
79
|
+
MATCH (n:%(schema_kind)s)-[:HAS_ATTRIBUTE]->(attr:Attribute)
|
|
80
80
|
WHERE attr.name = $attr_name
|
|
81
81
|
WITH DISTINCT n, attr
|
|
82
82
|
|
|
@@ -94,6 +94,7 @@ CALL (n, attr) {
|
|
|
94
94
|
RETURN has_value_e, av
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
|
|
97
98
|
// ------------
|
|
98
99
|
// create and update the HAS_VALUE edges
|
|
99
100
|
// ------------
|
|
@@ -153,9 +154,7 @@ CALL (attr, n) {
|
|
|
153
154
|
SET n.updated_at = $at, n.updated_by = $user_id
|
|
154
155
|
}
|
|
155
156
|
""" % {
|
|
156
|
-
"
|
|
157
|
-
f"{self.migration.previous_schema.kind}|Profile{self.migration.previous_schema.kind}|Template{self.migration.previous_schema.kind}"
|
|
158
|
-
),
|
|
157
|
+
"schema_kind": self.migration.previous_schema.kind,
|
|
159
158
|
"branch_filter": branch_filter,
|
|
160
159
|
"new_attr_value_labels": new_attr_value_labels,
|
|
161
160
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import Self
|
|
5
5
|
|
|
6
6
|
from pydantic import ConfigDict, Field, model_validator
|
|
7
7
|
|
|
@@ -24,33 +24,6 @@ def get_attribute_parameters_class_for_kind(kind: str) -> type[AttributeParamete
|
|
|
24
24
|
class AttributeParameters(HashableModel):
|
|
25
25
|
model_config = ConfigDict(extra="forbid")
|
|
26
26
|
|
|
27
|
-
@classmethod
|
|
28
|
-
def convert_from(cls, source: AttributeParameters) -> Self:
|
|
29
|
-
"""Convert from another AttributeParameters subclass.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
source: The source AttributeParameters instance to convert from
|
|
33
|
-
|
|
34
|
-
Returns:
|
|
35
|
-
A new instance of the target class with compatible fields populated
|
|
36
|
-
"""
|
|
37
|
-
source_data = source.model_dump()
|
|
38
|
-
return cls.convert_from_dict(source_data=source_data)
|
|
39
|
-
|
|
40
|
-
@classmethod
|
|
41
|
-
def convert_from_dict(cls, source_data: dict[str, Any]) -> Self:
|
|
42
|
-
"""Convert from a dictionary to the target class.
|
|
43
|
-
|
|
44
|
-
Args:
|
|
45
|
-
source_data: The source dictionary to convert from
|
|
46
|
-
|
|
47
|
-
Returns:
|
|
48
|
-
A new instance of the target class with compatible fields populated
|
|
49
|
-
"""
|
|
50
|
-
target_fields = set(cls.model_fields.keys())
|
|
51
|
-
filtered_data = {k: v for k, v in source_data.items() if k in target_fields}
|
|
52
|
-
return cls(**filtered_data)
|
|
53
|
-
|
|
54
27
|
|
|
55
28
|
class TextAttributeParameters(AttributeParameters):
|
|
56
29
|
regex: str | None = Field(
|
|
@@ -114,20 +114,13 @@ class AttributeSchema(GeneratedAttributeSchema):
|
|
|
114
114
|
@field_validator("parameters", mode="before")
|
|
115
115
|
@classmethod
|
|
116
116
|
def set_parameters_type(cls, value: Any, info: ValidationInfo) -> Any:
|
|
117
|
-
"""Override parameters class if using base AttributeParameters class and should be using a subclass
|
|
118
|
-
|
|
119
|
-
This validator handles parameter type conversion when an attribute's kind changes.
|
|
120
|
-
Fields from the source that don't exist in the target are silently dropped.
|
|
121
|
-
Fields with the same name in both classes are preserved.
|
|
122
|
-
"""
|
|
117
|
+
"""Override parameters class if using base AttributeParameters class and should be using a subclass"""
|
|
123
118
|
kind = info.data["kind"]
|
|
124
119
|
expected_parameters_class = get_attribute_parameters_class_for_kind(kind=kind)
|
|
125
120
|
if value is None:
|
|
126
121
|
return expected_parameters_class()
|
|
127
122
|
if not isinstance(value, expected_parameters_class) and isinstance(value, AttributeParameters):
|
|
128
|
-
return expected_parameters_class.
|
|
129
|
-
if isinstance(value, dict):
|
|
130
|
-
return expected_parameters_class.convert_from_dict(source_data=value)
|
|
123
|
+
return expected_parameters_class(**value.model_dump())
|
|
131
124
|
return value
|
|
132
125
|
|
|
133
126
|
@model_validator(mode="after")
|
|
@@ -36,7 +36,7 @@ class AttributeKindUpdateValidatorQuery(AttributeSchemaValidatorQuery):
|
|
|
36
36
|
self.params["null_value"] = NULL_VALUE
|
|
37
37
|
|
|
38
38
|
query = """
|
|
39
|
-
MATCH (n:%(
|
|
39
|
+
MATCH p = (n:%(node_kind)s)
|
|
40
40
|
CALL (n) {
|
|
41
41
|
MATCH path = (root:Root)<-[rr:IS_PART_OF]-(n)-[ra:HAS_ATTRIBUTE]-(:Attribute { name: $attr_name } )-[rv:HAS_VALUE]-(av:AttributeValue)
|
|
42
42
|
WHERE all(
|
|
@@ -51,10 +51,7 @@ class AttributeKindUpdateValidatorQuery(AttributeSchemaValidatorQuery):
|
|
|
51
51
|
WHERE all(r in relationships(full_path) WHERE r.status = "active")
|
|
52
52
|
AND attribute_value IS NOT NULL
|
|
53
53
|
AND attribute_value <> $null_value
|
|
54
|
-
""" % {
|
|
55
|
-
"branch_filter": branch_filter,
|
|
56
|
-
"node_kinds": f"{self.node_schema.kind}|Profile{self.node_schema.kind}|Template{self.node_schema.kind}",
|
|
57
|
-
}
|
|
54
|
+
""" % {"branch_filter": branch_filter, "node_kind": self.node_schema.kind}
|
|
58
55
|
|
|
59
56
|
self.add_to_query(query)
|
|
60
57
|
self.return_labels = ["node.uuid", "attribute_value", "value_relationship.branch as value_branch"]
|
infrahub/graphql/manager.py
CHANGED
|
@@ -598,10 +598,7 @@ class GraphQLSchemaManager:
|
|
|
598
598
|
required=False,
|
|
599
599
|
description="Human friendly identifier",
|
|
600
600
|
),
|
|
601
|
-
"_updated_at": graphene.DateTime(
|
|
602
|
-
required=False,
|
|
603
|
-
deprecation_reason="Query the node_metadata field instead. Will be removed in Infrahub 1.9",
|
|
604
|
-
),
|
|
601
|
+
"_updated_at": graphene.DateTime(required=False),
|
|
605
602
|
"display_label": graphene.String(required=False),
|
|
606
603
|
"Meta": type("Meta", (object,), meta_attrs),
|
|
607
604
|
}
|
|
@@ -1212,10 +1209,7 @@ class GraphQLSchemaManager:
|
|
|
1212
1209
|
|
|
1213
1210
|
main_attrs: dict[str, Any] = {
|
|
1214
1211
|
"node": graphene.Field(base_interface, required=False),
|
|
1215
|
-
"_updated_at": graphene.DateTime(
|
|
1216
|
-
required=False,
|
|
1217
|
-
deprecation_reason="Query the node_metadata field instead. Will be removed in Infrahub 1.9",
|
|
1218
|
-
),
|
|
1212
|
+
"_updated_at": graphene.DateTime(required=False),
|
|
1219
1213
|
"node_metadata": graphene.Field(node_metadata, required=True),
|
|
1220
1214
|
"Meta": type("Meta", (object,), meta_attrs),
|
|
1221
1215
|
}
|
infrahub/lock.py
CHANGED
|
@@ -10,7 +10,6 @@ from typing import TYPE_CHECKING
|
|
|
10
10
|
|
|
11
11
|
import redis.asyncio as redis
|
|
12
12
|
from prometheus_client import Histogram
|
|
13
|
-
from redis import UsernamePasswordCredentialProvider
|
|
14
13
|
from redis.asyncio.lock import Lock as GlobalLock
|
|
15
14
|
|
|
16
15
|
from infrahub import config
|
|
@@ -276,16 +275,10 @@ class InfrahubLockRegistry:
|
|
|
276
275
|
) -> None:
|
|
277
276
|
if config.SETTINGS.cache.enable and not local_only:
|
|
278
277
|
if config.SETTINGS.cache.driver == config.CacheDriver.Redis:
|
|
279
|
-
credential_provider: UsernamePasswordCredentialProvider | None = None
|
|
280
|
-
if config.SETTINGS.cache.username and config.SETTINGS.cache.password:
|
|
281
|
-
credential_provider = UsernamePasswordCredentialProvider(
|
|
282
|
-
username=config.SETTINGS.cache.username, password=config.SETTINGS.cache.password
|
|
283
|
-
)
|
|
284
278
|
self.connection = redis.Redis(
|
|
285
279
|
host=config.SETTINGS.cache.address,
|
|
286
280
|
port=config.SETTINGS.cache.service_port,
|
|
287
281
|
db=config.SETTINGS.cache.database,
|
|
288
|
-
credential_provider=credential_provider,
|
|
289
282
|
ssl=config.SETTINGS.cache.tls_enabled,
|
|
290
283
|
ssl_cert_reqs="optional" if not config.SETTINGS.cache.tls_insecure else "none",
|
|
291
284
|
ssl_check_hostname=not config.SETTINGS.cache.tls_insecure,
|
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
5
|
import redis.asyncio as redis
|
|
6
|
-
from redis import UsernamePasswordCredentialProvider
|
|
7
6
|
|
|
8
7
|
from infrahub import config
|
|
9
8
|
from infrahub.services.adapters.cache import InfrahubCache
|
|
@@ -14,16 +13,10 @@ if TYPE_CHECKING:
|
|
|
14
13
|
|
|
15
14
|
class RedisCache(InfrahubCache):
|
|
16
15
|
def __init__(self) -> None:
|
|
17
|
-
credential_provider: UsernamePasswordCredentialProvider | None = None
|
|
18
|
-
if config.SETTINGS.cache.username and config.SETTINGS.cache.password:
|
|
19
|
-
credential_provider = UsernamePasswordCredentialProvider(
|
|
20
|
-
username=config.SETTINGS.cache.username, password=config.SETTINGS.cache.password
|
|
21
|
-
)
|
|
22
16
|
self.connection = redis.Redis(
|
|
23
17
|
host=config.SETTINGS.cache.address,
|
|
24
18
|
port=config.SETTINGS.cache.service_port,
|
|
25
19
|
db=config.SETTINGS.cache.database,
|
|
26
|
-
credential_provider=credential_provider,
|
|
27
20
|
ssl=config.SETTINGS.cache.tls_enabled,
|
|
28
21
|
ssl_cert_reqs="optional" if not config.SETTINGS.cache.tls_insecure else "none",
|
|
29
22
|
ssl_check_hostname=not config.SETTINGS.cache.tls_insecure,
|
infrahub_sdk/analyzer.py
CHANGED
|
@@ -30,10 +30,10 @@ class GraphQLOperation(BaseModel):
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class GraphQLQueryAnalyzer:
|
|
33
|
-
def __init__(self, query: str, schema: GraphQLSchema | None = None
|
|
33
|
+
def __init__(self, query: str, schema: GraphQLSchema | None = None) -> None:
|
|
34
34
|
self.query: str = query
|
|
35
35
|
self.schema: GraphQLSchema | None = schema
|
|
36
|
-
self.document: DocumentNode =
|
|
36
|
+
self.document: DocumentNode = parse(self.query)
|
|
37
37
|
self._fields: dict | None = None
|
|
38
38
|
|
|
39
39
|
@property
|
infrahub_sdk/branch.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import warnings
|
|
3
4
|
from enum import Enum
|
|
4
5
|
from typing import TYPE_CHECKING, Any, Literal, overload
|
|
5
6
|
from urllib.parse import urlencode
|
|
@@ -92,6 +93,7 @@ class InfrahubBranchManager(InfraHubBranchManagerBase):
|
|
|
92
93
|
sync_with_git: bool = True,
|
|
93
94
|
description: str = "",
|
|
94
95
|
wait_until_completion: Literal[True] = True,
|
|
96
|
+
background_execution: bool | None = False,
|
|
95
97
|
) -> BranchData: ...
|
|
96
98
|
|
|
97
99
|
@overload
|
|
@@ -101,6 +103,7 @@ class InfrahubBranchManager(InfraHubBranchManagerBase):
|
|
|
101
103
|
sync_with_git: bool = True,
|
|
102
104
|
description: str = "",
|
|
103
105
|
wait_until_completion: Literal[False] = False,
|
|
106
|
+
background_execution: bool | None = False,
|
|
104
107
|
) -> str: ...
|
|
105
108
|
|
|
106
109
|
async def create(
|
|
@@ -109,9 +112,19 @@ class InfrahubBranchManager(InfraHubBranchManagerBase):
|
|
|
109
112
|
sync_with_git: bool = True,
|
|
110
113
|
description: str = "",
|
|
111
114
|
wait_until_completion: bool = True,
|
|
115
|
+
background_execution: bool | None = False,
|
|
112
116
|
) -> BranchData | str:
|
|
117
|
+
if background_execution is not None:
|
|
118
|
+
warnings.warn(
|
|
119
|
+
"`background_execution` is deprecated, please use `wait_until_completion` instead.",
|
|
120
|
+
DeprecationWarning,
|
|
121
|
+
stacklevel=1,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
background_execution = background_execution or not wait_until_completion
|
|
113
125
|
input_data = {
|
|
114
|
-
|
|
126
|
+
# Should be switched to `wait_until_completion` once `background_execution` is removed server side.
|
|
127
|
+
"background_execution": background_execution,
|
|
115
128
|
"data": {
|
|
116
129
|
"name": branch_name,
|
|
117
130
|
"description": description,
|
|
@@ -119,14 +132,15 @@ class InfrahubBranchManager(InfraHubBranchManagerBase):
|
|
|
119
132
|
},
|
|
120
133
|
}
|
|
121
134
|
|
|
122
|
-
mutation_query =
|
|
135
|
+
mutation_query = MUTATION_QUERY_TASK if background_execution else MUTATION_QUERY_DATA
|
|
123
136
|
query = Mutation(mutation="BranchCreate", input_data=input_data, query=mutation_query)
|
|
124
137
|
response = await self.client.execute_graphql(query=query.render(), tracker="mutation-branch-create")
|
|
125
138
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
# Make sure server version is recent enough to support background execution, as previously
|
|
140
|
+
# using background_execution=True had no effect.
|
|
141
|
+
if background_execution and "task" in response["BranchCreate"]:
|
|
142
|
+
return response["BranchCreate"]["task"]["id"]
|
|
143
|
+
return BranchData(**response["BranchCreate"]["object"])
|
|
130
144
|
|
|
131
145
|
async def delete(self, branch_name: str) -> bool:
|
|
132
146
|
input_data = {
|
|
@@ -247,6 +261,7 @@ class InfrahubBranchManagerSync(InfraHubBranchManagerBase):
|
|
|
247
261
|
sync_with_git: bool = True,
|
|
248
262
|
description: str = "",
|
|
249
263
|
wait_until_completion: Literal[True] = True,
|
|
264
|
+
background_execution: bool | None = False,
|
|
250
265
|
) -> BranchData: ...
|
|
251
266
|
|
|
252
267
|
@overload
|
|
@@ -256,6 +271,7 @@ class InfrahubBranchManagerSync(InfraHubBranchManagerBase):
|
|
|
256
271
|
sync_with_git: bool = True,
|
|
257
272
|
description: str = "",
|
|
258
273
|
wait_until_completion: Literal[False] = False,
|
|
274
|
+
background_execution: bool | None = False,
|
|
259
275
|
) -> str: ...
|
|
260
276
|
|
|
261
277
|
def create(
|
|
@@ -264,9 +280,19 @@ class InfrahubBranchManagerSync(InfraHubBranchManagerBase):
|
|
|
264
280
|
sync_with_git: bool = True,
|
|
265
281
|
description: str = "",
|
|
266
282
|
wait_until_completion: bool = True,
|
|
283
|
+
background_execution: bool | None = False,
|
|
267
284
|
) -> BranchData | str:
|
|
285
|
+
if background_execution is not None:
|
|
286
|
+
warnings.warn(
|
|
287
|
+
"`background_execution` is deprecated, please use `wait_until_completion` instead.",
|
|
288
|
+
DeprecationWarning,
|
|
289
|
+
stacklevel=1,
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
background_execution = background_execution or not wait_until_completion
|
|
268
293
|
input_data = {
|
|
269
|
-
|
|
294
|
+
# Should be switched to `wait_until_completion` once `background_execution` is removed server side.
|
|
295
|
+
"background_execution": background_execution,
|
|
270
296
|
"data": {
|
|
271
297
|
"name": branch_name,
|
|
272
298
|
"description": description,
|
|
@@ -274,14 +300,15 @@ class InfrahubBranchManagerSync(InfraHubBranchManagerBase):
|
|
|
274
300
|
},
|
|
275
301
|
}
|
|
276
302
|
|
|
277
|
-
mutation_query =
|
|
303
|
+
mutation_query = MUTATION_QUERY_TASK if background_execution else MUTATION_QUERY_DATA
|
|
278
304
|
query = Mutation(mutation="BranchCreate", input_data=input_data, query=mutation_query)
|
|
279
305
|
response = self.client.execute_graphql(query=query.render(), tracker="mutation-branch-create")
|
|
280
306
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
307
|
+
# Make sure server version is recent enough to support background execution, as previously
|
|
308
|
+
# using background_execution=True had no effect.
|
|
309
|
+
if background_execution and "task" in response["BranchCreate"]:
|
|
310
|
+
return response["BranchCreate"]["task"]["id"]
|
|
311
|
+
return BranchData(**response["BranchCreate"]["object"])
|
|
285
312
|
|
|
286
313
|
def delete(self, branch_name: str) -> bool:
|
|
287
314
|
input_data = {
|
infrahub_sdk/checks.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
3
4
|
import importlib
|
|
4
|
-
import
|
|
5
|
-
import pathlib
|
|
5
|
+
import os
|
|
6
6
|
import warnings
|
|
7
7
|
from abc import abstractmethod
|
|
8
8
|
from typing import TYPE_CHECKING, Any
|
|
@@ -55,7 +55,7 @@ class InfrahubCheck:
|
|
|
55
55
|
self.branch = branch
|
|
56
56
|
self.params = params or {}
|
|
57
57
|
|
|
58
|
-
self.root_directory = root_directory or
|
|
58
|
+
self.root_directory = root_directory or os.getcwd()
|
|
59
59
|
|
|
60
60
|
self._client = client
|
|
61
61
|
|
|
@@ -160,7 +160,7 @@ class InfrahubCheck:
|
|
|
160
160
|
data = await self.collect_data()
|
|
161
161
|
unpacked = data.get("data") or data
|
|
162
162
|
|
|
163
|
-
if
|
|
163
|
+
if asyncio.iscoroutinefunction(self.validate):
|
|
164
164
|
await self.validate(data=unpacked)
|
|
165
165
|
else:
|
|
166
166
|
self.validate(data=unpacked)
|
infrahub_sdk/client.py
CHANGED
|
@@ -401,7 +401,6 @@ class InfrahubClient(BaseClient):
|
|
|
401
401
|
fragment: bool = ...,
|
|
402
402
|
prefetch_relationships: bool = ...,
|
|
403
403
|
property: bool = ...,
|
|
404
|
-
include_metadata: bool = ...,
|
|
405
404
|
**kwargs: Any,
|
|
406
405
|
) -> SchemaType | None: ...
|
|
407
406
|
|
|
@@ -421,7 +420,6 @@ class InfrahubClient(BaseClient):
|
|
|
421
420
|
fragment: bool = ...,
|
|
422
421
|
prefetch_relationships: bool = ...,
|
|
423
422
|
property: bool = ...,
|
|
424
|
-
include_metadata: bool = ...,
|
|
425
423
|
**kwargs: Any,
|
|
426
424
|
) -> SchemaType: ...
|
|
427
425
|
|
|
@@ -441,7 +439,6 @@ class InfrahubClient(BaseClient):
|
|
|
441
439
|
fragment: bool = ...,
|
|
442
440
|
prefetch_relationships: bool = ...,
|
|
443
441
|
property: bool = ...,
|
|
444
|
-
include_metadata: bool = ...,
|
|
445
442
|
**kwargs: Any,
|
|
446
443
|
) -> SchemaType: ...
|
|
447
444
|
|
|
@@ -461,7 +458,6 @@ class InfrahubClient(BaseClient):
|
|
|
461
458
|
fragment: bool = ...,
|
|
462
459
|
prefetch_relationships: bool = ...,
|
|
463
460
|
property: bool = ...,
|
|
464
|
-
include_metadata: bool = ...,
|
|
465
461
|
**kwargs: Any,
|
|
466
462
|
) -> InfrahubNode | None: ...
|
|
467
463
|
|
|
@@ -481,7 +477,6 @@ class InfrahubClient(BaseClient):
|
|
|
481
477
|
fragment: bool = ...,
|
|
482
478
|
prefetch_relationships: bool = ...,
|
|
483
479
|
property: bool = ...,
|
|
484
|
-
include_metadata: bool = ...,
|
|
485
480
|
**kwargs: Any,
|
|
486
481
|
) -> InfrahubNode: ...
|
|
487
482
|
|
|
@@ -501,7 +496,6 @@ class InfrahubClient(BaseClient):
|
|
|
501
496
|
fragment: bool = ...,
|
|
502
497
|
prefetch_relationships: bool = ...,
|
|
503
498
|
property: bool = ...,
|
|
504
|
-
include_metadata: bool = ...,
|
|
505
499
|
**kwargs: Any,
|
|
506
500
|
) -> InfrahubNode: ...
|
|
507
501
|
|
|
@@ -520,7 +514,6 @@ class InfrahubClient(BaseClient):
|
|
|
520
514
|
fragment: bool = False,
|
|
521
515
|
prefetch_relationships: bool = False,
|
|
522
516
|
property: bool = False,
|
|
523
|
-
include_metadata: bool = False,
|
|
524
517
|
**kwargs: Any,
|
|
525
518
|
) -> InfrahubNode | SchemaType | None:
|
|
526
519
|
branch = branch or self.default_branch
|
|
@@ -554,7 +547,6 @@ class InfrahubClient(BaseClient):
|
|
|
554
547
|
fragment=fragment,
|
|
555
548
|
prefetch_relationships=prefetch_relationships,
|
|
556
549
|
property=property,
|
|
557
|
-
include_metadata=include_metadata,
|
|
558
550
|
**filters,
|
|
559
551
|
)
|
|
560
552
|
|
|
@@ -658,7 +650,6 @@ class InfrahubClient(BaseClient):
|
|
|
658
650
|
property: bool = ...,
|
|
659
651
|
parallel: bool = ...,
|
|
660
652
|
order: Order | None = ...,
|
|
661
|
-
include_metadata: bool = ...,
|
|
662
653
|
) -> list[SchemaType]: ...
|
|
663
654
|
|
|
664
655
|
@overload
|
|
@@ -678,7 +669,6 @@ class InfrahubClient(BaseClient):
|
|
|
678
669
|
property: bool = ...,
|
|
679
670
|
parallel: bool = ...,
|
|
680
671
|
order: Order | None = ...,
|
|
681
|
-
include_metadata: bool = ...,
|
|
682
672
|
) -> list[InfrahubNode]: ...
|
|
683
673
|
|
|
684
674
|
async def all(
|
|
@@ -697,7 +687,6 @@ class InfrahubClient(BaseClient):
|
|
|
697
687
|
property: bool = False,
|
|
698
688
|
parallel: bool = False,
|
|
699
689
|
order: Order | None = None,
|
|
700
|
-
include_metadata: bool = False,
|
|
701
690
|
) -> list[InfrahubNode] | list[SchemaType]:
|
|
702
691
|
"""Retrieve all nodes of a given kind
|
|
703
692
|
|
|
@@ -715,7 +704,6 @@ class InfrahubClient(BaseClient):
|
|
|
715
704
|
prefetch_relationships (bool, optional): Flag to indicate whether to prefetch related node data.
|
|
716
705
|
parallel (bool, optional): Whether to use parallel processing for the query.
|
|
717
706
|
order (Order, optional): Ordering related options. Setting `disable=True` enhances performances.
|
|
718
|
-
include_metadata (bool, optional): If True, includes node_metadata and relationship_metadata in the query.
|
|
719
707
|
|
|
720
708
|
Returns:
|
|
721
709
|
list[InfrahubNode]: List of Nodes
|
|
@@ -735,7 +723,6 @@ class InfrahubClient(BaseClient):
|
|
|
735
723
|
property=property,
|
|
736
724
|
parallel=parallel,
|
|
737
725
|
order=order,
|
|
738
|
-
include_metadata=include_metadata,
|
|
739
726
|
)
|
|
740
727
|
|
|
741
728
|
@overload
|
|
@@ -756,7 +743,6 @@ class InfrahubClient(BaseClient):
|
|
|
756
743
|
property: bool = ...,
|
|
757
744
|
parallel: bool = ...,
|
|
758
745
|
order: Order | None = ...,
|
|
759
|
-
include_metadata: bool = ...,
|
|
760
746
|
**kwargs: Any,
|
|
761
747
|
) -> list[SchemaType]: ...
|
|
762
748
|
|
|
@@ -778,7 +764,6 @@ class InfrahubClient(BaseClient):
|
|
|
778
764
|
property: bool = ...,
|
|
779
765
|
parallel: bool = ...,
|
|
780
766
|
order: Order | None = ...,
|
|
781
|
-
include_metadata: bool = ...,
|
|
782
767
|
**kwargs: Any,
|
|
783
768
|
) -> list[InfrahubNode]: ...
|
|
784
769
|
|
|
@@ -799,7 +784,6 @@ class InfrahubClient(BaseClient):
|
|
|
799
784
|
property: bool = False,
|
|
800
785
|
parallel: bool = False,
|
|
801
786
|
order: Order | None = None,
|
|
802
|
-
include_metadata: bool = False,
|
|
803
787
|
**kwargs: Any,
|
|
804
788
|
) -> list[InfrahubNode] | list[SchemaType]:
|
|
805
789
|
"""Retrieve nodes of a given kind based on provided filters.
|
|
@@ -819,7 +803,6 @@ class InfrahubClient(BaseClient):
|
|
|
819
803
|
partial_match (bool, optional): Allow partial match of filter criteria for the query.
|
|
820
804
|
parallel (bool, optional): Whether to use parallel processing for the query.
|
|
821
805
|
order (Order, optional): Ordering related options. Setting `disable=True` enhances performances.
|
|
822
|
-
include_metadata (bool, optional): If True, includes node_metadata and relationship_metadata in the query.
|
|
823
806
|
**kwargs (Any): Additional filter criteria for the query.
|
|
824
807
|
|
|
825
808
|
Returns:
|
|
@@ -846,7 +829,6 @@ class InfrahubClient(BaseClient):
|
|
|
846
829
|
partial_match=partial_match,
|
|
847
830
|
property=property,
|
|
848
831
|
order=order,
|
|
849
|
-
include_metadata=include_metadata,
|
|
850
832
|
)
|
|
851
833
|
query = Query(query=query_data)
|
|
852
834
|
response = await self.execute_graphql(
|
|
@@ -1975,7 +1957,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
1975
1957
|
property: bool = ...,
|
|
1976
1958
|
parallel: bool = ...,
|
|
1977
1959
|
order: Order | None = ...,
|
|
1978
|
-
include_metadata: bool = ...,
|
|
1979
1960
|
) -> list[SchemaTypeSync]: ...
|
|
1980
1961
|
|
|
1981
1962
|
@overload
|
|
@@ -1995,7 +1976,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
1995
1976
|
property: bool = ...,
|
|
1996
1977
|
parallel: bool = ...,
|
|
1997
1978
|
order: Order | None = ...,
|
|
1998
|
-
include_metadata: bool = ...,
|
|
1999
1979
|
) -> list[InfrahubNodeSync]: ...
|
|
2000
1980
|
|
|
2001
1981
|
def all(
|
|
@@ -2014,7 +1994,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2014
1994
|
property: bool = False,
|
|
2015
1995
|
parallel: bool = False,
|
|
2016
1996
|
order: Order | None = None,
|
|
2017
|
-
include_metadata: bool = False,
|
|
2018
1997
|
) -> list[InfrahubNodeSync] | list[SchemaTypeSync]:
|
|
2019
1998
|
"""Retrieve all nodes of a given kind
|
|
2020
1999
|
|
|
@@ -2032,7 +2011,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2032
2011
|
prefetch_relationships (bool, optional): Flag to indicate whether to prefetch related node data.
|
|
2033
2012
|
parallel (bool, optional): Whether to use parallel processing for the query.
|
|
2034
2013
|
order (Order, optional): Ordering related options. Setting `disable=True` enhances performances.
|
|
2035
|
-
include_metadata (bool, optional): If True, includes node_metadata and relationship_metadata in the query.
|
|
2036
2014
|
|
|
2037
2015
|
Returns:
|
|
2038
2016
|
list[InfrahubNodeSync]: List of Nodes
|
|
@@ -2052,7 +2030,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2052
2030
|
property=property,
|
|
2053
2031
|
parallel=parallel,
|
|
2054
2032
|
order=order,
|
|
2055
|
-
include_metadata=include_metadata,
|
|
2056
2033
|
)
|
|
2057
2034
|
|
|
2058
2035
|
def _process_nodes_and_relationships(
|
|
@@ -2114,7 +2091,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2114
2091
|
property: bool = ...,
|
|
2115
2092
|
parallel: bool = ...,
|
|
2116
2093
|
order: Order | None = ...,
|
|
2117
|
-
include_metadata: bool = ...,
|
|
2118
2094
|
**kwargs: Any,
|
|
2119
2095
|
) -> list[SchemaTypeSync]: ...
|
|
2120
2096
|
|
|
@@ -2136,7 +2112,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2136
2112
|
property: bool = ...,
|
|
2137
2113
|
parallel: bool = ...,
|
|
2138
2114
|
order: Order | None = ...,
|
|
2139
|
-
include_metadata: bool = ...,
|
|
2140
2115
|
**kwargs: Any,
|
|
2141
2116
|
) -> list[InfrahubNodeSync]: ...
|
|
2142
2117
|
|
|
@@ -2157,7 +2132,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2157
2132
|
property: bool = False,
|
|
2158
2133
|
parallel: bool = False,
|
|
2159
2134
|
order: Order | None = None,
|
|
2160
|
-
include_metadata: bool = False,
|
|
2161
2135
|
**kwargs: Any,
|
|
2162
2136
|
) -> list[InfrahubNodeSync] | list[SchemaTypeSync]:
|
|
2163
2137
|
"""Retrieve nodes of a given kind based on provided filters.
|
|
@@ -2177,7 +2151,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2177
2151
|
partial_match (bool, optional): Allow partial match of filter criteria for the query.
|
|
2178
2152
|
parallel (bool, optional): Whether to use parallel processing for the query.
|
|
2179
2153
|
order (Order, optional): Ordering related options. Setting `disable=True` enhances performances.
|
|
2180
|
-
include_metadata (bool, optional): If True, includes node_metadata and relationship_metadata in the query.
|
|
2181
2154
|
**kwargs (Any): Additional filter criteria for the query.
|
|
2182
2155
|
|
|
2183
2156
|
Returns:
|
|
@@ -2204,7 +2177,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2204
2177
|
partial_match=partial_match,
|
|
2205
2178
|
property=property,
|
|
2206
2179
|
order=order,
|
|
2207
|
-
include_metadata=include_metadata,
|
|
2208
2180
|
)
|
|
2209
2181
|
query = Query(query=query_data)
|
|
2210
2182
|
response = self.execute_graphql(
|
|
@@ -2294,7 +2266,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2294
2266
|
fragment: bool = ...,
|
|
2295
2267
|
prefetch_relationships: bool = ...,
|
|
2296
2268
|
property: bool = ...,
|
|
2297
|
-
include_metadata: bool = ...,
|
|
2298
2269
|
**kwargs: Any,
|
|
2299
2270
|
) -> SchemaTypeSync | None: ...
|
|
2300
2271
|
|
|
@@ -2314,7 +2285,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2314
2285
|
fragment: bool = ...,
|
|
2315
2286
|
prefetch_relationships: bool = ...,
|
|
2316
2287
|
property: bool = ...,
|
|
2317
|
-
include_metadata: bool = ...,
|
|
2318
2288
|
**kwargs: Any,
|
|
2319
2289
|
) -> SchemaTypeSync: ...
|
|
2320
2290
|
|
|
@@ -2334,7 +2304,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2334
2304
|
fragment: bool = ...,
|
|
2335
2305
|
prefetch_relationships: bool = ...,
|
|
2336
2306
|
property: bool = ...,
|
|
2337
|
-
include_metadata: bool = ...,
|
|
2338
2307
|
**kwargs: Any,
|
|
2339
2308
|
) -> SchemaTypeSync: ...
|
|
2340
2309
|
|
|
@@ -2354,7 +2323,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2354
2323
|
fragment: bool = ...,
|
|
2355
2324
|
prefetch_relationships: bool = ...,
|
|
2356
2325
|
property: bool = ...,
|
|
2357
|
-
include_metadata: bool = ...,
|
|
2358
2326
|
**kwargs: Any,
|
|
2359
2327
|
) -> InfrahubNodeSync | None: ...
|
|
2360
2328
|
|
|
@@ -2374,7 +2342,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2374
2342
|
fragment: bool = ...,
|
|
2375
2343
|
prefetch_relationships: bool = ...,
|
|
2376
2344
|
property: bool = ...,
|
|
2377
|
-
include_metadata: bool = ...,
|
|
2378
2345
|
**kwargs: Any,
|
|
2379
2346
|
) -> InfrahubNodeSync: ...
|
|
2380
2347
|
|
|
@@ -2394,7 +2361,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2394
2361
|
fragment: bool = ...,
|
|
2395
2362
|
prefetch_relationships: bool = ...,
|
|
2396
2363
|
property: bool = ...,
|
|
2397
|
-
include_metadata: bool = ...,
|
|
2398
2364
|
**kwargs: Any,
|
|
2399
2365
|
) -> InfrahubNodeSync: ...
|
|
2400
2366
|
|
|
@@ -2413,7 +2379,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2413
2379
|
fragment: bool = False,
|
|
2414
2380
|
prefetch_relationships: bool = False,
|
|
2415
2381
|
property: bool = False,
|
|
2416
|
-
include_metadata: bool = False,
|
|
2417
2382
|
**kwargs: Any,
|
|
2418
2383
|
) -> InfrahubNodeSync | SchemaTypeSync | None:
|
|
2419
2384
|
branch = branch or self.default_branch
|
|
@@ -2447,7 +2412,6 @@ class InfrahubClientSync(BaseClient):
|
|
|
2447
2412
|
fragment=fragment,
|
|
2448
2413
|
prefetch_relationships=prefetch_relationships,
|
|
2449
2414
|
property=property,
|
|
2450
|
-
include_metadata=include_metadata,
|
|
2451
2415
|
**filters,
|
|
2452
2416
|
)
|
|
2453
2417
|
|
infrahub_sdk/ctl/cli_commands.py
CHANGED
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import functools
|
|
5
5
|
import importlib
|
|
6
|
-
import inspect
|
|
7
6
|
import logging
|
|
8
7
|
import platform
|
|
9
8
|
import sys
|
|
@@ -241,7 +240,7 @@ async def _run_transform(
|
|
|
241
240
|
console.print("[yellow] you can specify a different branch with --branch")
|
|
242
241
|
raise typer.Abort()
|
|
243
242
|
|
|
244
|
-
if
|
|
243
|
+
if asyncio.iscoroutinefunction(transform_func):
|
|
245
244
|
output = await transform_func(response)
|
|
246
245
|
else:
|
|
247
246
|
output = transform_func(response)
|