dynamodb

package
v0.3.16 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEnv

func CheckEnv()

Types

type AwsAccountDynamoDB

type AwsAccountDynamoDB struct {
	Name string `json:"name"`
	// NameInt: Internal plumbing to easily sort Sandboxes
	NameInt            int
	Available          bool    `json:"available"`
	Reservation        string  `json:"reservation,omitempty"`
	Guid               string  `json:"guid"`
	ServiceUUID        string  `json:"service_uuid"`
	Envtype            string  `json:"envtype"`
	AccountID          string  `json:"account_id"`
	Owner              string  `json:"owner"`
	OwnerEmail         string  `json:"owner_email"`
	Zone               string  `json:"zone"`
	HostedZoneID       string  `json:"hosted_zone_id"`
	UpdateTime         float64 `json:"aws:rep:updatetime"`
	Comment            string  `json:"comment"`
	AwsAccessKeyID     string  `json:"aws_access_key_id"`
	AwsSecretAccessKey string  `json:"aws_secret_access_key"`
	// Conan
	ToCleanup         bool   `json:"to_cleanup"`
	ConanStatus       string `json:"conan_status"`
	ConanTimestamp    string `json:"conan_timestamp"`
	ConanHostname     string `json:"conan_hostname"`
	ConanCleanupCount int    `json:"conan_cleanup_count"`
}

Internal Type to represent the dynamodb table

func GetAccount

func GetAccount(svc *dynamodb.DynamoDB, name string) (AwsAccountDynamoDB, error)

func GetAccounts

func GetAccounts(svc *dynamodb.DynamoDB, filter expression.ConditionBuilder, batchSize int) ([]AwsAccountDynamoDB, error)

type AwsAccountDynamoDBProvider

type AwsAccountDynamoDBProvider struct {
	Svc         *dynamodb.DynamoDB
	VaultSecret string
}

func NewAwsAccountDynamoDBProvider

func NewAwsAccountDynamoDBProvider() *AwsAccountDynamoDBProvider

func NewAwsAccountDynamoDBProviderWithSecret

func NewAwsAccountDynamoDBProviderWithSecret(vaultSecret string) *AwsAccountDynamoDBProvider

func (*AwsAccountDynamoDBProvider) Count added in v0.3.5

func (a *AwsAccountDynamoDBProvider) Count() (int, error)

func (*AwsAccountDynamoDBProvider) CountAvailable added in v0.3.5

func (a *AwsAccountDynamoDBProvider) CountAvailable(reservation string) (int, error)

func (*AwsAccountDynamoDBProvider) DecryptSecret

func (a *AwsAccountDynamoDBProvider) DecryptSecret(encrypted string) (string, error)

func (*AwsAccountDynamoDBProvider) Delete added in v0.3.16

func (a *AwsAccountDynamoDBProvider) Delete(name string) error

Delete deletes an account from dynamodb

func (*AwsAccountDynamoDBProvider) FetchAll

FetchAll returns the list of all accounts from dynamodb

func (*AwsAccountDynamoDBProvider) FetchAllActiveByServiceUuid added in v0.3.5

func (a *AwsAccountDynamoDBProvider) FetchAllActiveByServiceUuid(serviceUuid string) ([]models.AwsAccount, error)

FetchAllActiveByServiceUuid returns the list of accounts from dynamodb for a specific service uuid that are not to cleanup

func (*AwsAccountDynamoDBProvider) FetchAllActiveByServiceUuidWithCreds added in v0.3.5

func (a *AwsAccountDynamoDBProvider) FetchAllActiveByServiceUuidWithCreds(serviceUuid string) ([]models.AwsAccountWithCreds, error)

FetchAllActiveByServiceUuidWithCreds returns the list of accounts from dynamodb for a specific service uuid

func (*AwsAccountDynamoDBProvider) FetchAllAvailable added in v0.3.5

func (a *AwsAccountDynamoDBProvider) FetchAllAvailable() ([]models.AwsAccount, error)

FetchAllAvailable returns the list of available accounts from dynamodb

func (*AwsAccountDynamoDBProvider) FetchAllByReservation added in v0.3.5

func (a *AwsAccountDynamoDBProvider) FetchAllByReservation(reservation string) ([]models.AwsAccount, error)

GetAccountsByReservation returns the list of accounts from dynamodb for a specific reservation

func (*AwsAccountDynamoDBProvider) FetchAllByServiceUuid

func (a *AwsAccountDynamoDBProvider) FetchAllByServiceUuid(serviceUuid string) ([]models.AwsAccount, error)

FetchAllByServiceUuid returns the list of accounts from dynamodb for a specific service uuid

func (*AwsAccountDynamoDBProvider) FetchAllByServiceUuidWithCreds added in v0.3.1

func (a *AwsAccountDynamoDBProvider) FetchAllByServiceUuidWithCreds(serviceUuid string) ([]models.AwsAccountWithCreds, error)

FetchAllByServiceUuidWithCreds returns the list of accounts from dynamodb for a specific service uuid

func (*AwsAccountDynamoDBProvider) FetchAllSorted

func (a *AwsAccountDynamoDBProvider) FetchAllSorted(by string) ([]models.AwsAccount, error)

FetchAllSorted

func (*AwsAccountDynamoDBProvider) FetchAllToCleanup

func (a *AwsAccountDynamoDBProvider) FetchAllToCleanup() ([]models.AwsAccount, error)

FetchAllToCleanup returns the list of accounts from dynamodb

func (*AwsAccountDynamoDBProvider) FetchByName

func (a *AwsAccountDynamoDBProvider) FetchByName(name string) (models.AwsAccount, error)

func (*AwsAccountDynamoDBProvider) MarkForCleanup

func (a *AwsAccountDynamoDBProvider) MarkForCleanup(name string) error

func (*AwsAccountDynamoDBProvider) MarkForCleanupByServiceUuid

func (a *AwsAccountDynamoDBProvider) MarkForCleanupByServiceUuid(serviceUuid string) error

func (*AwsAccountDynamoDBProvider) RemoveReservation added in v0.3.5

func (a *AwsAccountDynamoDBProvider) RemoveReservation(name string) error

RemoveReservation remove an account from a reservation

func (*AwsAccountDynamoDBProvider) Request

func (a *AwsAccountDynamoDBProvider) Request(service_uuid string, reservation string, count int, annotations map[string]string) ([]models.AwsAccountWithCreds, error)

Request reserve accounts for a service

func (*AwsAccountDynamoDBProvider) Reserve added in v0.3.5

func (a *AwsAccountDynamoDBProvider) Reserve(reservation string, count int) ([]models.AwsAccount, error)

Reserve reserve accounts for a reservation It takes the number of account to reserve. The function iterates over available accounts and update the 'reservation' column

func (*AwsAccountDynamoDBProvider) ScaleDownReservation added in v0.3.5

func (a *AwsAccountDynamoDBProvider) ScaleDownReservation(reservation string, count int) error

ScaleDownReservation scale down a reservation It removes some of the accounts from the reservation

Jump to

Keyboard shortcuts

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