agent

package
v1.1.97 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 38 Imported by: 22

Documentation

Index

Constants

View Source
const (
	AgentRunning   = "running"
	AgentStopped   = "stopped"
	AgentFailed    = "failed"
	AgentUnhealthy = "unhealthy"
	// CorsField -
	CorsField = "cors"
	// RedirectURLsField -
	RedirectURLsField = "redirectURLs"
)

AgentStatus - status for Agent resource

Variables

View Source
var (
	ErrDeletingService             = errors.Newf(1161, "error deleting API Service %s in Amplify Central")
	ErrDeletingServiceInstanceItem = errors.Newf(1162, "error deleting API Service Instance %s in Amplify Central")
	ErrUnableToGetAPIV1Resources   = errors.Newf(1163, "error retrieving API Service resource instances for %s")
)

Errors hit when validating Amplify Central connectivity

View Source
var AgentResourceType string

AgentResourceType - Holds the type for agent resource in Central

Functions

func AddUpdateAgentDetails

func AddUpdateAgentDetails(key, value string)

AddUpdateAgentDetails - Adds a new or Updates an existing key on the agent details sub resource

func ApplyResourceToConfig

func ApplyResourceToConfig(cfg interface{}) error

ApplyResourceToConfig - applies the resources to agent configs Uses reflection to get the IResourceConfigCallback interface on the config struct or struct variable. Makes call to ApplyResources method with dataplane and agent resources from API server

func GetAPICache

func GetAPICache() cache.Cache

GetAPICache - Returns the cache

func GetAgentResource

func GetAgentResource() *apiV1.ResourceInstance

GetAgentResource - Returns Agent resource

func GetAgentResourceManager added in v1.1.61

func GetAgentResourceManager() resource.Manager

GetAgentResourceManager - Returns Agent resource

func GetAttributeOnPublishedAPI

func GetAttributeOnPublishedAPI(externalAPIID string, attrName string) string

GetAttributeOnPublishedAPI - DEPRECATED Returns the value on published proxy

func GetAttributeOnPublishedAPIByID

func GetAttributeOnPublishedAPIByID(externalAPIID string, attrName string) string

GetAttributeOnPublishedAPIByID - Returns the value on published proxy

func GetAttributeOnPublishedAPIByName

func GetAttributeOnPublishedAPIByName(apiName string, attrName string) string

GetAttributeOnPublishedAPIByName - Returns the value on published proxy

func GetAttributeOnPublishedAPIByPrimaryKey

func GetAttributeOnPublishedAPIByPrimaryKey(primaryKey string, attrName string) string

GetAttributeOnPublishedAPIByPrimaryKey - Returns the value on published proxy

func GetAuthProviderRegistry

func GetAuthProviderRegistry() oauth.ProviderRegistry

GetAuthProviderRegistry - Returns the auth provider registry

func GetCacheManager

func GetCacheManager() agentcache.Manager

GetCacheManager - Returns the cache

func GetCentralAuthToken

func GetCentralAuthToken() (string, error)

GetCentralAuthToken - Returns the Auth token from AxwayID to make API call to Central

func GetCentralClient

func GetCentralClient() apic.Client

GetCentralClient - Returns the APIC Client

func GetCentralConfig

func GetCentralConfig() config.CentralConfig

GetCentralConfig - Returns the APIC Client

func GetDetailFromAgentResource

func GetDetailFromAgentResource(key string) string

GetDetailFromAgentResource - gets the value of an agent detail from the resource

func GetOwnerOnPublishedAPIByID

func GetOwnerOnPublishedAPIByID(externalAPIID string) *apiV1.Owner

GetOwnerOnPublishedAPIByID - Returns the owner spec of the published proxy

func GetOwnerOnPublishedAPIByName

func GetOwnerOnPublishedAPIByName(apiName string) *apiV1.Owner

GetOwnerOnPublishedAPIByName - Returns the owner spec of the published proxy

func GetOwnerOnPublishedAPIByPrimaryKey

func GetOwnerOnPublishedAPIByPrimaryKey(primaryKey string) *apiV1.Owner

GetOwnerOnPublishedAPIByPrimaryKey - Returns the owner spec of the published proxy

func GetResourceManager added in v1.1.61

func GetResourceManager() resource.Manager

func GetStatus added in v1.1.72

func GetStatus() string

GetStatus - get the last reported status

func GetTeamByID

func GetTeamByID(id string) *definitions.PlatformTeam

GetTeamByID - Returns the PlatformTeam associated with the id

func GetTeamByName

func GetTeamByName(name string) *definitions.PlatformTeam

GetTeamByName - Returns the PlatformTeam associated with the name

