config

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const (
	DefaultApiUrl    = "https://api.permit.io"
	DefaultDebugMode = false
	DefaultPdpUrl    = "http://localhost:7766"
	DefaultOpaUrl    = "http://localhost:8181"
)

Default Builder consts

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyLevel

type APIKeyLevel int
const (
	NoneAPIKeyLevel APIKeyLevel = iota
	OrganizationAPIKeyLevel
	ProjectAPIKeyLevel
	EnvironmentAPIKeyLevel
)

func GetApiKeyLevel

func GetApiKeyLevel(scope *models.APIKeyScopeRead) APIKeyLevel

type IPermitConfig

type IPermitConfig interface {
	GetApiUrl() string
	GetToken() string
	GetPdpUrl() string
	GetOpaUrl() string
	GetDebug() bool
	GetContext() *PermitContext
	GetLogger() *zap.Logger
}

type PermitBuilder

type PermitBuilder struct {
	PermitConfig
}

func NewConfigBuilder

func NewConfigBuilder(token string) *PermitBuilder

type PermitConfig

type PermitConfig struct {
	Context *PermitContext
	Logger  *zap.Logger
	// contains filtered or unexported fields
}

func NewPermitConfig

func NewPermitConfig(apiUrl string, token string, pdpUrl string, debug bool, context *PermitContext, logger *zap.Logger) *PermitConfig

func (*PermitConfig) Build

func (c *PermitConfig) Build() PermitConfig

func (*PermitConfig) GetApiUrl

func (c *PermitConfig) GetApiUrl() string

func (*PermitConfig) GetContext

func (c *PermitConfig) GetContext() *PermitContext

func (*PermitConfig) GetDebug

func (c *PermitConfig) GetDebug() bool

func (*PermitConfig) GetHTTPClient added in v0.0.10

func (c *PermitConfig) GetHTTPClient() *http.Client

func (*PermitConfig) GetLogger

func (c *PermitConfig) GetLogger() *zap.Logger

func (*PermitConfig) GetOpaUrl added in v0.0.4

func (c *PermitConfig) GetOpaUrl() string

func (*PermitConfig) GetPdpUrl

func (c *PermitConfig) GetPdpUrl() string

func (*PermitConfig) GetToken

func (c *PermitConfig) GetToken() string

func (*PermitConfig) WithApiUrl

func (c *PermitConfig) WithApiUrl(apiUrl string) *PermitConfig

func (*PermitConfig) WithContext

func (c *PermitConfig) WithContext(context *PermitContext) *PermitConfig

func (*PermitConfig) WithDebug

func (c *PermitConfig) WithDebug(debug bool) *PermitConfig

func (*PermitConfig) WithHTTPClient added in v0.0.10

func (c *PermitConfig) WithHTTPClient(client *http.Client) *PermitConfig

func (*PermitConfig) WithLogger

func (c *PermitConfig) WithLogger(logger *zap.Logger) *PermitConfig

func (*PermitConfig) WithOpaUrl added in v0.0.4

func (c *PermitConfig) WithOpaUrl(opaUrl string) *PermitConfig

func (*PermitConfig) WithPdpUrl added in v0.0.2

func (c *PermitConfig) WithPdpUrl(pdpUrl string) *PermitConfig

type PermitContext

type PermitContext struct {
	APIKeyLevel   APIKeyLevel
	ProjectId     string
	EnvironmentId string
}

func NewPermitContext

func NewPermitContext(apiKeyLevel APIKeyLevel, project string, environment string) *PermitContext

func PermitContextFactory

func PermitContextFactory(ctx context.Context, client *openapi.APIClient, project string, environment string, isUserInput bool) (*PermitContext, error)

func (*PermitContext) GetContext

func (p *PermitContext) GetContext() *PermitContext

func (*PermitContext) GetEnvironment

func (p *PermitContext) GetEnvironment() string

func (*PermitContext) GetProject

func (p *PermitContext) GetProject() string

func (*PermitContext) SetPermitContext added in v0.0.4

func (p *PermitContext) SetPermitContext(project string, environment string, apiKeyLevel APIKeyLevel)

type PermitContextInterface

type PermitContextInterface interface {
	SetPermitContext(project string, environment string, apiKeyLevel APIKeyLevel)
	GetProject() string
	GetEnvironment() string
	GetContext() *PermitContext
}

Jump to

Keyboard shortcuts

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