dns

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: Apache-2.0 Imports: 16 Imported by: 1

README

Akamai Config DNS (Zone Record Management)

A golang package that talks to the Akamai OPEN Config DNS API.

Documentation

Overview

Package dns provides access to the Akamai DNS V2 APIs

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadRequest is returned when a required parameter is missing
	ErrBadRequest = errors.New("missing argument")
)
View Source
var (
	// ErrStructValidation is returned returned when given struct validation failed
	ErrStructValidation = errors.New("struct validation")
)

Functions

This section is empty.

Types

type Authorities

type Authorities interface {
	// GetAuthorities provides a list of structured read-only list of name serveers
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getauthoritativenameserverdata
	GetAuthorities(context.Context, string) (*AuthorityResponse, error)
	// GetNameServerRecordList provides a list of name server records
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getauthoritativenameserverdata
	GetNameServerRecordList(context.Context, string) ([]string, error)
	//
	NewAuthorityResponse(context.Context, string) *AuthorityResponse
}

Authoritiess contains operations available on Authorities data sources See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getauthoritativenameserverdata

type AuthorityResponse

type AuthorityResponse struct {
	Contracts []Contract `json:"contracts"`
}

type BulkCreateResultResponse added in v2.0.2

type BulkCreateResultResponse struct {
	RequestId                string            `json:"requestId"`
	SuccessfullyCreatedZones []string          `json:"successfullyCreatedZones"`
	FailedZones              []*BulkFailedZone `json:"failedZones"`
}

type BulkDeleteResultResponse added in v2.0.2

type BulkDeleteResultResponse struct {
	RequestId                string            `json:"requestId"`
	SuccessfullyDeletedZones []string          `json:"successfullyDeletedZones"`
	FailedZones              []*BulkFailedZone `json:"failedZones"`
}

type BulkFailedZone added in v2.0.2

type BulkFailedZone struct {
	Zone          string `json:"zone"`
	FailureReason string `json:"failureReason"`
}

type BulkStatusResponse added in v2.0.2

type BulkStatusResponse struct {
	RequestId      string `json:"requestId"`
	ZonesSubmitted int    `json:"zonesSubmitted"`
	SuccessCount   int    `json:"successCount"`
	FailureCount   int    `json:"failureCount"`
	IsComplete     bool   `json:"isComplete"`
	ExpirationDate string `json:"expirationDate"`
}

type BulkZonesCreate added in v2.0.2

type BulkZonesCreate struct {
	Zones []*ZoneCreate `json:"zones"`
}

type BulkZonesResponse added in v2.0.2

type BulkZonesResponse struct {
	RequestId      string `json:"requestId"`
	ExpirationDate string `json:"expirationDate"`
}

type ChangeListResponse

type ChangeListResponse struct {
	Zone             string `json:"zone,omitempty"`
	ChangeTag        string `json:"changeTag,omitempty"`
	ZoneVersionID    string `json:"zoneVersionId,omitempty"`
	LastModifiedDate string `json:"lastModifiedDate,omitempty"`
	Stale            bool   `json:"stale,omitempty"`
}

type ClientFunc

type ClientFunc func(sess session.Session, opts ...Option) DNS

ClientFunc is a dns client new method, this can used for mocking

type Contract

type Contract struct {
	ContractID  string   `json:"contractId"`
	Authorities []string `json:"authorities"`
}

type DNS

type DNS interface {
	Zones
	TSIGKeys
	Authorities
	Records
	RecordSets
}

DNS is the dns api interface

func Client

func Client(sess session.Session, opts ...Option) DNS

Client returns a new dns Client instance with the specified controller

type Error

type Error struct {
	Type          string `json:"type"`
	Title         string `json:"title"`
	Detail        string `json:"detail"`
	Instance      string `json:"instance,omitempty"`
	BehaviorName  string `json:"behaviorName,omitempty"`
	ErrorLocation string `json:"errorLocation,omitempty"`
	StatusCode    int    `json:"-"`
}

Error is a papi error interface

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

Is handles error comparisons

type ListMetadata

type ListMetadata struct {
	ContractIDs   []string `json:"contractIds"`
	Page          int      `json:"page"`
	PageSize      int      `json:"pageSize"`
	ShowAll       bool     `json:"showAll"`
	TotalElements int      `json:"totalElements"`

} //`json:"metadata"`

type MetadataH

type MetadataH struct {
	LastPage      int  `json:"lastPage"`
	Page          int  `json:"page"`
	PageSize      int  `json:"pageSize"`
	ShowAll       bool `json:"showAll"`
	TotalElements int  `json:"totalElements"`

} //`json:"metadata"`

