api

package
v0.0.0-...-91b2197 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 License: Apache-2.0 Imports: 16 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	OwnerOnly   = AccessLevel("owner-only")
	CanAccess   = AccessLevel("can-access")
	CanDiscover = AccessLevel("can-discover")
)
View Source
const (
	Requested = Status("requested")
	Accepted  = Status("accepted")
	Declined  = Status("declined")
	Revoked   = Status("revoked")
)

Variables

View Source
var (
	ErrEntitlementNotFound = errors.New("entitlement not found")
)

Functions

func NewDataService

func NewDataService(store *EntitlementStore, sClient *storageclient.DataApi, metaStore *MetadataStore) dataResource

func NewDeviceService

func NewDeviceService(ctx context.Context, entitlementStore *EntitlementStore, metaStore *MetadataStore, out chan<- sensors.SensorMessage) deviceResource

func NewEntitlementService

func NewEntitlementService(store *EntitlementStore, mClient *metadataclient.MetadataApi) entitlementResource

Types

type AccessLevel

type AccessLevel string

type DataRequest

type DataRequest struct {
	Key string `json:"key" description:"unique name for the data"`
}

type DataResponse

type DataResponse struct {
	Data     interface{} `json:"data" description:"data returned type="object"`
	Metadata Metadata    `json:"metadata" description:"metadata for the data e.g. description"`
}

type DeviceRequest

type DeviceRequest struct {
	Type string `json:"type" description:"type of device" validate:"nonzero"`
}

type DeviceResponse

type DeviceResponse struct {
	DeviceRequest
	UID         string `json:"uid" description:"unique identifier for the device"`
	Name        string `json:"name" description:"unique name for the device" `
	Description string `json:"description" description:"information about the device" `
}

type Entitlement

type Entitlement struct {
	EntitlementRequest
	UID    string `json:"uid" description:"unique identifier of the entitlement request" validate:"nonzero"`
	Status Status `` /* 140-byte string literal not displayed */
}

Entitlement is returned to encapsulate the current status of the entitlement

func (Entitlement) IsAccessible

func (e Entitlement) IsAccessible() bool

IsAccessible returns true if the data can be accessed e.g. viewed, collated etc

func (Entitlement) IsDiscoverable

func (e Entitlement) IsDiscoverable() bool

IsDiscoverable returns true if the presence of the data can be discovered For the purposes of the prototype this means the data will be sent to the metadata service

type EntitlementRequest

type EntitlementRequest struct {
	Subject     string      `json:"subject" description:"path of the data e.g. data://user/email" validate:"nonzero"`
	AccessLevel AccessLevel `json:"level" description:"access level requested. Valid values 'owner-only', 'can-read','can-discover'" validate:"nonzero"`
}

EntitlementRequest are made to request some access to a bit of data

type EntitlementStore

type EntitlementStore struct {
	Accepted  entitlementMap
	Declined  entitlementMap
	Requested entitlementMap
	Revoked   entitlementMap
}

func NewEntitlementStore

func NewEntitlementStore() *EntitlementStore

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error" description:"error message if any"`
}

ErrorResponse signals error messages back to the client

type Metadata

type Metadata struct {
	Description string `json:"description" description:"human readable description of the data"`
	Subject     string `json:"subject" description:"description of the data"`
	Name        string `json:"name" description:"name of the data"`
	Path        string `json:"path" description:"path to the key of the data"`
}

type MetadataRequest

type MetadataRequest struct {
	Description string `json:"description" description:"human readable description of the data"`
}

type MetadataStore

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

func NewMetadataStore

func NewMetadataStore() *MetadataStore

func (*MetadataStore) Add

func (m *MetadataStore) Add(meta Metadata)

func (*MetadataStore) All

func (m *MetadataStore) All() []Metadata

func (*MetadataStore) FindBySubject

func (m *MetadataStore) FindBySubject(subject utils.Subject) (Metadata, bool)

type Status

type Status string

Jump to

Keyboard shortcuts

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