sdk

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindPlane

type BindPlane struct {
	BaseURL    string
	APIKey     string
	APIVersion string
	// contains filtered or unexported fields
}

BindPlane type stores the global configuration

func (BindPlane) APICall

func (bp BindPlane) APICall(method string, relativePath string, payload []byte) ([]byte, error)

APICall takes a HTTP method, relative api path, and payload returns the API response and an error example: APICall("GET", "/v1/collectors", nil)

func (BindPlane) CreateCredential

func (bp BindPlane) CreateCredential(payload []byte) (CredentialCreateResponse, error)

CreateCredential will configure a credential

func (BindPlane) CreateLogDestConfig added in v1.3.0

func (bp BindPlane) CreateLogDestConfig(config LogDestConfig) (LogDestConfig, error)

CreateLogDestConfig creates a destination config

func (BindPlane) CreateLogDestConfigRaw added in v1.3.0

func (bp BindPlane) CreateLogDestConfigRaw(config []byte) (LogDestConfig, error)

CreateLogDestConfigRaw creates a destination config

func (BindPlane) CreateLogSourceConfig added in v1.3.0

func (bp BindPlane) CreateLogSourceConfig(config LogSourceConfig) (LogSourceConfig, error)

CreateLogSourceConfig creates a log source config

func (BindPlane) CreateLogSourceConfigRaw added in v1.3.0

func (bp BindPlane) CreateLogSourceConfigRaw(config []byte) (LogSourceConfig, error)

CreateLogSourceConfigRaw creates a log source config

func (BindPlane) CreateLogTemplate added in v1.3.0

func (bp BindPlane) CreateLogTemplate(t LogTemplate) (LogTemplate, error)

CreateLogTemplate returns a log template

func (BindPlane) CreateSource

func (bp BindPlane) CreateSource(payload []byte) (SourceCreateResponse, error)

CreateSource will configure a new source, returning the http response body, http status code, and an error

func (BindPlane) DelLogDestConfig added in v1.3.0

func (bp BindPlane) DelLogDestConfig(id string) error

DelLogDestConfig deletes a log destination config

func (BindPlane) DeleteCollector

func (bp BindPlane) DeleteCollector(id string) error

DeleteCollector will delete a configured collector

func (BindPlane) DeleteCredential

func (bp BindPlane) DeleteCredential(id string) error

DeleteCredential will delete a configured credential

func (BindPlane) DeleteLogAgent added in v1.3.0

func (bp BindPlane) DeleteLogAgent(id string) error

DeleteLogAgent deletes a log agent

func (BindPlane) DeleteLogAgentDest added in v1.3.0

func (bp BindPlane) DeleteLogAgentDest(agentID, destID string) error

DeleteLogAgentDest deletes a destination config from a log agent

func (BindPlane) DeleteLogAgentSource added in v1.3.0

func (bp BindPlane) DeleteLogAgentSource(agentID, sourceID string) error

DeleteLogAgentSource deletes a source config from a log agent

func (BindPlane) DeleteLogSourceConfig added in v1.3.0

func (bp BindPlane) DeleteLogSourceConfig(id string) error

DeleteLogSourceConfig deletes a log source config

func (BindPlane) DeleteLogTemplate added in v1.3.0

func (bp BindPlane) DeleteLogTemplate(id string) error

DeleteLogTemplate returns a log template

func (BindPlane) DeleteSource

func (bp BindPlane) DeleteSource(id string) ([]byte, error)

DeleteSource will delete a configured source

func (BindPlane) DeployLogAgentDest added in v1.3.0

func (bp BindPlane) DeployLogAgentDest(agentID, configID string) (LogAgentDest, error)

DeployLogAgentDest deploys a destination config to a log agent

func (BindPlane) DeployLogAgentSource added in v1.3.0

func (bp BindPlane) DeployLogAgentSource(agentID, configID string) (LogAgentSource, error)

DeployLogAgentSource deploys a source config to a log agent

func (BindPlane) GetCollector

func (bp BindPlane) GetCollector(id string) (Collector, error)

GetCollector will return a collector object

func (BindPlane) GetCollectorGroup

func (bp BindPlane) GetCollectorGroup(id string) (CollectorGroup, error)

GetCollectorGroup will return a collector group object

func (BindPlane) GetCollectors

func (bp BindPlane) GetCollectors() ([]CollectorGroup, error)

GetCollectors will return an array of collector group objects

func (BindPlane) GetCredential

func (bp BindPlane) GetCredential(id string) (Credential, error)

GetCredential will return a credential type

func (BindPlane) GetCredentialTemplate

