twinmaker

package
v1.18.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEntityPropertyReferenceKey added in v1.1.1

func GetEntityPropertyReferenceKey(entityPropertyReference *iottwinmaker.EntityPropertyReference, propertyDefinitions map[string]*iottwinmaker.PropertyDefinitionResponse) (s string)

func HandleGetTokenError added in v1.3.0

func HandleGetTokenError(err error) error

func LoadPolicy

func LoadPolicy(workspace *iottwinmaker.GetWorkspaceOutput) (string, error)

func NewTwinMakerMockClient

func NewTwinMakerMockClient(path string) (*twinMakerMockClient, error)

NewTwinMakerMockClient provides a mock twinMakerMockClient for the session and associated calls

func SetInfo added in v1.3.0

func SetInfo(credentials *sts.Credentials, info models.TokenInfo) models.TokenInfo

Types

type IAMPolicy

type IAMPolicy struct {
	Version   string            `json:"Version"`
	Statement []PolicyStatement `json:"Statement"`
}

type PolicyStatement

type PolicyStatement struct {
	Effect    string   `json:"Effect"`
	Action    []string `json:"Action"`
	Resource  []string `json:"Resource"`
	Condition string   `json:"Condition,omitempty"`
}

type PropertyReference added in v1.1.1

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

type TwinMakerClient

type TwinMakerClient interface {
	GetSessionToken(ctx context.Context, duration time.Duration, workspaceId string) (*sts.Credentials, error)
	GetWriteSessionToken(ctx context.Context, duration time.Duration, workspaceId string) (*sts.Credentials, error)
	ListWorkspaces(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.ListWorkspacesOutput, error)
	GetWorkspace(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.GetWorkspaceOutput, error)
	ListScenes(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.ListScenesOutput, error)
	ListEntities(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.ListEntitiesOutput, error)
	ListComponentTypes(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.ListComponentTypesOutput, error)
	GetComponentType(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.GetComponentTypeOutput, error)
	GetEntity(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.GetEntityOutput, error)

	BatchPutPropertyValues(ctx context.Context, req *iottwinmaker.BatchPutPropertyValuesInput) (*iottwinmaker.BatchPutPropertyValuesOutput, error)

	// NOTE: only works with non-timeseries data
	GetPropertyValue(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.GetPropertyValueOutput, error)

	// NOTE: only works with timeseries data
	GetPropertyValueHistory(ctx context.Context, query models.TwinMakerQuery) (*iottwinmaker.GetPropertyValueHistoryOutput, error)
}

TwinMakerClient calls AWS services and returns the raw results

func NewCachingClient

func NewCachingClient(client TwinMakerClient, ttl time.Duration) TwinMakerClient

func NewTwinMakerClient

func NewTwinMakerClient(settings models.TwinMakerDataSourceSetting) (TwinMakerClient, error)

NewTwinMakerClient provides a twinMakerClient for the session and associated calls

type TwinMakerHandler

type TwinMakerHandler interface {
	GetSessionToken(ctx context.Context, duration time.Duration, workspaceId string) (models.TokenInfo, error)
	GetWriteSessionToken(ctx context.Context, duration time.Duration, workspaceId string) (models.TokenInfo, error)
	ListWorkspaces(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse
	ListScenes(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse
	ListEntities(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse
	ListComponentTypes(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse
	GetEntity(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse
	GetPropertyValue(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse

	// These APIs do not exist in TwinMaker, but are simple constructions
	GetComponentHistory(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse
	GetEntityHistory(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse
	GetAlarms(ctx context.Context, query models.TwinMakerQuery) backend.DataResponse
}

TwinMakerHandler uses a client to create grafana response objects

func NewTwinMakerHandler

func NewTwinMakerHandler(client TwinMakerClient) TwinMakerHandler

type TwinMakerResources

type TwinMakerResources interface {
	// Original model
	GetEntity(ctx context.Context, id string) (*iottwinmaker.GetEntityOutput, error)

	BatchPutPropertyValues(context.Context, []*iottwinmaker.PropertyValueEntry) (*iottwinmaker.BatchPutPropertyValuesOutput, error)

	// Selectable values
	ListWorkspaces(ctx context.Context) ([]models.SelectableString, error)
	ListScenes(ctx context.Context) ([]models.SelectableString, error)
	ListOptions(ctx context.Context) (models.OptionsInfo, error)
	ListEntity(ctx context.Context, id string) ([]models.SelectableProps, error)
}

Resource requests

func NewCachingResource

func NewCachingResource(res TwinMakerResources, ttl time.Duration) TwinMakerResources

func NewTwinMakerResource

func NewTwinMakerResource(client TwinMakerClient, workspaceId string) TwinMakerResources

Jump to

Keyboard shortcuts

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