func NewStandardRegionDriverSet(logDest io.Writer, creds config.Credentials) StandardRegionDriverSet { return &standardRegionDriverSet{ machineImageDriver: struct { *driver.SDKCreateMachineImageDriver *driver.SDKDeleteMachineImageDriver }{ driver.NewCreateMachineImageDriver(logDest, creds), driver.NewDeleteMachineImageDriver(logDest, creds), }, snapshotDriver: driver.NewSnapshotFromImageDriver(logDest, creds), amiDriver: driver.NewCreateAmiDriver(logDest, creds), copyAmiDriver: driver.NewCopyAmiDriver(logDest, creds), } }
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), } }
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()) Eventually(func() error { _, err = ec2Client.DescribeVolumes(&ec2.DescribeVolumesInput{VolumeIds: []*string{aws.String(volume.ID)}}) return err }, 10*time.Minute, 10*time.Second).Should(MatchError(ContainSubstring("InvalidVolume.NotFound"))) deleteMachineImageDriver := driver.NewDeleteMachineImageDriver(GinkgoWriter, creds) _ = deleteMachineImageDriver.Delete(machineImage) // ignore error on cleanup }) })