Skip to content

Commit ef1d5ad

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

File tree

8 files changed

+957
-0
lines changed

8 files changed

+957
-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: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: "Pipelines Overview"
3+
linkTitle: "Pipelines Overview"
4+
weight: 14
5+
---
6+
7+
GoodData Pipelines contains tools for automation of GoodData life cycle. Built over GoodData Python SDK, it allows you to conveniently manage user profiles, workspace permissions and more.
8+
9+
For further information, refer to the PIPELINES section in the left navigation menu.
10+
11+
## Installation
12+
13+
14+
Run the following command to install the ``gooddata-pipelines`` package on your system:
15+
16+
```bash
17+
pip install gooddata-pipelines
18+
```
19+
20+
### Requirements
21+
22+
- Python 3.10 or newer
23+
- GoodData.CN or GoodData Cloud
24+
25+
26+
27+
## Examples
28+
Here is an introductory example how to manage GoodData resources using GoodData Pipelines:
29+
30+
### Provision Child Workspaces
31+
```python
32+
from gooddata_pipelines import WorkspaceFullLoad, WorkspaceProvisioner
33+
34+
# GoodData.CN host in the form of uri eg. "http://localhost:3000"
35+
host = "http://localhost:3000"
36+
37+
# GoodData.CN user token
38+
token = "some_user_token"
39+
40+
# Initialize the provisioner
41+
provisioner = WorkspaceProvisioner.create(host=host, token=token)
42+
43+
# Gather the definitions of the workspaces you want to create
44+
raw_data: list[dict] = [
45+
{
46+
"parent_id": "parent_workspace_id",
47+
"workspace_id": "child_workspace_0",
48+
"workspace_name": "Child Workspace 0",
49+
"workspace_data_filter_id": "data_filter_id",
50+
"workspace_data_filter_values": ["value_0"],
51+
},
52+
]
53+
54+
# Validate the data
55+
validated_data = [WorkspaceFullLoad(**item) for item in raw_data]
56+
57+
# Run the provisioning
58+
provisioner.full_load(validated_data)
59+
60+
```
61+
<!--
62+
### Workspace Backup
63+
```python
64+
from gooddata_pipelines import BackupManager, BackupRestoreConfig
65+
66+
# GoodData.CN host in the form of uri eg. "http://localhost:3000"
67+
host = "http://localhost:3000"
68+
69+
# GoodData.CN user token
70+
token = "some_user_token"
71+
72+
# Define a list with IDs of workspaces you want to back up
73+
workspaces_to_back_up = ["workspace_id_1", "workspace_id_2"]
74+
75+
# Configure backup options
76+
config = BackupRestoreConfig(storage_type="local")
77+
78+
# Initialize the backup manager
79+
backup_manager = BackupManager.create(config, host, token)
80+
81+
# Run the backup
82+
backup_manager.backup_workspaces(workspace_ids=workspaces_to_back_up)
83+
84+
``` -->
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: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: "Provisioning"
3+
linkTitle: "Provisioning"
4+
weight: 1
5+
no_list: true
6+
---
7+
8+
Manage resources in GoodData.
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 structure of input data. For details about the expected inputs, check out the documentation page of individual provisioned 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 inluded in the input will be deleted.
32+
33+
### Incremental Load
34+
35+
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.
36+
37+
38+
## Usage
39+
40+
Regardless of workflow type or provisioned resource, the typical usage can be broken down into following steps:
41+
42+
1. Initialize the provisioner
43+
44+
1. Validate your data using an input model
45+
46+
1. Run the selected provisioning method (`.full_load()` or `.incremental_load()`) with your validated data
47+
48+
49+
Check the [resource pages](#supported-resources) for examples of workflow implementations.
50+
51+
## Logs
52+
53+
By default, the provisioners will not print out any information to the console. However, you can subscribe to the emitted logs using the `.subscribe()` method on the `logger` property of the provisioner instance. The logging service emits unformatted messages based on severity.
54+
55+
```python
56+
# Import and set up your logger
57+
import logging
58+
59+
# Import the provisioner
60+
from gooddata_pipelines import WorkspaceProvisioner
61+
62+
host="http://localhost:3000", token="some_user_token"
63+
64+
# In this example, we will use Python standard logging library.
65+
# However, you can subscribe any logger conforming to the LoggerLike protocol
66+
# defined in gooddata_pipelines.logger.logger
67+
logging.basicConfig(level=logging.INFO)
68+
logger = logging.getLogger(__name__)
69+
70+
71+
# Initialize the provisioner
72+
provisioner = WorkspaceProvisioner.create(host=host, token=token)
73+
74+
# Subscribe to the logging service
75+
provisioner.logger.subscribe(logger)
76+
77+
# Continue with the provisioning
78+
...
79+
```
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
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+
You can provision user groups using full or incremental load methods. Each of these methods requires a specific input type.
10+
11+
## Usage
12+
13+
Start by importing and initializing the UserGroupProvisioner.
14+
15+
```python
16+
17+
from gooddata_pipelines import UserGroupProvisioner
18+
19+
host="http://localhost:3000"
20+
token="some_user_token"
21+
22+
# Initialize the provisioner with GoodData credentials
23+
provisioner = UserGroupProvisioner.create(host=host, token=token)
24+
25+
```
26+
27+
28+
Then validate your data using an input model corresponding with 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.
29+
30+
The models expect following fields:
31+
- **user_group_id**: ID of the user group.
32+
- **user_group_name**: Name of the user group.
33+
- **parent_user_groups**: A list of parent user group IDs.
34+
- _**is_active**:_ Deletion flag. Present only in the IncrementalLoad models.
35+
36+
> **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.
37+
38+
Use the appropriate model to validate your data:
39+
40+
```python
41+
# Add the model to the imports
42+
from gooddata_pipelines import UserGroupFullLoad, UserGroupProvisioner
43+
44+
host = "http://localhost:3000"
45+
token = "some_user_token"
46+
47+
# Initialize the provisioner with GoodData credentials
48+
provisioner = UserGroupProvisioner.create(host=host, token=token)
49+
50+
# Load your data
51+
raw_data = [
52+
{
53+
"user_group_id": "user_group_1",
54+
"user_group_name": "User Group 1",
55+
"parent_user_groups": [],
56+
},
57+
]
58+
59+
# Validate the data
60+
validated_data = [
61+
UserGroupFullLoad(
62+
user_group_id=item["user_group_id"],
63+
user_group_name=item["user_group_name"],
64+
parent_user_groups=item["parent_user_groups"],
65+
)
66+
for item in raw_data
67+
]
68+
69+
```
70+
71+
Now with the provisioner initialized and your data validated, you can run the provisioner:
72+
73+
```python
74+
# Import, initialize, validate...
75+
...
76+
77+
# Run the provisiong method
78+
provisioner.full_load(validated_data)
79+
80+
```
81+
82+
## Examples
83+
84+
Here are full examples of a full load and incremental load user group provisioning workflows:
85+
86+
### Full Load
87+
88+
```python
89+
import logging
90+
91+
from gooddata_pipelines import UserGroupFullLoad, UserGroupProvisioner
92+
93+
host = "http://localhost:3000"
94+
token = "some_user_token"
95+
96+
# Initialize the provisioner
97+
provisioner = UserGroupProvisioner.create(host=host, token=token)
98+
99+
# Optional: set up logging and subscribe to logs emited by the provisioner
100+
logging.basicConfig(level=logging.INFO)
101+
logger = logging.getLogger(__name__)
102+
103+
provisioner.logger.subscribe(logger)
104+
105+
# Prepare your data
106+
raw_data = [
107+
{
108+
"user_group_id": "user_group_1",
109+
"user_group_name": "User Group 1",
110+
"parent_user_groups": [],
111+
},
112+
]
113+
114+
# Validate the data
115+
validated_data = [
116+
UserGroupFullLoad(
117+
user_group_id=item["user_group_id"],
118+
user_group_name=item["user_group_name"],
119+
parent_user_groups=item["parent_user_groups"],
120+
)
121+
for item in raw_data
122+
]
123+
124+
# Run the provisioning with the validated data
125+
provisioner.full_load(validated_data)
126+
127+
```
128+
129+
130+
### Incremental Load
131+
132+
```python
133+
import logging
134+
135+
from gooddata_pipelines import UserGroupIncrementalLoad, UserGroupProvisioner
136+
137+
host = "http://localhost:3000"
138+
token = "some_user_token"
139+
140+
# Initialize the provisioner
141+
provisioner = UserGroupProvisioner.create(host=host, token=token)
142+
143+
# Optional: set up logging and subscribe to logs emited by the provisioner
144+
logging.basicConfig(level=logging.INFO)
145+
logger = logging.getLogger(__name__)
146+
147+
provisioner.logger.subscribe(logger)
148+
149+
# Prepare your data
150+
raw_data = [
151+
{
152+
"user_group_id": "user_group_1",
153+
"user_group_name": "User Group 1",
154+
"parent_user_groups": [],
155+
"is_active": True,
156+
},
157+
]
158+
159+
# Validate the data
160+
validated_data = [
161+
UserGroupIncrementalLoad(
162+
user_group_id=item["user_group_id"],
163+
user_group_name=item["user_group_name"],
164+
parent_user_groups=item["parent_user_groups"],
165+
is_active=item["is_active"],
166+
)
167+
for item in raw_data
168+
]
169+
170+
# Run the provisioning with the validated data
171+
provisioner.incremental_load(validated_data)
172+
173+
```

0 commit comments

Comments
 (0)