hapi

package
v8.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 15 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")
	// ErrGetCertificate represents error when getting edge hostname certificate fails
	ErrGetCertificate = errors.New("get edge hostname certificate")
	// ErrNotFound represents error when getting edge hostname fails
	ErrNotFound = errors.New("not found")
)
View Source
var ErrGetChangeRequest = errors.New("get change request")

ErrGetChangeRequest returned when get change request fails

View Source
var (
	// ErrStructValidation is returned when given struct validation failed
	ErrStructValidation = errors.New("struct validation")
)

Functions

This section is empty.

Types

type ChangeRequest

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

ChangeRequest represents change response from api

type ChangeRequests

type ChangeRequests interface {
	// GetChangeRequest request status and details specified by the change ID
	// that is provided when you make a change request.
	//
	// See: https://techdocs.akamai.com/edge-hostnames/reference/get-changeid
	GetChangeRequest(context.Context, GetChangeRequest) (*ChangeRequest, error)
}

ChangeRequests contains operations to query for Change Requests.

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)

	// GetCertificate gets the certificate associated with an enhanced TLS edge hostname
	//
	// See: https://techdocs.akamai.com/edge-hostnames/reference/get-edge-hostname-certificate
	GetCertificate(context.Context, GetCertificateRequest) (*GetCertificateResponse, 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 GetCertificateRequest added in v8.2.0

type GetCertificateRequest struct {
	DNSZone    string
	RecordName string
}

GetCertificateRequest is used to get certificate associated with edge hostname

func (GetCertificateRequest) Validate added in v8.2.0

func (r GetCertificateRequest) Validate() error

Validate validates GetCertificateRequest

type GetCertificateResponse added in v8.2.0

type GetCertificateResponse struct {
	AvailableDomains []string  `json:"availableDomains"`
	CertificateID    string    `json:"certificateId"`
	CertificateType  string    `json:"certificateType"`
	CommonName       string    `json:"commonName"`
	ExpirationDate   time.Time `json:"expirationDate"`
	SerialNumber     string    `json:"serialNumber"`
	SlotNumber       int       `json:"slotNumber"`
	Status           string    `json:"status"`
	ValidationType   string    `json:"validationType"`
}

GetCertificateResponse represents edge hostname certificate

type GetChangeRequest

type GetChangeRequest struct {
	ChangeID int
}

GetChangeRequest is a request struct

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"`
	MapAlias               string    `json:"mapAlias"`
	UseCases               []UseCase `json:"useCases"`
}

GetEdgeHostnameResponse represents edge hostname

type HAPI

type HAPI interface {
	ChangeRequests
	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) GetCertificate added in v8.2.0

func (m *Mock) GetCertificate(ctx context.Context, req GetCertificateRequest) (*GetCertificateResponse, error)

func (*Mock) GetChangeRequest

func (m *Mock) GetChangeRequest(ctx context.Context, req GetChangeRequest) (*ChangeRequest, 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