We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5acff9 commit 80cea97Copy full SHA for 80cea97
infrahub_sdk/groups.py
@@ -0,0 +1,28 @@
1
+from typing import List
2
+
3
+from infrahub_sdk import InfrahubClient
4
+from infrahub_sdk.node import InfrahubNode
5
6
7
+async def group_add_subscriber(
8
+ client: InfrahubClient, group: InfrahubNode, subscribers: List[str], branch: str
9
+) -> dict:
10
+ subscribers_str = ["{ id: " + f'"{subscriber}"' + " }" for subscriber in subscribers]
11
+ query = """
12
+ mutation {
13
+ RelationshipAdd(
14
+ data: {
15
+ id: "%s",
16
+ name: "subscribers",
17
+ nodes: [ %s ]
18
+ }
19
+ ) {
20
+ ok
21
22
23
+ """ % (
24
+ group.id,
25
+ ", ".join(subscribers_str),
26
+ )
27
28
+ return await client.execute_graphql(query=query, branch_name=branch, tracker="mutation-relationshipadd")
0 commit comments