Documentation ¶
Index ¶
- func CreateUserData(publicKeyFile string) (string, error)
- func DeleteEC2Image(e *ec2.EC2, imageDesc *imageDescription) error
- func DescribeEC2Image(e *ec2.EC2, imageName string) (*imageDescription, error)
- func GetAWSCredentialsFromEnv() (*awsCredentials, error)
- func NewEC2(c *awsCredentials) (*ec2.EC2, error)
- func UploadImageToAWS(c *awsCredentials, imagePath string, imageName string) error
- func WithBootedImageInEC2(e *ec2.EC2, securityGroupName string, imageDesc *imageDescription, ...) (retErr error)
- func WithBootedNspawnDirectory(dir string, ns NetNS, f func() error) error
- func WithBootedNspawnImage(image string, ns NetNS, f func() error) error
- func WithBootedQemuImage(image string, ns NetNS, f func() error) error
- func WithExtractedTarArchive(archive string, f func(dir string) error) error
- func WithNetworkNamespace(f func(ns NetNS) error) error
- func WithSSHKeyPair(f func(privateKey, publicKey string) error) error
- type NetNS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUserData ¶
CreateUserData creates cloud-init's user-data that contains user redhat with the specified public key
func DeleteEC2Image ¶
DeleteEC2Image deletes the specified image and its associated snapshot
func DescribeEC2Image ¶
DescribeEC2Image searches for EC2 image by its name and returns its id and snapshot id
func GetAWSCredentialsFromEnv ¶
func GetAWSCredentialsFromEnv() (*awsCredentials, error)
GetAWSCredentialsFromEnv gets the credentials from environment variables If none of the environment variables is set, it returns nil. If some but not all environment variables are set, it returns an error.
func UploadImageToAWS ¶
UploadImageToAWS mimics the upload feature of osbuild-composer. It takes an image and an image name and creates an ec2 instance from them. The s3 key is never returned - the same thing is done in osbuild-composer, the user has no way of getting the s3 key.
func WithBootedImageInEC2 ¶
func WithBootedImageInEC2(e *ec2.EC2, securityGroupName string, imageDesc *imageDescription, publicKey string, instanceType string, f func(address string) error) (retErr error)
WithBootedImageInEC2 runs the function f in the context of booted image in AWS EC2
func WithBootedNspawnDirectory ¶
WithBootedNspawnImage boots the specified directory in the specified namespace using nspawn. The VM is killed immediately after function returns.
func WithBootedNspawnImage ¶
WithBootedNspawnImage boots the specified image in the specified namespace using nspawn. The VM is killed immediately after function returns.
func WithBootedQemuImage ¶
WithBootedQemuImage boots the specified image in the specified namespace using qemu. The VM is killed immediately after function returns.
func WithExtractedTarArchive ¶
WithExtractedTarArchive extracts the provided archive and passes a path to the result to the function f. The result is deleted immediately after the function returns.
func WithNetworkNamespace ¶
WithNetworkNamespace provides the function f with a new network namespace which is deleted immediately after f returns
func WithSSHKeyPair ¶
WithSSHKeyPair runs the function f with a newly generated ssh key-pair, they key-pair is deleted immediately after the function f returns
Types ¶
type NetNS ¶
type NetNS string
Network namespace abstraction
func (NetNS) NamespacedCommand ¶
NamespaceCommand returns an *exec.Cmd struct with the difference that it's prepended by "ip netns exec NAMESPACE_NAME" command, which runs the command in a namespaced environment.
func (NetNS) NamespacedCommandContext ¶
NamespaceCommand returns an *exec.Cmd struct with the difference that it's prepended by "ip netns exec NAMESPACE_NAME" command, which runs the command in a namespaced environment.