Documentation ¶
Index ¶
- Constants
- Variables
- func CheckProvider(provider string) (string, error)
- func NewID() string
- type AWSMetadata
- type Account
- type AccountCreation
- type AccountFilter
- type AccountMetadata
- type AccountProvision
- type AccountStateReport
- type AddParentSubnetRequest
- type Client
- func (c *Client) AddParentSubnet(request *AddParentSubnetRequest) (*ParentSubnet, error)
- func (c *Client) CreateAccount(request *CreateAccountRequest) (*Account, error)
- func (c *Client) CreateWebhook(request *CreateWebhookRequest) (*Webhook, error)
- func (c *Client) DeleteAccount(accountID string) error
- func (c *Client) DeleteWebhook(webhookID string) error
- func (c *Client) GetAccount(accountID string) (*Account, error)
- func (c *Client) GetAccounts(request *GetAccountsRequest) ([]*Account, error)
- func (c *Client) GetParentSubnet(subnet string) (*ParentSubnet, error)
- func (c *Client) GetParentSubnets(request *GetParentSubnetsRequest) ([]*ParentSubnet, error)
- func (c *Client) GetSubnet(subnet string) (*Subnet, error)
- func (c *Client) GetSubnets(request *GetSubnetsRequest) ([]*Subnet, error)
- func (c *Client) GetWebhook(webhookID string) (*Webhook, error)
- func (c *Client) GetWebhooks(request *GetWebhooksRequest) ([]*Webhook, error)
- func (c *Client) LockAPIForAccount(accountID string) error
- func (c *Client) ProvisionAccount(accountID string, request *ProvisionAccountRequest) (*Account, error)
- func (c *Client) RetryCreateAccount(accountID string) error
- func (c *Client) UnlockAPIForAccount(accountID string) error
- type CreateAccountRequest
- type CreateWebhookRequest
- type GetAccountsRequest
- type GetParentSubnetsRequest
- type GetSubnetsRequest
- type GetWebhooksRequest
- type ParentSubnet
- type ParentSubnetFilter
- type ProvisionAccountRequest
- type StateList
- type StateReportEntry
- type Subnet
- type SubnetFilter
- type Webhook
- type WebhookFilter
- type WebhookPayload
Constants ¶
const ( // AccountStateStable is a account in a stable state and undergoing no changes. AccountStateStable = "stable" // AccountStateCreationRequested is a account in the process of being created. AccountStateCreationRequested = "creation-requested" // AccountStateCreationFailed is a account that failed creation. AccountStateCreationFailed = "creation-failed" // AccountStateProvisioningRequested is a account in the process of being provisioned. AccountStateProvisioningRequested = "provisioning-requested" // AccountStateRefreshMetadata is a account that will have metadata refreshed. AccountStateRefreshMetadata = "refresh-metadata" // AccountStateProvisioningFailed is a account that failed provisioning. AccountStateProvisioningFailed = "provisioning-failed" // AccountStateDeletionRequested is a account in the process of being deleted. AccountStateDeletionRequested = "deletion-requested" // AccountStateDeletionFailed is a account that failed deletion. AccountStateDeletionFailed = "deletion-failed" // AccountStateDeleted is a account that has been deleted AccountStateDeleted = "deleted" )
const ( // AllPerPage signals the store to return all results, avoid pagination of any kind. AllPerPage = -1 // NoInstallationsLimit signals the store to return all multitenant database instances independently // of the number of installations using each instance. NoInstallationsLimit = -1 )
const ( // TypeAccount is the string value that represents an account TypeAccount = "account" // TypeParentSubnet is the string value that represents a parent subnet TypeParentSubnet = "parent_subnet" )
const (
// ProviderAWS is the cloud provider AWS.
ProviderAWS = "aws"
)
Variables ¶
var AllAccountRequestStates = []string{ AccountStateCreationRequested, AccountStateProvisioningRequested, AccountStateDeletionRequested, }
AllAccountRequestStates is a list of all states that a account can be put in via the API. Warning: When creating a new account state, it must be added to this list if an API endpoint should put the account in this state.
var AllAccountStates = []string{ AccountStateStable, AccountStateRefreshMetadata, AccountStateCreationRequested, AccountStateCreationFailed, AccountStateProvisioningRequested, AccountStateProvisioningFailed, AccountStateDeletionRequested, AccountStateDeletionFailed, AccountStateDeleted, }
AllAccountStates is a list of all states a account can be in. Warning: When creating a new account state, it must be added to this list.
var AllAccountStatesPendingWork = []string{ AccountStateCreationRequested, AccountStateProvisioningRequested, AccountStateRefreshMetadata, AccountStateDeletionRequested, }
AllAccountStatesPendingWork is a list of all account states that the supervisor will attempt to transition towards stable on the next "tick". Warning: When creating a new account state, it must be added to this list if the cloud account supervisor should perform some action on its next work cycle.
var BuildHash string
BuildHash holds the git commit hash when we build the server
Functions ¶
func CheckProvider ¶
CheckProvider normalizes the given provider, returning an error if invalid.
Types ¶
type AWSMetadata ¶
type AWSMetadata struct { ServiceCatalogProductID string AWSAccountID string AccountProductID string }
AWSMetadata is the provider metadata stored in a model.Account.
func NewAWSMetadata ¶
func NewAWSMetadata(metadataBytes []byte) (*AWSMetadata, error)
NewAWSMetadata creates an instance of AWSMetadata given the raw provider metadata.
type Account ¶
type Account struct { ID string State string Provider string ProviderMetadataAWS *AWSMetadata AccountMetadata *AccountMetadata Provisioner string CreateAt int64 DeleteAt int64 APISecurityLock bool LockAcquiredBy *string LockAcquiredAt int64 }
Account represents an AWS account.
func AccountFromReader ¶
AccountFromReader decodes a json-encoded account from the given io.Reader.
func AccountsFromReader ¶
AccountsFromReader decodes a json-encoded list of accounts from the given io.Reader.
func (*Account) ValidTransitionState ¶
ValidTransitionState returns whether a account can be transitioned into the new state or not based on its current state.
type AccountCreation ¶
type AccountCreation struct { SSOUserEmail string SSOFirstName string SSOLastName string ManagedOU string ControlTowerRole string ControlTowerAccountID string }
AccountCreation stores information neeeded for account creation.
type AccountFilter ¶
AccountFilter describes the parameters used to constrain a set of accounts.
type AccountMetadata ¶
AccountMetadata is the provider metadata stored in a model.Account.
func NewAccountMetadata ¶
func NewAccountMetadata(metadataBytes []byte) (*AccountMetadata, error)
NewAccountMetadata creates an instance of AccountMetadata given the raw provider metadata.
type AccountProvision ¶
type AccountProvision struct { StateBucket string TransitGatewayID string Environment string TransitGatewayRoutes string TeleportCIDR string CncCIDRs string BindServerIPs string CoreAccountID string }
AccountProvision stores information neeeded for account provision.
type AccountStateReport ¶
type AccountStateReport []StateReportEntry
AccountStateReport is a report of all account requests states.
func GetAccountRequestStateReport ¶
func GetAccountRequestStateReport() AccountStateReport
GetAccountRequestStateReport returns a AccountStateReport based on the current model of account states.
type AddParentSubnetRequest ¶
type AddParentSubnetRequest struct { CIDR string `json:"cidr,omitempty"` SplitRange int `json:"splitRange,omitempty"` }
AddParentSubnetRequest specifies the parameters for a new parent subnet.
func NewAddParentSubnetRequestFromReader ¶
func NewAddParentSubnetRequestFromReader(reader io.Reader) (*AddParentSubnetRequest, error)
NewAddParentSubnetRequestFromReader will create a AddParentSubnetRequest from an io.Reader with JSON data.
func (*AddParentSubnetRequest) SetDefaults ¶
func (request *AddParentSubnetRequest) SetDefaults()
SetDefaults sets the default values for a parent subnet create request.
func (*AddParentSubnetRequest) Validate ¶
func (request *AddParentSubnetRequest) Validate() error
Validate validates the values of a parent subnet create request.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the programmatic interface to the genesis server API.
func NewClientWithHeaders ¶
NewClientWithHeaders creates a client to the genesis server at the given address and uses the provided headers.
func (*Client) AddParentSubnet ¶
func (c *Client) AddParentSubnet(request *AddParentSubnetRequest) (*ParentSubnet, error)
AddParentSubnet requests the addition of a parent subnet from the configured genesis server.
func (*Client) CreateAccount ¶
func (c *Client) CreateAccount(request *CreateAccountRequest) (*Account, error)
CreateAccount requests the creation of an account from the configured genesis server.
func (*Client) CreateWebhook ¶
func (c *Client) CreateWebhook(request *CreateWebhookRequest) (*Webhook, error)
CreateWebhook requests the creation of a webhook from the configured genesis server.
func (*Client) DeleteAccount ¶
DeleteAccount deletes the given account and all resources contained therein.
func (*Client) DeleteWebhook ¶
DeleteWebhook deletes the given webhook.
func (*Client) GetAccount ¶
GetAccount fetches the specified account from the configured genesis server.
func (*Client) GetAccounts ¶
func (c *Client) GetAccounts(request *GetAccountsRequest) ([]*Account, error)
GetAccounts fetches the list of accounts from the configured genesis server.
func (*Client) GetParentSubnet ¶
func (c *Client) GetParentSubnet(subnet string) (*ParentSubnet, error)
GetParentSubnet fetches the specified parent subnet from the configured genesis server.
func (*Client) GetParentSubnets ¶
func (c *Client) GetParentSubnets(request *GetParentSubnetsRequest) ([]*ParentSubnet, error)
GetParentSubnets fetches the list of parent subnets from the configured genesis server.
func (*Client) GetSubnet ¶
GetSubnet fetches the specified subnet from the configured genesis server.
func (*Client) GetSubnets ¶
func (c *Client) GetSubnets(request *GetSubnetsRequest) ([]*Subnet, error)
GetSubnets fetches the list of subnets from the configured genesis server.
func (*Client) GetWebhook ¶
GetWebhook fetches the webhook from the configured genesis server.
func (*Client) GetWebhooks ¶
func (c *Client) GetWebhooks(request *GetWebhooksRequest) ([]*Webhook, error)
GetWebhooks fetches the list of webhooks from the configured genesis server.
func (*Client) LockAPIForAccount ¶
LockAPIForAccount locks API changes for a given account.
func (*Client) ProvisionAccount ¶
func (c *Client) ProvisionAccount(accountID string, request *ProvisionAccountRequest) (*Account, error)
ProvisionAccount provisions k8s operators and Helm charts on a account from the configured genesis server.
func (*Client) RetryCreateAccount ¶
RetryCreateAccount retries the creation of an account from the configured genesis server.
func (*Client) UnlockAPIForAccount ¶
UnlockAPIForAccount unlocks API changes for a given account.
type CreateAccountRequest ¶
type CreateAccountRequest struct { Provider string `json:"provider,omitempty"` ServiceCatalogProductID string `json:"serviceCatalogProductID,omitempty"` Provision bool `json:"provision,omitempty"` Subnet string `json:"subnet,omitempty"` APISecurityLock bool `json:"api-security-lock,omitempty"` }
CreateAccountRequest specifies the parameters for a new account.
func NewCreateAccountRequestFromReader ¶
func NewCreateAccountRequestFromReader(reader io.Reader) (*CreateAccountRequest, error)
NewCreateAccountRequestFromReader will create a CreateAccountRequest from an io.Reader with JSON data.
func (*CreateAccountRequest) SetDefaults ¶
func (request *CreateAccountRequest) SetDefaults()
SetDefaults sets the default values for an account create request.
func (*CreateAccountRequest) Validate ¶
func (request *CreateAccountRequest) Validate() error
Validate validates the values of an account create request.
type CreateWebhookRequest ¶
CreateWebhookRequest specifies the parameters for a new webhook.
func NewCreateWebhookRequestFromReader ¶
func NewCreateWebhookRequestFromReader(reader io.Reader) (*CreateWebhookRequest, error)
NewCreateWebhookRequestFromReader will create a CreateWebhookRequest from an io.Reader with JSON data.
type GetAccountsRequest ¶
GetAccountsRequest describes the parameters to request a list of accounts.
func (*GetAccountsRequest) ApplyToURL ¶
func (request *GetAccountsRequest) ApplyToURL(u *url.URL)
ApplyToURL modifies the given url to include query string parameters for the request.
type GetParentSubnetsRequest ¶
GetParentSubnetsRequest describes the parameters to request a list of parent subnets.
func (*GetParentSubnetsRequest) ApplyToURL ¶
func (request *GetParentSubnetsRequest) ApplyToURL(u *url.URL)
ApplyToURL modifies the given url to include query string parameters for the request.
type GetSubnetsRequest ¶
GetSubnetsRequest describes the parameters to request a list of subnets.
func (*GetSubnetsRequest) ApplyToURL ¶
func (request *GetSubnetsRequest) ApplyToURL(u *url.URL)
ApplyToURL modifies the given url to include query string parameters for the request.
type GetWebhooksRequest ¶
GetWebhooksRequest describes the parameters to request a list of webhooks.
func (*GetWebhooksRequest) ApplyToURL ¶
func (request *GetWebhooksRequest) ApplyToURL(u *url.URL)
ApplyToURL modifies the given url to include query string parameters for the request.
type ParentSubnet ¶
type ParentSubnet struct { ID string CIDR string SplitRange int CreateAt int64 LockAcquiredBy *string LockAcquiredAt int64 }
ParentSubnet represents a parent subnet range.
func ParentSubnetFromReader ¶
func ParentSubnetFromReader(reader io.Reader) (*ParentSubnet, error)
ParentSubnetFromReader decodes a json-encoded parent subnet from the given io.Reader.
func ParentSubnetsFromReader ¶
func ParentSubnetsFromReader(reader io.Reader) ([]*ParentSubnet, error)
ParentSubnetsFromReader decodes a json-encoded list of parent subnets from the given io.Reader.
func (*ParentSubnet) Clone ¶
func (c *ParentSubnet) Clone() (*ParentSubnet, error)
Clone returns a deep copy of the parent subnet.
type ParentSubnetFilter ¶
ParentSubnetFilter describes the parameters used to constrain a set of parent subnets.
type ProvisionAccountRequest ¶
type ProvisionAccountRequest struct {
Subnet string
}
ProvisionAccountRequest contains metadata related to changing the installed account state.
func NewProvisionAccountRequestFromReader ¶
func NewProvisionAccountRequestFromReader(reader io.Reader) (*ProvisionAccountRequest, error)
NewProvisionAccountRequestFromReader will create an UpdateAccountRequest from an io.Reader with JSON data.
type StateReportEntry ¶
type StateReportEntry struct { RequestedState string ValidStates StateList InvalidStates StateList }
StateReportEntry is a report entry of a given request state.
type Subnet ¶
type Subnet struct { ID string CIDR string AccountID string ParentSubnet string CreateAt int64 LockAcquiredBy *string LockAcquiredAt int64 }
Subnet represents a parent subnet range.
func SubnetFromReader ¶
SubnetFromReader decodes a json-encoded subnet from the given io.Reader.
func SubnetsFromReader ¶
SubnetsFromReader decodes a json-encoded list of subnets from the given io.Reader.
type SubnetFilter ¶
SubnetFilter describes the parameters used to constrain a set of subnets.
type Webhook ¶
Webhook represents a genesis webhook
func WebhookFromReader ¶
WebhookFromReader decodes a json-encoded webhook from the given io.Reader.
func WebhooksFromReader ¶
WebhooksFromReader decodes a json-encoded list of webhooks from the given io.Reader.
type WebhookFilter ¶
WebhookFilter describes the parameters used to constrain a set of webhooks.
type WebhookPayload ¶
type WebhookPayload struct { Timestamp int64 `json:"timestamp"` ID string `json:"id"` Type string `json:"type"` NewState string `json:"new_state"` OldState string `json:"old_state"` ExtraData map[string]string `json:"extra_data,omitempty"` }
WebhookPayload is the payload sent in every webhook.
func WebhookPayloadFromReader ¶
func WebhookPayloadFromReader(reader io.Reader) (*WebhookPayload, error)
WebhookPayloadFromReader decodes a json-encoded webhook payload from the given io.Reader.
func (*WebhookPayload) ToJSON ¶
func (p *WebhookPayload) ToJSON() (string, error)
ToJSON returns a JSON string representation of the webhook payload.