hapi

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package hapi provides access to the Akamai Edge Hostnames APIs

See: https://techdocs.akamai.com/edge-hostnames/reference/api

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDeleteEdgeHostname represents error when deleting edge hostname fails
	ErrDeleteEdgeHostname = errors.New("delete edge hostname")
	// ErrGetEdgeHostname represents error when getting edge hostname fails
	ErrGetEdgeHostname = errors.New("get edge hostname")
	// ErrUpdateEdgeHostname represents error when updating edge hostname fails
	ErrUpdateEdgeHostname = errors.New("update edge hostname")
)
View Source
var (
	// ErrStructValidation is returned when given struct validation failed
	ErrStructValidation = errors.New("struct validation")
)

Functions

This section is empty.

Types

type ChinaCDN

type ChinaCDN struct {
	IsChinaCDN        bool   `json:"isChinaCdn,omitempty"`
	CustomChinaCDNMap string `json:"customChinaCdnMap,omitempty"`
}

ChinaCDN represents China CDN settings of EdgeHostname

type ClientFunc

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

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

type DeleteEdgeHostnameRequest

type DeleteEdgeHostnameRequest struct {
	DNSZone           string
	RecordName        string
	StatusUpdateEmail []string
	Comments          string
}

DeleteEdgeHostnameRequest is used to delete edge hostname

func (DeleteEdgeHostnameRequest) Validate

func (r DeleteEdgeHostnameRequest) Validate() error

Validate validates DeleteEdgeHostnameRequest

type DeleteEdgeHostnameResponse

type DeleteEdgeHostnameResponse struct {
	Action            string         `json:"action"`
	ChangeID          int            `json:"changeId"`
	Comments          string         `json:"comments"`
	Status            string         `json:"status"`
	StatusMessage     string         `json:"statusMessage"`
	StatusUpdateDate  string         `json:"statusUpdateDate"`
	StatusUpdateEmail string         `json:"statusUpdateEmail"`
	SubmitDate        string         `json:"submitDate"`
	Submitter         string         `json:"submitter"`
	SubmitterEmail    string         `json:"submitterEmail"`
	EdgeHostnames     []EdgeHostname `json:"edgeHostnames"`
}

DeleteEdgeHostnameResponse is a response from deleting edge hostname

type EdgeHostname

type EdgeHostname struct {
	EdgeHostnameID         int       `json:"edgeHostnameId,omitempty"`
	RecordName             string    `json:"recordName"`
	DNSZone                string    `json:"dnsZone"`
	SecurityType           string    `json:"securityType"`
	UseDefaultTTL          bool      `json:"useDefaultTtl"`
	UseDefaultMap          bool      `json:"useDefaultMap"`
	TTL                    int       `json:"ttl"`
	Map                    string    `json:"map,omitempty"`
	SlotNumber             int       `json:"slotNumber,omitempty"`
	IPVersionBehavior      string    `json:"ipVersionBehavior,omitempty"`
	Comments               string    `json:"comments,omitempty"`
	ChinaCDN               ChinaCDN  `json:"chinaCdn,omitempty"`
	CustomTarget           string    `json:"customTarget,omitempty"`
	IsEdgeIPBindingEnabled bool      `json:"isEdgeIPBindingEnabled,omitempty"`
	MapAlias               string    `json:"mapAlias,omitempty"`
	ProductId              string    `json:"productId,omitempty"`
	SerialNumber           int       `json:"serialNumber,omitempty"`
	UseCases               []UseCase `json:"useCases,omitempty"`
}

EdgeHostname represents edge hostname part of DeleteEdgeHostnameResponse and UpdateEdgeHostnameResponse

type EdgeHostnames

type EdgeHostnames interface {
	// DeleteEdgeHostname allows deleting a specific edge hostname.
	// You must have an Admin or Technical role in order to delete an edge hostname.
	// You can delete any hostname that’s not currently part of an active Property Manager configuration.
	//
	// See: https://techdocs.akamai.com/edge-hostnames/reference/delete-edgehostname
	DeleteEdgeHostname(context.Context, DeleteEdgeHostnameRequest) (*DeleteEdgeHostnameResponse, error)

	// GetEdgeHostname gets a specific edge hostname's details including its product ID, IP version behavior,
	// and China CDN or Edge IP Binding status.
	//
	// See: https://techdocs.akamai.com/edge-hostnames/reference/get-edgehostnameid
	GetEdgeHostname(context.Context, int) (*GetEdgeHostnameResponse, error)

	// UpdateEdgeHostname allows update ttl (path = "/ttl") or IpVersionBehaviour (path = "/ipVersionBehavior")
	//
	// See: https://techdocs.akamai.com/edge-hostnames/reference/patch-edgehostnames
	UpdateEdgeHostname(context.Context, UpdateEdgeHostnameRequest) (*UpdateEdgeHostnameResponse, error)
}

EdgeHostnames contains operations available on Edge Hostname resource.

type Error

