Skip to content

Commit

Permalink
feat: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
John2360 committed Aug 1, 2024
1 parent 62be512 commit abe6edd
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 9 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Create Release

on:
push:
tags:
- "v*.*.*"

jobs:
create_release:
permissions:
contents: write
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Setup Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: |
poetry install --no-interaction
- name: Build
run: |
poetry build
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Release notes for ${{ github.ref }}
draft: false
prerelease: false

- name: Get .whl path name
id: get_whl_file_name
run: |
echo "::set-output name=whl_file_name::$(ls dist/*.whl)"
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.get_whl_file_name.outputs.whl_file_name }}
asset_name: fortress_sdk_python-${{ github.ref }}.whl
asset_content_type: application/zip

- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_SECRET }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/__pycache__/
**/.DS_Store
**/.DS_Store
dist/**
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Fortress

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Welcome to the Fortress Python SDK. This SDK provides a way for you to leverage
You can install the SDK using pip. Simply run the following command:

```bash
pip install fortress-platform-sdk
pip install fortress-sdk-python
```

## Quick Start

Here is a quick example to get you started with the SDK:

```python
from fortress_python_sdk import Client as FortressClient
from fortress_sdk_python import Client as FortressClient

# Initialize the client with your API key
client = FortressClient(org_id='your_org_id', api_key='your_api_key')
Expand Down
13 changes: 7 additions & 6 deletions fortress_sdk_python/fortress.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ def __init__(
org_id: str,
api_key: str,
):
# self.base_url = "https://api.fortress.build/v1"
self.base_url = "http://localhost:80/api/v1"
self.base_url = "https://api.fortress.build"
self.org_id = org_id
self.api_key = api_key

def get_uri(self, database):
endpoint = f"{self.base_url}/organization/{self.org_id}/{database}/database/uri"
endpoint = (
f"{self.base_url}/v1/organization/{self.org_id}/{database}/database/uri"
)
response = requests.get(
endpoint,
headers={"Api-Key": self.api_key},
Expand Down Expand Up @@ -101,7 +102,7 @@ def get_uri(self, database):
)

def create_database(self, database):
endpoint = f"{self.base_url}/organization/{self.org_id}/{database}/database"
endpoint = f"{self.base_url}/v1/organization/{self.org_id}/{database}/database"
response = requests.post(
endpoint,
headers={"Api-Key": self.api_key},
Expand All @@ -121,7 +122,7 @@ def create_database(self, database):
)

def delete_database(self, database):
endpoint = f"{self.base_url}/organization/{self.org_id}/{database}/database"
endpoint = f"{self.base_url}/v1/organization/{self.org_id}/{database}/database"
response = requests.delete(
endpoint,
headers={"Api-Key": self.api_key},
Expand All @@ -141,7 +142,7 @@ def delete_database(self, database):
)

def list_databases(self):
endpoint = f"{self.base_url}/organization/{self.org_id}/databases"
endpoint = f"{self.base_url}/v1/organization/{self.org_id}/databases"
response = requests.get(
endpoint,
headers={"Api-Key": self.api_key},
Expand Down

0 comments on commit abe6edd

Please sign in to comment.