Documentation
¶
Index ¶
- Constants
- type APIKeyLevel
- type FactsSyncTimeoutPolicy
- type IPermitConfig
- type PermitBuilder
- type PermitConfig
- func (c *PermitConfig) Build() PermitConfig
- func (c *PermitConfig) GetApiUrl() string
- func (c *PermitConfig) GetContext() *PermitContext
- func (c *PermitConfig) GetDebug() bool
- func (c *PermitConfig) GetFactsSyncTimeout() *time.Duration
- func (c *PermitConfig) GetFactsSyncTimeoutPolicy() FactsSyncTimeoutPolicy
- func (c *PermitConfig) GetHTTPClient() *http.Client
- func (c *PermitConfig) GetLogger() *zap.Logger
- func (c *PermitConfig) GetOpaUrl() string
- func (c *PermitConfig) GetPdpUrl() string
- func (c *PermitConfig) GetProxyFactsViaPDP() bool
- func (c *PermitConfig) GetToken() string
- func (c *PermitConfig) WithApiUrl(apiUrl string) *PermitConfig
- func (c *PermitConfig) WithContext(context *PermitContext) *PermitConfig
- func (c *PermitConfig) WithDebug(debug bool) *PermitConfig
- func (c *PermitConfig) WithFactsSyncTimeout(timeout time.Duration) *PermitConfig
- func (c *PermitConfig) WithHTTPClient(client *http.Client) *PermitConfig
- func (c *PermitConfig) WithLogger(logger *zap.Logger) *PermitConfig
- func (c *PermitConfig) WithOpaUrl(opaUrl string) *PermitConfig
- func (c *PermitConfig) WithPdpUrl(pdpUrl string) *PermitConfig
- func (c *PermitConfig) WithProxyFactsViaPDP(proxyFactsViaPDP bool) *PermitConfig
- func (c *PermitConfig) WithTimeout(timeout time.Duration) *PermitConfig
- type PermitContext
- type PermitContextInterface
Constants ¶
View Source
const ( DefaultApiUrl = "https://api.permit.io" DefaultDebugMode = false DefaultPdpUrl = "http://localhost:7766" DefaultOpaUrl = "http://localhost:8181" DefaultTimeout = time.Second * 5 DefaultFactsSyncTimeout = 10 * time.Second )
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 FactsSyncTimeoutPolicy ¶ added in v1.2.2
type FactsSyncTimeoutPolicy string
FactsSyncTimeoutPolicy defines the possible policies for facts synchronization timeout
const ( // FactsSyncTimeoutPolicyIgnore indicates to ignore timeout and continue FactsSyncTimeoutPolicyIgnore FactsSyncTimeoutPolicy = "ignore" // FactsSyncTimeoutPolicyFail indicates to fail the request when timeout is reached FactsSyncTimeoutPolicyFail FactsSyncTimeoutPolicy = "fail" )
type IPermitConfig ¶
type IPermitConfig interface {
GetApiUrl() string
GetToken() string
GetPdpUrl() string
GetOpaUrl() string
GetDebug() bool
GetContext() *PermitContext
GetLogger() *zap.Logger
// Deprecated: GetProxyFactsViaPDP will be removed in future versions.
GetProxyFactsViaPDP() bool
GetFactsSyncTimeout() *time.Duration
GetFactsSyncTimeoutPolicy() FactsSyncTimeoutPolicy
GetHTTPClient() *http.Client
}
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) GetFactsSyncTimeout ¶ added in v1.1.2
func (c *PermitConfig) GetFactsSyncTimeout() *time.Duration
func (*PermitConfig) GetFactsSyncTimeoutPolicy ¶ added in v1.2.2
func (c *PermitConfig) GetFactsSyncTimeoutPolicy() FactsSyncTimeoutPolicy
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) GetProxyFactsViaPDP ¶ added in v1.1.2
func (c *PermitConfig) GetProxyFactsViaPDP() bool
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) WithFactsSyncTimeout ¶ added in v1.1.2
func (c *PermitConfig) WithFactsSyncTimeout(timeout time.Duration) *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
func (*PermitConfig) WithProxyFactsViaPDP ¶ added in v1.1.2
func (c *PermitConfig) WithProxyFactsViaPDP(proxyFactsViaPDP bool) *PermitConfig
func (*PermitConfig) WithTimeout ¶ added in v1.0.5
func (c *PermitConfig) WithTimeout(timeout time.Duration) *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 (*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
}
Click to show internal directories.
Click to hide internal directories.