userdata

package
v0.0.0-...-c5d2a6e Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectiveToContentType

func DirectiveToContentType(d Directive) (string, error)

DirectiveToContentType maps a cloud-init directive to its MIME content type.

Types

type ClosingTag

type ClosingTag string

ClosingTag represents a marker that ends user data.

const (
	PowerShellScriptClosingTag ClosingTag = "</powershell>"
	BatchScriptClosingTag      ClosingTag = "</script>"
)

type Directive

type Directive string

Directive represents a marker that starts user data and indicates its type.

const (
	ShellScript   Directive = "#!"
	Include       Directive = "#include"
	CloudConfig   Directive = "#cloud-config"
	UpstartJob    Directive = "#upstart-job"
	CloudBoothook Directive = "#cloud-boothook"
	PartHandler   Directive = "#part-handler"
	// Windows-only types
	PowerShellScript Directive = "<powershell>"
	BatchScript      Directive = "<script>"
)

func Directives

func Directives() []Directive

func (Directive) CanPersist

func (d Directive) CanPersist() bool

CanPersist returns whether or not this directive is compatible with persisting user data (i.e. running it on every boot). This is relevant to Windows only.

func (Directive) ClosingTag

func (d Directive) ClosingTag() ClosingTag

ClosingTag returns the closing tag that marks the end of the directive.

func (Directive) NeedsClosingTag

func (d Directive) NeedsClosingTag() bool

NeedsClosingTag returns whether or not this directive must be closed.

type Options

type Options struct {
	// Directive is the marker at the start of user data that determines the
	// type of user data.
	Directive Directive
	// Content is the content of the user data itself, excluding metadata such
	// as the directive and tags.
	Content string

	// Persist indicates that the user data should run on every reboot rather
	// than just once. This is only used on Windows.
	Persist bool
}

Options represent parameters for generating user data.

func (*Options) Validate

func (u *Options) Validate() error

Validate verifies that the options are valid and sets defaults for closing tag if none is specified.

Jump to

Keyboard shortcuts

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