An open API service indexing awesome lists of open source software.

https://github.com/stackql/stackql-provider-digitalocean

generate stackql provider for DigitalOcean from openapi specs
https://github.com/stackql/stackql-provider-digitalocean

digitalocean stackql stackql-provider

Last synced: 3 months ago
JSON representation

generate stackql provider for DigitalOcean from openapi specs

Awesome Lists containing this project

README

          

## `digitalocean` provider for [`stackql`](https://github.com/stackql/stackql)

This repository is used to generate and document the `digitalocean` provider for StackQL, allowing you to query and manipulate DigitalOcean resources using SQL-like syntax. The provider is built using the `@stackql/provider-utils` package, which provides tools for converting OpenAPI specifications into StackQL-compatible provider schemas.

The `@stackql/provider-utils` package offers several utilities that this provider uses:
- `split` - Divides a large OpenAPI spec into smaller service-specific files
- `analyze` - Examines OpenAPI specs and generates mapping configuration files
- `generate` - Creates StackQL provider extensions from OpenAPI specs and mappings
- `docgen` - Builds documentation for the provider

### Prerequisites

To use the DigitalOcean provider with StackQL, you'll need:

1. A DigitalOcean account with appropriate API credentials
2. A DigitalOcean personal access token with sufficient permissions for the resources you want to access
3. StackQL CLI installed on your system (see [StackQL](https://github.com/stackql/stackql))

### 1. Download the Open API Specification

First, download the DigitalOcean API OpenAPI specification:

```bash
curl -L https://api-engineering.nyc3.digitaloceanspaces.com/spec-ci/DigitalOcean-public.v2.yaml \
-o provider-dev/downloaded/digitalocean-public.v2.yaml
```

This downloads the official DigitalOcean API specification, which defines all available API endpoints, request parameters, and response schemas.

### 2. Split into Service Specs

Next, split the monolithic OpenAPI specification into service-specific files:

```bash
npm run split -- \
--provider-name digitalocean \
--api-doc provider-dev/downloaded/digitalocean-public.v2.yaml \
--svc-discriminator tag \
--output-dir provider-dev/source \
--overwrite \
--svc-name-overrides "$(cat < Tokens/Keys.

Set your token as an environment variable:

```bash
export DIGITALOCEAN_TOKEN="your_token_here"
```

For more information, see the [DigitalOcean API documentation](https://docs.digitalocean.com/reference/api/).
```

### 8. Test web docs locally

```bash
cd website
# test build
yarn build

# run local dev server
yarn start
```

### 9. Publish web docs to GitHub Pages

Under __Pages__ in the repository, in the __Build and deployment__ section select __GitHub Actions__ as the __Source__. In Netlify DNS create the following records:

| Source Domain | Record Type | Target |
|---------------|--------------|--------|
| digitalocean-provider.stackql.io | CNAME | stackql.github.io. |

## License

MIT

## Contributing

Contributions to the DigitalOcean provider are welcome! Please feel free to submit a Pull Request.