Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebump docs #29

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

The [GlassFlow](https://www.glassflow.dev/) Python SDK provides a convenient way to interact with the GlassFlow API in your Python applications. The SDK is used to publish and consume events to your [GlassFlow pipelines](https://docs.glassflow.dev/concepts/pipeline).

!!! warning "SDK Maturity"
Please note that the GlassFlow Python SDK is currently in beta and is subject to potential breaking changes. We recommend keeping an eye on the official documentation and updating your code accordingly to ensure compatibility with future versions of the SDK.


## Installation

Expand All @@ -11,17 +14,6 @@ You can install the GlassFlow Python SDK using pip:
pip install glassflow
```

## Content

* [Publish and Consume Events](publish_and_consume.md) - Learn how to publish and consume events to/from a pipeline.
* [Pipeline Management](pipeline_management.md) - Learn how to manage your pipelines from the SDK.


## SDK Maturity

Please note that the GlassFlow Python SDK is currently in beta and is subject to potential breaking changes. We recommend keeping an eye on the official documentation and updating your code accordingly to ensure compatibility with future versions of the SDK.


## User Guides

For more detailed information on how to use the GlassFlow Python SDK, please refer to the [GlassFlow Documentation](https://docs.glassflow.dev). The documentation provides comprehensive guides, tutorials, and examples to help you get started with GlassFlow and make the most out of the SDK.
Expand Down
213 changes: 105 additions & 108 deletions docs/pipeline_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,151 +29,148 @@ allow for some extra functionalities like delete or update.
Returns information about the available pipelines. It can be restricted to a
specific space by passing the `space_id`.

### Example Usage

```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
res = client.list_pipelines()
```
???+ example "Usage"
```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
res = client.list_pipelines()
```

## Get Pipeline

Gets information about a pipeline from a given pipeline ID. It returns a Pipeline object
which can be used manage the Pipeline.

### Example Usage

```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
pipeline = client.get_pipeline(pipeline_id="<your pipeline id>")

print("Name:", pipeline.name)
```
???+ example "Usage"
```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
pipeline = client.get_pipeline(pipeline_id="<your pipeline id>")

print("Name:", pipeline.name)
```

## Create Pipeline

Creates a new pipeline and returns a `Pipeline` object.

### Example Usage

```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
pipeline = client.create_pipeline(
name="MyFirstPipeline",
space_id="<your space id>",
transformation_file="path/to/transformation.py"
)

print("Pipeline ID:", pipeline.id)
```

In the next example we create a pipeline with Google PubSub source
and a webhook sink:

```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")

pipeline = client.create_pipeline(
name="MyFirstPipeline",
space_id="<your space id>",
transformation_file="path/to/transformation.py",
source_kind="google_pubsub",
source_config={
"project_id": "<your gcp project id>",
"subscription_id": "<your subscription id>",
"credentials_json": "<your credentials json>"
},
sink_kind="webhook",
sink_config={
"url": "www.my-webhook-url.com",
"method": "POST",
"headers": [{"header1": "header1_value"}]
}
)
```
???+ example "Usage"
```python
from glassflow import GlassFlowClient
client = GlassFlowClient(personal_access_token="<your access token>")
pipeline = client.create_pipeline(
name="MyFirstPipeline",
space_id="<your space id>",
transformation_file="path/to/transformation.py"
)
print("Pipeline ID:", pipeline.id)
```

???+ example "Usage"
In the next example we create a pipeline with Google PubSub source
and a webhook sink:
```python
from glassflow import GlassFlowClient
client = GlassFlowClient(personal_access_token="<your access token>")
pipeline = client.create_pipeline(
name="MyFirstPipeline",
space_id="<your space id>",
transformation_file="path/to/transformation.py",
source_kind="google_pubsub",
source_config={
"project_id": "<your gcp project id>",
"subscription_id": "<your subscription id>",
"credentials_json": "<your credentials json>"
},
sink_kind="webhook",
sink_config={
"url": "www.my-webhook-url.com",
"method": "POST",
"headers": [{"header1": "header1_value"}]
}
)
```

## Update Pipeline

The Pipeline object has an update method.

### Example Usage

```python
from glassflow import Pipeline

pipeline = Pipeline(
id="<your pipeline id>",
personal_access_token="<your access token>",
)

pipeline.update(
transformation_file="path/to/new/transformation.py",
name="NewPipelineName",
)
```
???+ example "Usage"
```python
from glassflow import Pipeline

pipeline = Pipeline(
id="<your pipeline id>",
personal_access_token="<your access token>",
)

pipeline.update(
transformation_file="path/to/new/transformation.py",
name="NewPipelineName",
)
```

## Delete Pipeline

The Pipeline object has a delete method to delete a pipeline

### Example Usage

```python
from glassflow import Pipeline

pipeline = Pipeline(
id="<your pipeline id>",
personal_access_token="<your access token>"
)
pipeline.delete()
```
???+ example "Usage"
```python
from glassflow import Pipeline

pipeline = Pipeline(
id="<your pipeline id>",
personal_access_token="<your access token>"
)
pipeline.delete()
```

## List Spaces

Returns information about the available spaces.

### Example Usage

```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
res = client.list_spaces()
```
???+ example "Usage"
```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
res = client.list_spaces()
```


## Create Space

Creates a new space and returns a `Space` object.

```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
space = client.create_space(name="MyFirstSpace")
```
???+ example "Usage"
```python
from glassflow import GlassFlowClient

client = GlassFlowClient(personal_access_token="<your access token>")
space = client.create_space(name="MyFirstSpace")
```


## Delete Space

The Space object has a delete method to delete a space

### Example Usage

```python
from glassflow import Space

space = Space(
id="<your space id>",
personal_access_token="<your access token>"
)
space.delete()
```
???+ example "Usage"
```python
from glassflow import Space

space = Space(
id="<your space id>",
personal_access_token="<your access token>"
)
space.delete()
```
Loading
Loading