Documentation
¶
Index ¶
- Constants
- func Environment() string
- func IsDevelopment() bool
- func IsSelfHosted() bool
- func WithContext(ctx context.Context, cfg *ProviderConfig) context.Context
- type AuthentificationType
- type BicepOptions
- type EnvironmentOptions
- type EnvironmentType
- type HostOptions
- type IdentityOptions
- type ProviderConfig
- type ServerOptions
- type TerraformOptions
- type WorkerServerOptions
Constants ¶
const ( RadiusDevEnvironment = "dev" RadiusSelfHostedEnvironment = "self-hosted" )
Variables ¶
This section is empty.
Functions ¶
func Environment ¶
func Environment() string
Environment returns the current environment name. Can be configured by the RADIUS_ENV environment variables. Defaults to "dev" if not set.
func IsDevelopment ¶
func IsDevelopment() bool
IsDevelopment returns true if the current environment is development environment.
func IsSelfHosted ¶
func IsSelfHosted() bool
IsSelfHosted returns true if the current environment is self-hosted environment.
func WithContext ¶
func WithContext(ctx context.Context, cfg *ProviderConfig) context.Context
WithContext injects ProviderConfig into the given http context.
Types ¶
type AuthentificationType ¶
type AuthentificationType string
const ( ClientCertificateAuthType AuthentificationType = "ClientCertificate" AADPoPAuthType AuthentificationType = "PoP" )
type BicepOptions ¶ added in v0.26.0
type BicepOptions struct {
// DeleteRetryCount is the number of times to retry the request.
DeleteRetryCount string `yaml:"deleteRetryCount,omitempty"`
// DeleteRetryDelaySeconds is the delay between retries in seconds.
DeleteRetryDelaySeconds string `yaml:"deleteRetryDelaySeconds,omitempty"`
}
BicepOptions includes options required for bicep execution.
type EnvironmentOptions ¶
type EnvironmentOptions struct {
Name EnvironmentType `yaml:"name"`
RoleLocation string `yaml:"roleLocation"`
}
EnvironmentOptions represents the environment.
type EnvironmentType ¶
type EnvironmentType string
const ( Development EnvironmentType = "Dev" SelfHosted EnvironmentType = "Self-Hosted" AzureDogfood EnvironmentType = "Dogfood" AzureCloud EnvironmentType = "AzureCloud" AzureChinaCloud EnvironmentType = "AzureChinaCloud" AzureUSGovernment EnvironmentType = "AzureUSGovernment" AzureGermanCloud EnvironmentType = "AzureGermanCloud" )
type HostOptions ¶
type HostOptions struct {
// Config is the bootstrap configuration loaded from config file.
Config *ProviderConfig
// Arm is the ARM authorization configuration.
Arm *armauth.ArmConfig
// K8sConfig is the Kubernetes configuration for communicating with the local
// cluster.
K8sConfig *rest.Config
// UCPConnection is a connection to the UCP endpoint.
UCPConnection sdk.Connection
}
HostOptions defines all of the settings that our RP's execution environment provides.
func NewHostOptionsFromEnvironment ¶
func NewHostOptionsFromEnvironment(configPath string) (HostOptions, error)
NewHostOptionsFromEnvironment loads configuration from a given path, retrieves Kubernetes and ARM configurations, and returns a HostOptions object containing the configurations, or an error if any of the operations fail.
type IdentityOptions ¶
type IdentityOptions struct {
ClientID string `yaml:"clientId"`
Instance string `yaml:"instance"`
TenantID string `yaml:"tenantId"`
ArmEndpoint string `yaml:"armEndpoint"`
Audience string `yaml:"audience"`
PemCertPath string `yaml:"pemCertPath"`
}
IdentityOptions includes authentication options to issue JWT from Azure AD.
type ProviderConfig ¶
type ProviderConfig struct {
Env EnvironmentOptions `yaml:"environment"`
Identity IdentityOptions `yaml:"identity"`
DatabaseProvider databaseprovider.Options `yaml:"databaseProvider"`
SecretProvider secretprovider.SecretProviderOptions `yaml:"secretProvider"`
QueueProvider queueprovider.QueueProviderOptions `yaml:"queueProvider"`
Server *ServerOptions `yaml:"server,omitempty"`
WorkerServer *WorkerServerOptions `yaml:"workerServer,omitempty"`
MetricsProvider metricsservice.Options `yaml:"metricsProvider"`
TracerProvider traceservice.Options `yaml:"tracerProvider"`
ProfilerProvider profilerservice.Options `yaml:"profilerProvider"`
UCP config.UCPOptions `yaml:"ucp"`
Logging ucplog.LoggingOptions `yaml:"logging"`
Bicep BicepOptions `yaml:"bicep,omitempty"`
Terraform TerraformOptions `yaml:"terraform,omitempty"`
// FeatureFlags includes the list of feature flags.
FeatureFlags []string `yaml:"featureFlags"`
}
ProviderConfig includes the resource provider configuration.
func FromContext ¶
func FromContext(ctx context.Context) *ProviderConfig
FromContext extracts ProviderConfig from http context.
type ServerOptions ¶
type ServerOptions struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
PathBase string `yaml:"pathBase,omitempty"`
AuthType AuthentificationType `yaml:"authType,omitempty"`
// ArmMetadataEndpoints provides the client certification to authenticate between ARM and RP.
// https://armwiki.azurewebsites.net/authorization/AuthenticateBetweenARMandRP.html
ArmMetadataEndpoint string `yaml:"armMetadataEndpoint,omitempty"`
// EnableAuth when set the arm client authetication will be performed
EnableArmAuth bool `yaml:"enableArmAuth,omitempty"`
// TLSCertificateDirectory is the directory where the TLS certificates are stored.
//
// The server code will expect to find the following files in this directory:
// - tls.crt: The server's certificate.
// - tls.key: The server's private key.
TLSCertificateDirectory string `yaml:"tlsCertificateDirectory,omitempty"`
}
ServerOptions includes http server bootstrap options.
func (ServerOptions) Address ¶ added in v0.42.0
func (s ServerOptions) Address() string
Address returns the address of the server in host:port format.
type TerraformOptions ¶
type TerraformOptions struct {
// Path is the path to the directory mounted to the container where terraform can be installed and executed.
Path string `yaml:"path,omitempty"`
}
TerraformOptions includes options required for terraform execution.
type WorkerServerOptions ¶
type WorkerServerOptions struct {
// Port is the localhost port which provides the system-level info, such as healthprobe and metric port
Port *int32 `yaml:"port,omitempty"`
// MaxOperationConcurrency is the maximum concurrency to process async request operation.
MaxOperationConcurrency *int `yaml:"maxOperationConcurrency,omitempty"`
// MaxOperationRetryCount is the maximum retry count to process async request operation.
MaxOperationRetryCount *int `yaml:"maxOperationRetryCount,omitempty"`
}
WorkerServerOptions includes the worker server options.