sls

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCodeLogstoreIndexNotExist is the error code when Logstore index doesn't exist
	ErrCodeLogstoreIndexNotExist = "IndexConfigNotExist"
	// ErrCreateIndex is the error when failed to create the resource
	ErrCreateIndex = "failed to create a Logstore index"
	// ErrDeleteIndex is the error when failed to delete the resource
	ErrDeleteIndex = "failed to delete the Logstore index"
)
View Source
var (
	// ErrCodeMachineGroupNotExist is the error code when Logtail MachineGroup doesn't exist
	ErrCodeMachineGroupNotExist = "MachineGroupNotExist"
	// ErrCreateMachineGroup is the error when failed to create the resource
	ErrCreateMachineGroup = "failed to create a Logtail MachineGroup"
	// ErrDeleteMachineGroup is the error when failed to delete the resource
	ErrDeleteMachineGroup = "failed to delete the Logtail MachineGroup"

	// ErrGetAppliedConfigs is the error when getting configs from a machine group
	ErrGetAppliedConfigs = "failed to get applied configs from a machine group"
	// ErrApplyConfigToMachineGroup is the error when applying a config to a machine group
	ErrApplyConfigToMachineGroup = "failed to apply a config to a machine group"
	// ErrRemoveConfigFromMachineGroup is the error when removing a config from a machine group
	ErrRemoveConfigFromMachineGroup = "failed to remove a config from a machine group"
)
View Source
var (
	// ErrCodeProjectNotExist error code of ServerError when Project not found
	ErrCodeProjectNotExist = "ProjectNotExist"
	// ErrFailedToGetSLSProject is the error of failing to get an SLS project
	ErrFailedToGetSLSProject = "FailedToGetSLSProject"
	// ErrFailedToCreateSLSProject is the error of failing to create an SLS project
	ErrFailedToCreateSLSProject = "FailedToCreateSLSProject"
	// ErrFailedToUpdateSLSProject is the error of failing to update an SLS project
	ErrFailedToUpdateSLSProject = "FailedToUpdateSLSProject"
	// ErrFailedToDeleteSLSProject is the error of failing to delete an SLS project
	ErrFailedToDeleteSLSProject = "FailedToDeleteSLSProject"

	// ErrCodeStoreNotExist error code of ServerError when LogStore not found
	ErrCodeStoreNotExist = "LogStoreNotExist"
	// ErrFailedToGetSLSStore is the error of failing to get an SLS store
	ErrFailedToGetSLSStore = "FailedToGetSLSStore"
	// ErrFailedToCreateSLSStore is the error of failing to create an SLS store
	ErrFailedToCreateSLSStore = "FailedToCreateSLSStore"
	// ErrFailedToUpdateSLSStore is the error of failing to update an SLS store
	ErrFailedToUpdateSLSStore = "FailedToUpdateSLSStore"
	// ErrFailedToDeleteSLSStore is the error of failing to delete an SLS store
	ErrFailedToDeleteSLSStore = "FailedToDeleteSLSStore"

	// ErrCodeLogtailNotExist is the error code when Logtail doesn't exist
	ErrCodeLogtailNotExist = "ConfigNotExist"
)

Functions

func GenerateIndexObservation

func GenerateIndexObservation(index *sdk.Index) v1alpha1.LogstoreIndexObservation

GenerateIndexObservation is used to produce v1alpha1.LogstoreObservation

func GenerateLogtailObservation

func GenerateLogtailObservation(config *sdk.LogConfig) v1alpha1.LogtailObservation

GenerateLogtailObservation is used to produce v1alpha1.LogtailObservation

func GenerateMachineGroupBindingObservation

func GenerateMachineGroupBindingObservation(configs []string) v1alpha1.MachineGroupBindingObservation

GenerateMachineGroupBindingObservation is used to produce observation message

func GenerateMachineGroupObservation

func GenerateMachineGroupObservation(machineGroup *sdk.MachineGroup) v1alpha1.MachineGroupObservation

