Documentation ¶
Index ¶
- Variables
- type Account
- type Accounts
- type Deleter
- type Eventer
- type Manager
- type MultipleReader
- type NewAccountInput
- type NewServiceInput
- type Reader
- type ReaderWriterDeleter
- type Service
- func (a *Service) Create(data *Account) (*Account, error)
- func (a *Service) Delete(data *Account) error
- func (a *Service) Get(ID string) (*Account, error)
- func (a *Service) List(query *Account) (*Accounts, error)
- func (a *Service) ListPages(query *Account, fn func(*Accounts) bool) error
- func (a *Service) Reset(id string) (*Account, error)
- func (a *Service) Save(data *Account) error
- func (a *Service) Update(ID string, data *Account) (*Account, error)
- func (a *Service) UpsertPrincipalAccess(data *Account) error
- type SingleReader
- type Status
- type Writer
- type WriterDeleter
Constants ¶
This section is empty.
Variables ¶
var ( // PrincipalPolicyName default principal policy Name PrincipalPolicyName string )
var ValidStatuses = [5]Status{ StatusNone, StatusLeased, StatusNotReady, StatusOrphaned, StatusReady, }
ValidStatuses has the valid status options
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID *string `json:"id,omitempty" dynamodbav:"Id" schema:"id,omitempty"` // AWS Account ID Status *Status `json:"accountStatus,omitempty" dynamodbav:"AccountStatus,omitempty" schema:"status,omitempty"` // Status of the AWS Account LastModifiedOn *int64 `json:"lastModifiedOn,omitempty" dynamodbav:"LastModifiedOn" schema:"lastModifiedOn,omitempty"` // Last Modified Epoch Timestamp CreatedOn *int64 `json:"createdOn,omitempty" dynamodbav:"CreatedOn,omitempty" schema:"createdOn,omitempty"` // Account CreatedOn AdminRoleArn *arn.ARN `json:"adminRoleArn,omitempty" dynamodbav:"AdminRoleArn" schema:"adminRoleArn,omitempty"` // Assumed by the master account, to manage this user account PrincipalRoleArn *arn.ARN `json:"principalRoleArn,omitempty" dynamodbav:"PrincipalRoleArn,omitempty" schema:"principalRoleArn,omitempty"` // Assumed by principal users PrincipalPolicyHash *string `json:"principalPolicyHash,omitempty" dynamodbav:"PrincipalPolicyHash,omitempty" schema:"principalPolicyHash,omitempty"` // The the hash of the policy version deployed Metadata map[string]interface{} `json:"metadata,omitempty" dynamodbav:"Metadata,omitempty" schema:"-"` // Any org specific metadata pertaining to the account Limit *int64 `json:"-" dynamodbav:"-" schema:"limit,omitempty"` NextID *string `json:"-" dynamodbav:"-" schema:"nextId,omitempty"` PrincipalPolicyArn *arn.ARN `json:"-" dynamodbav:"-" schema:"-"` }
Account - Handles importing and exporting Accounts and non-exported Properties
func NewAccount ¶
func NewAccount(input NewAccountInput) (*Account, error)
NewAccount creates a new instance of account
func (*Account) UnmarshalDynamoDBAttributeValue ¶
func (a *Account) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
UnmarshalDynamoDBAttributeValue handles custom unmarshaling of an ARN
func (*Account) UnmarshalJSON ¶
UnmarshalJSON helps with custom unmarshalling needs
type Eventer ¶
type Eventer interface { AccountCreate(account *Account) error AccountDelete(account *Account) error AccountUpdate(old *Account, new *Account) error AccountReset(account *Account) error }
Eventer for publishing events
type Manager ¶
type Manager interface { ValidateAccess(role *arn.ARN) error UpsertPrincipalAccess(account *Account) error DeletePrincipalAccess(account *Account) error }
Manager manages all the actions against an account
type MultipleReader ¶
MultipleReader reads multiple accounts from the data store
type NewAccountInput ¶
type NewAccountInput struct { ID string AdminRoleArn arn.ARN Metadata map[string]interface{} PrincipalRoleName string }
NewAccountInput contains all the data for creating a new Account
type NewServiceInput ¶
type NewServiceInput struct { PrincipalRoleName string `env:"PRINCIPAL_ROLE_NAME" envDefault:"DCEPrincipal"` DataSvc ReaderWriterDeleter ManagerSvc Manager EventSvc Eventer }
NewServiceInput Input for creating a new Service
type ReaderWriterDeleter ¶
type ReaderWriterDeleter interface { Reader WriterDeleter }
ReaderWriterDeleter includes Reader and Writer interfaces
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a type corresponding to a Account table record
func NewService ¶
func NewService(input NewServiceInput) *Service
NewService creates a new instance of the Service
func (*Service) Create ¶
Create creates a new account using the data provided. Returns the account record
func (*Service) Delete ¶
Delete finds a given account and deletes it if it is not of status `Leased`. Returns the account.
func (*Service) Reset ¶
Reset initiates the Reset account process. It will not change the status as there may be many reasons why a reset is called. Delete, Lease Ending, etc.
func (*Service) UpsertPrincipalAccess ¶
UpsertPrincipalAccess merges principal access to make sure its in sync with expectations
type SingleReader ¶
SingleReader Reads Account information from the data store
type Status ¶
type Status string
Status is an account status type