cloud

package
v2.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ProvisioningStatusDEREGISTERING cloud.ProvisioningStatus = "deregistering"

Variables

View Source
var (
	ErrMissingAccessToken = fmt.Errorf("access token missing")
	ErrCannotSignIn       = fmt.Errorf("cannot sign in")
)
View Source
var (
	ErrMissingAuthorizationCode     = fmt.Errorf("authorization code missing")
	ErrMissingAuthorizationProvider = fmt.Errorf("authorization provider missing")
	ErrCannotSignUp                 = fmt.Errorf("cannot sign up")
)
View Source
var ErrCannotPublishResources = fmt.Errorf("cannot publish resources")
View Source
var ErrCannotRefreshToken = fmt.Errorf("cannot refresh token")
View Source
var ErrCannotSignOff = fmt.Errorf("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, 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) 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

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