apiendpoints

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAgeUnitSeconds MaxAgeUnitValue = "SECONDS"
	MaxAgeUnitMinutes MaxAgeUnitValue = "MINUTES"
	MaxAgeUnitHours   MaxAgeUnitValue = "HOURS"
	MaxAgeUnitDays    MaxAgeUnitValue = "DAYS"

	CacheResourceOptionCache                             CacheResourceOptionValue = "CACHE"
	CacheResourceOptionBypassCache                       CacheResourceOptionValue = "BYPASS_CACHE"
	CacheResourceOptionNoStore                           CacheResourceOptionValue = "NO_STORE"
	CacheResourceOptionHonorOriginCacheControl           CacheResourceOptionValue = "HONOR_ORIGIN_CACHE_CONTROL"
	CacheResourceOptionHonorOriginExpires                CacheResourceOptionValue = "HONOR_ORIGIN_EXPIRES"
	CacheResourceOptionHonorOriginCacheControlAndExpires CacheResourceOptionValue = "HONOR_ORIGIN_CACHE_CONTROL_AND_EXPIRES"
)
View Source
const (
	APIParameterLocationHeader APIParameterLocationValue = "header"
	APIParameterLocationCookie APIParameterLocationValue = "cookie"
	APIParameterLocationQuery  APIParameterLocationValue = "query"
	APIParameterLocationBody   APIParameterLocationValue = "body"

	APIParameterTypeString  APIParameterTypeValue = "string"
	APIParameterTypeInteger APIParameterTypeValue = "integer"
	APIParameterTypeNumber  APIParameterTypeValue = "number"
	APIParameterTypeBoolean APIParameterTypeValue = "boolean"
	APIParameterTypeJson    APIParameterTypeValue = "json/xml"
	APIParameterTypeXml     APIParameterTypeValue = "json/xml"
)
View Source
const (
	StatusPending     string = "PENDING"
	StatusActive      string = "ACTIVE"
	StatusDeactivated string = "DEACTIVATED"
	StatusFailed      string = "FAILED"
)

Variables

View Source
var (
	// Config contains the Akamai OPEN Edgegrid API credentials
	// for automatic signing of requests
	Config edgegrid.Config
)

Functions

func Init

func Init(config edgegrid.Config)

Init sets the CCU edgegrid Config

func IsActive

func IsActive(endpoint *Endpoint, network string) bool

Types

type APIParameterLocationValue

type APIParameterLocationValue string

type APIParameterTypeValue

type APIParameterTypeValue string

type APIPrivacyResource

type APIPrivacyResource struct {
	ResourceSettings
	Notes  string `json:"notes"`
	Public bool   `json:"public"`
}

type APIPrivacySettings

type APIPrivacySettings struct {
	Resources map[int]APIPrivacyResource `json:"resources"`
	Public    bool                       `json:"public"`
}

type AcgPair

type AcgPair []struct {
	DisplayName string `json:"displayName"`
	AcgID       string `json:"acgId"`
	GroupID     int    `json:"groupId"`
	ContractID  string `json:"contractId"`
}

type ActivateEndpointOptions

type ActivateEndpointOptions struct {
	APIEndPointId int
	VersionNumber int
}

type Activation

type Activation struct {
	Networks               []string `json:"networks"`
	NotificationRecipients []string `json:"notificationRecipients"`
	Notes                  string   `json:"notes"`
}

func ActivateEndpoint

func ActivateEndpoint(options *ActivateEndpointOptions, activation *Activation) (*Activation, error)

func DeactivateEndpoint

func DeactivateEndpoint(options *ActivateEndpointOptions, activation *Activation) (*Activation, error)

type CORSSetings

type CORSSetings struct {
	Enabled          bool          `json:"enabled"`
	AllowedOrigins   []string      `json:"allowedOrigins,omitempty"`
	AllowedHeaders   []string      `json:"allowedHeaders,omitempty"`
	AllowedMethods   []MethodValue `json:"allowedMethods,omitempty"`
	AllowCredentials bool          `json:"allowCredentials,omitempty"`
	ExposedHeaders   []string      `json:"exposedHeaders,omitempty"`
	PreflightMaxAge  int           `json:"preflightMaxAge,omitempty"`
}

