func NewIsolatedRegionDriverSet(logDest io.Writer, creds config.Credentials) IsolatedRegionDriverSet { return &isolatedRegionDriverSet{ machineImageDriver: struct { *driver.SDKCreateMachineImageManifestDriver *driver.SDKDeleteMachineImageDriver }{ driver.NewCreateMachineImageManifestDriver(logDest, creds), driver.NewDeleteMachineImageDriver(logDest, creds), }, volumeDriver: struct { *driver.SDKCreateVolumeDriver *driver.SDKDeleteVolumeDriver }{ driver.NewCreateVolumeDriver(logDest, creds), driver.NewDeleteVolumeDriver(logDest, creds), }, snapshotDriver: driver.NewSnapshotFromVolumeDriver(logDest, creds), createAmiDriver: driver.NewCreateAmiDriver(logDest, creds), } }
createMachineImageDriver := driver.NewCreateMachineImageManifestDriver(GinkgoWriter, creds) machineImageDriverConfig := resources.MachineImageDriverConfig{ MachineImagePath: machineImagePath, FileFormat: machineImageFormat, BucketName: bucketName, VolumeSizeGB: 3, } machineImage, err := createMachineImageDriver.Create(machineImageDriverConfig) Expect(err).ToNot(HaveOccurred()) volumeDriverConfig := resources.VolumeDriverConfig{ MachineImageManifestURL: machineImage.GetURL, } createVolumeDriver := driver.NewCreateVolumeDriver(GinkgoWriter, creds) volume, err := createVolumeDriver.Create(volumeDriverConfig) Expect(err).ToNot(HaveOccurred()) ec2Client := ec2.New(session.New(), &aws.Config{Region: aws.String(region)}) reqOutput, err := ec2Client.DescribeVolumes(&ec2.DescribeVolumesInput{VolumeIds: []*string{aws.String(volume.ID)}}) Expect(err).ToNot(HaveOccurred()) Expect(reqOutput.Volumes).To(HaveLen(1)) deleteVolumeDriver := driver.NewDeleteVolumeDriver(GinkgoWriter, creds) err = deleteVolumeDriver.Delete(volume) Expect(err).ToNot(HaveOccurred())