func GetUserAgent added in v1.1.96

func GetUserAgent() string

func Initialize

func Initialize(centralCfg config.CentralConfig) error

Initialize - Initializes the agent

func InitializeForTest

func InitializeForTest(apicClient apic.Client, opts ...TestOpt)

InitializeForTest - Initialize for test

func InitializeProfiling

func InitializeProfiling(cpuProfile, memProfile string)

InitializeProfiling - setup the CPU and Memory profiling if options given

func InitializeWithAgentFeatures

func InitializeWithAgentFeatures(centralCfg config.CentralConfig, agentFeaturesCfg config.AgentFeaturesConfig) error

InitializeWithAgentFeatures - Initializes the agent with agent features

func IsAPIPublished

func IsAPIPublished(externalAPIID string) bool

IsAPIPublished - DEPRECATED Returns true if the API Service is already published

func IsAPIPublishedByID

func IsAPIPublishedByID(externalAPIID string) bool

IsAPIPublishedByID - Returns true if the API Service is already published

func IsAPIPublishedByPrimaryKey

func IsAPIPublishedByPrimaryKey(primaryKey string) bool

IsAPIPublishedByPrimaryKey - Returns true if the API Service is already published

func NewAPIKeyAccessRequestBuilder

func NewAPIKeyAccessRequestBuilder() provisioning.AccessRequestBuilder

NewAPIKeyAccessRequestBuilder - called by the agents

func NewAPIKeyCredentialRequestBuilder

func NewAPIKeyCredentialRequestBuilder(options ...func(*crdBuilderOptions)) provisioning.CredentialRequestBuilder

NewAPIKeyCredentialRequestBuilder - add api key base properties for provisioning schema

func NewAccessRequestBuilder

func NewAccessRequestBuilder() provisioning.AccessRequestBuilder

NewAccessRequestBuilder - called by the agents to build and register a new access request definition

func NewBasicAuthAccessRequestBuilder added in v1.1.40

func NewBasicAuthAccessRequestBuilder() provisioning.AccessRequestBuilder

NewBasicAuthAccessRequestBuilder - called by the agents

func NewBasicAuthCredentialRequestBuilder added in v1.1.40

func NewBasicAuthCredentialRequestBuilder(options ...func(*crdBuilderOptions)) provisioning.CredentialRequestBuilder

NewBasicAuthCredentialRequestBuilder - add basic auth base properties for provisioning schema

func NewCredentialRequestBuilder

func NewCredentialRequestBuilder(options ...func(*crdBuilderOptions)) provisioning.CredentialRequestBuilder

NewCredentialRequestBuilder - called by the agents to build and register a new credential request definition

func NewOAuthCredentialRequestBuilder

func NewOAuthCredentialRequestBuilder(options ...func(*crdBuilderOptions)) provisioning.CredentialRequestBuilder

NewOAuthCredentialRequestBuilder - add oauth base properties for provisioning schema

func OnAgentResourceChange

func OnAgentResourceChange(agentResourceChangeHandler ConfigChangeHandler)

OnAgentResourceChange - Registers handler for resource change event

func OnConfigChange

func OnConfigChange(configChangeHandler ConfigChangeHandler)

OnConfigChange - Registers handler for config change event

func PublishAPI

func PublishAPI(serviceBody apic.ServiceBody) error

PublishAPI - Publishes the API

func PublishingLock added in v1.1.42

func PublishingLock()

func PublishingUnlock added in v1.1.42

func PublishingUnlock()

func RefreshTeamCache added in v1.1.71

func RefreshTeamCache()

func RegisterAPIValidator

func RegisterAPIValidator(apiValidator APIValidator)

RegisterAPIValidator - Registers callback for validating the API on gateway

func RegisterDeleteServiceValidator

func RegisterDeleteServiceValidator(validator interface{})

RegisterDeleteServiceValidator - DEPRECATED Registers callback for validating if the service should be deleted

func RegisterProvisioner

func RegisterProvisioner(provisioner provisioning.Provisioning)

RegisterProvisioner - allow the agent to register a provisioner

func RegisterResourceEventHandler

func RegisterResourceEventHandler(name string, resourceEventHandler handler.Handler)

RegisterResourceEventHandler - Registers handler for resource events

func RegisterShutdownHandler added in v1.1.69

func RegisterShutdownHandler(handler ShutdownHandler)

RegisterShutdownHandler - Registers shutdown handler

func RemovePublishedAPIAgentDetail

func RemovePublishedAPIAgentDetail(externalAPIID, detailKey string) error

RemovePublishedAPIAgentDetail -

func StartAgentStatusUpdate

