apphost

package
v0.0.0-...-6ab3b6d Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const DaprPubSubComponentType = "pubsub"
View Source
const DaprStateStoreComponentType = "state"
View Source
const RedisContainerAppService = "redis"

Variables

This section is empty.

Functions

func BicepTemplate

func BicepTemplate(manifest *Manifest, options AppHostOptions) (*memfs.FS, error)

BicepTemplate returns a filesystem containing the generated bicep files for the given manifest. These files represent the shared infrastructure that would normally be under the `infra/` folder for the given manifest.

func ContainerAppManifestTemplateForProject

func ContainerAppManifestTemplateForProject(
	manifest *Manifest, projectName string, options AppHostOptions) (string, error)

ContainerAppManifestTemplateForProject returns the container app manifest template for a given project. It can be used (after evaluation) to deploy the service to a container app environment.

func Containers

func Containers(manifest *Manifest) map[string]genContainer

Containers returns information about all container.v0 resources from a manifest.

func Dockerfiles

func Dockerfiles(manifest *Manifest) map[string]genDockerfile

Dockerfiles returns information about all dockerfile.v0 resources from a manifest.

func EvalString

func EvalString(src string, evalExpr func(string) (string, error)) (string, error)

evalString evaluates a given string expression, using the provided evalExpr function to produce values for expressions in the string. It supports strings that contain expressions of the form "{expression}" where "expression" is any string that does not contain a '}' character. The evalExpr function is called with the expression (without the enclosing '{' and '}' characters) and should return the value to be substituted into the string. If the evalExpr function returns an error, evalString will return that error. The '{' and '}' characters can be escaped by doubling them, e.g. "{{" and "}}". If a string is malformed (e.g. an unmatched '{' or '}' character), evalString will return an error.

func GenerateProjectArtifacts

func GenerateProjectArtifacts(
	ctx context.Context,
	projectDir string,
	projectName string,
	manifest *Manifest,
	appHostProject string,
) (map[string]ContentsAndMode, error)

GenerateProjectArtifacts generates all the artifacts to manage a project with `azd`. The azure.yaml file as well as a helpful next-steps.md file.

func IsAspireDashboardEnabled

func IsAspireDashboardEnabled(alphaFeatureManager *alpha.FeatureManager) bool

func ProjectPaths

func ProjectPaths(manifest *Manifest) map[string]string

ProjectPaths returns a map of project names to their paths.

Types

type AppHostOptions

type AppHostOptions struct {
	AutoConfigureDataProtection bool
	AspireDashboard             bool
}

type AspireDashboard

type AspireDashboard struct {
	Link string
}

func AspireDashboardUrl

func AspireDashboardUrl(
	ctx context.Context,
	env *environment.Environment,
	alphaFeatureManager *alpha.FeatureManager) *AspireDashboard

func (*AspireDashboard) MarshalJSON

func (aspireD *AspireDashboard) MarshalJSON() ([]byte, error)

func (*AspireDashboard) ToString

func (aspireD *AspireDashboard) ToString(currentIndentation string) string

type Binding

type Binding struct {
	TargetPort *int   `json:"targetPort,omitempty"`
	Port       *int   `json:"port,omitempty"`
	Scheme     string `json:"scheme"`
	Protocol   string `json:"protocol"`
	Transport  string `json:"transport"`
	External   bool   `json:"external"`
}

type ContentsAndMode

type ContentsAndMode struct {
	Contents string
	Mode     fs.FileMode
}

type DaprComponentResourceMetadata

type DaprComponentResourceMetadata struct {
	Type *string `json:"type"`
}

type DaprResourceMetadata

type DaprResourceMetadata struct {
	AppId                  *string `json:"appId,omitempty"`
	Application            *string `json:"application,omitempty"`
	AppPort                *int    `json:"appPort,omitempty"`
	AppProtocol            *string `json:"appProtocol,omitempty"`
	DaprHttpMaxRequestSize *int    `json:"daprHttpMaxRequestSize,omitempty"`
	DaprHttpReadBufferSize *int    `json:"daprHttpReadBufferSize,omitempty"`
	EnableApiLogging       *bool   `json:"enableApiLogging,omitempty"`
	LogLevel               *string `json:"logLevel,omitempty"`
}

type Input

type Input struct {
	Type    string        `json:"type"`
	Secret  bool          `json:"secret"`
	Default *InputDefault `json:"default,omitempty"`
}

type InputDefault

type InputDefault struct {
	Generate *InputDefaultGenerate `json:"generate,omitempty"`
}