type CacheResource

type CacheResource struct {
	ResourceSettings
	Option     CacheResourceOptionValue `json:"option"`
	MaxAge     *MaxAge                  `json:"maxAge"`
	ServeStale bool                     `json:"serveStale"`
}

type CacheResourceOptionValue

type CacheResourceOptionValue string

type CacheSettings

type CacheSettings struct {
	Enabled           bool                  `json:"enabled"`
	Option            string                `json:"option"`
	MaxAge            *MaxAge               `json:"maxAge"`
	ServeStale        bool                  `json:"serveStale"`
	DownstreamCaching DownstreamCaching     `json:"downstreamCaching"`
	ErrorCaching      ErrorCaching          `json:"errorCaching"`
	Resources         map[int]CacheResource `json:"resources"`
}

type Category

type Category struct {
	APICategoryID          int    `json:"apiCategoryId,omitempty"`
	APICategoryName        string `json:"apiCategoryName"`
	APICategoryDescription string `json:"apiCategoryDescription"`
	Link                   string `json:"link"`
	LockVersion            int    `json:"lockVersion"`
	CreatedBy              string `json:"createdBy,omitempty"`
	CreateDate             string `json:"createDate,omitempty"`
	UpdatedBy              string `json:"updatedBy,omitempty"`
	UpdateDate             string `json:"updateDate,omitempty"`
}

type CloneVersionOptions

type CloneVersionOptions struct {
	EndpointId int
	Version    int
}

type CompressResponseValue

type CompressResponseValue string
const (
	CompressResponseAlways       CompressResponseValue = "ALWAYS"
	CompressResponseNever        CompressResponseValue = "NEVER"
	CompressResponseSameAsOrigin CompressResponseValue = "SAME_AS_ORIGIN"
)

type CreateEndpointFromFileOptions

type CreateEndpointFromFileOptions struct {
	File       string
	Format     string
	ContractId string
	GroupId    int
}

type CreateEndpointOptions

type CreateEndpointOptions struct {
	ContractId string   `json:"contractId,omitempty"`
	GroupId    int      `json:"groupId,omitempty"`
	Name       string   `json:"apiEndPointName,omitempty"`
	BasePath   string   `json:"basePath,omitempty"`
	Hostnames  []string `json:"apiEndPointHosts,omitempty"`
}

type DownstreamCaching

type DownstreamCaching struct {
	Option        string  `json:"option"`
	Lifetime      string  `json:"lifetime"`
	MaxAge        *MaxAge `json:"maxAge"`
	Headers       string  `json:"headers"`
	MarkAsPrivate bool    `json:"markAsPrivate"`
}

type Endpoint

type Endpoint struct {
	APICategoryIds             []int                 `json:"apiCategoryIds,omitempty"`
	APIEndPointHosts           []string              `json:"apiEndPointHosts"`
	APIEndPointID              int                   `json:"apiEndPointId,omitempty"`
	APIEndPointLocked          bool                  `json:"apiEndPointLocked,omitempty"`
	APIEndPointName            string                `json:"apiEndPointName"`
	APIEndPointScheme          string                `json:"apiEndPointScheme,omitempty"`
	APIResourceBaseInfo        []*ResourceBaseInfo   `json:"apiResourceBaseInfo,omitempty"`
	BasePath                   string                `json:"basePath,omitempty"`
	ClonedFromVersion          *int                  `json:"clonedFromVersion,omitempty"`
	ConsumeType                string                `json:"consumeType,omitempty"`
	ContractID                 string                `json:"contractId,omitempty"`
	CreateDate                 string                `json:"createDate,omitempty"`
	CreatedBy                  string                `json:"createdBy,omitempty"`
	Description                string                `json:"description,omitempty"`
	GroupID                    int                   `json:"groupId,omitempty"`
	ProductionVersion          *VersionSummary       `json:"productionVersion,omitempty"`
	ProductionStatus           string                `json:"productionStatus,omitempty"`
	ProtectedByAPIKey          bool                  `json:"protectedByApiKey,omitempty"`
	StagingStatus              string                `json:"stagingStatus,omitempty"`
	StagingVersion             *VersionSummary       `json:"stagingVersion,omitempty"`
	UpdateDate                 string                `json:"updateDate,omitempty"`
	UpdatedBy                  string                `json:"updatedBy,omitempty"`
	VersionNumber              int                   `json:"versionNumber,omitempty"`
	SecurityScheme             *SecurityScheme       `json:"securityScheme,omitempty"`
	AkamaiSecurityRestrictions *SecurityRestrictions `json:"akamaiSecurityRestrictions,omitempty"`
	APIResources               *Resources            `json:"apiResources,omitempty"`
}