type Option

type Option func(*dns)

Option defines a DNS option

type RecordBody

type RecordBody struct {
	Name       string `json:"name,omitempty"`
	RecordType string `json:"type,omitempty"`
	TTL        int    `json:"ttl,omitempty"`
	// Active field no longer used in v2
	Active bool     `json:"active,omitempty"`
	Target []string `json:"rdata,omitempty"`
}

func (*RecordBody) Validate

func (rec *RecordBody) Validate() error

Validate validates RecordBody

type RecordSetResponse

type RecordSetResponse struct {
	Metadata   MetadataH   `json:"metadata"`
	Recordsets []Recordset `json:"recordsets"`
}

type RecordSets

type RecordSets interface {
	// NewRecordSetResponse returns new response object
	NewRecordSetResponse(context.Context, string) *RecordSetResponse
	// GetRecordsets retrieves recordsets with Query Args. No formatting of arg values
	// See: See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getzonerecordsets
	GetRecordsets(context.Context, string, ...RecordsetQueryArgs) (*RecordSetResponse, error)
	// CreateRecordsets creates multiple recordsets
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#postzonerecordsets
	CreateRecordsets(context.Context, *Recordsets, string, ...bool) error
	// UpdateRecordsets sreplaces list of recordsets
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#putzonerecordsets
	UpdateRecordsets(context.Context, *Recordsets, string, ...bool) error
}

Recordsets contains operations available on a recordsets See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html

type Records

type Records interface {
	// RecordToMap returns a map containing record content
	RecordToMap(context.Context, *RecordBody) map[string]interface{}
	// Return bare bones tsig key struct
	NewRecordBody(context.Context, RecordBody) *RecordBody
	//  GetRecordList retrieves recordset list based on type
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getzonerecordsets
	GetRecordList(context.Context, string, string, string) (*RecordSetResponse, error)
	// GetRdata retrieves record rdata, e.g. target
	GetRdata(context.Context, string, string, string) ([]string, error)
	// ProcessRdata
	ProcessRdata(context.Context, []string, string) []string
	// ParseRData parses rdata. returning map
	ParseRData(context.Context, string, []string) map[string]interface{}
	// GetRecord retrieves a recordset and returns as RecordBody
	// See:  https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getzonerecordset
	GetRecord(context.Context, string, string, string) (*RecordBody, error)
	// CreateRecord creates recordset
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#postzonerecordset
	CreateRecord(context.Context, *RecordBody, string, ...bool) error
	// DeleteRecord removes recordset
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#deletezonerecordset
	DeleteRecord(context.Context, *RecordBody, string, ...bool) error
	// UpdateRecord replaces the recordset
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#putzonerecordset
	UpdateRecord(context.Context, *RecordBody, string, ...bool) error
	// FullIPv6 is utility method to convert IP to string
	FullIPv6(context.Context, net.IP) string
	// PadCoordinates is utility method to convert IP to normalize coordinates
	PadCoordinates(context.Context, string) string
}

Records contains operations available on a Record resource See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html

type Recordset

type Recordset struct {
	Name  string   `json:"name"`
	Type  string   `json:"type"`
	TTL   int      `json:"ttl"`
	Rdata []string `json:"rdata"`

} //`json:"recordsets"`

type RecordsetQueryArgs

type RecordsetQueryArgs struct {
	Page     int
	PageSize int
	Search   string
	ShowAll  bool
	SortBy   string
	Types    string
}

Recordset Query args struct

type Recordsets

type Recordsets struct {
	Recordsets []Recordset `json:"recordsets"`
}

Recordsets Struct. Used for Create and Update Recordsets

func (*Recordsets) Validate

func (rs *Recordsets) Validate() error

Validate validates Recordsets

type TSIGKey

type TSIGKey struct {
	Name      string `json:"name"`
	Algorithm string `json:"algorithm,omitempty"`
	Secret    string `json:"secret,omitempty"`
}

func (*TSIGKey) Validate

func (key *TSIGKey) Validate() error

Validate validates RecordBody

type TSIGKeyBulkPost

type TSIGKeyBulkPost struct {
	Key   *TSIGKey `json:"key"`
	Zones []string `json:"zones"`
}

func (*TSIGKeyBulkPost) Validate

func (bulk *TSIGKeyBulkPost) Validate() error

type TSIGKeyResponse

type TSIGKeyResponse struct {
	TSIGKey
	ZoneCount int64 `json:"zonesCount,omitempty"`
}