type InputDefaultGenerate

type InputDefaultGenerate struct {
	MinLength  *uint `json:"minLength,omitempty"`
	Lower      *bool `json:"lower,omitempty"`
	Upper      *bool `json:"upper,omitempty"`
	Numeric    *bool `json:"numeric,omitempty"`
	Special    *bool `json:"special,omitempty"`
	MinLower   *uint `json:"minLower,omitempty"`
	MinUpper   *uint `json:"minUpper,omitempty"`
	MinNumeric *uint `json:"minNumeric,omitempty"`
	MinSpecial *uint `json:"minSpecial,omitempty"`
}

type Manifest

type Manifest struct {
	Schema    string               `json:"$schema"`
	Resources map[string]*Resource `json:"resources"`
	// BicepFiles holds any bicep files generated by Aspire next to the manifest file.
	BicepFiles *memfs.FS `json:"-"`
}

func ManifestFromAppHost

func ManifestFromAppHost(
	ctx context.Context, appHostProject string, dotnetCli dotnet.DotNetCli, dotnetEnv string,
) (*Manifest, error)

ManifestFromAppHost returns the Manifest from the given app host.

type Reference

type Reference struct {
	Bindings []string `json:"bindings,omitempty"`
}

type Resource

type Resource struct {
	// Type is present on all resource types
	Type string `json:"type"`

	// Path is present on a project.v0 resource and is the path to the project file, and on a dockerfile.v0
	// resource and is the path to the Dockerfile (including the "Dockerfile" filename).
	// For a bicep.v0 resource, it is the path to the bicep file.
	Path *string `json:"path,omitempty"`

	// Context is present on a dockerfile.v0 resource and is the path to the context directory.
	Context *string `json:"context,omitempty"`

	// BuildArgs is present on a dockerfile.v0 resource and is the --build-arg for building the docker image.
	BuildArgs map[string]string `json:"buildArgs,omitempty"`

	// Args is optionally present on project.v0 and dockerfile.v0 resources and are the arguments to pass to the container.
	Args []string `json:"args,omitempty"`

	// Parent is present on a resource which is a child of another. It is the name of the parent resource. For example, a
	// postgres.database.v0 is a child of a postgres.server.v0, and so it would have a parent of which is the name of
	// the server resource.
	Parent *string `json:"parent,omitempty"`

	// Image is present on a container.v0 resource and is the image to use for the container.
	Image *string `json:"image,omitempty"`

	// Bindings is present on container.v0, project.v0 and dockerfile.v0 resources, and is a map of binding names to
	// binding details.
	Bindings custommaps.WithOrder[Binding] `json:"bindings,omitempty"`

	// Env is present on project.v0, container.v0 and dockerfile.v0 resources, and is a map of environment variable
	// names to value  expressions. The value expressions are simple expressions like "{redis.connectionString}" or
	// "{postgres.port}" to allow referencing properties of other resources. The set of properties supported in these
	// expressions depends on the type of resource you are referencing.
	Env map[string]string `json:"env,omitempty"`

	// Queues is optionally present on a azure.servicebus.v0 resource, and is a list of queue names to create.
	Queues *[]string `json:"queues,omitempty"`

	// Topics is optionally present on a azure.servicebus.v0 resource, and is a list of topic names to create.
	Topics *[]string `json:"topics,omitempty"`

	// Some resources just represent connections to existing resources that need not be provisioned.  These resources have
	// a "connectionString" property which is the connection string that should be used during binding.
	ConnectionString *string `json:"connectionString,omitempty"`

	// Dapr is present on dapr.v0 resources.
	Dapr *DaprResourceMetadata `json:"dapr,omitempty"`

	// DaprComponent is present on dapr.component.v0 resources.
	DaprComponent *DaprComponentResourceMetadata `json:"daprComponent,omitempty"`

	// Inputs is present on resources that need inputs from during the provisioning process (e.g asking for an API key, or
	// a password for a database).
	Inputs map[string]Input `json:"inputs,omitempty"`

	// For a bicep.v0 resource, defines the input parameters for the bicep file.
	Params map[string]any `json:"params,omitempty"`

	// parameter.v0 uses value field to define the value of the parameter.
	Value string

	// container.v0 uses volumes field to define the volumes of the container.
	Volumes []*Volume `json:"volumes,omitempty"`
}

type Volume

type Volume struct {
	Name     string `json:"name,omitempty"`
	Target   string `json:"target"`
	ReadOnly bool   `json:"readOnly"`
}

Jump to

Keyboard shortcuts

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