cloud

package
v2.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ProvisioningStatusDEREGISTERING cloud.ProvisioningStatus = "deregistering"

Variables

View Source
var (
	ErrCannotPublishResources   = errors.New("cannot publish resources")
	ErrCannotUnpublishResources = errors.New("cannot unpublish resources")
)
View Source
var (
	ErrMissingAccessToken = errors.New("access token missing")
	ErrCannotSignIn       = errors.New("cannot sign in")
)
View Source
var (
	ErrMissingAuthorizationCode     = errors.New("authorization code missing")
	ErrMissingAuthorizationProvider = errors.New("authorization provider missing")
	ErrCannotSignUp                 = errors.New("cannot sign up")
)
View Source
var ErrCannotRefreshToken = errors.New("cannot refresh token")
View Source
var ErrCannotSignOff = errors.New("cannot sign off")

Functions

func MakeSignInRequest

func MakeSignInRequest(deviceID, userID, accessToken string) (ocfCloud.CoapSignInRequest, error)

func MakeSignUpRequest

func MakeSignUpRequest(deviceID, code, provider string) (ocfCloud.CoapSignUpRequest, error)

Types

type CAPool

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

func MakeCAPool

func MakeCAPool(getCAPool GetCAPool, useSystemCAPool bool) CAPool

func (CAPool) GetPool

func (c CAPool) GetPool() (*x509.CertPool, error)

func (CAPool) IsValid

func (c CAPool) IsValid() bool

type CAPoolGetter

type CAPoolGetter = interface {
	IsValid() bool
	GetPool() (*x509.CertPool, error)
}

type Config

type Config struct {
	AccessToken           string
	UserID                string
	RefreshToken          string
	ValidUntil            time.Time
	AuthorizationProvider string
	CloudID               string
	CloudURL              string
}

type Configuration

type Configuration struct {
	ResourceTypes         []string                 `yaml:"-" json:"rt"`
	Interfaces            []string                 `yaml:"-" json:"if"`
	Name                  string                   `yaml:"-" json:"n"`
	AuthorizationProvider string                   `yaml:"authorizationProvider" json:"apn"`
	CloudID               string                   `yaml:"cloudID" json:"sid"`
	URL                   string                   `yaml:"cloudEndpoint" json:"cis"`
	LastErrorCode         int                      `yaml:"-" json:"clec"`
	ProvisioningStatus    cloud.ProvisioningStatus `yaml:"-" json:"cps"`
	AuthorizationCode     string                   `yaml:"-" json:"-"`
}

type GetCAPool

type GetCAPool func() []*x509.Certificate

type GetCertificates

type GetCertificates func(deviceID string) []tls.Certificate

type GetLinksFilteredBy

type GetLinksFilteredBy func(endpoints schema.Endpoints, deviceIDfilter uuid.UUID, resourceTypesFitler []string, policyBitMaskFitler schema.BitMask) (links schema.ResourceLinks)

type Manager

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

func New

func New(cfg Config, deviceID uuid.UUID, save func(), handler net.RequestHandler, getLinks GetLinksFilteredBy, caPool CAPoolGetter, loop *eventloop.Loop, opts ...Option) (*Manager, error)

func (*Manager) Close

func (c *Manager) Close()

func (*Manager) ExportConfig

func (c *Manager) ExportConfig() Config

func (*Manager) Get

func (c *Manager) Get(request *net.Request) (*pool.Message, error)

func (*Manager) Init

func (c *Manager) Init()

func (*Manager) Post

func (c *Manager) Post(request *net.Request) (*pool.Message, error)

func (*Manager) PublishResources added in v2.4.1

func (c *Manager) PublishResources(hrefs ...string)

func (*Manager) Reconnect added in v2.4.3

func (c *Manager) Reconnect()

func (*Manager) UnpublishResources added in v2.4.1

func (c *Manager) UnpublishResources(hrefs ...string)

func (*Manager) Unregister

func (c *Manager) Unregister()

type Option

type Option func(*OptionsCfg)

func WithGetCertificates

func WithGetCertificates(getCertificates GetCertificates) Option

func WithLogger

func WithLogger(logger log.Logger) Option

func WithMaxMessageSize

func WithMaxMessageSize(maxMessageSize uint32) Option

func WithRemoveCloudCAs

func WithRemoveCloudCAs(removeCloudCA RemoveCloudCAs) Option

func WithTickInterval added in v2.4.3

func WithTickInterval(t time.Duration) Option

type OptionsCfg

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

type RemoveCloudCAs

type RemoveCloudCAs func(cloudID ...string)

Jump to

Keyboard shortcuts

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