az

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AzureUserAgentEnvVar is the environment variable used by the az CLI to set
	// the user agent string sent to Azure.
	AzureUserAgentEnvVar = "AZURE_HTTP_USER_AGENT"

	// UserAgentOptOutEnvVar is the name of the environment variable that disables
	// user agent reporting.
	UserAgentOptOutEnvVar = "PORTER_AZ_MIXIN_USER_AGENT_OPT_OUT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name  string
	Steps []TypedStep // using UnmarshalYAML so that we don't need a custom type per action
}

func (Action) GetSteps

func (a Action) GetSteps() []builder.ExecutableStep

func (Action) MakeSteps

func (a Action) MakeSteps() interface{}

MakeSteps builds a slice of Steps for data to be unmarshaled into.

func (*Action) UnmarshalYAML

func (a *Action) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML takes any yaml in this form ACTION: - az: ... and puts the steps into the Action.Steps field

type BuildInput

type BuildInput struct {
	Config MixinConfig
}

BuildInput represents stdin passed to the mixin for the build command.

type GroupCommand added in v0.6.0

type GroupCommand struct {
	Description string `yaml:"description"`
	Name        string `yaml:"name"`
	Location    string `yaml:"location"`
	// contains filtered or unexported fields
}

GroupCommand ensures that a group exist or not

func (*GroupCommand) GetArguments added in v0.6.0

func (c *GroupCommand) GetArguments() []string

func (*GroupCommand) GetCommand added in v0.6.0

func (c *GroupCommand) GetCommand() string

func (*GroupCommand) GetFlags added in v0.6.0

func (c *GroupCommand) GetFlags() builder.Flags

func (*GroupCommand) GetWorkingDir added in v0.6.0

func (c *GroupCommand) GetWorkingDir() string

func (*GroupCommand) HandleError added in v0.6.0

func (c *GroupCommand) HandleError(ctx context.Context, err builder.ExitError, stdout string, stderr string) error

func (*GroupCommand) SetAction added in v0.6.0

func (c *GroupCommand) SetAction(action string)

func (*GroupCommand) SuppressesOutput added in v0.6.0

func (c *GroupCommand) SuppressesOutput() bool

type Mixin

type Mixin struct {
	runtime.RuntimeConfig
	// contains filtered or unexported fields
}

func New

func New() *Mixin

New azure mixin client, initialized with useful defaults.

func NewFor added in v1.0.0

func NewFor(cfg runtime.RuntimeConfig) *Mixin

func (*Mixin) Build

func (m *Mixin) Build(ctx context.Context) error

Build installs the az cli and any configured extensions.

func (*Mixin) Execute

func (m *Mixin) Execute(ctx context.Context) error

func (*Mixin) GetMixinUserAgent added in v1.0.0

func (m *Mixin) GetMixinUserAgent() string

GetMixinUserAgent returns the portion of the user agent string for the mixin.

func (*Mixin) PrintSchema

func (m *Mixin) PrintSchema() error

func (*Mixin) PrintVersion

func (m *Mixin) PrintVersion(opts version.Options) error

func (*Mixin) SetUserAgent added in v0.7.0

func (m *Mixin) SetUserAgent()

SetUserAgent sets the AZURE_HTTP_USER_AGENT environment variable with the full user agent string, which includes both a portion for porter and the mixin.

func (*Mixin) Version added in v0.7.0

func (m *Mixin) Version() mixin.Metadata

type MixinConfig

type MixinConfig struct {
	// UserAgentOptOut allows a bundle author to opt out from adding porter and the mixin's version to the az CLI user agent string.
	UserAgentOptOut bool `yaml:"userAgentOptOut,omitempty"`

	// ClientVersion is the version of the az CLI to install.
	ClientVersion string `yaml:"clientVersion,omitempty"`

	// Extensions is a list of az CLI extensions to install.
	Extensions []string `yaml:"extensions,omitempty"`
}

MixinConfig represents configuration that can be set on the az mixin in porter.yaml mixins:

  • az: extensions:
  • NAME

type Output

type Output struct {
	Name string `yaml:"name"`

	// See https://porter.sh/mixins/exec/#outputs
	JsonPath string `yaml:"jsonPath,omitempty"`
	FilePath string `yaml:"path,omitempty"`
}

func (Output) GetFilePath

func (o Output) GetFilePath() string

func (Output) GetJsonPath

func (o Output) GetJsonPath() string

func (Output) GetName

func (o Output) GetName() string

type Steps added in v0.6.0

type Steps struct {
	TypedStep `yaml:"az"`
}

type TestMixin

type TestMixin struct {
	*Mixin
	TestContext *portercontext.TestContext
}

func NewTestMixin

func NewTestMixin(t *testing.T) *TestMixin

NewTestMixin initializes a mixin test client, with the output buffered, and an in-memory file system.

type TypedCommand added in v0.6.0

type TypedCommand interface {
	SetAction(action string)
	builder.ExecutableStep
	builder.SuppressesOutput
}

type TypedStep added in v0.6.0

type TypedStep struct {
	Description string
	TypedCommand
}

func (*TypedStep) UnmarshalYAML added in v0.6.0

func (s *TypedStep) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML takes any yaml in this form az:

description: something
COMMAND: # custom... -> make the CustomCommand for us

type UserCommand added in v0.6.0

type UserCommand struct {
	Name           string        `yaml:"name"`
	Description    string        `yaml:"description"`
	Arguments      []string      `yaml:"arguments,omitempty"`
	Flags          builder.Flags `yaml:"flags,omitempty"`
	Outputs        []Output      `yaml:"outputs,omitempty"`
	SuppressOutput bool          `yaml:"suppress-output,omitempty"`

	// Support custom error handling
	builder.IgnoreErrorHandler `yaml:"ignoreErrors,omitempty"`
}

func (*UserCommand) GetArguments added in v0.6.0

func (s *UserCommand) GetArguments() []string

func (*UserCommand) GetCommand added in v0.6.0

func (s *UserCommand) GetCommand() string

func (*UserCommand) GetFlags added in v0.6.0

func (s *UserCommand) GetFlags() builder.Flags

func (*UserCommand) GetOutputs added in v0.6.0

func (s *UserCommand) GetOutputs() []builder.Output

func (UserCommand) GetWorkingDir added in v0.6.0

func (s UserCommand) GetWorkingDir() string

func (*UserCommand) SetAction added in v0.6.0

func (s *UserCommand) SetAction(_ string)

func (*UserCommand) SuppressesOutput added in v0.6.0

func (s *UserCommand) SuppressesOutput() bool

Jump to

Keyboard shortcuts

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