Documentation
¶
Index ¶
- Constants
- Variables
- func CreateInstance(ctx context.Context, vmc *AwsEc2Controller, ...) error
- func InstanceStatusByID(ctx context.Context, vmc *AwsEc2Controller, instanceID string) (*cloudyvm.VirtualMachineStatus, error)
- func InstanceStatusByVmName(ctx context.Context, vmc *AwsEc2Controller, vmName string) (*cloudyvm.VirtualMachineStatus, error)
- func ListAllInstances(ctx context.Context, vmc *AwsEc2Controller) ([]*cloudyvm.VirtualMachineStatus, error)
- func ListInstancesWithTag(ctx context.Context, vmc *AwsEc2Controller, tag string) ([]*cloudyvm.VirtualMachineStatus, error)
- func SetInstanceState(ctx context.Context, vmc *AwsEc2Controller, ...) (*cloudyvm.VirtualMachineStatus, error)
- func StartInstance(ctx context.Context, vmc *AwsEc2Controller, vmName string, wait bool) error
- func StopInstance(ctx context.Context, vmc *AwsEc2Controller, vmName string, wait bool) error
- func TerminateInstance(ctx context.Context, vmc *AwsEc2Controller, vmName string, wait bool) error
- func ValidateConfiguration(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) error
- type AWSCloudFront
- type AWSRoute53
- type AwsEc2Controller
- func (vmc *AwsEc2Controller) Create(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) (*cloudyvm.VirtualMachineConfiguration, error)
- func (vmc *AwsEc2Controller) CreateNIC(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration, subnetId string) error
- func (vmc *AwsEc2Controller) Delete(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) (*cloudyvm.VirtualMachineConfiguration, error)
- func (vmc *AwsEc2Controller) DeleteNIC(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) error
- func (vmc *AwsEc2Controller) FindBestSubnet(ctx context.Context, availableSubnets []string) (string, error)
- func (vmc *AwsEc2Controller) FindNICsByName(ctx context.Context, nicName string) ([]*cloudyvm.VirtualMachineNetwork, error)
- func (vmc *AwsEc2Controller) FindNicByID(ctx context.Context, id string) (*cloudyvm.VirtualMachineNetwork, error)
- func (vmc *AwsEc2Controller) GetAllNICs(ctx context.Context) ([]*cloudyvm.VirtualMachineNetwork, error)
- func (vmc *AwsEc2Controller) GetAvailableIPs(ctx context.Context, subnetID string) (int, error)
- func (vmc *AwsEc2Controller) GetLimits(ctx context.Context) ([]*cloudyvm.VirtualMachineLimit, error)
- func (vmc *AwsEc2Controller) GetVMSizes(ctx context.Context) (map[string]*cloudyvm.VmSize, error)
- func (vmc *AwsEc2Controller) GetVmNic(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) (*cloudyvm.VirtualMachineNetwork, error)
- func (vmc *AwsEc2Controller) ListAll(ctx context.Context) ([]*cloudyvm.VirtualMachineStatus, error)
- func (vmc *AwsEc2Controller) ListWithTag(ctx context.Context, tag string) ([]*cloudyvm.VirtualMachineStatus, error)
- func (vmc *AwsEc2Controller) SetState(ctx context.Context, state cloudyvm.VirtualMachineAction, vmName string, ...) (*cloudyvm.VirtualMachineStatus, error)
- func (vmc *AwsEc2Controller) Start(ctx context.Context, vmName string, wait bool) error
- func (vmc *AwsEc2Controller) Status(ctx context.Context, vmName string) (*cloudyvm.VirtualMachineStatus, error)
- func (vmc *AwsEc2Controller) Stop(ctx context.Context, vmName string, wait bool) error
- func (vmc *AwsEc2Controller) Terminate(ctx context.Context, vmName string, wait bool) error
- type AwsEc2ControllerConfig
- type AwsEc2ControllerFactory
- type AwsSecretManager
- func (a *AwsSecretManager) DeleteSecret(ctx context.Context, key string) error
- func (a *AwsSecretManager) GetSecret(ctx context.Context, key string) (string, error)
- func (a *AwsSecretManager) GetSecretBinary(ctx context.Context, key string) ([]byte, error)
- func (a *AwsSecretManager) SaveSecret(ctx context.Context, key string, secret string) error
- func (a *AwsSecretManager) SaveSecretBinary(ctx context.Context, key string, secret []byte) error
- type AwsSecretManagerFactory
- type Cognito
- func (c *Cognito) AddCallbackUrl(domain string, userpoolid string, clientId string) error
- func (c *Cognito) AddUserToGroup(groupName string, uid string) error
- func (c *Cognito) Attr(name string, value string) *cognitoidentityprovider.AttributeType
- func (c *Cognito) CreateGroup(group *models.Group) error
- func (c *Cognito) CreateUser(user *models.User) error
- func (c *Cognito) DeleteGroup(grp string) error
- func (c *Cognito) DeleteUser(uid string) error
- func (c *Cognito) DisableUser(uid string) error
- func (c *Cognito) EnableUser(uid string) error
- func (c *Cognito) GetGroup(grpId string) (*models.Group, error)
- func (c *Cognito) GetUser(username string) (*models.User, error)
- func (c *Cognito) GetUserFromEmail(email string) (*models.User, error)
- func (c *Cognito) GetUserGroups(username string) ([]*models.Group, error)
- func (c *Cognito) IsAttributeSupported(field string) bool
- func (c *Cognito) ListAllUsersInGroup(groupName string) ([]*models.User, error)
- func (c *Cognito) ListGroups() ([]*models.Group, error)
- func (c *Cognito) ListUsers(filter string, pageToken string) ([]*models.User, string, error)
- func (c *Cognito) ListUsersInGroup(groupName string, pageToken string) ([]*models.User, string, error)
- func (c *Cognito) RemoveUserFromGroup(groupName string, uid string) error
- func (c *Cognito) ResetUserPassword(uid string) error
- func (c *Cognito) SetUserGroups(username string, groups []string) error
- func (c *Cognito) SetUserPassword(uid string, password string, permanent bool) error
- func (c *Cognito) ToUserAttributes(user *models.User) []*cognitoidentityprovider.AttributeType
- func (c *Cognito) UpdateUser(user *models.User) error
- func (c *Cognito) VerifyEmail(uid string) error
- type CognitoConfig
- type CognitoGroupManager
- func (c *CognitoGroupManager) AddMembers(ctx context.Context, groupId string, userIds []string) error
- func (c *CognitoGroupManager) DeleteGroup(ctx context.Context, grpId string) error
- func (c *CognitoGroupManager) GetGroup(ctx context.Context, grpId string) (*models.Group, error)
- func (c *CognitoGroupManager) GetGroupMembers(ctx context.Context, grpId string) ([]*models.User, error)
- func (c *CognitoGroupManager) GetUserGroups(ctx context.Context, uid string) ([]*models.Group, error)
- func (c *CognitoGroupManager) ListGroups(ctx context.Context) ([]*models.Group, error)
- func (c *CognitoGroupManager) NewGroup(ctx context.Context, grp *models.Group) (*models.Group, error)
- func (c *CognitoGroupManager) RemoveMembers(ctx context.Context, groupId string, userIds []string) error
- func (c *CognitoGroupManager) UpdateGroup(ctx context.Context, grp *models.Group) (bool, error)
- type CognitoGroupManagerFactory
- type CognitoUserManager
- func (c *CognitoUserManager) DeleteUser(ctx context.Context, uid string) error
- func (c *CognitoUserManager) Disable(ctx context.Context, uid string) error
- func (c *CognitoUserManager) Enable(ctx context.Context, uid string) error
- func (c *CognitoUserManager) ForceUserName(ctx context.Context, name string) (string, bool, error)
- func (c *CognitoUserManager) GetUser(ctx context.Context, uid string) (*models.User, error)
- func (c *CognitoUserManager) ListUsers(ctx context.Context, page interface{}, filter interface{}) ([]*models.User, interface{}, error)
- func (c *CognitoUserManager) NewUser(ctx context.Context, newUser *models.User) (*models.User, error)
- func (c *CognitoUserManager) UpdateUser(ctx context.Context, usr *models.User) error
- type CognitoUserManagerFactory
- type Dynamo
- type EmailQuota
- type Queue
- type SESEmailer
- type SESEmailerConfig
- type SESEmailerFactory
Constants ¶
const AWS = "azure"
const Attr_address = "address"
const Attr_birthdate = "birthdate"
const Attr_email = "email"
const Attr_familyName = "family name"
const Attr_gender = "gender"
const Attr_givenName = "given name"
const Attr_locale = "locale"
const Attr_middleName = "middle name"
const Attr_name = "name"
const Attr_nickname = "nickname"
const Attr_phoneNumber = "phone number"
const Attr_picture = "picture"
const Attr_preferredUsername = "preferred username"
const Attr_profile = "profile"
const Attr_updatedAt = "updated at"
const Attr_website = "website"
const Attr_zoneinfo = "zoneinfo"
const AwsCognito = "cognito"
const AwsEc2 = "aws-ec2"
const AwsSecreatManagerID = "aws-secretmanager"
const CognitoUserExtra_Enabled_B = "cognito-enabled"
const CognitoUserExtra_PoolID_S = "cogntio_poolid"
const CognitoUserExtra_PreferredMFA_S = "cogntio_mfa"
Variables ¶
var DefaultUserAttributes = []string{ Attr_email, Attr_name, Attr_givenName, Attr_familyName, }
Functions ¶
func CreateInstance ¶
func CreateInstance(ctx context.Context, vmc *AwsEc2Controller, vm *cloudyvm.VirtualMachineConfiguration) error
creates an instance with a given vm config
func InstanceStatusByID ¶
func InstanceStatusByID(ctx context.Context, vmc *AwsEc2Controller, instanceID string) (*cloudyvm.VirtualMachineStatus, error)
func InstanceStatusByVmName ¶
func InstanceStatusByVmName(ctx context.Context, vmc *AwsEc2Controller, vmName string) (*cloudyvm.VirtualMachineStatus, error)
given a VM Name, find the status of the underlying instance The instance will have a name tag matching the VM Name returns nil if no matching instance found
func ListAllInstances ¶
func ListAllInstances(ctx context.Context, vmc *AwsEc2Controller) ([]*cloudyvm.VirtualMachineStatus, error)
func ListInstancesWithTag ¶
func ListInstancesWithTag(ctx context.Context, vmc *AwsEc2Controller, tag string) ([]*cloudyvm.VirtualMachineStatus, error)
func SetInstanceState ¶
func SetInstanceState(ctx context.Context, vmc *AwsEc2Controller, state cloudyvm.VirtualMachineAction, vmName string, wait bool) (*cloudyvm.VirtualMachineStatus, error)
func StartInstance ¶
func StopInstance ¶
func TerminateInstance ¶
Terminates an instance with a given name
func ValidateConfiguration ¶
func ValidateConfiguration(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) error
Types ¶
type AWSCloudFront ¶
type AWSCloudFront struct { Client *cloudfront.CloudFront // contains filtered or unexported fields }
func NewCloudFront ¶
func NewCloudFront() *AWSCloudFront
func (*AWSCloudFront) AppendCNAME ¶
func (awscf *AWSCloudFront) AppendCNAME(cname string, distId string) error
func (*AWSCloudFront) GetDNSName ¶
func (awscf *AWSCloudFront) GetDNSName(cname string) (string, error)
func (*AWSCloudFront) GetDistribution ¶
func (awscf *AWSCloudFront) GetDistribution(cname string) (*cloudfront.DistributionSummary, error)
GetDistribution looks up a distribution based on the cname or the distribution ID
type AWSRoute53 ¶
func NewRoute53 ¶
func NewRoute53() *AWSRoute53
func (*AWSRoute53) GetHostedZoneID ¶
func (awsroute53 *AWSRoute53) GetHostedZoneID(name string) (string, error)
func (*AWSRoute53) UpsertARec ¶
func (awsroute53 *AWSRoute53) UpsertARec(zoneId string, name string, DNSName string) error
type AwsEc2Controller ¶
type AwsEc2Controller struct { Quotas *servicequotas.ServiceQuotas Ec2Client *ec2.EC2 Config *AwsEc2ControllerConfig }
func NewAwsEc2Controller ¶
func NewAwsEc2Controller(ctx context.Context, config *AwsEc2ControllerConfig) (*AwsEc2Controller, error)
func (*AwsEc2Controller) Create ¶
func (vmc *AwsEc2Controller) Create(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) (*cloudyvm.VirtualMachineConfiguration, error)
func (*AwsEc2Controller) CreateNIC ¶
func (vmc *AwsEc2Controller) CreateNIC(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration, subnetId string) error
func (*AwsEc2Controller) Delete ¶
func (vmc *AwsEc2Controller) Delete(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) (*cloudyvm.VirtualMachineConfiguration, error)
func (*AwsEc2Controller) DeleteNIC ¶
func (vmc *AwsEc2Controller) DeleteNIC(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) error
func (*AwsEc2Controller) FindBestSubnet ¶
func (vmc *AwsEc2Controller) FindBestSubnet(ctx context.Context, availableSubnets []string) (string, error)
Returns the first subnet found with IP availability out of availableSubnets
func (*AwsEc2Controller) FindNICsByName ¶
func (vmc *AwsEc2Controller) FindNICsByName(ctx context.Context, nicName string) ([]*cloudyvm.VirtualMachineNetwork, error)
Finds EC2 Network Interfaces that have a matching name and returns a list of them in cloudy format
func (*AwsEc2Controller) FindNicByID ¶
func (vmc *AwsEc2Controller) FindNicByID(ctx context.Context, id string) (*cloudyvm.VirtualMachineNetwork, error)
Finds an EC2 Network Interface that has a matching ID and returns it in cloudy format. Returns nil if no NIC found
func (*AwsEc2Controller) GetAllNICs ¶
func (vmc *AwsEc2Controller) GetAllNICs(ctx context.Context) ([]*cloudyvm.VirtualMachineNetwork, error)
Calls getNICs with an empty filter to get all NICs
func (*AwsEc2Controller) GetAvailableIPs ¶
Retrieves the number of available IPs in a subnet
func (*AwsEc2Controller) GetLimits ¶
func (vmc *AwsEc2Controller) GetLimits(ctx context.Context) ([]*cloudyvm.VirtualMachineLimit, error)
func (*AwsEc2Controller) GetVMSizes ¶
func (*AwsEc2Controller) GetVmNic ¶
func (vmc *AwsEc2Controller) GetVmNic(ctx context.Context, vm *cloudyvm.VirtualMachineConfiguration) (*cloudyvm.VirtualMachineNetwork, error)
Finds the primary EC2 Network Interface for a given VM and returns it in cloudy format
func (*AwsEc2Controller) ListAll ¶
func (vmc *AwsEc2Controller) ListAll(ctx context.Context) ([]*cloudyvm.VirtualMachineStatus, error)
func (*AwsEc2Controller) ListWithTag ¶
func (vmc *AwsEc2Controller) ListWithTag(ctx context.Context, tag string) ([]*cloudyvm.VirtualMachineStatus, error)
func (*AwsEc2Controller) SetState ¶
func (vmc *AwsEc2Controller) SetState(ctx context.Context, state cloudyvm.VirtualMachineAction, vmName string, wait bool) (*cloudyvm.VirtualMachineStatus, error)
func (*AwsEc2Controller) Status ¶
func (vmc *AwsEc2Controller) Status(ctx context.Context, vmName string) (*cloudyvm.VirtualMachineStatus, error)
type AwsEc2ControllerConfig ¶
type AwsEc2ControllerConfig struct { // ?? // NetworkResourceGroup string // From Environment Variable // SourceImageGalleryName string // From Environment Variable // Vnet string // From Environment Variable AvailableSubnets []string // From Environment Variable }
type AwsEc2ControllerFactory ¶
type AwsEc2ControllerFactory struct{}
func (*AwsEc2ControllerFactory) Create ¶
func (f *AwsEc2ControllerFactory) Create(cfg interface{}) (cloudyvm.VMController, error)
creates the AWS VM Controller Interface
func (*AwsEc2ControllerFactory) FromEnv ¶
func (f *AwsEc2ControllerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)
type AwsSecretManager ¶
type AwsSecretManager struct {
Region string
}
func (*AwsSecretManager) DeleteSecret ¶
func (a *AwsSecretManager) DeleteSecret(ctx context.Context, key string) error
func (*AwsSecretManager) GetSecretBinary ¶
func (*AwsSecretManager) SaveSecret ¶
func (*AwsSecretManager) SaveSecretBinary ¶
type AwsSecretManagerFactory ¶
type AwsSecretManagerFactory struct{}
func (*AwsSecretManagerFactory) Create ¶
func (c *AwsSecretManagerFactory) Create(cfg interface{}) (secrets.SecretProvider, error)
func (*AwsSecretManagerFactory) FromEnv ¶
func (c *AwsSecretManagerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)
type Cognito ¶
type Cognito struct { CognitoPoolID string Region string Svc *cognitoidentityprovider.CognitoIdentityProvider UserAttributes []string // contains filtered or unexported fields }
func NewCognito ¶
func (*Cognito) AddCallbackUrl ¶
func (*Cognito) AddUserToGroup ¶
AddUserToGroup calls the cognitofunction
func (*Cognito) Attr ¶
func (c *Cognito) Attr(name string, value string) *cognitoidentityprovider.AttributeType
func (*Cognito) DeleteGroup ¶
func (*Cognito) DeleteUser ¶
func (*Cognito) DisableUser ¶
func (*Cognito) EnableUser ¶
func (*Cognito) GetUser ¶
GetUser calls cognito to get a list of users. The filter and page token parameters are optional
func (*Cognito) GetUserFromEmail ¶
func (*Cognito) GetUserGroups ¶
func (*Cognito) IsAttributeSupported ¶
func (*Cognito) ListAllUsersInGroup ¶
ListUsersInGroup calls the cognitofunction
func (*Cognito) ListGroups ¶
ListGroups calls the cognitofunction
func (*Cognito) ListUsers ¶
ListUsers calls cognito to get a list of users. The filter and page token parameters are optional
func (*Cognito) ListUsersInGroup ¶
func (c *Cognito) ListUsersInGroup(groupName string, pageToken string) ([]*models.User, string, error)
ListUsersInGroup calls the cognitofunction
func (*Cognito) RemoveUserFromGroup ¶
RemoveUserFromGroup calls the cognitofunction
func (*Cognito) ResetUserPassword ¶
func (*Cognito) SetUserGroups ¶
Overwrites all the groups that the user is in and sets them to the provided groups
func (*Cognito) SetUserPassword ¶
func (*Cognito) ToUserAttributes ¶
func (c *Cognito) ToUserAttributes(user *models.User) []*cognitoidentityprovider.AttributeType
func (*Cognito) VerifyEmail ¶
type CognitoConfig ¶
type CognitoGroupManager ¶
type CognitoGroupManager struct { Client *Cognito Config *CognitoConfig }
func NewCognitoGroupManager ¶
func NewCognitoGroupManager(cfg *CognitoConfig) (*CognitoGroupManager, error)
func (*CognitoGroupManager) AddMembers ¶
func (*CognitoGroupManager) DeleteGroup ¶
func (c *CognitoGroupManager) DeleteGroup(ctx context.Context, grpId string) error
func (*CognitoGroupManager) GetGroupMembers ¶
func (*CognitoGroupManager) GetUserGroups ¶
func (*CognitoGroupManager) ListGroups ¶
func (*CognitoGroupManager) RemoveMembers ¶
func (*CognitoGroupManager) UpdateGroup ¶
type CognitoGroupManagerFactory ¶
type CognitoGroupManagerFactory struct{}
func (*CognitoGroupManagerFactory) Create ¶
func (c *CognitoGroupManagerFactory) Create(cfg interface{}) (cloudy.GroupManager, error)
func (*CognitoGroupManagerFactory) FromEnv ¶
func (c *CognitoGroupManagerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)
type CognitoUserManager ¶
type CognitoUserManager struct { Client *Cognito Config *CognitoConfig }
func NewCognitoUserManager ¶
func NewCognitoUserManager(cfg *CognitoConfig) (*CognitoUserManager, error)
func (*CognitoUserManager) DeleteUser ¶
func (c *CognitoUserManager) DeleteUser(ctx context.Context, uid string) error
func (*CognitoUserManager) Disable ¶
func (c *CognitoUserManager) Disable(ctx context.Context, uid string) error
func (*CognitoUserManager) Enable ¶
func (c *CognitoUserManager) Enable(ctx context.Context, uid string) error
func (*CognitoUserManager) ForceUserName ¶
func (*CognitoUserManager) NewUser ¶
func (c *CognitoUserManager) NewUser(ctx context.Context, newUser *models.User) (*models.User, error)
NewUser creates a new user. A password is required. If a password is not specified then one will be generated. TODO: FIgure out user definition.. claims.. users attributes... etc.
func (*CognitoUserManager) UpdateUser ¶
type CognitoUserManagerFactory ¶
type CognitoUserManagerFactory struct{}
func (*CognitoUserManagerFactory) Create ¶
func (c *CognitoUserManagerFactory) Create(cfg interface{}) (cloudy.UserManager, error)
func (*CognitoUserManagerFactory) FromEnv ¶
func (c *CognitoUserManagerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)
type EmailQuota ¶
type Queue ¶
Queue simple wrapper for SQS actions
type SESEmailer ¶
Amazon Simple Email Service (SES) is a cost-effective, flexible, and scalable email service that enables developers to send mail from within any application. You can configure Amazon SES quickly to support several email use cases, including transactional, marketing, or mass email communications. Amazon SES's flexible IP deployment and email authentication options help drive higher deliverability and protect sender reputation, while sending analytics measure the impact of each email. With Amazon SES, you can send email securely, globally, and at scale. -- https://aws.amazon.com/ses/
## Usage Notes You need to make sure that you only send "from" your approved email addresses. Also, this mailer includes some capablities to check your email quota. Under the covers the send raw email method is being called to support attachements. https://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html
func NewSESEmailer ¶
func NewSESEmailer() (*SESEmailer, error)
func (*SESEmailer) DecodeSendError ¶
func (m *SESEmailer) DecodeSendError(err error) string
DecodeSendError turns the error into a status string
func (*SESEmailer) PauseSending ¶
func (m *SESEmailer) PauseSending()
func (*SESEmailer) Quota ¶
func (m *SESEmailer) Quota() (*EmailQuota, error)
Quota gets the quota for sending
func (*SESEmailer) ResumeSending ¶
func (m *SESEmailer) ResumeSending()
type SESEmailerConfig ¶
type SESEmailerConfig struct{}
type SESEmailerFactory ¶
type SESEmailerFactory struct{}
func (*SESEmailerFactory) Create ¶
func (ses *SESEmailerFactory) Create(cfg interface{}) (cloudy.Emailer, error)
func (*SESEmailerFactory) FromEnv ¶
func (ses *SESEmailerFactory) FromEnv(env *cloudy.Environment) (interface{}, error)