ocm

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthPayload

type AuthPayload struct {
	Username     string `json:"username"`
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name"`
	Organization string `json:"org_id"`
	Email        string `json:"email"`
	Issuer       string `json:"iss"`
	ClientID     string `json:"clientId"`
	IsAdmin      bool   `json:"is_admin"`
	IsUser       bool   `json:"is_user"`
}

AuthPayload defines the structure of the User

type Client

type Client struct {
	Cache *cache.Cache

	Authentication OCMAuthentication
	Authorization  OCMAuthorization
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config Config, log *logrus.Logger) (*Client, error)

func (*Client) NewConnection

func (c *Client) NewConnection() (*sdkClient.Connection, error)

NewConnection creates a new connection

type Config

type Config struct {
	BaseURL      string `envconfig:"OCM_BASE_URL" default:""`
	ClientID     string `envconfig:"OCM_SERVICE_CLIENT_ID" default:""`
	ClientSecret string `envconfig:"OCM_SERVICE_CLIENT_SECRET" default:""`
	SelfToken    string `envconfig:"OCM_SELF_TOKEN" default:""`
}

type OCMAuthentication

type OCMAuthentication interface {
	AuthenticatePullSecret(ctx context.Context, pullSecret string) (user *AuthPayload, err error)
}

type OCMAuthorization

type OCMAuthorization interface {
	AccessReview(ctx context.Context, username, action, resourceType string) (allowed bool, err error)
	CapabilityReview(ctx context.Context, username, capabilityName, capabilityType string) (allowed bool, err error)
}

type SdKLogger

type SdKLogger struct {
	Log         *logrus.Logger
	FieldLogger logrus.FieldLogger
}

func (*SdKLogger) Debug

func (l *SdKLogger) Debug(ctx context.Context, format string, args ...interface{})

func (*SdKLogger) DebugEnabled

func (l *SdKLogger) DebugEnabled() bool

func (*SdKLogger) Error

func (l *SdKLogger) Error(ctx context.Context, format string, args ...interface{})

func (*SdKLogger) ErrorEnabled

func (l *SdKLogger) ErrorEnabled() bool

func (*SdKLogger) Info

func (l *SdKLogger) Info(ctx context.Context, format string, args ...interface{})

func (*SdKLogger) InfoEnabled

func (l *SdKLogger) InfoEnabled() bool

func (*SdKLogger) Warn

func (l *SdKLogger) Warn(ctx context.Context, format string, args ...interface{})

func (*SdKLogger) WarnEnabled

func (l *SdKLogger) WarnEnabled() bool

Jump to

Keyboard shortcuts

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