conohav3

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 12 Imported by: 1

README

ConoHa VPS Ver 3.0 for libdns

This package implements the libdns interface for ConoHa VPS Ver.3.0 using ConoHa VPS Ver.3.0 Public APIs.

Authenticating

The conohav3 package authenticates using the credentials required by ConoHa's Identity API.

You must provide the following variables:

  • APITenantID: Your ConoHa Tenant ID . This identifies your account's tenant.
  • APIUserID: Your User ID associated with the API credentials.
  • APIPassword: The User Password for the user.
  • Region (optional): The ConoHa service region. If omitted, defaults to "c3j1".

These credentials are used to obtain a token from the Identity service, which is then used to authorize DNS API requests.

See Identity APIs for more details.

Example Configuration

p := conohav3.Provider{
    APITenantID: "apiTenantID",
    APIUserID: "apiUserID",
    APIPassword: "apiPassword",
    Region: "region", // Optional. If omitted, defaults to "c3j1".
}
zone := `example.localhost`

// List existing records
fmt.Printf("List existing records\n")
currentRecords, err := conohav3.GetRecords(context.TODO(), zone)
if err != nil {
    fmt.Printf("%v\n", err)
	return
}
for _, record := range currentRecords {
	fmt.Printf("Exists: %v\n", record)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	APITenantID string `json:"api_tenant_id,omitempty"` // ConoHa API tenant ID
	APIUserID   string `json:"api_user_id,omitempty"`   // ConoHa API user ID
	APIPassword string `json:"api_password,omitempty"`  // ConoHa API password
	Region      string `json:"region,omitempty"`        // ConoHa API region (e.g. "c3j1")
	// contains filtered or unexported fields
}

Provider facilitates DNS record management using the ConoHa VPS API (v3.0). It implements the libdns interfaces for getting, appending, setting, and deleting DNS records.

func (*Provider) AppendRecords

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

AppendRecords adds the specified records to the zone. It returns the successfully added records.

func (*Provider) DeleteRecords

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

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

func (*Provider) GetRecords

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

GetRecords lists all the DNS records in the specified 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, updating existing ones or creating new ones. It returns the records that were updated or added.

Jump to

Keyboard shortcuts

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