GenerateMachineGroupObservation is used to produce observation information

func GenerateObservation

func GenerateObservation(project *sdk.LogProject) v1alpha1.ProjectObservation

GenerateObservation is used to produce v1alpha1.ProjectObservation

func GenerateStoreObservation

func GenerateStoreObservation(store *sdk.LogStore) v1alpha1.StoreObservation

GenerateStoreObservation is used to produce v1alpha1.StoreObservation

func IsIndexNotFoundError

func IsIndexNotFoundError(err error) bool

IsIndexNotFoundError is helper function to test whether SLS Logstore index cloud not be found

func IsIndexUpdateToDate

func IsIndexUpdateToDate(cr *v1alpha1.LogstoreIndex, index *sdk.Index) bool

IsIndexUpdateToDate checks whether cr is up to date

func IsLogtailNotFoundError

func IsLogtailNotFoundError(err error) bool

IsLogtailNotFoundError helper function to test for SLS Logtail not found error

func IsLogtailUpdateToDate

func IsLogtailUpdateToDate(cr *v1alpha1.Logtail, config *sdk.LogConfig) bool

IsLogtailUpdateToDate checks whether cr is up to date

func IsMachineGroupNotFoundError

func IsMachineGroupNotFoundError(err error) bool

IsMachineGroupNotFoundError is helper function to test whether SLS Logtail MachineGroup cloud not be found

func IsMachineGroupUpdateToDate

func IsMachineGroupUpdateToDate(cr *v1alpha1.MachineGroup, machineGroup *sdk.MachineGroup) bool

IsMachineGroupUpdateToDate checks whether cr is up to date

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError helper function to test for SLS project not found error

func IsStoreNotFoundError

func IsStoreNotFoundError(err error) bool

IsStoreNotFoundError helper function to test for SLS Store not found error

func IsStoreUpdateToDate

func IsStoreUpdateToDate(cr *v1alpha1.LogStore, store *sdk.LogStore) bool

IsStoreUpdateToDate checks whether cr is up to date

Types

type LogClient

type LogClient struct {
	Client sdk.ClientInterface
}

LogClient is the SDK client of SLS

func NewClient

func NewClient(accessKeyID, accessKeySecret, securityToken, endpoint string) *LogClient

NewClient creates new SLS client

func (*LogClient) ApplyConfigToMachineGroup

func (c *LogClient) ApplyConfigToMachineGroup(projectName,
	groupName, confName *string) error

ApplyConfigToMachineGroup applied a config to a machine group

func (*LogClient) Create

func (c *LogClient) Create(name, description string) (*sdk.LogProject, error)

Create creates SLS project

func (*LogClient) CreateConfig

func (c *LogClient) CreateConfig(name string, t v1alpha1.LogtailParameters) error

CreateConfig creates SLS Logtail config

func (*LogClient) CreateIndex

func (c *LogClient) CreateIndex(param v1alpha1.LogstoreIndexParameters) error

CreateIndex creates SLS Logstore index

func (*LogClient) CreateMachineGroup

func (c *LogClient) CreateMachineGroup(name string, param v1alpha1.MachineGroupParameters) error

CreateMachineGroup creates SLS Logtail MachineGroup

func (*LogClient) CreateStore

func (c *LogClient) CreateStore(project string, logstore *sdk.LogStore) error

CreateStore creates SLS store

func (*LogClient) Delete

func (c *LogClient) Delete(name string) error

Delete deletes SLS project

func (*LogClient) DeleteConfig

func (c *LogClient) DeleteConfig(project string, config string) error

DeleteConfig deletes SLS Logtail config

func (*LogClient) DeleteIndex

func (c *LogClient) DeleteIndex(project, logstore *string) error

DeleteIndex deletes SLS Logstore index

func (*LogClient) DeleteMachineGroup

func (c *LogClient) DeleteMachineGroup(project *string, machineGroup string) error

DeleteMachineGroup deletes SLS Logtail MachineGroup

func (*LogClient) DeleteStore