func (bp BindPlane) GetCredentialTemplate(id string) (CredentialTypeTemplate, error)

GetCredentialTemplate will return a Credential configuration

func (BindPlane) GetCredentialType

func (bp BindPlane) GetCredentialType(id string) (CredentialType, error)

GetCredentialType returns a credentials type

func (BindPlane) GetCredentials

func (bp BindPlane) GetCredentials() ([]Credential, error)

GetCredentials will return a credential type

func (BindPlane) GetJob

func (bp BindPlane) GetJob(id string) (Job, error)

GetJob will return a job object using an interface{} for the result key

func (BindPlane) GetLogAgent added in v1.3.0

func (bp BindPlane) GetLogAgent(id string) (LogAgent, error)

GetLogAgent returns a log agent

func (BindPlane) GetLogAgentDest added in v1.3.0

func (bp BindPlane) GetLogAgentDest(agentID, destID string) (LogAgentDest, error)

GetLogAgentDest returns a log agent's destination by id

func (BindPlane) GetLogAgentSource added in v1.3.0

func (bp BindPlane) GetLogAgentSource(agentID, sourceID string) (LogAgentSource, error)

GetLogAgentSource returns a log agent's source by id

func (BindPlane) GetLogAgentTask added in v1.3.0

func (bp BindPlane) GetLogAgentTask(agentID, taskID string) (LogAgentTask, error)

GetLogAgentTask returns a task for a given agent

func (BindPlane) GetLogDestConfig added in v1.3.0

func (bp BindPlane) GetLogDestConfig(id string) (LogDestConfig, error)

GetLogDestConfig returns a log destination config

func (BindPlane) GetLogDestType added in v1.3.0

func (bp BindPlane) GetLogDestType(id string) (LogDestType, error)

GetLogDestType returns a logging destination type

func (BindPlane) GetLogDestTypeParameters added in v1.3.0

func (bp BindPlane) GetLogDestTypeParameters(id string) ([]byte, error)

GetLogDestTypeParameters returns a logging destination's configuraton parameters

func (BindPlane) GetLogSourceConfig added in v1.3.0

func (bp BindPlane) GetLogSourceConfig(id string) (LogSourceConfig, error)

GetLogSourceConfig returns a specified log source config

func (BindPlane) GetLogSourceType added in v1.3.0

func (bp BindPlane) GetLogSourceType(id string) (LogSourceType, error)

GetLogSourceType returns a source type

func (BindPlane) GetLogSourceTypeParameters added in v1.3.0

func (bp BindPlane) GetLogSourceTypeParameters(id string) ([]byte, error)

GetLogSourceTypeParameters returns a source type template

func (BindPlane) GetLogTemplate added in v1.3.0

func (bp BindPlane) GetLogTemplate(id string) (LogTemplate, error)

GetLogTemplate returns a log template

func (BindPlane) GetSource

func (bp BindPlane) GetSource(id string) (SourceConfigGet, error)

GetSource will return a source object

func (BindPlane) GetSourceTemplate

func (bp BindPlane) GetSourceTemplate(id string) (SourceTypeTemplate, error)

GetSourceTemplate will return a SourceTypeTemplate with default values

func (BindPlane) GetSourceType

func (bp BindPlane) GetSourceType(id string) (SourceType, error)

GetSourceType will return a source type

func (BindPlane) GetSources

func (bp BindPlane) GetSources() ([]SourceConfigGet, error)

GetSources will return a source object

func (BindPlane) GetStatus

func (bp BindPlane) GetStatus(job Job) int

GetStatus returns an int representing the job status

func (*BindPlane) Init

func (bp *BindPlane) Init() error

Init checks set configuration values and sets defaults if required

func (BindPlane) InstallCMDLogAgent added in v1.3.0

func (bp BindPlane) InstallCMDLogAgent(logAgentPlatform, templateID string) (string, error)

InstallCMDLogAgent returns the install commands for installing the bindplane log agent

func (BindPlane) ListJobs

func (bp BindPlane) ListJobs() ([]Job, error)

ListJobs will return an array of collector objects

func (BindPlane) ListLogAgentDest added in v1.3.0

func (bp BindPlane) ListLogAgentDest(id string) ([]LogAgentDest, error)

ListLogAgentDest returns a log agent

func (BindPlane) ListLogAgentSources added in v1.3.0

func (bp BindPlane) ListLogAgentSources(id string) ([]LogAgentSource, error)

ListLogAgentSources returns all log agents

func (BindPlane) ListLogAgents added in v1.3.0

func (bp BindPlane) ListLogAgents() ([]LogAgent, error)

ListLogAgents returns all log agents

func (BindPlane) ListLogDestConfigs added in v1.3.0

