lms

package
v0.0.0-...-4b7ff4e Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0, Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FakeCaCertificate     = "cert-ca-payload"
	FakeSignedCertificate = "signed-cert-payload"
	FakeLmsHost           = "lms.localhost"
	FakePrivateKey        = "private-key"
)

Variables

This section is empty.

Functions

func NewTenantManager

func NewTenantManager(storage TenantStorage, lmsClient TenantCreator, log logrus.FieldLogger) *manager

Types

type Client

type Client interface {
	CreateTenant(input CreateTenantInput) (o CreateTenantOutput, err error)
	GetTenantStatus(tenantID string) (status TenantStatus, err error)
	GetTenantInfo(tenantID string) (status TenantInfo, err error)

	GetCACertificate(tenantID string) (cert string, found bool, err error)
	GetCertificateByURL(url string) (cert string, found bool, err error)
	RequestCertificate(tenantID string, subject pkix.Name) (string, []byte, error)
}

func NewClient

func NewClient(cfg Config, log logrus.FieldLogger) Client

type ClusterType

type ClusterType string

ClusterType can be ha or single-node

const (
	ClusterTypeHA         ClusterType = "ha"
	ClusterTypeSingleNode ClusterType = "single-node"
)

type Config

type Config struct {
	URL string

	// tenant predefined values
	ClusterType ClusterType // ha or single-node
	Environment string

	Token      string
	SamlTenant string
	Region     string `envconfig:"optional"`
	Mandatory  bool   `envconfig:"default=true"`

	Disabled bool
}

func (Config) Validate

func (c Config) Validate() error

type CreateTenantInput

type CreateTenantInput struct {
	Name            string
	Region          string
	GlobalAccountID string
}

type CreateTenantOutput

type CreateTenantOutput struct {
	ID string `json:"id"`
}

type FakeClient

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

FakeClient implements the lms client interface but does not call real external system

func NewFakeClient

func NewFakeClient(timeToReady time.Duration) *FakeClient

NewFakeClient creates lms fake client which response tenant ready after timeToReady duration

func (*FakeClient) CreateTenant

func (f *FakeClient) CreateTenant(input CreateTenantInput) (o CreateTenantOutput, err error)

func (*FakeClient) GetCACertificate

func (f *FakeClient) GetCACertificate(tenantID string) (cert string, found bool, err error)

func (*FakeClient) GetCertificateByURL

func (f *FakeClient) GetCertificateByURL(url string) (cert string, found bool, err error)

func (*FakeClient) GetTenantInfo

func (f *FakeClient) GetTenantInfo(tenantID string) (status TenantInfo, err error)

func (*FakeClient) GetTenantStatus

func (f *FakeClient) GetTenantStatus(tenantID string) (status TenantStatus, err error)

func (*FakeClient) IsCertRequestedForTenant

func (f *FakeClient) IsCertRequestedForTenant(tenantID string) bool

assert methods

func (*FakeClient) RequestCertificate

func (f *FakeClient) RequestCertificate(tenantID string, subj pkix.Name) (id string, privateKey []byte, err error)

type TenantCreator

type TenantCreator interface {
	CreateTenant(input CreateTenantInput) (o CreateTenantOutput, err error)
}

type TenantInfo

type TenantInfo struct {
	ID  string `json:"id"`
	DNS string `json:"dns"`
}

type TenantStatus

type TenantStatus struct {
	KibanaDNSResolves        bool   `json:"kibanaDNSResolves"`
	ElasticsearchDNSResolves bool   `json:"elasticsearchDNSResolves"`
	KibanaState              string `json:"kibanaState"`
}

type TenantStorage

type TenantStorage interface {
	FindTenantByName(name, region string) (internal.LMSTenant, bool, error)
	InsertTenant(tenant internal.LMSTenant) error
}

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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