ssmsecret

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: Apache-2.0 Imports: 15 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// ResourceName is the name of the ssmsecret resource
	ResourceName = "ssmsecret"

	//MaxBatchNum is the maximum batch number that ssm GetParameters API can accept at one time
	MaxBatchNum = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SSMSecretResource

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

SSMSecretResource represents secrets as a task resource. The secrets are stored in SSM Parameter Store.

func NewSSMSecretResource

func NewSSMSecretResource(taskARN string,
	ssmSecrets map[string][]apicontainer.Secret,
	executionCredentialsID string,
	credentialsManager credentials.Manager,
	ssmClientCreator factory.SSMClientCreator) *SSMSecretResource

NewSSMSecretResource creates a new SSMSecretResource object

func (*SSMSecretResource) ApplyTransition

func (secret *SSMSecretResource) ApplyTransition(nextState resourcestatus.ResourceStatus) error

ApplyTransition calls the function required to move to the specified status

func (*SSMSecretResource) Cleanup

func (secret *SSMSecretResource) Cleanup() error

Cleanup removes the secret value created for the task

func (*SSMSecretResource) Create

func (secret *SSMSecretResource) Create() error

Create fetches secret value from SSM in batches. It spins up multiple goroutines in order to retrieve values in parallel.

func (*SSMSecretResource) DesiredTerminal

func (secret *SSMSecretResource) DesiredTerminal() bool

DesiredTerminal returns true if the secret's desired status is REMOVED

func (*SSMSecretResource) GetCachedSecretValue

func (secret *SSMSecretResource) GetCachedSecretValue(secretKey string) (string, bool)

GetCachedSecretValue retrieves the secret value from secretData field

func (*SSMSecretResource) GetCreatedAt

func (secret *SSMSecretResource) GetCreatedAt() time.Time

GetCreatedAt sets the timestamp for resource's creation time

func (*SSMSecretResource) GetDesiredStatus

func (secret *SSMSecretResource) GetDesiredStatus() resourcestatus.ResourceStatus

GetDesiredStatus safely returns the desired status of the task

func (*SSMSecretResource) GetKnownStatus

func (secret *SSMSecretResource) GetKnownStatus() resourcestatus.ResourceStatus

GetKnownStatus safely returns the currently known status of the task

func (*SSMSecretResource) GetName

func (secret *SSMSecretResource) GetName() string

GetName safely returns the name of the resource

func (*SSMSecretResource) GetTerminalReason

func (secret *SSMSecretResource) GetTerminalReason() string

GetTerminalReason returns an error string to propagate up through to task state change messages

func (*SSMSecretResource) Initialize

func (secret *SSMSecretResource) Initialize(resourceFields *taskresource.ResourceFields,
	taskKnownStatus status.TaskStatus,
	taskDesiredStatus status.TaskStatus)

func (*SSMSecretResource) KnownCreated

func (secret *SSMSecretResource) KnownCreated() bool

KnownCreated returns true if the secret's known status is CREATED

func (*SSMSecretResource) MarshalJSON

func (secret *SSMSecretResource) MarshalJSON() ([]byte, error)

MarshalJSON serialises the SSMSecretResource struct to JSON

func (*SSMSecretResource) NextKnownState

func (secret *SSMSecretResource) NextKnownState() resourcestatus.ResourceStatus

NextKnownState returns the state that the resource should progress to based on its `KnownState`.

func (*SSMSecretResource) SetAppliedStatus

func (secret *SSMSecretResource) SetAppliedStatus(status resourcestatus.ResourceStatus) bool

SetAppliedStatus sets the applied status of resource and returns whether the resource is already in a transition

func (*SSMSecretResource) SetCachedSecretValue added in v1.23.0

func (secret *SSMSecretResource) SetCachedSecretValue(secretKey string, secretValue string)

SetCachedSecretValue set the secret value in the secretData field given the key and value

func (*SSMSecretResource) SetCreatedAt

func (secret *SSMSecretResource) SetCreatedAt(createdAt time.Time)

SetCreatedAt sets the timestamp for resource's creation time

func (*SSMSecretResource) SetDesiredStatus

func (secret *SSMSecretResource) SetDesiredStatus(status resourcestatus.ResourceStatus)

SetDesiredStatus safely sets the desired status of the resource

func (*SSMSecretResource) SetKnownStatus

func (secret *SSMSecretResource) SetKnownStatus(status resourcestatus.ResourceStatus)

SetKnownStatus safely sets the currently known status of the resource

func (*SSMSecretResource) StatusString

func (secret *SSMSecretResource) StatusString(status resourcestatus.ResourceStatus) string

StatusString returns the string of the cgroup resource status

func (*SSMSecretResource) SteadyState

func (secret *SSMSecretResource) SteadyState() resourcestatus.ResourceStatus

SteadyState returns the transition state of the resource defined as "ready"

func (*SSMSecretResource) TerminalStatus

func (secret *SSMSecretResource) TerminalStatus() resourcestatus.ResourceStatus

TerminalStatus returns the last transition state of cgroup

func (*SSMSecretResource) UnmarshalJSON

func (secret *SSMSecretResource) UnmarshalJSON(b []byte) error

UnmarshalJSON deserialises the raw JSON to a SSMSecretResource struct

type SSMSecretResourceJSON

type SSMSecretResourceJSON struct {
	TaskARN                string                           `json:"taskARN"`
	CreatedAt              *time.Time                       `json:"createdAt,omitempty"`
	DesiredStatus          *SSMSecretStatus                 `json:"desiredStatus"`
	KnownStatus            *SSMSecretStatus                 `json:"knownStatus"`
	RequiredSecrets        map[string][]apicontainer.Secret `json:"secretResources"`
	ExecutionCredentialsID string                           `json:"executionCredentialsID"`
}

type SSMSecretStatus

type SSMSecretStatus resourcestatus.ResourceStatus
const (
	// is the zero state of a task resource
	SSMSecretStatusNone SSMSecretStatus = iota
	// represents a task resource which has been created
	SSMSecretCreated
	// represents a task resource which has been cleaned up
	SSMSecretRemoved
)

func (*SSMSecretStatus) MarshalJSON

func (as *SSMSecretStatus) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding the ResourceStatus type

func (SSMSecretStatus) String

func (as SSMSecretStatus) String() string

StatusString returns a human readable string representation of this object

func (*SSMSecretStatus) UnmarshalJSON

func (as *SSMSecretStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the logic for parsing the JSON-encoded ResourceStatus data

Jump to

Keyboard shortcuts

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