exoscale

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 9 Imported by: 2

README

Exoscale for libdns

Go Reference

This package implements the libdns interfaces for Exoscale, allowing you to manage DNS records.

Configuration


This provider expects the following configuration:

Required

  • APIKey: Exoscale API Key
  • APISecret: Exoscale API Secret

Here is an example of the minimum permissions you can set for the role associated to your API Key.

{
  "default-service-strategy": "deny",
  "services": {
    "dns": {
      "type": "rules",
      "rules": [
        {
          "expression": "operation == 'list-dns-domains'",
          "action": "allow"
        },
        {
          "expression": "!(resources.dns_domain.unicode_name in [\"example.com\"])",
          "action": "deny"
        },
        {
          "expression": "true",
          "action": "allow"
        }
      ]
    }
  }
}

Testing


For testing, set the TEST_API_KEY, TEST_API_SECRET and TEST_ZONE as environment variable.

$ TEST_API_KEY="EXO..." TEST_API_SECRET="..." TEST_ZONE="example.com" go test -v
=== RUN   Test_AppendRecords
--- PASS: Test_AppendRecords (13.89s)
=== RUN   Test_DeleteRecords
--- PASS: Test_DeleteRecords (7.37s)
=== RUN   Test_GetRecords
--- PASS: Test_GetRecords (7.89s)
=== RUN   Test_SetRecords
--- PASS: Test_SetRecords (14.23s)
PASS
ok  	github.com/libdns/exoscale	43.393s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// Exoscale API Key (required)
	APIKey string `json:"api_key,omitempty"`
	// Exoscale API Secret (required)
	APISecret string `json:"api_secret,omitempty"`
	// contains filtered or unexported fields
}

Provider facilitates DNS record manipulation with Exoscale.

func (*Provider) AppendRecords

func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

AppendRecords adds records to the zone. It returns the records that were added.

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

DeleteRecords deletes the records from the zone. It returns the records that were deleted.

func (*Provider) GetRecords

func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)

GetRecords lists all the records in the zone.

func (*Provider) SetRecords

func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

SetRecords sets the records in the zone, either by updating existing records or creating new ones. It returns the updated records.

func (*Provider) StringToDNSDomainRecordRequestType

func (p *Provider) StringToDNSDomainRecordRequestType(recordType string) (egoscale.CreateDNSDomainRecordRequestType, error)

Function to get the DNSDomainRecordRequestType from a string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL