infrahub-server 1.2.6__py3-none-any.whl → 1.2.8__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.
Files changed (86) hide show
  1. infrahub/api/transformation.py +1 -0
  2. infrahub/artifacts/models.py +4 -0
  3. infrahub/cli/db.py +3 -1
  4. infrahub/cli/patch.py +153 -0
  5. infrahub/computed_attribute/models.py +81 -1
  6. infrahub/computed_attribute/tasks.py +35 -53
  7. infrahub/config.py +2 -1
  8. infrahub/constants/__init__.py +0 -0
  9. infrahub/core/constants/__init__.py +1 -0
  10. infrahub/core/graph/index.py +3 -1
  11. infrahub/core/manager.py +16 -5
  12. infrahub/core/migrations/graph/m014_remove_index_attr_value.py +7 -8
  13. infrahub/core/node/__init__.py +4 -1
  14. infrahub/core/protocols.py +1 -0
  15. infrahub/core/query/ipam.py +7 -5
  16. infrahub/core/query/node.py +96 -29
  17. infrahub/core/schema/definitions/core/builtin.py +2 -4
  18. infrahub/core/schema/definitions/core/transform.py +1 -0
  19. infrahub/core/validators/aggregated_checker.py +2 -2
  20. infrahub/core/validators/uniqueness/query.py +8 -3
  21. infrahub/database/__init__.py +2 -10
  22. infrahub/database/index.py +1 -1
  23. infrahub/database/memgraph.py +2 -1
  24. infrahub/database/neo4j.py +1 -1
  25. infrahub/git/integrator.py +27 -3
  26. infrahub/git/models.py +4 -0
  27. infrahub/git/tasks.py +3 -0
  28. infrahub/git_credential/helper.py +2 -2
  29. infrahub/message_bus/operations/requests/proposed_change.py +6 -0
  30. infrahub/message_bus/types.py +3 -0
  31. infrahub/patch/__init__.py +0 -0
  32. infrahub/patch/constants.py +13 -0
  33. infrahub/patch/edge_adder.py +64 -0
  34. infrahub/patch/edge_deleter.py +33 -0
  35. infrahub/patch/edge_updater.py +28 -0
  36. infrahub/patch/models.py +98 -0
  37. infrahub/patch/plan_reader.py +107 -0
  38. infrahub/patch/plan_writer.py +92 -0
  39. infrahub/patch/queries/__init__.py +0 -0
  40. infrahub/patch/queries/base.py +17 -0
  41. infrahub/patch/queries/consolidate_duplicated_nodes.py +109 -0
  42. infrahub/patch/queries/delete_duplicated_edges.py +138 -0
  43. infrahub/patch/runner.py +254 -0
  44. infrahub/patch/vertex_adder.py +61 -0
  45. infrahub/patch/vertex_deleter.py +33 -0
  46. infrahub/patch/vertex_updater.py +28 -0
  47. infrahub/proposed_change/tasks.py +1 -0
  48. infrahub/server.py +3 -1
  49. infrahub/transformations/models.py +3 -0
  50. infrahub/transformations/tasks.py +1 -0
  51. infrahub/webhook/models.py +3 -0
  52. infrahub_sdk/checks.py +1 -1
  53. infrahub_sdk/client.py +4 -4
  54. infrahub_sdk/config.py +17 -0
  55. infrahub_sdk/ctl/cli_commands.py +9 -3
  56. infrahub_sdk/ctl/generator.py +2 -2
  57. infrahub_sdk/ctl/menu.py +56 -13
  58. infrahub_sdk/ctl/object.py +55 -5
  59. infrahub_sdk/ctl/utils.py +22 -1
  60. infrahub_sdk/exceptions.py +19 -1
  61. infrahub_sdk/generator.py +12 -66
  62. infrahub_sdk/node.py +42 -26
  63. infrahub_sdk/operation.py +80 -0
  64. infrahub_sdk/protocols.py +12 -0
  65. infrahub_sdk/protocols_generator/__init__.py +0 -0
  66. infrahub_sdk/protocols_generator/constants.py +28 -0
  67. infrahub_sdk/{code_generator.py → protocols_generator/generator.py} +47 -34
  68. infrahub_sdk/protocols_generator/template.j2 +114 -0
  69. infrahub_sdk/recorder.py +3 -0
  70. infrahub_sdk/schema/__init__.py +110 -74
  71. infrahub_sdk/schema/main.py +36 -2
  72. infrahub_sdk/schema/repository.py +6 -0
  73. infrahub_sdk/spec/menu.py +3 -3
  74. infrahub_sdk/spec/object.py +522 -41
  75. infrahub_sdk/testing/docker.py +4 -5
  76. infrahub_sdk/testing/schemas/animal.py +7 -0
  77. infrahub_sdk/transforms.py +15 -27
  78. infrahub_sdk/yaml.py +63 -7
  79. {infrahub_server-1.2.6.dist-info → infrahub_server-1.2.8.dist-info}/METADATA +2 -2
  80. {infrahub_server-1.2.6.dist-info → infrahub_server-1.2.8.dist-info}/RECORD +85 -64
  81. infrahub_testcontainers/docker-compose.test.yml +2 -0
  82. infrahub_sdk/ctl/constants.py +0 -115
  83. /infrahub/{database/constants.py → constants/database.py} +0 -0
  84. {infrahub_server-1.2.6.dist-info → infrahub_server-1.2.8.dist-info}/LICENSE.txt +0 -0
  85. {infrahub_server-1.2.6.dist-info → infrahub_server-1.2.8.dist-info}/WHEEL +0 -0
  86. {infrahub_server-1.2.6.dist-info → infrahub_server-1.2.8.dist-info}/entry_points.txt +0 -0