func (bp BindPlane) ListLogDestConfigs() ([]LogDestConfig, error)

ListLogDestConfigs lists available log destination types

func (BindPlane) ListLogDestTypes added in v1.3.0

func (bp BindPlane) ListLogDestTypes() ([]LogDestType, error)

ListLogDestTypes lists available log destination types

func (BindPlane) ListLogSourceConfigs added in v1.3.0

func (bp BindPlane) ListLogSourceConfigs() ([]LogSourceConfig, error)

ListLogSourceConfigs returns all configured log sources

func (BindPlane) ListLogSourceTypes added in v1.3.0

func (bp BindPlane) ListLogSourceTypes() ([]LogSourceType, error)

ListLogSourceTypes returns all available log source types

func (BindPlane) ListLogTemplates added in v1.3.0

func (bp BindPlane) ListLogTemplates() ([]LogTemplate, error)

ListLogTemplates returns all log templates

func (BindPlane) ListSourceTypes

func (bp BindPlane) ListSourceTypes() ([]SourceType, error)

ListSourceTypes will return an array of available source types

func (BindPlane) UpdateLogAgent added in v1.3.0

func (bp BindPlane) UpdateLogAgent(id string) (LogAgentUpdateResp, error)

UpdateLogAgent returns a log agent

func (BindPlane) UpdateLogDestConfig added in v1.3.0

func (bp BindPlane) UpdateLogDestConfig(id string) (LogDestConfig, error)

UpdateLogDestConfig updates the log destination config version to the latest

func (BindPlane) UpdateLogTemplate added in v1.3.0

func (bp BindPlane) UpdateLogTemplate(id string, t LogTemplate) error

UpdateLogTemplate returns a log template

func (BindPlane) UpdateVersionLogSourceConfig added in v1.3.0

func (bp BindPlane) UpdateVersionLogSourceConfig(id string) (LogSourceConfig, error)

UpdateVersionLogSourceConfig updates the log source config version

type Collector

type Collector struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	URL        string `json:"url"`
	Version    string `json:"version"`
	Hostname   string `json:"hostname"`
	Status     string `json:"status"`
	NumSources int    `json:"num_sources"`
}

Collector type describes a collector configuration

func (Collector) Print

func (c Collector) Print(j bool) error

Print prints a collector

type CollectorGroup

type CollectorGroup struct {
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	URL        string      `json:"url"`
	Group      bool        `json:"group"`
	Status     string      `json:"status"`
	NumSources int         `json:"num_sources"`
	Collectors []Collector `json:"collectors"`
}

CollectorGroup type describes a collector group configuration

func (CollectorGroup) Print

func (g CollectorGroup) Print(j bool) error

Print prints a collector group

type Credential

type Credential struct {
	ID               string             `json:"id"`
	Name             string             `json:"name"`
	URL              string             `json:"url"`
	CredentialTypeID string             `json:"credential_type_id"`
	Parameters       interface{}        `json:"parameters"`
	Sources          []CredentialSource `json:"sources"`
}

Credential describes a source credential configuration

func (Credential) Print

func (c Credential) Print(j bool) error

Print will print a Credential object

type CredentialCreateResponse

type CredentialCreateResponse struct {
	ID               string      `json:"id"`
	Name             string      `json:"name"`
	URL              string      `json:"url"`
	CredentialTypeID string      `json:"credential_type_id"`
	Parameters       interface{} `json:"parameters"`
}

CredentialCreateResponse type describes the json body returned by the credential create endpoint

func (CredentialCreateResponse) Print

func (c CredentialCreateResponse) Print(j bool) error

Print will print a CredentialCreateResponse object

type CredentialSource added in v1.1.0

type CredentialSource struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	URL        string `json:"url"`
	Stopped    bool   `json:"stopped"`
	Status     string `json:"status"`
	SourceType struct {
		ID     string `json:"id"`
		URL    string `json:"url"`
		DocURL string `json:"doc_url"`
	}
}

CredentialSource describes the soure object returned inside a Credential object's list of sources

type CredentialType

type CredentialType struct {
	ID          string        `json:"id"`
	Name        string        `json:"name"`
	Parameters  []interface{} `json:"parameters"`
	Credentials []Credential  `json:"credentials"`
}

CredentialType describes a credential type object

func (CredentialType) Print

func (c CredentialType) Print() error

Print will print the CredentialType object

type CredentialTypeTemplate

type CredentialTypeTemplate struct {
	Name             string      `json:"name"`
	CredentialTypeID string      `json:"credential_type_id"`
	Parameters       interface{} `json:"parameters"`
}

CredentialTypeTemplate describes a credential type template object

