common

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MPL-2.0, MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const (
	AzureVaultApiVersion = "2016-10-01"
)
View Source
const (
	SkippingImageCreation = "Skipping image creation..."
)

Variables

View Source
var TemplateFuncs = template.FuncMap{
	"clean_resource_name": templateCleanImageName,
}

Functions

func DumpConfig

func DumpConfig(config interface{}, say func(string))

func GlueStrings

func GlueStrings(a, b string) string

removes overlap between the end of a and the start of b and glues them together

func IsStateCancelled

func IsStateCancelled(stateBag multistep.StateBag) bool

func MapToAzureTags

func MapToAzureTags(in map[string]string) map[string]*string

func StringsContains

func StringsContains(haystack []string, needle string) bool

StringsContains returns true if the `haystack` contains the `needle`. Search is case insensitive.

Types

type AZVaultClientIface

type AZVaultClientIface interface {
	GetSecret(string, string) (*Secret, error)
	SetSecret(string, string, string) error
}

Enables us to test steps that access this cli

type Artifact

type Artifact struct {
	// Array of the Azure resource IDs that were created.
	Resources []string

	// BuilderId is the unique ID for the builder that created this AMI
	BuilderIdValue string

	// Azure client for performing API stuff.
	AzureClientSet client.AzureClientSet

	// StateData should store data such as GeneratedData
	// to be shared with post-processors
	StateData map[string]interface{}
}

Artifact is an artifact implementation that contains built Managed Images or Disks.

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (*Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type Config added in v1.0.8

type Config struct {
	// Skip creating the image.
	// Useful for setting to `true` during a build test stage.
	// Defaults to `false`.
	SkipCreateImage bool `mapstructure:"skip_create_image" required:"false"`
}

func (Config) CaptureSteps added in v1.0.8

func (config Config) CaptureSteps(say func(string), steps ...multistep.Step) []multistep.Step

CaptureSteps returns the steps unless `SkipCreateImage` is `true`. In that case it returns a step that to inform the user that image capture is being skipped.

type MockAZVaultClient

type MockAZVaultClient struct {
	GetSecretCalled       bool
	SetSecretCalled       bool
	SetSecretVaultName    string
	SetSecretSecretName   string
	SetSecretCert         string
	DeleteResponderCalled bool
	DeletePreparerCalled  bool
	DeleteSenderCalled    bool

	IsError bool
}

func (*MockAZVaultClient) DeletePreparer

func (m *MockAZVaultClient) DeletePreparer(resourceGroupName string, vaultName string) (*http.Request, error)

func (*MockAZVaultClient) DeleteResponder

func (m *MockAZVaultClient) DeleteResponder(resp *http.Response) (autorest.Response, error)

func (*MockAZVaultClient) DeleteSender

func (m *MockAZVaultClient) DeleteSender(req *http.Request) (*http.Response, error)

func (*MockAZVaultClient) GetSecret

func (m *MockAZVaultClient) GetSecret(vaultName, secretName string) (*Secret, error)

func (*MockAZVaultClient) SetSecret

func (m *MockAZVaultClient) SetSecret(vaultName, secretName string, secretValue string) error

type Secret

type Secret struct {
	ID    *string `json:"id,omitempty"`
	Value string  `json:"value"`
}

type StepNotify added in v1.0.8

type StepNotify struct {
	// contains filtered or unexported fields
}

func NewStepNotify added in v1.0.8

func NewStepNotify(message string, say func(string)) *StepNotify

func (*StepNotify) Cleanup added in v1.0.8

func (step *StepNotify) Cleanup(state multistep.StateBag)

func (*StepNotify) Run added in v1.0.8

func (step *StepNotify) Run(
	ctx context.Context,
	state multistep.StateBag,
) multistep.StepAction

type VaultClient

type VaultClient struct {
	autorest.Client

	SubscriptionID string
	// contains filtered or unexported fields
}

func NewVaultClient

func NewVaultClient(keyVaultEndpoint url.URL) VaultClient

func NewVaultClientWithBaseURI

func NewVaultClientWithBaseURI(baseURI, subscriptionID string) VaultClient

func (*VaultClient) GetSecret

func (client *VaultClient) GetSecret(vaultName, secretName string) (*Secret, error)

func (*VaultClient) SetSecret

func (client *VaultClient) SetSecret(vaultName, secretName string, secretValue string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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