Documentation ¶
Overview ¶
Package papi provides a simple wrapper for the Akamai Property Manager API
Index ¶
- Constants
- Variables
- func Init(config edgegrid.Config)
- func PrintRules(rules *Rules) error
- type Activation
- func (activation *Activation) Cancel(property *Property) error
- func (activation *Activation) GetActivation(property *Property) (time.Duration, error)
- func (activation *Activation) Init()
- func (activation *Activation) PollStatus(property *Property) bool
- func (activation *Activation) Save(property *Property, acknowledgeWarnings bool) error
- type ActivationComplianceRecord
- type ActivationValue
- type Activations
- func (activations *Activations) GetActivations(property *Property) error
- func (activations *Activations) GetLatestActivation(network NetworkValue, status StatusValue) (*Activation, error)
- func (activations *Activations) GetLatestProductionActivation(status StatusValue) (*Activation, error)
- func (activations *Activations) GetLatestStagingActivation(status StatusValue) (*Activation, error)
- type AvailableBehavior
- type AvailableBehaviors
- type AvailableCriteria
- type Behavior
- type ClientSettings
- type ClonePropertyFrom
- type CnameTypeValue
- type Contract
- type Contracts
- type CpCode
- type CpCodes
- type Criteria
- type EdgeHostname
- type EdgeHostnames
- func (edgeHostnames *EdgeHostnames) AddEdgeHostname(edgeHostname *EdgeHostname)
- func (edgeHostnames *EdgeHostnames) FindEdgeHostname(edgeHostname *EdgeHostname) (*EdgeHostname, error)
- func (edgeHostnames *EdgeHostnames) GetEdgeHostnames(contract *Contract, group *Group, options string) error
- func (edgeHostnames *EdgeHostnames) NewEdgeHostname() *EdgeHostname
- func (edgeHostnames *EdgeHostnames) PostUnmarshalJSON() error
- type Group
- func (group *Group) GetCpCodes(contract *Contract) (*CpCodes, error)
- func (group *Group) GetEdgeHostnames(contract *Contract, options string) (*EdgeHostnames, error)
- func (group *Group) GetGroup()
- func (group *Group) GetProperties(contract *Contract) (*Properties, error)
- func (group *Group) NewProperty(contract *Contract) (*Property, error)
- type Groups
- type Hostname
- type Hostnames
- type NetworkValue
- type OptionValue
- type Product
- type Products
- type Properties
- func (properties *Properties) AddProperty(newProperty *Property)
- func (properties *Properties) FindProperty(name string) (*Property, error)
- func (properties *Properties) GetProperties(contract *Contract, group *Group) error
- func (properties *Properties) NewProperty(contract *Contract, group *Group) *Property
- func (properties *Properties) PostUnmarshalJSON() error
- type Property
- func (property *Property) Activate(activation *Activation, acknowledgeWarnings bool) error
- func (property *Property) Delete() error
- func (property *Property) GetActivations() (*Activations, error)
- func (property *Property) GetAvailableBehaviors() (*AvailableBehaviors, error)
- func (property *Property) GetHostnames(version *Version) (*Hostnames, error)
- func (property *Property) GetLatestVersion(activatedOn NetworkValue) (*Version, error)
- func (property *Property) GetProperty() error
- func (property *Property) GetRules() (*Rules, error)
- func (property *Property) GetRulesDigest() (string, error)
- func (property *Property) GetVersions() (*Versions, error)
- func (property *Property) PostUnmarshalJSON() error
- func (property *Property) PreMarshalJSON() error
- func (property *Property) Save() error
- type Rule
- type RuleCriteriaMustSatisfyValue
- type RuleErrors
- type RuleFormats
- type Rules
- func (rules *Rules) AddBehaviorOptions(path string, newOptions OptionValue) error
- func (rules *Rules) AddChildBehavior(path string, behavior *Behavior) error
- func (rules *Rules) AddChildCriteria(path string, criteria *Criteria) error
- func (rules *Rules) AddChildRule(path string, rule *Rule) error
- func (rules *Rules) AddCriteriaOptions(path string, newOptions OptionValue) error
- func (rules *Rules) FindBehavior(path string) (*Behavior, error)
- func (rules *Rules) FindCriteria(path string) (*Criteria, error)
- func (rules *Rules) FindParentRule(path string) (*Rule, error)
- func (rules *Rules) FindRule(path string) (*Rule, error)
- func (rules *Rules) Freeze(format string) error
- func (rules *Rules) GetAllRules() []*Rule
- func (rules *Rules) GetRules(property *Property) error
- func (rules *Rules) GetRulesDigest(property *Property) (string, error)
- func (rules *Rules) PostUnmarshalJSON() error
- func (rules *Rules) PreMarshalJSON() error
- func (rules *Rules) Save() error
- func (rules *Rules) SetBehaviorOptions(path string, newOptions OptionValue) error
- func (rules *Rules) SetChildBehavior(path string, behavior *Behavior) error
- func (rules *Rules) SetChildCriteria(path string, criteria *Criteria) error
- func (rules *Rules) SetChildRule(path string, rule *Rule) error
- func (rules *Rules) SetCriteriaOptions(path string, newOptions OptionValue) error
- type StatusValue
- type Version
- type Versions
- func (versions *Versions) AddVersion(version *Version)
- func (versions *Versions) GetLatestVersion(activatedOn NetworkValue) (*Version, error)
- func (versions *Versions) GetVersions(property *Property) error
- func (versions *Versions) NewVersion(createFromVersion *Version, useEtagStrict bool) *Version
- func (versions *Versions) PostUnmarshalJSON() error
Constants ¶
const ( // ActivationTypeActivate Activation.ActivationType value ACTIVATE ActivationTypeActivate ActivationValue = "ACTIVATE" // ActivationTypeDeactivate Activation.ActivationType value DEACTIVATE ActivationTypeDeactivate ActivationValue = "DEACTIVATE" // NetworkProduction Activation.Network value PRODUCTION NetworkProduction NetworkValue = "PRODUCTION" // NetworkStaging Activation.Network value STAGING NetworkStaging NetworkValue = "STAGING" // StatusActive Activation.Status value ACTIVE StatusActive StatusValue = "ACTIVE" // StatusInactive Activation.Status value INACTIVE StatusInactive StatusValue = "INACTIVE" // StatusPending Activation.Status value PENDING StatusPending StatusValue = "PENDING" // StatusZone1 Activation.Status value ZONE_1 StatusZone1 StatusValue = "ZONE_1" // StatusZone2 Activation.Status value ZONE_2 StatusZone2 StatusValue = "ZONE_2" // StatusZone3 Activation.Status value ZONE_3 StatusZone3 StatusValue = "ZONE_3" // StatusAborted Activation.Status value ABORTED StatusAborted StatusValue = "ABORTED" // StatusFailed Activation.Status value FAILED StatusFailed StatusValue = "FAILED" // StatusDeactivated Activation.Status value DEACTIVATED StatusDeactivated StatusValue = "DEACTIVATED" // StatusPendingDeactivation Activation.Status value PENDING_DEACTIVATION StatusPendingDeactivation StatusValue = "PENDING_DEACTIVATION" // StatusNew Activation.Status value NEW StatusNew StatusValue = "NEW" )
const ( ErrInvalidPath = iota ErrCriteriaNotFound ErrBehaviorNotFound ErrRuleNotFound ErrInvalidRules )
Error constants
Variables ¶
var (
Config edgegrid.Config
)
var ( ErrorMap = map[int]error{ ErrInvalidPath: errors.New("Invalid Path"), ErrCriteriaNotFound: errors.New("Criteria not found"), ErrBehaviorNotFound: errors.New("Behavior not found"), ErrRuleNotFound: errors.New("Rule not found"), ErrInvalidRules: errors.New("Rule validation failed. See papi.Rules.Errors for details"), } )
Functions ¶
func PrintRules ¶
PrintRules prints a reasonably easy to read tree of all rules and behaviors on a property
Types ¶
type Activation ¶
type Activation struct { client.Resource ActivationID string `json:"activationId,omitempty"` ActivationType ActivationValue `json:"activationType,omitempty"` AcknowledgeWarnings []string `json:"acknowledgeWarnings,omitempty"` ComplianceRecord *ActivationComplianceRecord `json:"complianceRecord,omitempty"` FastPush bool `json:"fastPush,omitempty"` IgnoreHTTPErrors bool `json:"ignoreHttpErrors,omitempty"` PropertyName string `json:"propertyName,omitempty"` PropertyID string `json:"propertyId,omitempty"` PropertyVersion int `json:"propertyVersion"` Network NetworkValue `json:"network"` Status StatusValue `json:"status,omitempty"` SubmitDate string `json:"submitDate,omitempty"` UpdateDate string `json:"updateDate,omitempty"` Note string `json:"note,omitempty"` NotifyEmails []string `json:"notifyEmails"` StatusChange chan bool `json:"-"` // contains filtered or unexported fields }
Activation represents a property activation resource
func NewActivation ¶
func NewActivation(parent *Activations) *Activation
NewActivation creates a new Activation
func (*Activation) Cancel ¶
func (activation *Activation) Cancel(property *Property) error
Cancel an activation in progress
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#cancelapendingactivation Endpoint: DELETE /papi/v1/properties/{propertyId}/activations/{activationId}{?contractId,groupId}
func (*Activation) GetActivation ¶
func (activation *Activation) GetActivation(property *Property) (time.Duration, error)
GetActivation populates the Activation resource
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getanactivation Endpoint: GET /papi/v1/properties/{propertyId}/activations/{activationId}{?contractId,groupId}
func (*Activation) Init ¶
func (activation *Activation) Init()
func (*Activation) PollStatus ¶
func (activation *Activation) PollStatus(property *Property) bool
PollStatus will responsibly poll till the property is active or an error occurs
The Activation.StatusChange is a channel that can be used to block on status changes. If a new valid status is returned, true will be sent to the channel, otherwise, false will be sent.
go activation.PollStatus(property) for activation.Status != edgegrid.StatusActive { select { case statusChanged := <-activation.StatusChange: if statusChanged == false { break } case <-time.After(time.Minute * 30): break } } if activation.Status == edgegrid.StatusActive { // Activation succeeded }
func (*Activation) Save ¶
func (activation *Activation) Save(property *Property, acknowledgeWarnings bool) error
Save activates a given property
If acknowledgeWarnings is true and warnings are returned on the first attempt, a second attempt is made, acknowledging the warnings.
See: Property.Activate() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#activateaproperty Endpoint: POST /papi/v1/properties/{propertyId}/activations/{?contractId,groupId}
type ActivationComplianceRecord ¶
type ActivationComplianceRecord struct {
NoncomplianceReason string `json:"noncomplianceReason,omitempty"`
}
type ActivationValue ¶
type ActivationValue string
ActivationValue is used to create an "enum" of possible Activation.ActivationType values
type Activations ¶
type Activations struct { client.Resource AccountID string `json:"accountId"` ContractID string `json:"contractId"` GroupID string `json:"groupId"` Activations struct { Items []*Activation `json:"items"` } `json:"activations"` }
Activations is a collection of property activations
func (*Activations) GetActivations ¶
func (activations *Activations) GetActivations(property *Property) error
GetActivations retrieves activation data for a given property
See: Property.GetActivations() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listactivations Endpoint: GET /papi/v1/properties/{propertyId}/activations/{?contractId,groupId}
func (*Activations) GetLatestActivation ¶
func (activations *Activations) GetLatestActivation(network NetworkValue, status StatusValue) (*Activation, error)
GetLatestActivation gets the latest activation for the specified network
Default to NetworkProduction. Pass in a status to check for, defaults to StatusActive
func (*Activations) GetLatestProductionActivation ¶
func (activations *Activations) GetLatestProductionActivation(status StatusValue) (*Activation, error)
GetLatestProductionActivation retrieves the latest activation for the production network
Pass in a status to check for, defaults to StatusActive
func (*Activations) GetLatestStagingActivation ¶
func (activations *Activations) GetLatestStagingActivation(status StatusValue) (*Activation, error)
GetLatestStagingActivation retrieves the latest activation for the staging network
Pass in a status to check for, defaults to StatusActive
type AvailableBehavior ¶
type AvailableBehavior struct { client.Resource Name string `json:"name"` SchemaLink string `json:"schemaLink"` // contains filtered or unexported fields }
AvailableBehavior represents an available behavior resource
func NewAvailableBehavior ¶
func NewAvailableBehavior(parent *AvailableBehaviors) *AvailableBehavior
NewAvailableBehavior creates a new AvailableBehavior
func (*AvailableBehavior) GetSchema ¶
func (behavior *AvailableBehavior) GetSchema() (*gojsonschema.Schema, error)
GetSchema retrieves the JSON schema for an available behavior
type AvailableBehaviors ¶
type AvailableBehaviors struct { client.Resource ContractID string `json:"contractId"` GroupID string `json:"groupId"` ProductID string `json:"productId"` RuleFormat string `json:"ruleFormat"` Behaviors struct { Items []AvailableBehavior `json:"items"` } `json:"behaviors"` }
AvailableBehaviors represents a collection of available rule behaviors
func GetAvailableBehaviors ¶
func GetAvailableBehaviors(property *Property) (*AvailableBehaviors, error)
GetAvailableBehaviors retrieves all available behaviors for a property
func NewAvailableBehaviors ¶
func NewAvailableBehaviors() *AvailableBehaviors
NewAvailableBehaviors creates a new AvailableBehaviors
func (*AvailableBehaviors) GetAvailableBehaviors ¶
func (availableBehaviors *AvailableBehaviors) GetAvailableBehaviors(property *Property) error
GetAvailableBehaviors retrieves available behaviors for a given property
See: Property.GetAvailableBehaviors API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listavailablebehaviors Endpoint: GET /papi/v1/properties/{propertyId}/versions/{propertyVersion}/available-behaviors{?contractId,groupId}
func (*AvailableBehaviors) PostUnmarshalJSON ¶
func (availableBehaviors *AvailableBehaviors) PostUnmarshalJSON() error
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
type AvailableCriteria ¶
type AvailableCriteria struct { client.Resource ContractID string `json:"contractId"` GroupID string `json:"groupId"` ProductID string `json:"productId"` RuleFormat string `json:"ruleFormat"` AvailableCriteria struct { Items []struct { Name string `json:"name"` SchemaLink string `json:"schemaLink"` } `json:"items"` } `json:"availableCriteria"` }
AvailableCriteria represents a collection of available rule criteria
func GetAvailableCriteria ¶
func GetAvailableCriteria(property *Property) (*AvailableCriteria, error)
GetAvailableCriteria retrieves all available criteria for a property
func NewAvailableCriteria ¶
func NewAvailableCriteria() *AvailableCriteria
NewAvailableCriteria creates a new AvailableCriteria
func (*AvailableCriteria) GetAvailableCriteria ¶
func (availableCriteria *AvailableCriteria) GetAvailableCriteria(property *Property) error
GetAvailableCriteria retrieves criteria available for a given property
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listavailablecriteria Endpoint: GET /papi/v1/properties/{propertyId}/versions/{propertyVersion}/available-criteria{?contractId,groupId}
type Behavior ¶
type Behavior struct { client.Resource Name string `json:"name"` Options *OptionValue `json:"options"` // contains filtered or unexported fields }
Behavior represents a rule behavior resource
type ClientSettings ¶
type ClientSettings struct { client.Resource RuleFormat string `json:"ruleFormat"` }
ClientSettings represents the PAPI client settings resource
func NewClientSettings ¶
func NewClientSettings() *ClientSettings
NewClientSettings creates a new ClientSettings
func (*ClientSettings) GetClientSettings ¶
func (clientSettings *ClientSettings) GetClientSettings() error
GetClientSettings populates ClientSettings
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getclientsettings Endpoint: GET /papi/v1/client-settings
func (*ClientSettings) Save ¶
func (clientSettings *ClientSettings) Save() error
Save updates client settings
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#updateclientsettings Endpoint: PUT /papi/v1/client-settings
type ClonePropertyFrom ¶
type ClonePropertyFrom struct { client.Resource PropertyID string `json:"propertyId"` Version int `json:"version"` CopyHostnames bool `json:"copyHostnames,omitempty"` CloneFromVersionEtag string `json:"cloneFromVersionEtag,omitempty"` }
ClonePropertyFrom represents
func NewClonePropertyFrom ¶
func NewClonePropertyFrom() *ClonePropertyFrom
NewClonePropertyFrom creates a new ClonePropertyFrom
type CnameTypeValue ¶
type CnameTypeValue string
CnameTypeValue is used to create an "enum" of possible Hostname.CnameType values
const ( // CnameTypeEdgeHostname Hostname.CnameType value EDGE_HOSTNAME CnameTypeEdgeHostname CnameTypeValue = "EDGE_HOSTNAME" )
type Contract ¶
type Contract struct { client.Resource ContractID string `json:"contractId"` ContractTypeName string `json:"contractTypeName"` // contains filtered or unexported fields }
Contract represents a property contract resource
func (*Contract) GetContract ¶
GetContract populates a Contract
func (*Contract) GetProducts ¶
GetProducts gets products associated with a contract
type Contracts ¶
type Contracts struct { client.Resource AccountID string `json:"accountId"` Contracts struct { Items []*Contract `json:"items"` } `json:"contracts"` }
Contracts represents a collection of property manager contracts
func (*Contracts) GetContracts ¶
GetContracts populates Contracts with contract data
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listcontracts Endpoint: GET /papi/v1/contracts
func (*Contracts) PostUnmarshalJSON ¶
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
type CpCode ¶
type CpCode struct { client.Resource CpcodeID string `json:"cpcodeId,omitempty"` CpcodeName string `json:"cpcodeName"` ProductID string `json:"productId,omitempty"` ProductIDs []string `json:"productIds,omitempty"` CreatedDate time.Time `json:"createdDate,omitempty"` // contains filtered or unexported fields }
CpCode represents a single CP Code
API Docs: https://developer.akamai.com/api/luna/papi/data.html#cpcode
func (*CpCode) GetCpCode ¶
GetCpCode populates the *CpCode with it's data
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getacpcode Endpoint: GET /papi/v1/cpcodes/{cpcodeId}{?contractId,groupId}
func (*CpCode) ID ¶
ID retrieves a CP Codes integer ID
PAPI Behaviors require the integer ID, rather than the prefixed string returned
func (*CpCode) Save ¶
Save will create a new CP Code. You cannot update a CP Code; trying to do so will result in an error.
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#createanewcpcode Endpoint: POST /papi/v1/cpcodes/{?contractId,groupId}
type CpCodes ¶
type CpCodes struct { client.Resource AccountID string `json:"accountId"` Contract *Contract `json:"-"` ContractID string `json:"contractId"` GroupID string `json:"groupId"` Group *Group `json:"-"` CpCodes struct { Items []*CpCode `json:"items"` } `json:"cpcodes"` }
CpCodes represents a collection of CP Codes
See: CpCodes.GetCpCodes() API Docs: https://developer.akamai.com/api/luna/papi/data.html#cpcode
func GetCpCodes ¶
GetCpCodes creates a new CpCodes struct and populates it with all CP Codes associated with a contract/group
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listcpcodes
func NewCpCodes ¶
NewCpCodes creates a new *CpCodes
func (*CpCodes) GetCpCodes ¶
GetCpCodes populates a *CpCodes with it's related CP Codes
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listcpcodes Endpoint: GET /papi/v1/cpcodes/{?contractId,groupId}
func (*CpCodes) NewCpCode ¶
NewCpCode creates a new *CpCode associated with this *CpCodes as it's parent.
func (*CpCodes) PostUnmarshalJSON ¶
PostUnmarshalJSON is called after UnmarshalJSON to setup the structs internal state. The cpcodes.Complete channel is utilized to communicate full completion.
type Criteria ¶
type Criteria struct { client.Resource Name string `json:"name"` Options *OptionValue `json:"options"` // contains filtered or unexported fields }
Criteria represents a rule criteria resource
type EdgeHostname ¶
type EdgeHostname struct { client.Resource EdgeHostnameID string `json:"edgeHostnameId,omitempty"` EdgeHostnameDomain string `json:"edgeHostnameDomain,omitempty"` ProductID string `json:"productId"` DomainPrefix string `json:"domainPrefix"` DomainSuffix string `json:"domainSuffix"` Status StatusValue `json:"status,omitempty"` Secure bool `json:"secure,omitempty"` IPVersionBehavior string `json:"ipVersionBehavior,omitempty"` MapDetailsSerialNumber int `json:"mapDetails:serialNumber,omitempty"` MapDetailsSlotNumber int `json:"mapDetails:slotNumber,omitempty"` MapDetailsMapDomain string `json:"mapDetails:mapDomain,omitempty"` StatusChange chan bool `json:"-"` // contains filtered or unexported fields }
EdgeHostname represents an Edge Hostname resource
func NewEdgeHostname ¶
func NewEdgeHostname(edgeHostnames *EdgeHostnames) *EdgeHostname
NewEdgeHostname creates a new EdgeHostname
func (*EdgeHostname) GetEdgeHostname ¶
func (edgeHostname *EdgeHostname) GetEdgeHostname(options string) error
GetEdgeHostname populates EdgeHostname with data
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getanedgehostname Endpoint: GET /papi/v1/edgehostnames/{edgeHostnameId}{?contractId,groupId,options}
func (*EdgeHostname) Init ¶
func (edgeHostname *EdgeHostname) Init()
func (*EdgeHostname) PollStatus ¶
func (edgeHostname *EdgeHostname) PollStatus(options string) bool
PollStatus will responsibly poll till the property is active or an error occurs
The EdgeHostname.StatusChange is a channel that can be used to block on status changes. If a new valid status is returned, true will be sent to the channel, otherwise, false will be sent.
go edgeHostname.PollStatus("") for edgeHostname.Status != edgegrid.StatusActive { select { case statusChanged := <-edgeHostname.StatusChange: if statusChanged == false { break } case <-time.After(time.Minute * 30): break } } if edgeHostname.Status == edgegrid.StatusActive { // EdgeHostname activated successfully }
func (*EdgeHostname) Save ¶
func (edgeHostname *EdgeHostname) Save(options string) error
Save creates a new Edge Hostname
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#createanewedgehostname Endpoint: POST /papi/v1/edgehostnames/{?contractId,groupId,options}
type EdgeHostnames ¶
type EdgeHostnames struct { client.Resource AccountID string `json:"accountId"` ContractID string `json:"contractId"` GroupID string `json:"groupId"` EdgeHostnames struct { Items []*EdgeHostname `json:"items"` } `json:"edgeHostnames"` }
EdgeHostnames is a collection for PAPI Edge Hostname resources
func GetEdgeHostnames ¶
func GetEdgeHostnames(contract *Contract, group *Group, options string) (*EdgeHostnames, error)
GetEdgeHostnames retrieves all edge hostnames
func NewEdgeHostnames ¶
func NewEdgeHostnames() *EdgeHostnames
NewEdgeHostnames creates a new EdgeHostnames
func (*EdgeHostnames) AddEdgeHostname ¶
func (edgeHostnames *EdgeHostnames) AddEdgeHostname(edgeHostname *EdgeHostname)
func (*EdgeHostnames) FindEdgeHostname ¶
func (edgeHostnames *EdgeHostnames) FindEdgeHostname(edgeHostname *EdgeHostname) (*EdgeHostname, error)
func (*EdgeHostnames) GetEdgeHostnames ¶
func (edgeHostnames *EdgeHostnames) GetEdgeHostnames(contract *Contract, group *Group, options string) error
GetEdgeHostnames will populate EdgeHostnames with Edge Hostname data
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listedgehostnames Endpoint: GET /papi/v1/edgehostnames/{?contractId,groupId,options}
func (*EdgeHostnames) NewEdgeHostname ¶
func (edgeHostnames *EdgeHostnames) NewEdgeHostname() *EdgeHostname
NewEdgeHostname creates a new EdgeHostname within a given EdgeHostnames
func (*EdgeHostnames) PostUnmarshalJSON ¶
func (edgeHostnames *EdgeHostnames) PostUnmarshalJSON() error
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
type Group ¶
type Group struct { client.Resource GroupName string `json:"groupName"` GroupID string `json:"groupId"` ParentGroupID string `json:"parentGroupId,omitempty"` ContractIDs []string `json:"contractIds"` // contains filtered or unexported fields }
Group represents a group resource
func (*Group) GetCpCodes ¶
GetCpCodes retrieves all CP codes associated with a given group and contract
func (*Group) GetEdgeHostnames ¶
func (group *Group) GetEdgeHostnames(contract *Contract, options string) (*EdgeHostnames, error)
GetEdgeHostnames retrieves all Edge hostnames associated with a given group/contract
func (*Group) GetProperties ¶
func (group *Group) GetProperties(contract *Contract) (*Properties, error)
GetProperties retrieves all properties associated with a given group and contract
type Groups ¶
type Groups struct { client.Resource AccountID string `json:"accountId"` AccountName string `json:"accountName"` Groups struct { Items []*Group `json:"items"` } `json:"groups"` }
Groups represents a collection of PAPI groups
func (*Groups) GetGroups ¶
GetGroups populates Groups with group data
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listgroups Endpoint: GET /papi/v1/groups/
func (*Groups) PostUnmarshalJSON ¶
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
type Hostname ¶
type Hostname struct { client.Resource CnameType CnameTypeValue `json:"cnameType"` EdgeHostnameID string `json:"edgeHostnameId"` CnameFrom string `json:"cnameFrom"` CnameTo string `json:"cnameTo,omitempty"` // contains filtered or unexported fields }
Hostname represents a property hostname resource
type Hostnames ¶
type Hostnames struct { client.Resource AccountID string `json:"accountId"` ContractID string `json:"contractId"` GroupID string `json:"groupId"` PropertyID string `json:"propertyId"` PropertyVersion int `json:"propertyVersion"` Etag string `json:"etag"` Hostnames struct { Items []*Hostname `json:"items"` } `json:"hostnames"` }
Hostnames is a collection of Property Hostnames
func (*Hostnames) GetHostnames ¶
GetHostnames retrieves hostnames assigned to a given property
If no version is given, the latest version is used ¶
See: Property.GetHostnames() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listapropertyshostnames Endpoint: GET /papi/v1/properties/{propertyId}/versions/{propertyVersion}/hostnames/{?contractId,groupId}
func (*Hostnames) NewHostname ¶
NewHostname creates a new Hostname within a given Hostnames
func (*Hostnames) PostUnmarshalJSON ¶
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
type NetworkValue ¶
type NetworkValue string
NetworkValue is used to create an "enum" of possible Activation.Network values
type OptionValue ¶
type OptionValue client.JSONBody
OptionValue represents a generic option value
OptionValue is a map with string keys, and any type of value. You can nest OptionValues as necessary to create more complex values.
type Product ¶
type Product struct { client.Resource ProductName string `json:"productName"` ProductID string `json:"productId"` // contains filtered or unexported fields }
Product represents a product resource
type Products ¶
type Products struct { client.Resource AccountID string `json:"accountId"` ContractID string `json:"contractId"` Products struct { Items []*Product `json:"items"` } `json:"products"` }
Products represents a collection of products
func GetProducts ¶
GetProducts retrieves all products
func (*Products) GetProducts ¶
GetProducts populates Products with product data
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listproducts Endpoint: GET /papi/v1/products/{?contractId}
func (*Products) PostUnmarshalJSON ¶
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
type Properties ¶
type Properties struct { client.Resource Properties struct { Items []*Property `json:"items"` } `json:"properties"` }
Properties is a collection of PAPI Property resources
func GetProperties ¶
func GetProperties(contract *Contract, group *Group) (*Properties, error)
GetProperties retrieves all properties for a given contract/group
func (*Properties) AddProperty ¶
func (properties *Properties) AddProperty(newProperty *Property)
AddProperty adds a property to the collection, if the property already exists in the collection it will be replaced.
func (*Properties) FindProperty ¶
func (properties *Properties) FindProperty(name string) (*Property, error)
FindProperty finds a property by name within the collection
func (*Properties) GetProperties ¶
func (properties *Properties) GetProperties(contract *Contract, group *Group) error
GetProperties populates Properties with property data
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listproperties Endpoint: GET /papi/v1/properties/{?contractId,groupId}
func (*Properties) NewProperty ¶
func (properties *Properties) NewProperty(contract *Contract, group *Group) *Property
NewProperty creates a new property associated with the collection
func (*Properties) PostUnmarshalJSON ¶
func (properties *Properties) PostUnmarshalJSON() error
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
type Property ¶
type Property struct { client.Resource AccountID string `json:"accountId,omitempty"` Contract *Contract `json:"-"` Group *Group `json:"-"` ContractID string `json:"contractId,omitempty"` GroupID string `json:"groupId,omitempty"` PropertyID string `json:"propertyId,omitempty"` PropertyName string `json:"propertyName"` LatestVersion int `json:"latestVersion,omitempty"` StagingVersion int `json:"stagingVersion,omitempty"` ProductionVersion int `json:"productionVersion,omitempty"` Note string `json:"note,omitempty"` ProductID string `json:"productId,omitempty"` CloneFrom *ClonePropertyFrom `json:"cloneFrom"` // contains filtered or unexported fields }
Property represents a PAPI Property
func NewProperty ¶
func NewProperty(parent *Properties) *Property
NewProperty creates a new Property
func (*Property) Activate ¶
func (property *Property) Activate(activation *Activation, acknowledgeWarnings bool) error
Activate activates a given property
If acknowledgeWarnings is true and warnings are returned on the first attempt, a second attempt is made, acknowledging the warnings.
See: Activation.Save() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#activateaproperty Endpoint: POST /papi/v1/properties/{propertyId}/activations/{?contractId,groupId}
func (*Property) Delete ¶
Delete a property
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#removeaproperty Endpoint: DELETE /papi/v1/properties/{propertyId}{?contractId,groupId}
func (*Property) GetActivations ¶
func (property *Property) GetActivations() (*Activations, error)
GetActivations retrieves activation data for a given property
See: Activations.GetActivations() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listactivations Endpoint: GET /papi/v1/properties/{propertyId}/activations/{?contractId,groupId}
func (*Property) GetAvailableBehaviors ¶
func (property *Property) GetAvailableBehaviors() (*AvailableBehaviors, error)
GetAvailableBehaviors retrieves available behaviors for a given property
See: AvailableBehaviors.GetAvailableBehaviors API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listavailablebehaviors Endpoint: GET /papi/v1/properties/{propertyId}/versions/{propertyVersion}/available-behaviors{?contractId,groupId}
func (*Property) GetHostnames ¶
GetHostnames retrieves hostnames assigned to a given property
If no version is given, the latest version is used ¶
See: Hostnames.GetHostnames() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listapropertyshostnames Endpoint: GET /papi/v1/properties/{propertyId}/versions/{propertyVersion}/hostnames/{?contractId,groupId}
func (*Property) GetLatestVersion ¶
func (property *Property) GetLatestVersion(activatedOn NetworkValue) (*Version, error)
GetLatestVersion gets the latest active version, optionally of a given network
See: Versions.GetLatestVersion() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getthelatestversion Endpoint: GET /papi/v1/properties/{propertyId}/versions/latest{?contractId,groupId,activatedOn}
func (*Property) GetProperty ¶
GetProperty populates a Property
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getaproperty Endpoint: GET /papi/v1/properties/{propertyId}{?contractId,groupId}
func (*Property) GetRules ¶
GetRules retrieves rules for a property
See: Rules.GetRules API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getaruletree Endpoint: GET /papi/v1/properties/{propertyId}/versions/{propertyVersion}/rules/{?contractId,groupId}
func (*Property) GetRulesDigest ¶
GetRulesDigest fetches the Etag for a rule tree
See: Rules.GetRulesDigest() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getaruletreesdigest Endpoint: HEAD /papi/v1/properties/{propertyId}/versions/{propertyVersion}/rules/{?contractId,groupId}
func (*Property) GetVersions ¶
GetVersions retrieves all versions for a a given property
See: Versions.GetVersions() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listversions Endpoint: GET /papi/v1/properties/{propertyId}/versions/{?contractId,groupId}
func (*Property) PostUnmarshalJSON ¶
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
func (*Property) PreMarshalJSON ¶
PreMarshalJSON is called before JSON marshaling
See: jsonhooks-v1/json.Marshal()
func (*Property) Save ¶
Save will create a property, optionally cloned from another property
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#createorcloneaproperty Endpoint: POST /papi/v1/properties/{?contractId,groupId}
type Rule ¶
type Rule struct { client.Resource Depth int `json:"-"` Name string `json:"name"` Criteria []*Criteria `json:"criteria,omitempty"` Behaviors []*Behavior `json:"behaviors,omitempty"` Children []*Rule `json:"children,omitempty"` Comments string `json:"comments,omitempty"` CriteriaLocked bool `json:"criteriaLocked,omitempty"` CriteriaMustSatisfy RuleCriteriaMustSatisfyValue `json:"criteriaMustSatisfy,omitempty"` UUID string `json:"uuid,omitempty"` Options struct { IsSecure bool `json:"is_secure,omitempty"` } `json:"options,omitempty"` // contains filtered or unexported fields }
Rule represents a property rule resource
func (*Rule) AddBehavior ¶
AddBehavior appends a rule behavior
func (*Rule) AddChildRule ¶
AddChildRule appends a child rule
func (*Rule) AddCriteria ¶
AddCriteria appends a rule criteria
type RuleCriteriaMustSatisfyValue ¶
type RuleCriteriaMustSatisfyValue string
const ( RuleCriteriaMustSatisfyAll RuleCriteriaMustSatisfyValue = "any" RuleCriteriaMustSatisfyAny RuleCriteriaMustSatisfyValue = "all" )
type RuleErrors ¶
type RuleErrors struct { client.Resource Type string `json:"type"` Title string `json:"title"` Detail string `json:"detail"` Instance string `json:"instance"` BehaviorName string `json:"behaviorName"` }
RuleErrors represents an validate error returned for a rule
type RuleFormats ¶
type RuleFormats struct { client.Resource RuleFormats struct { Items []string `json:"items"` } `json:"ruleFormats"` }
RuleFormats is a collection of available rule formats
func (*RuleFormats) GetLatest ¶
func (ruleFormats *RuleFormats) GetLatest() (string, error)
func (*RuleFormats) GetRuleFormats ¶
func (ruleFormats *RuleFormats) GetRuleFormats() error
GetRuleFormats populates RuleFormats
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listruleformats Endpoint: GET /papi/v1/rule-formats
func (*RuleFormats) GetSchema ¶
func (ruleFormats *RuleFormats) GetSchema(product string, ruleFormat string) (*gojsonschema.Schema, error)
GetSchema fetches the schema for a given product and rule format
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getaruleformatsschema Endpoint: /papi/v1/schemas/products/{productId}/{ruleFormat}
type Rules ¶
type Rules struct { client.Resource AccountID string `json:"accountId"` ContractID string `json:"contractId"` GroupID string `json:"groupId"` PropertyID string `json:"propertyId"` PropertyVersion int `json:"propertyVersion"` Etag string `json:"etag"` RuleFormat string `json:"ruleFormat"` Rules *Rule `json:"rules"` Errors []*RuleErrors `json:"errors,omitempty"` }
Rules is a collection of property rules
func (*Rules) AddBehaviorOptions ¶
func (rules *Rules) AddBehaviorOptions(path string, newOptions OptionValue) error
AddBehaviorOptions adds/replaces options on a given behavior path
path is a / delimited path from the root of the rule set to the behavior. Individual existing options are overwritten. To replace all options, see SetBehaviorOptions instead.
For example, to change the CP Code, the behavior exists at the root, and is called "cpCode", making the path, "/cpCode":
rules.AddBehaviorOptions( "/cpCode", edgegrid.OptionValue{ "value": edgegrid.OptionValue{ "id": cpcode, }, }, )
The adaptiveImageCompression behavior defaults to being under the Performance -> JPEG Images, making the path "/Performance/JPEG Images/adaptiveImageCompression":
rules.AddBehaviorOptions( "/Performance/JPEG Images/adaptiveImageCompression", edgegrid.OptionValue{ "tier3StandardCompressionValue": 30, }, )
This will only change the "tier3StandardCompressionValue" option value.
func (*Rules) AddChildBehavior ¶
AddChildBehavior adds a behavior as a child of the given rule path
If the behavior already exists, it's options are merged with the existing options.
func (*Rules) AddChildCriteria ¶
AddChildCriteria adds criteria as a child of the rule specified by the given path
If the criteria already exists it's options are added to the existing criteria.
func (*Rules) AddChildRule ¶
AddChildRule adds a rule as a child of the rule specified by the given path
If the rule already exists, criteria, behaviors, and child rules are added to the existing rule.
func (*Rules) AddCriteriaOptions ¶
func (rules *Rules) AddCriteriaOptions(path string, newOptions OptionValue) error
AddCriteriaOptions adds/replaces options on a given Criteria path
path is a / delimited path from the root of the rule set to the criteria. Individual existing options are overwritten. To replace all options, see SetCriteriaOptions instead.
func (*Rules) FindBehavior ¶
FindBehavior locates a specific behavior by path
See SetBehaviorOptions and AddBehaviorOptions for examples of paths.
func (*Rules) FindCriteria ¶
FindCriteria locates a specific Critieria by path
See SetCriteriaOptions and AddCriteriaOptions for examples of paths.
func (*Rules) FindParentRule ¶
Find the parent rule for a given rule, criteria, or behavior path
func (*Rules) FindRule ¶
FindRule locates a specific rule by path
See SetBehaviorOptions and AddBehaviorOptions for examples of paths.
func (*Rules) GetAllRules ¶
GetAllRules returns a flattened rule tree for easy iteration
Each Rule has a Depth property that makes it possible to identify it's original placement in the tree.
func (*Rules) GetRules ¶
GetRules populates Rules with rule data for a given property
See: Property.GetRules API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getaruletree Endpoint: GET /papi/v1/properties/{propertyId}/versions/{propertyVersion}/rules/{?contractId,groupId}
func (*Rules) GetRulesDigest ¶
GetRulesDigest fetches the Etag for a rule tree
See: Property.GetRulesDigest() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getaruletreesdigest Endpoint: HEAD /papi/v1/properties/{propertyId}/versions/{propertyVersion}/rules/{?contractId,groupId}
func (*Rules) PostUnmarshalJSON ¶
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()
func (*Rules) PreMarshalJSON ¶
PreMarshalJSON is called before JSON marshaling
See: jsonhooks-v1/json.Marshal()
func (*Rules) Save ¶
Save creates/updates a rule tree for a property
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#updatearuletree Endpoint: PUT /papi/v1/properties/{propertyId}/versions/{propertyVersion}/rules/{?contractId,groupId}
func (*Rules) SetBehaviorOptions ¶
func (rules *Rules) SetBehaviorOptions(path string, newOptions OptionValue) error
SetBehaviorOptions sets the options on a given behavior path
path is a / delimited path from the root of the rule set to the behavior. All existing options are overwritten. To add/replace options see AddBehaviorOptions instead.
For example, to set the CP Code, the behavior exists at the root, and is called "cpCode", making the path, "/cpCode":
rules.SetBehaviorOptions( "/cpCode", edgegrid.OptionValue{ "value": edgegrid.OptionValue{ "id": cpcode, }, }, )
The adaptiveImageCompression behavior defaults to being under the Performance -> JPEG Images, making the path "/Performance/JPEG Images/adaptiveImageCompression":
rules.SetBehaviorOptions( "/Performance/JPEG Images/adaptiveImageCompression"", edgegrid.OptionValue{ "tier3StandardCompressionValue": 30, }, )
However, this would replace all other options for that behavior, meaning the example would fail to validate without the other required options.
func (*Rules) SetChildBehavior ¶
SetChildBehavior adds a behavior as a child of the given rule path
If the behavior already exists it is replaced with the given behavior
func (*Rules) SetChildCriteria ¶
SetChildCriteria adds criteria as a child of the rule specified by the given path
If the criteria already exists it will replace the existing criteria.
func (*Rules) SetChildRule ¶
SetChildRule adds a rule as a child of the rule specified by the given path
If the rule already exists, it is replaced by the given rule.
func (*Rules) SetCriteriaOptions ¶
func (rules *Rules) SetCriteriaOptions(path string, newOptions OptionValue) error
SetCriteriaOptions sets the options on a given criteria path
path is a / delimited path from the root of the rule set to the criteria. All existing options are overwritten. To add/replace options see AddCriteriaOptions instead.
type StatusValue ¶
type StatusValue string
StatusValue is used to create an "enum" of possible Activation.Status values
type Version ¶
type Version struct { client.Resource PropertyVersion int `json:"propertyVersion,omitempty"` UpdatedByUser string `json:"updatedByUser,omitempty"` UpdatedDate time.Time `json:"updatedDate,omitempty"` ProductionStatus StatusValue `json:"productionStatus,omitempty"` StagingStatus StatusValue `json:"stagingStatus,omitempty"` Etag string `json:"etag,omitempty"` ProductID string `json:"productId,omitempty"` Note string `json:"note,omitempty"` CreateFromVersion int `json:"createFromVersion,omitempty"` CreateFromVersionEtag string `json:"createFromVersionEtag,omitempty"` // contains filtered or unexported fields }
Version represents a Property Version
func (*Version) GetVersion ¶
GetVersion populates a Version
Api Docs: https://developer.akamai.com/api/luna/papi/resources.html#getaversion Endpoint: /papi/v1/properties/{propertyId}/versions/{propertyVersion}{?contractId,groupId}
func (*Version) HasBeenActivated ¶
func (version *Version) HasBeenActivated(activatedOn NetworkValue) (bool, error)
HasBeenActivated determines if a given version has been activated, optionally on a specific network
func (*Version) Save ¶
Save creates a new version
API Docs: https://developer.akamai.com/api/luna/papi/resources.html#createanewversion Endpoint: POST /papi/v1/properties/{propertyId}/versions/{?contractId,groupId}
type Versions ¶
type Versions struct { client.Resource PropertyID string `json:"propertyId"` PropertyName string `json:"propertyName"` AccountID string `json:"accountId"` ContractID string `json:"contractId"` GroupID string `json:"groupId"` Versions struct { Items []*Version `json:"items"` } `json:"versions"` RuleFormat string `json:"ruleFormat,omitempty"` }
Versions contains a collection of Property Versions
func GetVersions ¶
GetVersions retrieves all versions for a given property
func (*Versions) AddVersion ¶
AddVersion adds or replaces a version within the collection
func (*Versions) GetLatestVersion ¶
func (versions *Versions) GetLatestVersion(activatedOn NetworkValue) (*Version, error)
GetLatestVersion retrieves the latest Version for a property
See: Property.GetLatestVersion() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#getthelatestversion Endpoint: GET /papi/v1/properties/{propertyId}/versions/latest{?contractId,groupId,activatedOn}
func (*Versions) GetVersions ¶
GetVersions retrieves all versions for a a given property
See: Property.GetVersions() API Docs: https://developer.akamai.com/api/luna/papi/resources.html#listversions Endpoint: GET /papi/v1/properties/{propertyId}/versions/{?contractId,groupId}
func (*Versions) NewVersion ¶
NewVersion creates a new version associated with the Versions collection
func (*Versions) PostUnmarshalJSON ¶
PostUnmarshalJSON is called after JSON unmarshaling into EdgeHostnames
See: jsonhooks-v1/jsonhooks.Unmarshal()