dns

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Overview

Package dns represents our SiteHost `/dns` API endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRecordRequest

type AddRecordRequest struct {
	ClientID string `json:"client_id"`
	Domain   string `json:"domain"`
	Type     string `json:"type"`
	Name     string `json:"name"`
	Content  string `json:"content"`
	Priority string `json:"prio"`
}

AddRecordRequest represents a request to create a DNSRecord.

type AddRecordResponse added in v0.4.0

type AddRecordResponse struct {
	Return struct {
		ID string `json:"id"`
	} `json:"return"`
	models.APIResponse
}

AddRecordResponse is the return for adding a cloud database.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Service to work with SiteHost API.

func New

func New(c *api.Client) *Client

New is an initialisation function.

func (*Client) AddRecord

func (s *Client) AddRecord(ctx context.Context, opts AddRecordRequest) (response AddRecordResponse, err error)

AddRecord adds a new record to the DNS for a domain. This function takes a context.Context and an AddRecordRequest struct as input parameters. It returns an APIResponse struct and an error.

func (*Client) CreateZone

func (s *Client) CreateZone(ctx context.Context, opts CreateZoneRequest) (response CreateZoneResponse, err error)

CreateZone creates a new DNS zone with the specified domain name. This function takes a context.Context and a CreateZoneRequest struct as input parameters. It returns a CreateZoneResponse struct and an error.

func (*Client) DeleteRecord

func (s *Client) DeleteRecord(ctx context.Context, opts DeleteRecordRequest) (response models.APIResponse, err error)

DeleteRecord deletes a record from the DNS for a domain. This function takes a context.Context and a DeleteRecordRequest struct as input parameters. It returns an APIResponse struct and an error.

func (*Client) DeleteZone

func (s *Client) DeleteZone(ctx context.Context, request DeleteZoneRequest) (response models.APIResponse, err error)

DeleteZone deletes an existing DNS zone with the specified domain name. It takes a context.Context and a DeleteZoneRequest struct as input parameters. It returns a models.APIResponse pointer and an error.

func (*Client) GetRecord added in v0.3.2

func (s *Client) GetRecord(ctx context.Context, request RecordRequest) (response models.DNSRecord, err error)

GetRecord returns a record by id.

func (*Client) GetRecordWithRecord deprecated added in v0.3.2

func (s *Client) GetRecordWithRecord(ctx context.Context, request models.DNSRecord) (response models.DNSRecord, err error)

GetRecordWithRecord is a special case, for mainly when we are creating records where we need to get back what we just created.

Deprecated: This is only needed for older versions of the Terraform provider as we now get a record ID back.

func (*Client) GetRecordWithType added in v0.3.2

func (s *Client) GetRecordWithType(ctx context.Context, request RecordRequest) (response []models.DNSRecord, err error)

GetRecordWithType gets the record and filter based on type, as we often want to deal with the records of a specific type, mainly for use in external contexts, ie: terrorform.

func (*Client) GetZone

func (s *Client) GetZone(ctx context.Context, request GetZoneRequest) (response GetZoneResponse, err error)

GetZone searches for a domain in the DNS made easy service by sending a request with a query containing the domain name. If the response contains any matching domain, it returns it as part of the GetZoneResponse. If the response is empty, a control to handle this case is missing and should be added.

func (*Client) ListRecords

func (s *Client) ListRecords(ctx context.Context, request ListRecordsRequest) (response ListRecordsResponse, err error)

ListRecords returns a list of DNS records for the specified domain. This function takes a context.Context and a ListRecordsRequest struct as input parameters. It returns a ListRecordsResponse struct and an error.

func (*Client) ListZones

func (s *Client) ListZones(ctx context.Context, opt *ListZoneOptions) (response ListZoneResponse, err error)

ListZones retrieves a list of all DNS zones associated with the client's account, optionally filtering by specified parameters in ListZoneOptions. It returns a pointer to a slice of DNSZone objects and an error if any.

func (*Client) UpdateRecord

func (s *Client) UpdateRecord(ctx context.Context, opts UpdateRecordRequest) (response models.APIResponse, err error)

UpdateRecord updates an existing DNS record for a domain. This function takes a context.Context and an UpdateRecordRequest struct as input parameters. It returns an APIResponse struct and an error.

type CreateZoneRequest

type CreateZoneRequest struct {
	DomainName string `json:"name"`
}

CreateZoneRequest represents a request to create a DNSZone (domain).

type CreateZoneResponse

type CreateZoneResponse struct {
	Return struct {
		IsMigration bool `json:"is_migration"`
	} `json:"return"`
	models.APIResponse
}

CreateZoneResponse represents a request to create a DNSZone (domain).

type DeleteRecordRequest

type DeleteRecordRequest struct {
	ClientID string `json:"client_id"`
	Domain   string `json:"domain"`
	RecordID string `json:"record_id"`
}

DeleteRecordRequest represents a request to delete a DNSRecord.

type DeleteZoneRequest

type DeleteZoneRequest struct {
	DomainName string `json:"name"`
}

DeleteZoneRequest represents a request to delete a DNSZone.

type GetZoneRequest

type GetZoneRequest struct {
	DomainName string `json:"name"`
}

GetZoneRequest represents a request to get a DNSZone.

type GetZoneResponse

type GetZoneResponse struct {
	Return []struct {
		Name string `json:"name"`
	} `json:"return"`
	models.APIResponse
}

GetZoneResponse represents a request to get a DNSZone (domain).

type ListRecordsRequest

type ListRecordsRequest struct {
	Domain string `json:"domain"`
}

ListRecordsRequest represents a request to list DNSRecords.

type ListRecordsResponse

type ListRecordsResponse struct {
	Return []models.DNSRecord `json:"return"`
	models.APIResponse
}

ListRecordsResponse represents a response from the ListRecords method.

type ListZoneOptions

type ListZoneOptions struct {
	Domain     string `url:"filters[domain],omitempty"`
	SortBy     string `url:"filters[sort_by],omitempty"`
	SortDir    string `url:"filters[sort_dir],omitempty"`
	PageSize   int    `url:"filters[page_size],omitempty"`
	PageNumber int    `url:"filters[page_number],omitempty"`
}

ListZoneOptions represents a request to list DNSZones.

type ListZoneResponse

type ListZoneResponse struct {
	Return struct {
		models.Pagination
		Data []models.DNSZone `json:"data"`
	} `json:"return"`
	models.APIResponse
}

ListZoneResponse represents a request to list all DNSZones (domains).

type RecordRequest

type RecordRequest struct {
	ID         string `json:"id"`
	RRType     string `json:"rr_type"`
	DomainName string `json:"name"`
}

RecordRequest represents a request to get a DNSRecord.

type UpdateRecordRequest

type UpdateRecordRequest struct {
	ClientID string `json:"client_id"`
	Domain   string `json:"domain"`
	RecordID string `json:"record_id"`
	Type     string `json:"type"`
	Name     string `json:"name"`
	Content  string `json:"content"`
	Priority string `json:"prio"`
}

UpdateRecordRequest represents a request to update a DNSRecord.

Jump to

Keyboard shortcuts

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