store

package
v0.0.0-...-cc2a774 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken string

func (AccessToken) GetSubject

func (t AccessToken) GetSubject() (string, error)

func (AccessToken) String

func (t AccessToken) String() string

type Endpoint

type Endpoint struct {
	AuthUrl  string `json:"AuthUrl" envconfig:"AUTH_URL" required:"true"`
	TokenUrl string `json:"TokenUrl" envconfig:"TOKEN_URL" required:"true"`
}

type LinkedAccount

type LinkedAccount struct {
	ID          string
	TargetURL   string
	TargetCloud OAuth
	OriginCloud OAuth
}

func (LinkedAccount) RefreshTokens

func (l LinkedAccount) RefreshTokens(ctx context.Context, s Store) (LinkedAccount, error)

type LinkedAccountHandler

type LinkedAccountHandler interface {
	Handle(ctx context.Context, iter LinkedAccountIter) (err error)
}

type LinkedAccountIter

type LinkedAccountIter interface {
	Next(ctx context.Context, sub *LinkedAccount) bool
	Err() error
}

type LinkedCloud

type LinkedCloud struct {
	ID           string   `json:"ID"`
	Name         string   `json:"Name" envconfig:"NAME" required:"true"`
	ClientID     string   `json:"ClientId" envconfig:"CLIENT_ID" required:"true"`
	ClientSecret string   `json:"ClientSecret" envconfig:"CLIENT_SECRET" required:"true"`
	Scopes       []string `json:"Scopes" envconfig:"SCOPES" required:"true"`
	Endpoint     Endpoint `json:"Endpoint"`
	Audience     string   `json:"Audience" envconfig:"AUDIENCE"`
}

func (LinkedCloud) ToOAuth2Config

func (l LinkedCloud) ToOAuth2Config() oauth2.Config

type LinkedCloudHandler

type LinkedCloudHandler interface {
	Handle(ctx context.Context, iter LinkedCloudIter) (err error)
}

type LinkedCloudIter

type LinkedCloudIter interface {
	Next(ctx context.Context, sub *LinkedCloud) bool
	Err() error
}

type LinkedCloudsHandler

type LinkedCloudsHandler struct {
	LinkedClouds []LinkedCloud
}

func (*LinkedCloudsHandler) Handle

func (h *LinkedCloudsHandler) Handle(ctx context.Context, iter LinkedCloudIter) (err error)

type OAuth

type OAuth struct {
	LinkedCloudID string
	AccessToken   AccessToken
	RefreshToken  string
	Expiry        time.Time
}

func (OAuth) GetAccessToken

func (o OAuth) GetAccessToken() (AccessToken, error)

func (OAuth) IsValidAccessToken

func (o OAuth) IsValidAccessToken() bool

func (OAuth) Refresh

func (o OAuth) Refresh(ctx context.Context, s Store) (OAuth, error)

type Query

type Query struct {
	ID string
}

type Store

type Store interface {
	UpdateLinkedCloud(ctx context.Context, sub LinkedCloud) error
	InsertLinkedCloud(ctx context.Context, sub LinkedCloud) error
	RemoveLinkedCloud(ctx context.Context, ConfigId string) error
	LoadLinkedClouds(ctx context.Context, query Query, h LinkedCloudHandler) error

	UpdateLinkedAccount(ctx context.Context, sub LinkedAccount) error
	InsertLinkedAccount(ctx context.Context, sub LinkedAccount) error
	RemoveLinkedAccount(ctx context.Context, LinkedAccountId string) error
	LoadLinkedAccounts(ctx context.Context, query Query, h LinkedAccountHandler) error

	LoadSubscriptions(ctx context.Context, query []SubscriptionQuery, h SubscriptionHandler) error
	FindOrCreateSubscription(ctx context.Context, sub Subscription) (Subscription, error)
	RemoveSubscriptions(ctx context.Context, query SubscriptionQuery) error
}

type Subscription

type Subscription struct {
	SubscriptionID  string
	Type            Type
	LinkedAccountID string
	DeviceID        string
	Href            string
	SigningSecret   string
}

type SubscriptionHandler

type SubscriptionHandler interface {
	Handle(ctx context.Context, iter SubscriptionIter) (err error)
}

type SubscriptionIter

type SubscriptionIter interface {
	Next(ctx context.Context, sub *Subscription) bool
	Err() error
}

type SubscriptionQuery

type SubscriptionQuery struct {
	SubscriptionID  string
	LinkedAccountID string
	DeviceID        string
	Href            string
	Type            Type
}

type Type

type Type string
const (
	Type_Devices  Type = "devices"
	Type_Device   Type = "device"
	Type_Resource Type = "resource"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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