func (CredentialTypeTemplate) Print

func (c CredentialTypeTemplate) Print() error

Print will print the CredentialTypeTemplate object

type Job

type Job struct {
	ID      string      `json:"id"`
	Status  string      `json:"status"`
	Message string      `json:"message"`
	URL     string      `json:"url"`
	Result  interface{} `json:"result"`
}

Job describes a job object

func (Job) Print

func (job Job) Print(j bool) error

Print will print a Job object

type LogAgent added in v1.3.0

type LogAgent struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Version       string `json:"version"`
	LatestVersion string `json:"latest_version"`
	Status        string `json:"status"`
}

LogAgent represents a BindPlane log agent

func (LogAgent) Print added in v1.3.0

func (a LogAgent) Print(j bool) error

Print prints a LogAgent

type LogAgentDest added in v1.3.0

type LogAgentDest struct {
	DestinationConfigID string `json:"destination_config_id"`
	Name                string `json:"name"`
	Version             string `json:"version"`
	LatestVersion       string `json:"latest_version"`
	TypeID              string `json:"type_id"`
}

LogAgentDest represents a Bindplane Log agent destination config

func (LogAgentDest) Print added in v1.3.0

func (d LogAgentDest) Print(j bool) error

Print prints a LogAgentDest

type LogAgentSource added in v1.3.0

type LogAgentSource struct {
	SourceConfigID string `json:"source_config_id"`
	Name           string `json:"name"`
	Version        string `json:"version"`
	LatestVersion  string `json:"latest_version"`
	TypeID         string `json:"type_id"`
}

LogAgentSource represents a BindPlane log agent's source configuration

func (LogAgentSource) Print added in v1.3.0

func (s LogAgentSource) Print(j bool) error

Print prints a LogAgentSource

type LogAgentTask added in v1.3.0

type LogAgentTask struct {
	ID      string `json:"id"`
	AgentID string `json:"agent_id"`
	Name    string `json:"name"`
	State   string `json:"state"`
}

LogAgentTask represents a BindPlane log agent task

func (LogAgentTask) Print added in v1.3.0

func (t LogAgentTask) Print(j bool) error

Print prints a LogAgent

type LogAgentUpdateResp added in v1.3.0

type LogAgentUpdateResp struct {
	AgentID string `json:"agent_id"`
	TaskID  string `json:"task_id"`
}

LogAgentUpdateResp represents the object returned by the api when an update command is issued

func (LogAgentUpdateResp) Print added in v1.3.0

func (a LogAgentUpdateResp) Print(j bool) error

Print prints a LogAgentUpdateResp

type LogDestConfig added in v1.3.0

type LogDestConfig struct {
	ID          string `json:"id,omitempty"`
	Name        string `json:"name"`
	Destination struct {
		ID      string `json:"id,omitempty"`
		Name    string `json:"name,omitempty"`
		Version string `json:"version,omitempty"`
	} `json:"destination,omitempty"`
	Configuration      map[string]interface{} `json:"configuration,omitempty"`
	DestinationTypeID  string                 `json:"destination_type_id,omitempty"`
	DestinationVersion string                 `json:"destination_version,omitempty"`
	CreatedAt          int64                  `json:"created_at,omitempty"`
	UpdatedAt          int64                  `json:"updated_at,omitempty"`
}

LogDestConfig represents a logging destination configuration

func (LogDestConfig) Print added in v1.3.0

func (d LogDestConfig) Print(j bool) error

Print print a LogDestConfig type

type LogDestType added in v1.3.0

type LogDestType struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Version string `json:"version"`
	DocURL  string `json:"doc_url"`
}

LogDestType represents a logging destination

func (LogDestType) Print added in v1.3.0

func (d LogDestType) Print(j bool) error

Print prints a LogDestType type

type LogSourceConfig added in v1.3.0

type LogSourceConfig struct {
	// ID is always returned from the API but it is
	// not required when creating a new config
	ID     string `json:"id,omitempty"`
	Name   string `json:"name"`
	Source struct {
		ID      string `json:"id,omitempty"`
		Name    string `json:"name,omitempty"`
		Version string `json:"version,omitempty"`
	} `json:"source,omitempty"`

	// configuration is only returned when getting a specific
	// config, not during a list operation, therefore we omit
	// it when it is not present
	Configuration  map[string]interface{} `json:"configuration,omitempty"`
	CustomTemplate string                 `json:"custom_template,omitempty"`
	SourceTypeID   string                 `json:"source_type_id,omitempty"`
	SourceVersion  string                 `json:"source_version,omitempty"`
	CreatedAt      int64                  `json:"created_at,omitempty"`
	UpdatedAt      int64                  `json:"updated_at,omitempty"`
}