type TSIGKeys

type TSIGKeys interface {
	// Return bare bones tsig key struct
	NewTsigKey(context.Context, string) *TSIGKey
	// Return empty query string struct. No elements required.
	NewTsigQueryString(context.Context) *TSIGQueryString
	// List TSIG Keys
	// See:
	ListTsigKeys(context.Context, *TSIGQueryString) (*TSIGReportResponse, error)
	// GetTsigKeyZones retrieves DNS Zones using tsig key
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#gettsigkeys
	GetTsigKeyZones(context.Context, *TSIGKey) (*ZoneNameListResponse, error)
	// GetTsigKeyAliases retrieves a DNS Zone's aliases
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#posttsigusedby
	GetTsigKeyAliases(context.Context, string) (*ZoneNameListResponse, error)
	// Bulk Zones tsig key update
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#posttsigbulkupdate
	TsigKeyBulkUpdate(context.Context, *TSIGKeyBulkPost) error
	// GetZoneKey retrieves a DNS Zone's key
	// See:  https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getzonekey
	GetTsigKey(context.Context, string) (*TSIGKeyResponse, error)
	// Delete tsig key for zone
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#deletezonekey
	DeleteTsigKey(context.Context, string) error
	// Update tsig key for zone
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#putzonekey
	UpdateTsigKey(context.Context, *TSIGKey, string) error
}

TSIGKeys contains operations available on TSIKeyG resource See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html

type TSIGQueryString

type TSIGQueryString struct {
	ContractIds []string `json:"contractIds,omitempty"`
	Search      string   `json:"search,omitempty"`
	SortBy      []string `json:"sortBy,omitempty"`
	Gid         int64    `json:"gid,omitempty"`
}

type TSIGReportMeta

type TSIGReportMeta struct {
	TotalElements int64    `json:"totalElements"`
	Search        string   `json:"search,omitempty"`
	Contracts     []string `json:"contracts,omitempty"`
	Gid           int64    `json:"gid,omitempty"`
	SortBy        []string `json:"sortBy,omitempty"`
}

type TSIGReportResponse

type TSIGReportResponse struct {
	Metadata *TSIGReportMeta    `json:"metadata"`
	Keys     []*TSIGKeyResponse `json:"keys,omitempty"`
}

type TSIGZoneAliases

type TSIGZoneAliases struct {
	Aliases []string `json:"aliases"`
}

type ZoneCreate

type ZoneCreate struct {
	Zone                  string   `json:"zone"`
	Type                  string   `json:"type"`
	Masters               []string `json:"masters,omitempty"`
	Comment               string   `json:"comment,omitempty"`
	SignAndServe          bool     `json:"signAndServe"`
	SignAndServeAlgorithm string   `json:"signAndServeAlgorithm,omitempty"`
	TsigKey               *TSIGKey `json:"tsigKey,omitempty"`
	Target                string   `json:"target,omitempty"`
	EndCustomerID         string   `json:"endCustomerId,omitempty"`
	ContractID            string   `json:"contractId,omitempty"`
}

type ZoneListQueryArgs

type ZoneListQueryArgs struct {
	ContractIDs string
	Page        int
	PageSize    int
	Search      string
	ShowAll     bool
	SortBy      string
	Types       string
}

Zone List Query args struct

type ZoneListResponse

type ZoneListResponse struct {
	Metadata *ListMetadata   `json:"metadata,omitempty"`
	Zones    []*ZoneResponse `json:"zones,omitempty"`
}

type ZoneNameListResponse

type ZoneNameListResponse struct {
	Zones   []string `json:"zones"`
	Aliases []string `json:"aliases,omitempty"`
}

Zones List Response

type ZoneNameTypesResponse

type ZoneNameTypesResponse struct {
	Types []string `json:"types"`
}

Recordset Types for Zone|Name Response

type ZoneNamesResponse

type ZoneNamesResponse struct {
	Names []string `json:"names"`
}

returned list of Zone Names

type ZoneQueryString

type ZoneQueryString struct {
	Contract string
	Group    string
}

type ZoneResponse