func CloneVersion

func CloneVersion(options *CloneVersionOptions) (*Endpoint, error)

func CreateEndpoint

func CreateEndpoint(options *CreateEndpointOptions) (*Endpoint, error)

func CreateEndpointFromFile

func CreateEndpointFromFile(options *CreateEndpointFromFileOptions) (*Endpoint, error)

func GetVersion

func GetVersion(options *GetVersionOptions) (*Endpoint, error)

func ModifyVersion

func ModifyVersion(endpoint *Endpoint) (*Endpoint, error)

func RemoveEndpoint

func RemoveEndpoint(endpointId int) (*Endpoint, error)

func RemoveVersion

func RemoveVersion(options *RemoveVersionOptions) (*Endpoint, error)

func UpdateEndpointFromFile

func UpdateEndpointFromFile(options *UpdateEndpointFromFileOptions) (*Endpoint, error)

type EndpointList

type EndpointList struct {
	APIEndPoints Endpoints `json:"apiEndPoints"`
	Links        Links     `json:"links"`
	Page         int       `json:"page"`
	PageSize     int       `json:"pageSize"`
	TotalSize    int       `json:"totalSize"`
}

func (*EndpointList) ListEndpoints

func (list *EndpointList) ListEndpoints(options *ListEndpointOptions) error

type Endpoints

type Endpoints []Endpoint

type ErrorCaching

type ErrorCaching struct {
	Enabled       bool    `json:"enabled"`
	MaxAge        *MaxAge `json:"maxAge"`
	PreserveStale bool    `json:"preserveStale"`
}

type GetVersionOptions

type GetVersionOptions struct {
	EndpointId int
	Version    int
}

type GzipSettings

type GzipSettings struct {
	CompressResponse CompressResponseValue `json:"compressResponse"`
}

type ImportResult

type ImportResult struct {
	APIEndpointDetails Endpoint `json:"apiEndpointDetails"`
	Problems           Problems `json:"problems"`
}

type JWTClaim

type JWTClaim struct {
	Name     string   `json:"name"`
	Validate bool     `json:"validate"`
	Required bool     `json:"required"`
	Value    []string `json:"value"`
	Type     string   `json:"type"`
}

type JWTSettings

type JWTSettings struct {
	Enabled  bool `json:"enabled"`
	Settings struct {
		Location   JWTSettingsLocationValue `json:"location"`
		ParamName  string                   `json:"paramName"`
		ClockSkew  int                      `json:"clockSkew"`
		Validation *struct {
			Claims        []JWTClaim    `json:"claims"`
			RsaPublicKeyA RsaPublicKey  `json:"rsaPublicKeyA"`
			RsaPublicKeyB *RsaPublicKey `json:"rsaPublicKeyB,omitempty"`
		} `json:"validation"`
	} `json:"settings"`
	Resources map[int]JWTSettingsResource `json:"resources"`
}

type JWTSettingsLocationValue

type JWTSettingsLocationValue string
const (
	JWTSettingsLocationHeader JWTSettingsLocationValue = "HEADER"
	JWTSettingsLocationCookie JWTSettingsLocationValue = "COOKIE"
	JWTSettingsLocationQuery  JWTSettingsLocationValue = "QUERY"
)

