func main() { configuration, err := flags.ParseFlags(os.Args[1:]) if err != nil { fmt.Fprintf(os.Stderr, "\n\n%s\n", err) os.Exit(1) } boshConfig := bosh.Config{ URL: configuration.BoshDirector, Password: configuration.BoshPassword, Username: configuration.BoshUser, AllowInsecureSSL: true, } aws := clients.NewAWS(configuration.AWSAccessKeyID, configuration.AWSSecretAccessKey, configuration.AWSRegion, configuration.AWSEndpointOverride) bosh := clients.NewBOSH(bosh.NewClient(boshConfig), os.Stdout) subnetChecker := subnetchecker.NewSubnetChecker(aws) awsDeployer := awsdeployer.NewAWSDeployer(bosh, subnetChecker, os.Stdout) err = awsDeployer.Deploy(configuration.ManifestPath) if err != nil { fmt.Fprintf(os.Stderr, "\n\n%s\n", err) os.Exit(1) } os.Exit(0) }
"github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/service/ec2" "github.com/cloudfoundry/mega-ci/scripts/ci/deploy-aws-manifests/clients" "github.com/cloudfoundry/mega-ci/scripts/ci/deploy-aws-manifests/fakes" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("AWS", func() { var ( awsClient clients.AWS fakeSession *fakes.Session ) BeforeEach(func() { awsClient = clients.NewAWS("some-access-key-id", "some-secret-access-key", "some-region", "some-endpoint") fakeSession = &fakes.Session{} }) Describe("Session", func() { It("returns a new ec2 session", func() { session, err := awsClient.Session() Expect(err).NotTo(HaveOccurred()) _, ok := session.(clients.Session) Expect(ok).To(BeTrue()) client, ok := session.(*ec2.EC2) Expect(ok).To(BeTrue()) Expect(client.Config.Credentials).To(Equal(credentials.NewStaticCredentials("some-access-key-id", "some-secret-access-key", "")))