type ZoneResponse struct {
	Zone                  string   `json:"zone,omitempty"`
	Type                  string   `json:"type,omitempty"`
	Masters               []string `json:"masters,omitempty"`
	Comment               string   `json:"comment,omitempty"`
	SignAndServe          bool     `json:"signAndServe"`
	SignAndServeAlgorithm string   `json:"signAndServeAlgorithm,omitempty"`
	TsigKey               *TSIGKey `json:"tsigKey,omitempty"`
	Target                string   `json:"target,omitempty"`
	EndCustomerID         string   `json:"endCustomerId,omitempty"`
	ContractID            string   `json:"contractId,omitempty"`
	AliasCount            int64    `json:"aliasCount,omitempty"`
	ActivationState       string   `json:"activationState,omitempty"`
	LastActivationDate    string   `json:"lastActivationDate,omitempty"`
	LastModifiedBy        string   `json:"lastModifiedBy,omitempty"`
	LastModifiedDate      string   `json:"lastModifiedDate,omitempty"`
	VersionId             string   `json:"versionId,omitempty"`
}

type Zones

type Zones interface {
	// ListZones retrieves a list of all zones user can access
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getzones
	ListZones(context.Context, ...ZoneListQueryArgs) (*ZoneListResponse, error)
	// NewZone returns a new ZoneCreate object
	NewZone(context.Context, ZoneCreate) *ZoneCreate
	// NewZoneResponse returns a new ZoneResponse object
	NewZoneResponse(context.Context, string) *ZoneResponse
	// NewChangeListResponse returns a new ChangeListResponse object
	NewChangeListResponse(context.Context, string) *ChangeListResponse
	// NewZoneQueryString returns a new ZoneQueryString object
	NewZoneQueryString(context.Context, string, string) *ZoneQueryString
	// GetZone retrieves Zone metadata
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getzone
	GetZone(context.Context, string) (*ZoneResponse, error)
	//GetChangeList treieves Zone changelist
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getchangelist
	GetChangeList(context.Context, string) (*ChangeListResponse, error)
	// GetMasterZoneFile retrieves master zone file
	// https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getversionmasterzonefile
	GetMasterZoneFile(context.Context, string) (string, error)
	//  PostMasterZoneFile updates master zone file
	// https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#postmasterzonefile
	PostMasterZoneFile(context.Context, string, string) error
	// CreateZone
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#postzones
	CreateZone(context.Context, *ZoneCreate, ZoneQueryString, ...bool) error
	// Create Changelist
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#postchangelists
	SaveChangelist(context.Context, *ZoneCreate) error
	// Save changelist for the Zone to create default NS SOA records
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#postchangelistsubmit
	SubmitChangelist(context.Context, *ZoneCreate) error
	// UpdateZone updates the Zone
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#putzone
	UpdateZone(context.Context, *ZoneCreate, ZoneQueryString) error
	// DeleteZone a zone
	// See: N/A
	DeleteZone(context.Context, *ZoneCreate, ZoneQueryString) error
	// ValidateZone validates zone metadata based on type
	ValidateZone(context.Context, *ZoneCreate) error
	// GetZoneNames retrieves a list of a zone's record names
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getzonerecordsetnames
	GetZoneNames(context.Context, string) (*ZoneNamesResponse, error)
	// GetZoneNameTypes retrieves a zone name's record types
	// See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getzonerecordsettypes
	GetZoneNameTypes(context.Context, string, string) (*ZoneNameTypesResponse, error)
	// CreateBulkZones submits create bulk zone request
	// https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#postbulkzonecreate
	CreateBulkZones(context.Context, *BulkZonesCreate, ZoneQueryString) (*BulkZonesResponse, error)
	// DeleteBulkZones submits delete bulk zone request
	// https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#postbulkzonedelete
	DeleteBulkZones(context.Context, *ZoneNameListResponse, ...bool) (*BulkZonesResponse, error)
	// GetBulkZoneCreateStatus retrieves submit request status
	// https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getbulkzonecreatestatus
	GetBulkZoneCreateStatus(context.Context, string) (*BulkStatusResponse, error)
	//GetBulkZoneDeleteStatus retrieves submit request status
	// https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getbulkzonedeletestatus
	GetBulkZoneDeleteStatus(context.Context, string) (*BulkStatusResponse, error)
	// GetBulkZoneCreateResult retrieves create request result
	// https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getbulkzonecreateresult
	GetBulkZoneCreateResult(ctx context.Context, requestid string) (*BulkCreateResultResponse, error)
	// GetBulkZoneDeleteResult retrieves delete request result
	// https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html#getbulkzonedeleteresult
	GetBulkZoneDeleteResult(context.Context, string) (*BulkDeleteResultResponse, error)
}

Zones contains operations available on Zone resources See: https://developer.akamai.com/api/cloud_security/edge_dns_zone_management/v2.html

Jump to

Keyboard shortcuts

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