config

package
v0.0.0-...-29c6822 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2018 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigTopic = "mdm.ServerConfigUpdated"
View Source
const DEPTokenTopic = "mdm.TokenAdded"

Variables

This section is empty.

Functions

func MakeApplyDEPTokensEndpoint

func MakeApplyDEPTokensEndpoint(svc Service) endpoint.Endpoint

func MakeGetDEPTokensEndpoint

func MakeGetDEPTokensEndpoint(svc Service) endpoint.Endpoint

func MakeHTTPHandler

func MakeHTTPHandler(e Endpoints, logger log.Logger) *mux.Router

func MakeSavePushCertificateEndpoint

func MakeSavePushCertificateEndpoint(svc Service) endpoint.Endpoint

func MarshalServerConfig

func MarshalServerConfig(conf *ServerConfig) ([]byte, error)

func UnmarshalServerConfig

func UnmarshalServerConfig(data []byte, conf *ServerConfig) error

Types

type ConfigService

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

func New

func New(store Store) *ConfigService

func (*ConfigService) ApplyDEPToken

func (svc *ConfigService) ApplyDEPToken(ctx context.Context, P7MContent []byte) error

func (*ConfigService) GetDEPTokens

func (svc *ConfigService) GetDEPTokens(ctx context.Context) ([]DEPToken, []byte, error)

func (*ConfigService) SavePushCertificate

func (svc *ConfigService) SavePushCertificate(ctx context.Context, cert, key []byte) error

type DEPToken

type DEPToken struct {
	ConsumerKey       string    `json:"consumer_key"`
	ConsumerSecret    string    `json:"consumer_secret"`
	AccessToken       string    `json:"access_token"`
	AccessSecret      string    `json:"access_secret"`
	AccessTokenExpiry time.Time `json:"access_token_expiry"`
}

func (DEPToken) Client

func (tok DEPToken) Client() (dep.Client, error)

create a DEP client from token.

type Endpoints

type Endpoints struct {
	ApplyDEPTokensEndpoint      endpoint.Endpoint
	SavePushCertificateEndpoint endpoint.Endpoint
	GetDEPTokensEndpoint        endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service) Endpoints

func (Endpoints) ApplyDEPToken

func (e Endpoints) ApplyDEPToken(ctx context.Context, P7MContent []byte) error

func (Endpoints) GetDEPTokens

func (e Endpoints) GetDEPTokens(ctx context.Context) ([]DEPToken, []byte, error)

func (Endpoints) SavePushCertificate

func (e Endpoints) SavePushCertificate(ctx context.Context, cert, key []byte) error

type ServerConfig

type ServerConfig struct {
	PushCertificate []byte
	PrivateKey      []byte
}

ServerConfig holds the configuration of the MDM Server.

type Service

type Service interface {
	SavePushCertificate(ctx context.Context, cert, key []byte) error
	ApplyDEPToken(ctx context.Context, P7MContent []byte) error
	GetDEPTokens(ctx context.Context) ([]DEPToken, []byte, error)
}

func NewHTTPClient

func NewHTTPClient(instance, token string, logger log.Logger, opts ...httptransport.ClientOption) (Service, error)

type Store

type Store interface {
	SavePushCertificate(cert, key []byte) error
	PushCertificate() (*tls.Certificate, error)
	PushTopic() (string, error)
	DEPKeypair() (key *rsa.PrivateKey, cert *x509.Certificate, err error)
	AddToken(consumerKey string, json []byte) error
	DEPTokens() ([]DEPToken, error)
}

Directories

Path Synopsis
internal
configproto
Package configproto is a generated protocol buffer package.
Package configproto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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