type Error struct {
	Type            string      `json:"type"`
	Title           string      `json:"title"`
	Detail          string      `json:"detail"`
	Instance        string      `json:"instance,omitempty"`
	RequestInstance string      `json:"requestInstance,omitempty"`
	Method          string      `json:"method,omitempty"`
	RequestTime     string      `json:"requestTime,omitempty"`
	BehaviorName    string      `json:"behaviorName,omitempty"`
	ErrorLocation   string      `json:"errorLocation,omitempty"`
	Status          int         `json:"status,omitempty"`
	DomainPrefix    string      `json:"domainPrefix,omitempty"`
	DomainSuffix    string      `json:"domainSuffix,omitempty"`
	Errors          []ErrorItem `json:"errors,omitempty"`
}

Error is a hapi 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 ErrorItem

type ErrorItem struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

ErrorItem represents single error item

type GetEdgeHostnameResponse

type GetEdgeHostnameResponse struct {
	EdgeHostnameID         int      `json:"edgeHostnameId"`
	RecordName             string   `json:"recordName"`
	DNSZone                string   `json:"dnsZone"`
	SecurityType           string   `json:"securityType"`
	UseDefaultTTL          bool     `json:"useDefaultTtl"`
	UseDefaultMap          bool     `json:"useDefaultMap"`
	IPVersionBehavior      string   `json:"ipVersionBehavior"`
	ProductID              string   `json:"productId"`
	TTL                    int      `json:"ttl"`
	Map                    string   `json:"map,omitempty"`
	SlotNumber             int      `json:"slotNumber,omitempty"`
	Comments               string   `json:"comments"`
	SerialNumber           int      `json:"serialNumber,omitempty"`
	CustomTarget           string   `json:"customTarget,omitempty"`
	ChinaCdn               ChinaCDN `json:"chinaCdn,omitempty"`
	IsEdgeIPBindingEnabled bool     `json:"isEdgeIPBindingEnabled,omitempty"`
}

GetEdgeHostnameResponse represents edge hostname

type HAPI

type HAPI interface {
	EdgeHostnames
}

HAPI is the hapi api interface

func Client

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

Client returns a new hapi Client instance with the specified controller

type Mock

type Mock struct {
	mock.Mock
}

func (*Mock) DeleteEdgeHostname

func (m *Mock) DeleteEdgeHostname(ctx context.Context, request DeleteEdgeHostnameRequest) (*DeleteEdgeHostnameResponse, error)

func (*Mock) GetEdgeHostname

func (m *Mock) GetEdgeHostname(ctx context.Context, id int) (*GetEdgeHostnameResponse, error)

func (*Mock) UpdateEdgeHostname

func (m *Mock) UpdateEdgeHostname(ctx context.Context, request UpdateEdgeHostnameRequest) (*UpdateEdgeHostnameResponse, error)

type Option

type Option func(*hapi)

Option defines a HAPI option

type UpdateEdgeHostnameRequest

type UpdateEdgeHostnameRequest struct {
	DNSZone           string
	RecordName        string
	StatusUpdateEmail []string
	Comments          string
	Body              []UpdateEdgeHostnameRequestBody
}

UpdateEdgeHostnameRequest is a request used to update edge hostname

func (UpdateEdgeHostnameRequest) Validate

func (r UpdateEdgeHostnameRequest) Validate() error

Validate validates DeleteEdgeHostnameRequest

type UpdateEdgeHostnameRequestBody

type UpdateEdgeHostnameRequestBody struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value string `json:"value"`
}

UpdateEdgeHostnameRequestBody is a request's body used to update edge hostname

func (UpdateEdgeHostnameRequestBody) Validate

func (b UpdateEdgeHostnameRequestBody) Validate() error

Validate validates UpdateEdgeHostnameRequestBody

type UpdateEdgeHostnameResponse

type UpdateEdgeHostnameResponse struct {
	Action            string         `json:"action,omitempty"`
	ChangeID          int            `json:"changeId,omitempty"`
	Comments          string         `json:"comments,omitempty"`
	Status            string         `json:"status,omitempty"`
	StatusMessage     string         `json:"statusMessage,omitempty"`
	StatusUpdateDate  string         `json:"statusUpdateDate,omitempty"`
	StatusUpdateEmail string         `json:"statusUpdateEmail,omitempty"`
	SubmitDate        string         `json:"submitDate,omitempty"`
	Submitter         string         `json:"submitter,omitempty"`
	SubmitterEmail    string         `json:"submitterEmail,omitempty"`
	EdgeHostnames     []EdgeHostname `json:"edgeHostnames,omitempty"`
}

UpdateEdgeHostnameResponse is a response from deleting edge hostname

type UseCase

type UseCase struct {
	Type    string `json:"type,omitempty"`
	Option  string `json:"option"`
	UseCase string `json:"useCase"`
}

UseCase represents useCase attribute in EdgeHostname

Jump to

Keyboard shortcuts

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