Skip to content

Commit 8613e8d

Browse files
committed
docs(gooddata-pipelines): public documentation
1 parent be7d8d5 commit 8613e8d

File tree

8 files changed

+945
-0
lines changed

8 files changed

+945
-0
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ The project documentation is done in hugo. To contribute:
6060

6161
2. Run `make new-docs`
6262

63+
3. Open [http://localhost:1313/latest/](http://localhost:1313/latest/) in your browser to see the preview.
64+
6365
The documentation is deployed using manually triggered GitHub workflows.
6466

6567
One logical change is done in one commit.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: "Pipelines Overview"
3+
linkTitle: "Pipelines Overview"
4+
weight: 14
5+
---
6+
7+
GoodData Pipelines contains tools for automating GoodData lifecycle management. Built on top of [GoodData Python SDK](https://www.gooddata.com/docs/python-sdk/latest/), it enables you to programmatically provision and manage workspaces, users, user groups, and their permissions.
8+
9+
For further information, refer to the PIPELINES section in the left navigation menu.
10+
11+
## Installation
12+
13+
Run the following command to install the ``gooddata-pipelines`` package on your system:
14+
15+
```bash
16+
pip install gooddata-pipelines
17+
```
18+
19+
### Requirements
20+
21+
- Python 3.10 or newer
22+
- GoodData.CN or GoodData Cloud
23+
24+
## Examples
25+
26+
Here is an introductory example of how to manage GoodData resources using GoodData Pipelines:
27+
28+
### Provision Child Workspaces
29+
```python
30+
from gooddata_pipelines import WorkspaceFullLoad, WorkspaceProvisioner
31+
32+
# GoodData.CN host URI (e.g., "http://localhost:3000")
33+
host = "http://localhost:3000"
34+
35+
# GoodData.CN user token
36+
token = "some_user_token"
37+
38+
# Initialize the provisioner
39+
provisioner = WorkspaceProvisioner.create(host=host, token=token)
40+
41+
# Gather the definitions of the workspaces you want to create
42+
raw_data: list[dict] = [
43+
{
44+
"parent_id": "demo_parent_workspace",
45+
"workspace_id": "sales_team_workspace",
46+
"workspace_name": "Sales Team Workspace",
47+
"workspace_data_filter_id": "region_filter",
48+
"workspace_data_filter_values": ["north_america"],
49+
},
50+
]
51+
52+
# Validate the data
53+
validated_data = [WorkspaceFullLoad(**item) for item in raw_data]
54+
55+
# Run the provisioning
56+
provisioner.full_load(validated_data)
57+
58+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "GOODDATA PIPELINES"
3+
linkTitle: "GOODDATA PIPELINES"
4+
weight: 60
5+
navigationLabel: true
6+
---
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: "Provisioning"
3+
linkTitle: "Provisioning"
4+
weight: 1
5+
no_list: true
6+
---
7+
8+
Programmatically manage and provision resources in your GoodData environment.
9+
10+
## Supported Resources
11+
12+
Resources you can provision using GoodData Pipelines:
13+
14+
- [Workspaces](workspaces/)
15+
- [Users](users/)
16+
- [User Groups](user_groups/)
17+
- [Workspace Permissions](workspace-permissions/)
18+
19+
20+
## Workflow Types
21+
22+
There are two types of provisioning supported by GoodData Pipelines:
23+
24+
- [Full load](#full-load)
25+
- [Incremental load](#incremental-load)
26+
27+
The provisioning types employ different algorithms and expect different structures of input data. For details about the expected inputs, check out the documentation page for each individual resource.
28+
29+
### Full Load
30+
31+
Full load provisioning aims to fully synchronize the state of your GoodData instance with the provided input. This workflow will create new resources and update existing ones based on the input. Any resources existing on GoodData Cloud not included in the input will be deleted.
32+
33+
> ⚠️ **Warning**: Full load provisioning will delete any existing resources not included in your input data.
34+
35+
### Incremental Load
36+
37+
During incremental provisioning, the algorithm will only interact with resources specified in the input. During the incremental load, the input data expects an extra parameter: `is_active`. Resources with `True` value will be updated. On the other hand, by setting it to `False`, you can mark resources for deletion. Any other resources already existing in GoodData will not be altered.
38+
39+
### Workflow Comparison
40+
41+
| **Aspect** | **Full Load** | **Incremental Load** |
42+
|------------|---------------|----------------------|
43+
| **Scope** | Synchronizes entire state | Only specified resources |
44+
| **Deletion** | Deletes unspecified resources | Only deletes resources marked `is_active: False` |
45+
| **Use Case** | Complete environment setup | Targeted updates |
46+
47+
## Usage
48+
49+
Regardless of workflow type or resource being provisioned, the typical usage follows these steps:
50+
51+
1. Initialize the provisioner
52+
53+
1. Validate your data using an input model
54+
55+
1. Run the selected provisioning method (`.full_load()` or `.incremental_load()`) with your validated data
56+
57+
58+
Check the [resource pages](#supported-resources) for detailed instructions and examples of workflow implementations.
59+
60+
## Logs
61+
62+
By default, the provisioners operate silently. To monitor progress and troubleshoot issues, you can subscribe to the emitted logs using the `.subscribe()` method on the `logger` property of the provisioner instance.
63+
64+
```python
65+
# Import and set up your logger
66+
import logging
67+
68+
# Import the provisioner
69+
from gooddata_pipelines import WorkspaceProvisioner
70+
71+
host = "http://localhost:3000"
72+
token = "some_user_token"
73+
74+
# In this example, we will use Python standard logging library.
75+
# However, you can use any logger conforming to the LoggerLike protocol
76+
# defined in gooddata_pipelines.logger.logger
77+
logging.basicConfig(level=logging.INFO)
78+
logger = logging.getLogger(__name__)
79+
80+
81+
# Initialize the provisioner
82+
provisioner = WorkspaceProvisioner.create(host=host, token=token)
83+
84+
# Subscribe to the logging service
85+
provisioner.logger.subscribe(logger)
86+
87+
# Continue with the provisioning
88+
...
89+
```
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
title: "User Groups"
3+
linkTitle: "User Group"
4+
weight: 3
5+
---
6+
7+
User group provisioning allows you to create, update, or delete user groups.
8+
9+
User groups enable you to organize users and manage permissions at scale by assigning permissions to groups rather than individual users.
10+
11+
You can provision user groups using full or incremental load methods. Each of these methods requires a specific input type.
12+
13+
## Usage
14+
15+
Start by importing and initializing the UserGroupProvisioner.
16+
17+
```python
18+
19+
from gooddata_pipelines import UserGroupProvisioner
20+
21+
host = "http://localhost:3000"
22+
token = "some_user_token"
23+
24+
# Initialize the provisioner with GoodData credentials
25+
provisioner = UserGroupProvisioner.create(host=host, token=token)
26+
27+
```
28+
29+
30+
Then validate your data using an input model corresponding to the provisioned resource and selected workflow type, i.e., `UserGroupFullLoad` if you intend to run the provisioning in full load mode, or `UserGroupIncrementalLoad` if you want to provision incrementally.
31+
32+
The models expect the following fields:
33+
- **user_group_id**: ID of the user group.
34+
- **user_group_name**: Name of the user group.
35+
- **parent_user_groups**: A list of parent user group IDs.
36+
- _**is_active**:_ Deletion flag. Present only in the IncrementalLoad models.
37+
38+
> **Note on IDs**: Each ID can only contain allowed characters. See [Workspace Object Identification](https://www.gooddata.com/docs/cloud/create-workspaces/objects-identification/) to learn more about object identifiers.
39+
40+
Use the appropriate model to validate your data:
41+
42+
```python
43+
# Add the model to the imports
44+
from gooddata_pipelines import UserGroupFullLoad, UserGroupProvisioner
45+
46+
host = "http://localhost:3000"
47+
token = "some_user_token"
48+
49+
# Initialize the provisioner with GoodData credentials
50+
provisioner = UserGroupProvisioner.create(host=host, token=token)
51+
52+
# Load your data
53+
raw_data = [
54+
{
55+
"user_group_id": "user_group_1",
56+
"user_group_name": "User Group 1",
57+
"parent_user_groups": [],
58+
},
59+
]
60+
61+
# Validate the data
62+
validated_data = [
63+
UserGroupFullLoad(
64+
user_group_id=item["user_group_id"],
65+
user_group_name=item["user_group_name"],
66+
parent_user_groups=item["parent_user_groups"],
67+
)
68+
for item in raw_data
69+
]
70+
71+
```
72+
73+
Now with the provisioner initialized and your data validated, you can run the provisioner:
74+
75+
```python
76+
# Import, initialize, validate...
77+
...
78+
79+
# Run the provisioning method
80+
provisioner.full_load(validated_data)
81+
82+
```
83+
84+
## Examples
85+
86+
Here are full examples of a full load and incremental load user group provisioning workflows:
87+
88+
### Full Load
89+
90+
```python
91+
import logging
92+
93+
from gooddata_pipelines import UserGroupFullLoad, UserGroupProvisioner
94+
95+
host = "http://localhost:3000"
96+
token = "some_user_token"
97+
98+
# Initialize the provisioner
99+
provisioner = UserGroupProvisioner.create(host=host, token=token)
100+
101+
# Optional: set up logging and subscribe to logs emitted by the provisioner
102+
logging.basicConfig(level=logging.INFO)
103+
logger = logging.getLogger(__name__)
104+
105+
provisioner.logger.subscribe(logger)
106+
107+
# Prepare your data
108+
raw_data = [
109+
{
110+
"user_group_id": "user_group_1",
111+
"user_group_name": "User Group 1",
112+
"parent_user_groups": [],
113+
},
114+
]
115+
116+
# Validate the data
117+
validated_data = [
118+
UserGroupFullLoad(
119+
user_group_id=item["user_group_id"],
120+
user_group_name=item["user_group_name"],
121+
parent_user_groups=item["parent_user_groups"],
122+
)
123+
for item in raw_data
124+
]
125+
126+
# Run the provisioning with the validated data
127+
provisioner.full_load(validated_data)
128+
129+
```
130+
131+
132+
### Incremental Load
133+
134+
```python
135+
import logging
136+
137+
from gooddata_pipelines import UserGroupIncrementalLoad, UserGroupProvisioner
138+
139+
host = "http://localhost:3000"
140+
token = "some_user_token"
141+
142+
# Initialize the provisioner
143+
provisioner = UserGroupProvisioner.create(host=host, token=token)
144+
145+
# Optional: set up logging and subscribe to logs emitted by the provisioner
146+
logging.basicConfig(level=logging.INFO)
147+
logger = logging.getLogger(__name__)
148+
149+
provisioner.logger.subscribe(logger)
150+
151+
# Prepare your data
152+
raw_data = [
153+
{
154+
"user_group_id": "user_group_1",
155+
"user_group_name": "User Group 1",
156+
"parent_user_groups": [],
157+
"is_active": True,
158+
},
159+
]
160+
161+
# Validate the data
162+
validated_data = [
163+
UserGroupIncrementalLoad(
164+
user_group_id=item["user_group_id"],
165+
user_group_name=item["user_group_name"],
166+
parent_user_groups=item["parent_user_groups"],
167+
is_active=item["is_active"],
168+
)
169+
for item in raw_data
170+
]
171+
172+
# Run the provisioning with the validated data
173+
provisioner.incremental_load(validated_data)
174+
175+
```

0 commit comments

Comments
 (0)