func (c *LogClient) DeleteStore(project string, logstore string) error

DeleteStore deletes SLS store

func (*LogClient) Describe

func (c *LogClient) Describe(name string) (*sdk.LogProject, error)

Describe describes SLS project

func (*LogClient) DescribeConfig

func (c *LogClient) DescribeConfig(project string, config string) (*sdk.LogConfig, error)

DescribeConfig describes SLS Logtail config

func (*LogClient) DescribeIndex

func (c *LogClient) DescribeIndex(project, logstore *string) (*sdk.Index, error)

DescribeIndex describes SLS Logstore index

func (*LogClient) DescribeMachineGroup

func (c *LogClient) DescribeMachineGroup(project *string, name string) (*sdk.MachineGroup, error)

DescribeMachineGroup describes SLS Logtail MachineGroup

func (*LogClient) DescribeStore

func (c *LogClient) DescribeStore(project string, logstore string) (*sdk.LogStore, error)

DescribeStore describes SLS store

func (*LogClient) GetAppliedConfigs

func (c *LogClient) GetAppliedConfigs(projectName *string,
	groupName *string) ([]string, error)

GetAppliedConfigs gets applied configs to a machine group

func (*LogClient) RemoveConfigFromMachineGroup

func (c *LogClient) RemoveConfigFromMachineGroup(projectName,
	groupName, confName *string) error

RemoveConfigFromMachineGroup remove a config from a machine group

func (*LogClient) Update

func (c *LogClient) Update(name, description string) (*sdk.LogProject, error)

Update updates SLS project's description

func (*LogClient) UpdateConfig

func (c *LogClient) UpdateConfig(project string, config *sdk.LogConfig) error

UpdateConfig updates SLS Logtail config's description

func (*LogClient) UpdateIndex

func (c *LogClient) UpdateIndex(project, logstore *string, index *sdk.Index) error

UpdateIndex updates SLS Logstore index

func (*LogClient) UpdateMachineGroup

func (c *LogClient) UpdateMachineGroup(project, logstore *string, machineGroup *sdk.MachineGroup) error

UpdateMachineGroup updates SLS Logtail MachineGroup

func (*LogClient) UpdateStore

func (c *LogClient) UpdateStore(project string, logstore string, ttl int) error

UpdateStore updates SLS store's description

type LogClientInterface

type LogClientInterface interface {
	Describe(name string) (*sdk.LogProject, error)
	Create(name, description string) (*sdk.LogProject, error)
	Update(name, description string) (*sdk.LogProject, error)
	Delete(name string) error

	DescribeStore(project string, logstore string) (*sdk.LogStore, error)
	CreateStore(project string, store *sdk.LogStore) error
	UpdateStore(project string, logstore string, ttl int) error
	DeleteStore(project string, logstore string) error

	DescribeConfig(project string, config string) (*sdk.LogConfig, error)
	CreateConfig(name string, config v1alpha1.LogtailParameters) error
	UpdateConfig(project string, config *sdk.LogConfig) error
	DeleteConfig(project string, config string) error

	DescribeIndex(project, logstore *string) (*sdk.Index, error)
	CreateIndex(param v1alpha1.LogstoreIndexParameters) error
	UpdateIndex(project, logstore *string, index *sdk.Index) error
	DeleteIndex(project, logstore *string) error

	DescribeMachineGroup(project *string, name string) (*sdk.MachineGroup, error)
	CreateMachineGroup(name string, param v1alpha1.MachineGroupParameters) error
	UpdateMachineGroup(project, logstore *string, machineGroup *sdk.MachineGroup) error
	DeleteMachineGroup(project *string, logstore string) error

	GetAppliedConfigs(projectName *string, groupName *string) ([]string, error)
	ApplyConfigToMachineGroup(projectName, groupName, confName *string) error
	RemoveConfigFromMachineGroup(projectName, groupName, confName *string) error
}

LogClientInterface is the Log client interface

Jump to

Keyboard shortcuts

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