models

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache *resourceCache
View Source
var CollectionApiConfigs map[string]collectionApiConfig
View Source
var GenerateResourceKey = func() (string, error) {
	return uuid.GenerateUUID()
}
View Source
var RestConfigs map[string]restConfig
View Source
var Verbose bool = false

Functions

func InitItsiApiLimiter

func InitItsiApiLimiter(concurrency int)

func NewCache

func NewCache(size int) *resourceCache

func NilTemplateMarshal

func NilTemplateMarshal(b *Base) (string, error)

Types

type Base

type Base struct {
	Splunk ClientConfig

	// key used to collect this resource via the REST API
	RESTKey string
	// Terraform Identifier
	TFID    string
	RawJson RawJson
	Fields  []string
	Hash    string
	// contains filtered or unexported fields
}

func NewBase

func NewBase(clientConfig ClientConfig, key, id, objectType string) *Base

func (*Base) Clone

func (b *Base) Clone() *Base

func (*Base) Create

func (b *Base) Create(ctx context.Context) (*Base, error)

func (*Base) Delete

func (b *Base) Delete(ctx context.Context) error

func (*Base) Dump

func (b *Base) Dump(ctx context.Context, offset, count int) ([]*Base, error)

func (*Base) Find

func (b *Base) Find(ctx context.Context) (result *Base, err error)

Returns an object from cache if it's present, or makes the relevant API calls..

func (*Base) GetPageSize

func (b *Base) GetPageSize() int

func (*Base) Populate

func (b *Base) Populate(raw []byte) error

func (*Base) PopulateRawJSON added in v0.10.0

func (b *Base) PopulateRawJSON(ctx context.Context, body map[string]interface{}) error

func (*Base) Read

func (b *Base) Read(ctx context.Context) (*Base, error)

func (*Base) Update

func (b *Base) Update(ctx context.Context) error

func (*Base) UpdateAsync added in v0.9.2

func (b *Base) UpdateAsync(ctx context.Context) error

type ClientConfig

type ClientConfig struct {
	BearerToken string
	User        string
	Password    string
	Host        string
	Port        int
	SkipTLS     bool
	Concurrency int
	Timeout     int
	RetryPolicy backoff.Policy
}

type CollectionApi

type CollectionApi struct {
	RESTKey              string                  // key used to collect this resource via the REST API
	Collection           string                  // Collection name
	App                  string                  // Collection App
	Owner                string                  // Collection owner
	Data                 map[string]interface{}  // Data for this object
	Params               string                  // URL query string, iff provided
	Body                 []byte                  // Body used for this API call
	CustomBehaviourCodes map[int]util.HandleCode // Common unretriable errors
	// contains filtered or unexported fields
}

func NewCollection

func NewCollection(clientConfig ClientConfig, collection, app, owner, key, objectType string) *CollectionApi

func (*CollectionApi) Create

func (c *CollectionApi) Create(ctx context.Context) (*CollectionApi, error)

func (*CollectionApi) Delete

func (c *CollectionApi) Delete(ctx context.Context) (*CollectionApi, error)

func (*CollectionApi) Marshal

func (c *CollectionApi) Marshal(obj interface{}) (bytes []byte, err error)

func (*CollectionApi) Read

func (c *CollectionApi) Read(ctx context.Context) (*CollectionApi, error)

func (*CollectionApi) SetCodeHandle added in v0.10.15

func (c *CollectionApi) SetCodeHandle(code int, instruction util.HandleCode)

func (*CollectionApi) Unmarshal

func (c *CollectionApi) Unmarshal(bytes []byte) (res interface{}, err error)

func (*CollectionApi) Update

func (c *CollectionApi) Update(ctx context.Context) (*CollectionApi, error)

type HttpClients

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

func (*HttpClients) Get

func (hc *HttpClients) Get(config ClientConfig) IHttpClient

type IHttpClient added in v0.8.2

type IHttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type IHttpClients added in v0.8.2

type IHttpClients interface {
	Get(config ClientConfig) IHttpClient
}

func InitHttpClients added in v0.8.2

func InitHttpClients() IHttpClients

type RESTKeyByTFID

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

func NewRESTKeyByTFID

func NewRESTKeyByTFID() *RESTKeyByTFID

func (*RESTKeyByTFID) Get

func (m *RESTKeyByTFID) Get(RestInterface, ObjectType, TFID string) (RESTKey string)

func (*RESTKeyByTFID) Update

func (m *RESTKeyByTFID) Update(RestInterface, ObjectType, TFID string, RESTKey string)

type RawJson added in v0.9.2

type RawJson json.RawMessage

func (RawJson) MarshalJSON added in v0.9.2

func (rj RawJson) MarshalJSON() ([]byte, error)

func (RawJson) ToInterfaceMap added in v0.9.2

func (rj RawJson) ToInterfaceMap() (m map[string]interface{}, err error)

func (*RawJson) UnmarshalJSON added in v0.9.2

func (rj *RawJson) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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