@@ -1,115 +0,0 @@
1
- PROTOCOLS_TEMPLATE = """#
2
- # Generated by "infrahubctl protocols"
3
- #
4
-
5
- from __future__ import annotations
6
-
7
- from typing import TYPE_CHECKING, Optional
8
-
9
- from infrahub_sdk.protocols import CoreNode, {{ base_protocols | join(', ') }}
10
-
11
- if TYPE_CHECKING:
12
- {% if sync %}
13
- from infrahub_sdk.node import RelatedNodeSync, RelationshipManagerSync
14
- {% else %}
15
- from infrahub_sdk.node import RelatedNode, RelationshipManager
16
- {% endif %}
17
- from infrahub_sdk.protocols_base import (
18
- AnyAttribute,
19
- AnyAttributeOptional,
20
- String,
21
- StringOptional,
22
- Integer,
23
- IntegerOptional,
24
- Boolean,
25
- BooleanOptional,
26
- DateTime,
27
- DateTimeOptional,
28
- Dropdown,
29
- DropdownOptional,
30
- HashedPassword,
31
- HashedPasswordOptional,
32
- MacAddress,
33
- MacAddressOptional,
34
- IPHost,
35
- IPHostOptional,
36
- IPNetwork,
37
- IPNetworkOptional,
38
- JSONAttribute,
39
- JSONAttributeOptional,
40
- ListAttribute,
41
- ListAttributeOptional,
42
- URL,
43
- URLOptional,
44
- )
45
- {% for generic in generics %}
46
-
47
-
48
- class {{ generic.namespace + generic.name }}(CoreNode):
49
- {% if not generic.attributes|default([]) and not generic.relationships|default([]) %}
50
- pass
51
- {% endif %}
52
- {% for attribute in generic.attributes|default([]) %}
53
- {{ attribute | render_attribute }}
54
- {% endfor %}
55
- {% for relationship in generic.relationships|default([]) %}
56
- {{ relationship | render_relationship(sync) }}
57
- {% endfor %}
58
- {% if generic.hierarchical | default(false) %}
59
- {% if sync %}
60
- parent: RelatedNodeSync
61
- children: RelationshipManagerSync
62
- {% else %}
63
- parent: RelatedNode
64
- children: RelationshipManager
65
- {% endif %}
66
- {% endif %}
67
- {% endfor %}
68
- {% for node in nodes %}
69
-
70
-
71
- class {{ node.namespace + node.name }}({{ node.inherit_from | join(", ") or "CoreNode" }}):
72
- {% if not node.attributes|default([]) and not node.relationships|default([]) %}
73
- pass
74
- {% endif %}
75
- {% for attribute in node.attributes|default([]) %}
76
- {{ attribute | render_attribute }}
77
- {% endfor %}
78
- {% for relationship in node.relationships|default([]) %}
79
- {{ relationship | render_relationship(sync) }}
80
- {% endfor %}
81
- {% if node.hierarchical | default(false) %}
82
- {% if sync %}
83
- parent: RelatedNodeSync
84
- children: RelationshipManagerSync
85
- {% else %}
86
- parent: RelatedNode
87
- children: RelationshipManager
88
- {% endif %}
89
- {% endif %}
90
- {% endfor %}
91
- {% for node in profiles %}
92
-
93
-
94
- class {{ node.namespace + node.name }}({{ node.inherit_from | join(", ") or "CoreNode" }}):
95
- {% if not node.attributes|default([]) and not node.relationships|default([]) %}
96
- pass
97
- {% endif %}
98
- {% for attribute in node.attributes|default([]) %}
99
- {{ attribute | render_attribute }}
100
- {% endfor %}
101
- {% for relationship in node.relationships|default([]) %}
102
- {{ relationship | render_relationship(sync) }}
103
- {% endfor %}
104
- {% if node.hierarchical | default(false) %}
105
- {% if sync %}
106
- parent: RelatedNodeSync
107
- children: RelationshipManagerSync
108
- {% else %}
109
- parent: RelatedNode
110
- children: RelationshipManager
111
- {% endif %}
112
- {% endif %}
113
- {% endfor %}
114
-
115
- """