LogSourceConfig type represents a log source config

func (LogSourceConfig) Print added in v1.3.0

func (c LogSourceConfig) Print(j bool) error

Print prints a LogSourceConfig

type LogSourceType added in v1.3.0

type LogSourceType struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Version string `json:"version"`
	DocURL  string `json:"doc_url"`
}

LogSourceType type represents a log source type

func (LogSourceType) Print added in v1.3.0

func (s LogSourceType) Print(j bool) error

Print prints a LogSourceType

type LogTemplate added in v1.3.0

type LogTemplate struct {
	ID                  string   `json:"id,omitempty"`
	Name                string   `json:"name"`
	SourceConfigIds     []string `json:"source_config_ids"`
	DestinationConfigID string   `json:"destination_config_id"`
	AgentGroup          string   `json:"agent_group"`
	CreatedAt           int64    `json:"created_at,omitempty"`
	UpdatedAt           int64    `json:"updated_at,omitempty"`
}

LogTemplate represents a bindplane logs template

func (LogTemplate) Print added in v1.3.0

func (t LogTemplate) Print(j bool) error

Print prints a LogTemplate

func (LogTemplate) Verify added in v1.3.0

func (t LogTemplate) Verify() error

Verify validates a LogTemplateCreate type

type SourceConfigCreate

type SourceConfigCreate struct {
	CollectionInterval int         `json:"collection_interval"`
	CollectorID        string      `json:"collector_id"`
	Configuration      interface{} `json:"configuration"`
	Credentials        struct {
		Credentials string `json:"credentials"`
	} `json:"credentials"`
	Name       string `json:"name"`
	SourceType string `json:"source_type"`
}

SourceConfigCreate type describes a source configuration to be created

func (SourceConfigCreate) Validate

func (s SourceConfigCreate) Validate() error

Validate validates a SourceConfigCreate configuration

type SourceConfigGet

type SourceConfigGet struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	URL        string `json:"url"`
	SourceType struct {
		ID     string `json:"id"`
		Name   string `json:"name"`
		URL    string `json:"url"`
		DocURL string `json:"doc_url"`
	} `json:"source_type"`
	CollectionInterval int          `json:"collection_interval"`
	CreatedAt          string       `json:"created_at"`
	Credentials        []Credential `json:"credentials"`
	Configuration      interface{}  `json:"configuration"`
	Status             string       `json:"status"`
	StatusReportedAt   string       `json:"status_reported_at"`
	StatusMessage      string       `json:"status_message"`
	Stopped            bool         `json:"stopped"`
	Collector          struct {
		ID         string `json:"id"`
		Name       string `json:"name"`
		URL        string `json:"url"`
		Version    string `json:"version"`
		Hostname   string `json:"hostname"`
		Status     string `json:"status"`
		NumSources int    `json:"num_sources"`
	} `json:"collector"`
}

SourceConfigGet type describes a source configuration

func (SourceConfigGet) Print

func (s SourceConfigGet) Print(j bool) error

Print prints a Source

type SourceCreateResponse

type SourceCreateResponse struct {
	JobID string `json:"job_id"`
	URL   string `json:"url"`
}

SourceCreateResponse type describes the json body returned by the source create endpoint

func (SourceCreateResponse) Print

func (s SourceCreateResponse) Print(j bool) error

Print prints a SourceCreateResponse

type SourceType

type SourceType struct {
	ID                        string           `json:"id"`
	Name                      string           `json:"name"`
	URL                       string           `json:"url"`
	DocURL                    string           `json:"doc_url"`
	Version                   string           `json:"version"`
	DefaultCollectionInterval int              `json:"default_collection_interval"`
	CredentialTypes           []CredentialType `json:"credential_types"`
	ConnectionParameters      interface{}      `json:"connection_parameters"`
}

SourceType type describes a source type configuration

func (SourceType) Print

func (s SourceType) Print(j bool) error

Print prints a SourceType

type SourceTypeTemplate

type SourceTypeTemplate struct {
	Name               string `json:"name"`
	SourceType         string `json:"source_type"`
	CollectorID        string `json:"collector_id"`
	CollectionInterval int    `json:"collection_interval"`
	Credentials        struct {
		Credentials string `json:"credentials"`
	} `json:"credentials"`
	Configuration interface{} `json:"configuration"`
}

SourceTypeTemplate type describes a source type template configuration

func (SourceTypeTemplate) Print

func (s SourceTypeTemplate) Print() error

Print prints a SourceTypeTemplate

Jump to

Keyboard shortcuts

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