hostoptions

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RadiusDevEnvironment           = "dev"
	RadiusSelfHostedDevEnvironment = "self-hosted-dev"
	RadiusSelfHostedEnvironment    = "self-hosted"
	RadiusDogfood                  = "df-westus3"
	RadiusCanaryEastUS2EUAP        = "prod-eastus2euap"
	RadiusCanaryCentralUS2EUAP     = "prod-centralus2euap"
	RadiusProdPrefix               = "prod"
)

Variables

This section is empty.

Functions

func Environment

func Environment() string

Environment returns the current environment name.

func IsCanary

func IsCanary() bool

IsCanary returns true if the current environment is canary region.

func IsDevelopment

func IsDevelopment() bool

IsDevelopment returns true if the current environment is development environment.

func IsDogfood

func IsDogfood() bool

IsDogfood returns true if the current environment is dogfood environment.

func IsProduction

func IsProduction() bool

IsProduction returns true if the current environment is production, but not canary.

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"`
	StorageProvider  dataprovider.StorageProviderOptions      `yaml:"storageProvider"`
	SecretProvider   sprovider.SecretProviderOptions          `yaml:"secretProvider"`
	QueueProvider    qprovider.QueueProviderOptions           `yaml:"queueProvider"`
	Server           *ServerOptions                           `yaml:"server,omitempty"`
	WorkerServer     *WorkerServerOptions                     `yaml:"workerServer,omitempty"`
	MetricsProvider  metricsprovider.MetricsProviderOptions   `yaml:"metricsProvider"`
	TracerProvider   trace.Options                            `yaml:"tracerProvider"`
	ProfilerProvider profilerprovider.ProfilerProviderOptions `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"`
}

ServerOptions includes http server bootstrap options.

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.

Jump to

Keyboard shortcuts

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