Skip to content

Commit

Permalink
feat(website): Add Gandi source plugin docs (#5198)
Browse files Browse the repository at this point in the history
Also adds few more real world™️  examples.
  • Loading branch information
disq committed Dec 1, 2022
1 parent d3ee4c7 commit 811910d
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 26 deletions.
27 changes: 1 addition & 26 deletions plugins/source/gandi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,4 @@ The CloudQuery Gandi plugin pulls configuration out of Gandi resources and loads

## Links

- [Configuration](./docs/configuration.md)
- [Tables](./docs/tables/README.md)

## Authentication

In order to fetch information from Gandi, `cloudquery` needs to be authenticated. An API key is required for authentication. Get your API key from [Gandi's Account Settings Page](https://account.gandi.net/en/).

## Query Examples

### Get all domains

```sql
select * from gandi_domains;
```

### Inspect glue records for a specific domain

```sql
select * from gandi_domain_glue_records where fqdn = 'yourdomain.com';
```

### Inspect LiveDNS snapshots for a given domain

```sql
select count(1) as number_of_snapshots, max(created_at) as last_snapshot_at from gandi_livedns_snapshots where fqdn = 'yourdomain.com';
```
- [User Guide](https://docs.cloudquery.io/docs/plugins/sources/gandi/overview)
1 change: 1 addition & 0 deletions website/pages/docs/plugins/sources/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"azure": "Azure",
"gcp": "GCP",
"cloudflare": "Cloudflare",
"gandi": "Gandi",
"digitalocean": "DigitalOcean",
"github": "GitHub",
"heroku": "Heroku",
Expand Down
10 changes: 10 additions & 0 deletions website/pages/docs/plugins/sources/gandi/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"overview": "Overview",
"configuration": "Configuration",
"tables": {
"title": "Tables ↗",
"href": "https://github.com/cloudquery/cloudquery/blob/main/plugins/source/gandi/docs/tables/README.md",
"newWindow": true,
"route": "https://github.com/cloudquery/cloudquery/blob/main/plugins/source/gandi/docs/tables/README.md"
}
}
40 changes: 40 additions & 0 deletions website/pages/docs/plugins/sources/gandi/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Gandi Source Plugin Configuration Reference

## Example

This example syncs from Gandi to a Postgres destination, using `api_key` authentication. The (top level) source spec section is described in the [Source Spec Reference](/docs/reference/source-spec).

```yaml copy
kind: source
# Common source-plugin configuration
spec:
name: gandi
path: cloudquery/gandi
version: "VERSION_SOURCE_GANDI"
tables: ["*"]
destinations: ["postgresql"]

# Gandi specific configuration
spec:
api_key: "<YOUR_API_KEY_HERE>"
```

## Gandi Spec

This is the (nested) spec used by the Gandi source plugin.

- `api_key` (string, required):
An API key to access Gandi resources. This can be generated from [Gandi's Account Settings Page](https://account.gandi.net/en/).

- `sharing_id` (string, optional. Default: not used):
This is your Gandi Organization ID if you wish to limit the queries to a specific Gandi org.

- `gandi_debug` (bool, optional. Default: false):
Enables verbose logging of HTTP calls made by the [underlying library](https://github.com/go-gandi/go-gandi).

- `endpoint_url` (string, optional. Default: `https://api.gandi.net`):
Endpoint URL to make the API requests to. To use the [Gandi Sandbox](https://api.sandbox.gandi.net/docs/sandbox/) API endpoint, set this to `https://api.sandbox.gandi.net/`.

- `timeout_secs` (integer as seconds, optional. Default: `300`):
Default timeout for each API request. Defaults to 5 minutes.

38 changes: 38 additions & 0 deletions website/pages/docs/plugins/sources/gandi/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Gandi Plugin

The CloudQuery Gandi plugin pulls configuration out of Gandi resources and loads it into any supported CloudQuery destination (e.g. PostgreSQL).

## Authentication

In order to fetch information from Gandi, `cloudquery` needs to be authenticated. An API key is required for authentication. Get your API key from [Gandi's Account Settings Page](https://account.gandi.net/en/).

## Query Examples

### Get list of domains which will expire in 90 days

```sql
select fqdn, dates->>'registry_ends_at' as registry_ends_at, date_trunc('day', (dates->>'registry_ends_at')::timestamp - current_timestamp) as days_left from gandi_domains where ((dates->>'registry_ends_at')::timestamp - interval '90 day') < current_timestamp order by 1;
```

### Get domains in Gandi LiveDNS

```sql
select fqdn, current, nameservers from gandi_domain_live_dns order by 1;
```

### Get list of domain glue records

```sql
select fqdn, name, ips from gandi_domain_glue_records order by 1, 2;
```

### Get list of LiveDNS domains which don't have automatic snapshots enabled

```sql
select d.fqdn from gandi_livedns_domains d left join gandi_livedns_snapshots s on s.fqdn=d.fqdn and s.automatic where s.fqdn is null;
```
### Inspect LiveDNS snapshots for a given domain

```sql
select count(1) as number_of_snapshots, max(created_at) as last_snapshot_at from gandi_livedns_snapshots where fqdn = 'yourdomain.com';
```
4 changes: 4 additions & 0 deletions website/pages/docs/plugins/sources/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Official source plugins follow [release stages](#source-plugin-release-stages).
| [Okta][okta] | {getLatestVersion("source", "okta")} | [Changelog][Okta-Changelog] | [Tables][Okta-Tables] | Preview |
| [Terraform][terraform] | {getLatestVersion("source", "terraform")} | [Changelog][Terraform-Changelog] | [Tables][Terraform-Tables] | Preview |
| [Cloudflare][cloudflare] | {getLatestVersion("source", "cloudflare")} | [Changelog][Cloudflare-Changelog] | [Tables][Cloudflare-Tables] | Preview |
| [Gandi][gandi] | {getLatestVersion("source", `gandi`)} | [Changelog][Gandi-Changelog] | [Tables][Gandi-Tables] | Preview |

## Community

Expand Down Expand Up @@ -60,6 +61,7 @@ For version `Major.Minor.Patch`:
[okta]: ./okta/overview
[terraform]: ./terraform/overview
[cloudflare]: ./cloudflare/overview
[gandi]: ./gandi/overview
[AWS-Changelog]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/aws/CHANGELOG.md
[Azure-Changelog]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/CHANGELOG.md
[GCP-Changelog]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/gcp/CHANGELOG.md
Expand All @@ -70,6 +72,7 @@ For version `Major.Minor.Patch`:
[Okta-Changelog]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/okta/CHANGELOG.md
[Terraform-Changelog]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/terraform/CHANGELOG.md
[Cloudflare-Changelog]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/cloudflare/CHANGELOG.md
[Gandi-Changelog]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/gandi/CHANGELOG.md
[AWS-Tables]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/aws/docs/tables/README.md
[Azure-Tables]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/azure/docs/tables/README.md
[GCP-Tables]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/gcp/docs/tables/README.md
Expand All @@ -80,3 +83,4 @@ For version `Major.Minor.Patch`:
[Okta-Tables]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/okta/docs/tables/README.md
[Terraform-Tables]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/terraform/docs/tables/README.md
[Cloudflare-Tables]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/cloudflare/docs/tables/README.md
[Gandi-Tables]: https://github.com/cloudquery/cloudquery/blob/main/plugins/source/gandi/docs/tables/README.md

0 comments on commit 811910d

Please sign in to comment.