infrahub-server 1.1.1__py3-none-any.whl → 1.1.3__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/api/__init__.py +13 -5
- infrahub/api/artifact.py +9 -15
- infrahub/api/auth.py +7 -1
- infrahub/api/dependencies.py +15 -2
- infrahub/api/diff/diff.py +13 -7
- infrahub/api/file.py +5 -10
- infrahub/api/internal.py +19 -6
- infrahub/api/menu.py +8 -6
- infrahub/api/oauth2.py +25 -10
- infrahub/api/oidc.py +26 -10
- infrahub/api/query.py +2 -2
- infrahub/api/schema.py +48 -59
- infrahub/api/storage.py +8 -8
- infrahub/api/transformation.py +6 -5
- infrahub/auth.py +1 -26
- infrahub/cli/__init__.py +1 -1
- infrahub/cli/context.py +5 -8
- infrahub/cli/db.py +6 -6
- infrahub/cli/git_agent.py +1 -1
- infrahub/computed_attribute/models.py +1 -1
- infrahub/computed_attribute/tasks.py +1 -1
- infrahub/config.py +5 -5
- infrahub/core/account.py +2 -10
- infrahub/core/attribute.py +22 -0
- infrahub/core/branch/models.py +1 -1
- infrahub/core/branch/tasks.py +4 -3
- infrahub/core/diff/calculator.py +14 -0
- infrahub/core/diff/combiner.py +6 -2
- infrahub/core/diff/conflicts_enricher.py +2 -2
- infrahub/core/diff/coordinator.py +296 -87
- infrahub/core/diff/data_check_synchronizer.py +33 -4
- infrahub/core/diff/enricher/cardinality_one.py +3 -3
- infrahub/core/diff/enricher/hierarchy.py +4 -1
- infrahub/core/diff/merger/merger.py +11 -1
- infrahub/core/diff/merger/serializer.py +5 -29
- infrahub/core/diff/model/path.py +88 -4
- infrahub/core/diff/query/field_specifiers.py +35 -0
- infrahub/core/diff/query/roots_metadata.py +48 -0
- infrahub/core/diff/query/save.py +1 -0
- infrahub/core/diff/query_parser.py +27 -11
- infrahub/core/diff/repository/deserializer.py +7 -3
- infrahub/core/diff/repository/repository.py +100 -9
- infrahub/core/diff/tasks.py +1 -1
- infrahub/core/graph/__init__.py +1 -1
- infrahub/core/integrity/object_conflict/conflict_recorder.py +6 -1
- infrahub/core/ipam/utilization.py +6 -1
- infrahub/core/manager.py +8 -0
- infrahub/core/merge.py +6 -1
- infrahub/core/migrations/graph/__init__.py +2 -0
- infrahub/core/migrations/graph/m014_remove_index_attr_value.py +1 -1
- infrahub/core/migrations/graph/m015_diff_format_update.py +1 -1
- infrahub/core/migrations/graph/m016_diff_delete_bug_fix.py +1 -1
- infrahub/core/migrations/graph/m018_uniqueness_nulls.py +101 -0
- infrahub/core/migrations/query/attribute_add.py +5 -5
- infrahub/core/migrations/schema/tasks.py +2 -2
- infrahub/core/migrations/shared.py +3 -3
- infrahub/core/node/__init__.py +8 -2
- infrahub/core/node/constraints/grouped_uniqueness.py +9 -2
- infrahub/core/query/__init__.py +5 -2
- infrahub/core/query/diff.py +32 -19
- infrahub/core/query/ipam.py +30 -22
- infrahub/core/query/node.py +91 -40
- infrahub/core/schema/generated/attribute_schema.py +2 -2
- infrahub/core/schema/generated/base_node_schema.py +2 -2
- infrahub/core/schema/generated/relationship_schema.py +1 -1
- infrahub/core/schema/schema_branch_computed.py +1 -1
- infrahub/core/task/task_log.py +1 -1
- infrahub/core/validators/attribute/kind.py +1 -1
- infrahub/core/validators/interface.py +1 -2
- infrahub/core/validators/models/violation.py +1 -14
- infrahub/core/validators/shared.py +2 -2
- infrahub/core/validators/tasks.py +7 -4
- infrahub/core/validators/uniqueness/index.py +2 -4
- infrahub/database/index.py +1 -1
- infrahub/dependencies/builder/constraint/schema/aggregated.py +2 -0
- infrahub/dependencies/builder/constraint/schema/attribute_kind.py +8 -0
- infrahub/dependencies/builder/diff/data_check_synchronizer.py +2 -0
- infrahub/git/base.py +3 -3
- infrahub/git/integrator.py +1 -1
- infrahub/graphql/api/endpoints.py +12 -3
- infrahub/graphql/app.py +2 -2
- infrahub/graphql/auth/query_permission_checker/default_branch_checker.py +2 -17
- infrahub/graphql/auth/query_permission_checker/merge_operation_checker.py +1 -12
- infrahub/graphql/auth/query_permission_checker/object_permission_checker.py +6 -40
- infrahub/graphql/auth/query_permission_checker/super_admin_checker.py +5 -8
- infrahub/graphql/enums.py +2 -2
- infrahub/graphql/initialization.py +27 -8
- infrahub/graphql/manager.py +9 -3
- infrahub/graphql/models.py +6 -0
- infrahub/graphql/mutations/account.py +14 -10
- infrahub/graphql/mutations/computed_attribute.py +11 -22
- infrahub/graphql/mutations/diff.py +2 -0
- infrahub/graphql/mutations/main.py +5 -16
- infrahub/graphql/mutations/proposed_change.py +11 -20
- infrahub/graphql/mutations/resource_manager.py +6 -3
- infrahub/graphql/mutations/schema.py +8 -7
- infrahub/graphql/mutations/tasks.py +1 -1
- infrahub/graphql/permissions.py +3 -4
- infrahub/graphql/queries/account.py +2 -11
- infrahub/graphql/queries/resource_manager.py +21 -10
- infrahub/graphql/query.py +3 -1
- infrahub/graphql/resolvers/resolver.py +5 -1
- infrahub/graphql/types/task.py +14 -2
- infrahub/menu/generator.py +6 -18
- infrahub/message_bus/messages/event_node_mutated.py +2 -2
- infrahub/message_bus/operations/check/repository.py +2 -4
- infrahub/message_bus/operations/event/branch.py +2 -4
- infrahub/message_bus/operations/requests/proposed_change.py +1 -1
- infrahub/message_bus/operations/requests/repository.py +3 -5
- infrahub/message_bus/types.py +1 -1
- infrahub/permissions/__init__.py +12 -3
- infrahub/permissions/backend.py +2 -17
- infrahub/permissions/constants.py +12 -8
- infrahub/permissions/local_backend.py +5 -102
- infrahub/permissions/manager.py +135 -0
- infrahub/permissions/report.py +14 -25
- infrahub/permissions/types.py +6 -0
- infrahub/proposed_change/tasks.py +1 -1
- infrahub/task_manager/models.py +34 -5
- infrahub/task_manager/task.py +14 -6
- infrahub/visuals.py +1 -3
- infrahub_sdk/client.py +204 -43
- infrahub_sdk/ctl/cli_commands.py +106 -6
- infrahub_sdk/data.py +3 -2
- infrahub_sdk/graphql.py +5 -0
- infrahub_sdk/node.py +21 -2
- infrahub_sdk/queries.py +69 -0
- infrahub_sdk/schema/main.py +1 -0
- infrahub_sdk/testing/schemas/animal.py +1 -0
- infrahub_sdk/types.py +6 -0
- infrahub_sdk/utils.py +17 -0
- {infrahub_server-1.1.1.dist-info → infrahub_server-1.1.3.dist-info}/METADATA +1 -1
- {infrahub_server-1.1.1.dist-info → infrahub_server-1.1.3.dist-info}/RECORD +136 -131
- infrahub/core/diff/query/empty_roots.py +0 -33
- {infrahub_server-1.1.1.dist-info → infrahub_server-1.1.3.dist-info}/LICENSE.txt +0 -0
- {infrahub_server-1.1.1.dist-info → infrahub_server-1.1.3.dist-info}/WHEEL +0 -0
- {infrahub_server-1.1.1.dist-info → infrahub_server-1.1.3.dist-info}/entry_points.txt +0 -0
infrahub_sdk/node.py
CHANGED
|
@@ -23,6 +23,7 @@ if TYPE_CHECKING:
|
|
|
23
23
|
|
|
24
24
|
from .client import InfrahubClient, InfrahubClientSync
|
|
25
25
|
from .schema import AttributeSchemaAPI, MainSchemaTypesAPI, RelationshipSchemaAPI
|
|
26
|
+
from .types import Order
|
|
26
27
|
|
|
27
28
|
# pylint: disable=too-many-lines
|
|
28
29
|
|
|
@@ -977,6 +978,7 @@ class InfrahubNodeBase:
|
|
|
977
978
|
include: list[str] | None = None,
|
|
978
979
|
exclude: list[str] | None = None,
|
|
979
980
|
partial_match: bool = False,
|
|
981
|
+
order: Order | None = None,
|
|
980
982
|
) -> dict[str, Any | dict]:
|
|
981
983
|
data: dict[str, Any] = {
|
|
982
984
|
"count": None,
|
|
@@ -985,6 +987,9 @@ class InfrahubNodeBase:
|
|
|
985
987
|
|
|
986
988
|
data["@filters"] = filters or {}
|
|
987
989
|
|
|
990
|
+
if order:
|
|
991
|
+
data["@filters"]["order"] = order
|
|
992
|
+
|
|
988
993
|
if offset:
|
|
989
994
|
data["@filters"]["offset"] = offset
|
|
990
995
|
|
|
@@ -1176,9 +1181,16 @@ class InfrahubNode(InfrahubNodeBase):
|
|
|
1176
1181
|
prefetch_relationships: bool = False,
|
|
1177
1182
|
partial_match: bool = False,
|
|
1178
1183
|
property: bool = False,
|
|
1184
|
+
order: Order | None = None,
|
|
1179
1185
|
) -> dict[str, Any | dict]:
|
|
1180
1186
|
data = self.generate_query_data_init(
|
|
1181
|
-
filters=filters,
|
|
1187
|
+
filters=filters,
|
|
1188
|
+
offset=offset,
|
|
1189
|
+
limit=limit,
|
|
1190
|
+
include=include,
|
|
1191
|
+
exclude=exclude,
|
|
1192
|
+
partial_match=partial_match,
|
|
1193
|
+
order=order,
|
|
1182
1194
|
)
|
|
1183
1195
|
data["edges"]["node"].update(
|
|
1184
1196
|
await self.generate_query_data_node(
|
|
@@ -1682,9 +1694,16 @@ class InfrahubNodeSync(InfrahubNodeBase):
|
|
|
1682
1694
|
prefetch_relationships: bool = False,
|
|
1683
1695
|
partial_match: bool = False,
|
|
1684
1696
|
property: bool = False,
|
|
1697
|
+
order: Order | None = None,
|
|
1685
1698
|
) -> dict[str, Any | dict]:
|
|
1686
1699
|
data = self.generate_query_data_init(
|
|
1687
|
-
filters=filters,
|
|
1700
|
+
filters=filters,
|
|
1701
|
+
offset=offset,
|
|
1702
|
+
limit=limit,
|
|
1703
|
+
include=include,
|
|
1704
|
+
exclude=exclude,
|
|
1705
|
+
partial_match=partial_match,
|
|
1706
|
+
order=order,
|
|
1688
1707
|
)
|
|
1689
1708
|
data["edges"]["node"].update(
|
|
1690
1709
|
self.generate_query_data_node(
|
infrahub_sdk/queries.py
CHANGED
|
@@ -42,3 +42,72 @@ query {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
"""
|
|
45
|
+
|
|
46
|
+
QUERY_USER = """
|
|
47
|
+
query GET_PROFILE_DETAILS {
|
|
48
|
+
AccountProfile {
|
|
49
|
+
id
|
|
50
|
+
display_label
|
|
51
|
+
account_type {
|
|
52
|
+
value
|
|
53
|
+
__typename
|
|
54
|
+
updated_at
|
|
55
|
+
}
|
|
56
|
+
status {
|
|
57
|
+
label
|
|
58
|
+
value
|
|
59
|
+
updated_at
|
|
60
|
+
__typename
|
|
61
|
+
}
|
|
62
|
+
description {
|
|
63
|
+
value
|
|
64
|
+
updated_at
|
|
65
|
+
__typename
|
|
66
|
+
}
|
|
67
|
+
label {
|
|
68
|
+
value
|
|
69
|
+
updated_at
|
|
70
|
+
__typename
|
|
71
|
+
}
|
|
72
|
+
member_of_groups {
|
|
73
|
+
count
|
|
74
|
+
edges {
|
|
75
|
+
node {
|
|
76
|
+
display_label
|
|
77
|
+
group_type {
|
|
78
|
+
value
|
|
79
|
+
}
|
|
80
|
+
... on CoreAccountGroup {
|
|
81
|
+
id
|
|
82
|
+
roles {
|
|
83
|
+
count
|
|
84
|
+
edges {
|
|
85
|
+
node {
|
|
86
|
+
permissions {
|
|
87
|
+
count
|
|
88
|
+
edges {
|
|
89
|
+
node {
|
|
90
|
+
display_label
|
|
91
|
+
identifier {
|
|
92
|
+
value
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
display_label
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
__typename
|
|
106
|
+
name {
|
|
107
|
+
value
|
|
108
|
+
updated_at
|
|
109
|
+
__typename
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
"""
|
infrahub_sdk/schema/main.py
CHANGED
|
@@ -81,6 +81,7 @@ class SchemaAnimal:
|
|
|
81
81
|
include_in_menu=True,
|
|
82
82
|
inherit_from=[TESTING_ANIMAL],
|
|
83
83
|
display_labels=["name__value", "breed__value", "color__value"],
|
|
84
|
+
order_by=["name__value"],
|
|
84
85
|
attributes=[
|
|
85
86
|
Attr(name="breed", kind=AttributeKind.TEXT, optional=False),
|
|
86
87
|
Attr(name="color", kind=AttributeKind.COLOR, default_value="#555555", optional=True),
|
infrahub_sdk/types.py
CHANGED
|
@@ -4,6 +4,8 @@ import enum
|
|
|
4
4
|
from logging import Logger
|
|
5
5
|
from typing import TYPE_CHECKING, Any, Protocol, Union, runtime_checkable
|
|
6
6
|
|
|
7
|
+
from pydantic import BaseModel
|
|
8
|
+
|
|
7
9
|
if TYPE_CHECKING:
|
|
8
10
|
import httpx
|
|
9
11
|
|
|
@@ -64,3 +66,7 @@ class InfrahubLogger(Protocol):
|
|
|
64
66
|
|
|
65
67
|
|
|
66
68
|
InfrahubLoggers = Union[InfrahubLogger, Logger]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class Order(BaseModel):
|
|
72
|
+
disable: bool | None = None
|
infrahub_sdk/utils.py
CHANGED
|
@@ -335,3 +335,20 @@ def write_to_file(path: Path, value: Any) -> bool:
|
|
|
335
335
|
written = path.write_text(to_write)
|
|
336
336
|
|
|
337
337
|
return written is not None
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def get_user_permissions(data: list[dict]) -> dict:
|
|
341
|
+
groups = {}
|
|
342
|
+
for group in data:
|
|
343
|
+
group_name = group["node"]["display_label"]
|
|
344
|
+
permissions = []
|
|
345
|
+
|
|
346
|
+
roles = group["node"].get("roles", {}).get("edges", [])
|
|
347
|
+
for role in roles:
|
|
348
|
+
role_permissions = role["node"].get("permissions", {}).get("edges", [])
|
|
349
|
+
for permission in role_permissions:
|
|
350
|
+
permissions.append(permission["node"]["identifier"]["value"])
|
|
351
|
+
|
|
352
|
+
groups[group_name] = permissions
|
|
353
|
+
|
|
354
|
+
return groups
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: infrahub-server
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
4
4
|
Summary: Infrahub is taking a new approach to Infrastructure Management by providing a new generation of datastore to organize and control all the data that defines how an infrastructure should run.
|
|
5
5
|
Home-page: https://opsmill.com
|
|
6
6
|
License: AGPL-3.0-only
|