type JWTSettingsResource

type JWTSettingsResource struct {
	ResourceSettings
	Enabled bool    `json:"enabled"`
	Notes   *string `json:"notes,omitempty"`
}
type Links []struct {
	Rel  string `json:"rel"`
	Href string `json:"href"`
}

type ListEndpointOptions

type ListEndpointOptions struct {
	ContractId        string `url:"contractId,omitempty"`
	GroupId           int    `url:"groupId,omitempty"`
	Category          string `url:"category,omitempty"`
	Contains          string `url:"contains,omitempty"`
	Page              int    `url:"page,omitempty"`
	PageSize          int    `url:"pageSize,omitempty"`
	Show              string `url:show,omitempty`
	SortBy            string `url:"sortBy,omitempty"`
	SortOrder         string `url:"sortOrder,omitempty"`
	VersionPreference string `url:"versionPreference,omitempty"`
}

type ListVersionsOptions

type ListVersionsOptions struct {
	EndpointId int
}

type MaxAge

type MaxAge struct {
	Duration int    `json:"duration"`
	Unit     string `json:"unit"`
}

type MaxAgeUnitValue

type MaxAgeUnitValue string

type Method

type Method struct {
	APIResourceMethodID      int          `json:"apiResourceMethodId"`
	APIResourceMethod        MethodValue  `json:"apiResourceMethod"`
	APIResourceMethodLogicID int          `json:"apiResourceMethodLogicId"`
	APIParameters            []Parameters `json:"apiParameters"`
}

type MethodValue

type MethodValue string
const (
	MethodGet     MethodValue = "get"
	MethodPost    MethodValue = "post"
	MethodPut     MethodValue = "put"
	MethodDelete  MethodValue = "delete"
	MethodHead    MethodValue = "head"
	MethodPatch   MethodValue = "patch"
	MethodOptions MethodValue = "options"
)

type Methods

type Methods []Method

type Parameters

type Parameters struct {
	APIChildParameters      []*Parameters             `json:"apiChildParameters"`
	APIParameterID          int                       `json:"apiParameterId"`
	APIParameterRequired    bool                      `json:"apiParameterRequired"`
	APIParameterName        string                    `json:"apiParameterName"`
	APIParameterLocation    APIParameterLocationValue `json:"apiParameterLocation"`
	APIParameterType        APIParameterTypeValue     `json:"apiParameterType"`
	APIParameterNotes       *string                   `json:"apiParameterNotes"`
	APIParamLogicID         int                       `json:"apiParamLogicId"`
	Array                   bool                      `json:"array"`
	APIParameterRestriction struct {
		RangeRestriction struct {
			RangeMin int `json:"rangeMin"`
			RangeMax int `json:"rangeMax"`
		} `json:"rangeRestriction"`
	} `json:"apiParameterRestriction"`
}

type Problem

type Problem struct {
	Detail   string   `json:"detail"`
	Errors   Problems `json:"errors"`
	Instance string   `json:"instance"`
	Status   int      `json:"status"`
	Title    string   `json:"title"`
	Type     string   `json:"type"`
}

type Problems

type Problems []*Problem

type RemoveVersionOptions

type RemoveVersionOptions struct {
	EndpointId    int
	VersionNumber int
}

type Resource

type Resource struct {
	APIResourceID           int     `json:"apiResourceId"`
	APIResourceName         string  `json:"apiResourceName"`
	ResourcePath            string  `json:"resourcePath"`
	Description             string  `json:"description"`
	LockVersion             int     `json:"lockVersion"`
	APIResourceClonedFromID *int    `json:"apiResourceClonedFromId"`
	APIResourceLogicID      int     `json:"apiResourceLogicId"`
	CreatedBy               string  `json:"createdBy"`
	CreateDate              string  `json:"createDate"`
	UpdatedBy               string  `json:"updatedBy"`
	UpdateDate              string  `json:"updateDate"`
	APIResourceMethods      Methods `json:"apiResourceMethods"`
}

type ResourceBaseInfo

