-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Mikhail Parfenov <[email protected]> Co-authored-by: Roman Dyakov <[email protected]> Co-authored-by: Mikhail Parfenov <[email protected]>
- Loading branch information
Showing
7 changed files
with
465 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Go | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [ '1.21.5' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Display Go version | ||
run: go version | ||
- name: Install deps | ||
run: go get | ||
- name: Build | ||
run: go build | ||
# - name: Test with the Go CLI | ||
# run: go test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,49 @@ | ||
**DEVELOPER INSTRUCTIONS:** | ||
# Yandex Cloud DNS for [`libdns`](https://github.com/libdns/libdns) | ||
|
||
This repo is a template for developers to use when creating new [libdns](https://github.com/libdns/libdns) provider implementations. | ||
This package implements the [libdns interfaces](https://github.com/libdns/libdns) for [Yandex Cloud API](https://yandex.cloud/en/docs/dns/api-ref/) allowing you to manage DNS records. | ||
|
||
Be sure to update: | ||
|
||
- The package name | ||
- The Go module name in go.mod | ||
- The latest `libdns/libdns` version in go.mod | ||
- All comments and documentation, including README below and godocs | ||
- License (must be compatible with Apache/MIT) | ||
- All "TODO:"s is in the code | ||
- All methods that currently do nothing | ||
## Authenticate | ||
|
||
Remove this section from the readme before publishing. | ||
To authenticate API you need to supply a Yandex Cloud IAM token. It will automatically ensure from Service Account authorization keys. | ||
|
||
--- | ||
More info: <https://yandex.cloud/en/docs/dns/api-ref/authentication> | ||
|
||
\<PROVIDER NAME\> for [`libdns`](https://github.com/libdns/libdns) | ||
======================= | ||
|
||
[![Go Reference](https://pkg.go.dev/badge/test.svg)](https://pkg.go.dev/github.com/libdns/TODO:PROVIDER_NAME) | ||
## Usage | ||
|
||
This package implements the [libdns interfaces](https://github.com/libdns/libdns) for \<PROVIDER\>, allowing you to manage DNS records. | ||
```go | ||
package main | ||
|
||
TODO: Show how to configure and use. Explain any caveats. | ||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
"time" | ||
|
||
yandex_cloud "github.com/profcomff/libdns-yandex-cloud" | ||
) | ||
|
||
func main() { | ||
p := &yandex_cloud.Provider{ServiceAccountConfigPath: "./authorized_keys.json"} | ||
// File structure | ||
// { | ||
// "id": "...", | ||
// "service_account_id": "...", | ||
// "created_at": "2024-08-04T14:00:38.626813184Z", | ||
// "key_algorithm": "RSA_2048", | ||
// "public_key": "-----BEGIN PUBLIC KEY-----\n ... \n-----END PUBLIC KEY-----\n", | ||
// "private_key": "PLEASE DO NOT REMOVE THIS LINE! Yandex.Cloud SA Key ID <...>\n-----BEGIN PRIVATE KEY-----\n ... \n-----END PRIVATE KEY-----\n", | ||
// "dns_zone_id": "..." | ||
// } | ||
|
||
|
||
records, err := p.GetRecords(context.WithTimeout(context.Background(), time.Duration(15*time.Second)), "") | ||
if err != nil { | ||
fmt.Printf("Error: %s", err.Error()) | ||
return | ||
} | ||
|
||
fmt.Println(records) | ||
} | ||
``` |
Oops, something went wrong.