func StartAgentStatusUpdate()

StartAgentStatusUpdate - starts 2 separate jobs that runs the periodic status updates and immediate status updates

func TestWithAgentType added in v1.1.75

func TestWithAgentType(agentType config.AgentType) func(*testOpts)

func TestWithCentralConfig added in v1.1.75

func TestWithCentralConfig(cfg config.CentralConfig) func(*testOpts)

func TestWithMarketplace added in v1.1.74

func TestWithMarketplace() func(*testOpts)

func UnregisterResourceEventHandler

func UnregisterResourceEventHandler(name string)

UnregisterResourceEventHandler - removes the specified resource event handler

func UpdateStatus

func UpdateStatus(status, description string)

UpdateStatus - Updates the agent state

func UpdateStatusWithContext

func UpdateStatusWithContext(ctx context.Context, status, prevStatus, description string)

UpdateStatusWithContext - Updates the agent state providing a context

func UpdateStatusWithPrevious

func UpdateStatusWithPrevious(status, prevStatus, description string)

UpdateStatusWithPrevious - Updates the agent state providing a previous state

func WithCRDDeprovisionExpired added in v1.1.91

func WithCRDDeprovisionExpired() func(c *crdBuilderOptions)

WithCRDDeprovisionExpired - set the flag for deprovisioning expired credential

func WithCRDExpirationDays added in v1.1.91

func WithCRDExpirationDays(expirationDays int) func(c *crdBuilderOptions)

WithCRDExpirationDays - set the expiration days

func WithCRDForIDP

func WithCRDForIDP(p oauth.Provider, scopes []string) func(c *crdBuilderOptions)

WithCRDForIDP - set the schema properties using the provider metadata

func WithCRDIsRenewable added in v1.1.35

func WithCRDIsRenewable() func(c *crdBuilderOptions)

WithCRDIsRenewable - set the flag for renewable credential

func WithCRDIsSuspendable added in v1.1.35

func WithCRDIsSuspendable() func(c *crdBuilderOptions)

WithCRDIsSuspendable - set the flag for suspendable credential

func WithCRDName

func WithCRDName(name string) func(c *crdBuilderOptions)

WithCRDName - set another name for the CRD

func WithCRDOAuthPublicKey

func WithCRDOAuthPublicKey() func(c *crdBuilderOptions)

WithCRDOAuthPublicKey - set that the Oauth cred is key based

func WithCRDOAuthSecret

func WithCRDOAuthSecret() func(c *crdBuilderOptions)

WithCRDOAuthSecret - set that the Oauth cred is secret based

func WithCRDProvisionSchemaProperty

func WithCRDProvisionSchemaProperty(prop provisioning.PropertyBuilder) func(c *crdBuilderOptions)

WithCRDProvisionSchemaProperty - add more provisioning properties

func WithCRDRegisterFunc added in v1.1.91

func WithCRDRegisterFunc(registerFunc provisioning.RegisterCredentialRequestDefinition) func(c *crdBuilderOptions)

WithCRDRegisterFunc - use the provided registration function for creating CRD

func WithCRDRequestSchemaProperty

func WithCRDRequestSchemaProperty(prop provisioning.PropertyBuilder) func(c *crdBuilderOptions)

WithCRDRequestSchemaProperty - add more request properties

func WithCRDTitle added in v1.1.35

func WithCRDTitle(title string) func(c *crdBuilderOptions)

WithCRDTitle - set the title for the CRD

Types

type APIValidator

type APIValidator func(apiID, stageName string) bool

APIValidator - Callback for validating the API

type ConfigChangeHandler

type ConfigChangeHandler func()

ConfigChangeHandler - Callback for Config change event

func GetConfigChangeHandler

func GetConfigChangeHandler() ConfigChangeHandler

GetConfigChangeHandler - returns registered config change handler

type EventSync

type EventSync struct {
	// contains filtered or unexported fields
}

EventSync struct for syncing events from central

func NewEventSync

func NewEventSync() (*EventSync, error)

NewEventSync creates an EventSync

func (*EventSync) RebuildCache added in v1.1.61

func (es *EventSync) RebuildCache()

func (*EventSync) SyncCache

func (es *EventSync) SyncCache() error

SyncCache initializes agent cache and starts the agent in stream or poll mode

type PublishAPIFunc

type PublishAPIFunc func(serviceBody apic.ServiceBody) error

PublishAPIFunc definition for the PublishAPI func

type ShutdownHandler added in v1.1.69

type ShutdownHandler func()

ShutdownHandler - function that the agent may implement to be called when a shutdown request is received

type TestOpt added in v1.1.74

type TestOpt func(*testOpts)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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