type ResourceBaseInfo struct {
	APIResourceClonedFromID *int    `json:"apiResourceClonedFromId"`
	APIResourceID           int     `json:"apiResourceId"`
	APIResourceLogicID      int     `json:"apiResourceLogicId"`
	APIResourceName         string  `json:"apiResourceName"`
	CreateDate              string  `json:"createDate"`
	CreatedBy               string  `json:"createdBy"`
	Description             *string `json:"description"`
	Link                    *string `json:"link"`
	LockVersion             int     `json:"lockVersion"`
	Private                 bool    `json:"private"`
	ResourcePath            string  `json:"resourcePath"`
	UpdateDate              string  `json:"updateDate"`
	UpdatedBy               string  `json:"updatedBy"`
}

type ResourceSettings

type ResourceSettings struct {
	Path                 string        `json:"path"`
	Methods              []MethodValue `json:"methods"`
	InheritsFromEndpoint bool          `json:"inheritsFromEndpoint"`
}

type Resources

type Resources []Resource

func GetResources

func GetResources(endpointId int, version int) (*Resources, error)

type RsaPublicKey

type RsaPublicKey struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

type SecurityRestrictions

type SecurityRestrictions struct {
	MaxJsonxmlElement       int `json:"MAX_JSONXML_ELEMENT,omitempty"`
	MaxElementNameLength    int `json:"MAX_ELEMENT_NAME_LENGTH,omitempty"`
	MaxDocDepth             int `json:"MAX_DOC_DEPTH,omitempty"`
	PositiveSecurityEnabled int `json:"POSITIVE_SECURITY_ENABLED,omitempty"`
	MaxStringLength         int `json:"MAX_STRING_LENGTH,omitempty"`
	MaxBodySize             int `json:"MAX_BODY_SIZE,omitempty"`
	MaxIntegerValue         int `json:"MAX_INTEGER_VALUE,omitempty"`
}

type SecurityScheme

type SecurityScheme struct {
	SecuritySchemeType   string                `json:"securitySchemeType,omitempty"`
	SecuritySchemeDetail *SecuritySchemeDetail `json:"securitySchemeDetail,omitempty"`
}

type SecuritySchemeDetail

type SecuritySchemeDetail struct {
	APIKeyLocation string `json:"apiKeyLocation,omitempty"`
	APIKeyName     string `json:"apiKeyName,omitempty"`
}

type StatusValue

type StatusValue string

type UpdateEndpointFromFileOptions

type UpdateEndpointFromFileOptions struct {
	EndpointId int
	Version    int
	File       string
	Format     string
}

type Version

type Version struct {
	CreatedBy            string       `json:"createdBy"`
	CreateDate           string       `json:"createDate"`
	UpdateDate           string       `json:"updateDate"`
	UpdatedBy            string       `json:"updatedBy"`
	APIEndPointVersionID int          `json:"apiEndPointVersionId"`
	BasePath             string       `json:"basePath"`
	Description          *string      `json:"description`
	BasedOn              *int         `json:"basedOn"`
	StagingStatus        *StatusValue `json:"stagingStatus"`
	ProductionStatus     *StatusValue `json:"productionStatus"`
	StagingDate          *string      `json:"stagingDate"`
	ProductionDate       *string      `json:"productionDate"`
	IsVersionLocked      bool         `json:"isVersionLocked"`
	AvailableActions     []string     `json:"availableActions"`
	VersionNumber        int          `json:"versionNumber"`
	LockVersion          int          `json:"lockVersion"`
}

type VersionSummary

type VersionSummary struct {
	Status        StatusValue `json:"status,omitempty"`
	VersionNumber int         `json:"versionNumber,omitempty"`
}

type Versions

type Versions struct {
	APIEndPointID   int       `json:"apiEndPointId"`
	APIEndPointName string    `json:"apiEndPointName"`
	APIVersions     []Version `json:"apiVersions"`
}

func ListVersions

func ListVersions(options *ListVersionsOptions) (*Versions, error)

Jump to

Keyboard shortcuts

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