Beispiel #1
0
        public void EnsureStackExists()
        {
            if (_hasCreatedStack)
            {
                return;
            }

            _awsConfiguration = new AwsConfiguration
            {
                AssumeRoleTrustDocument = Roles.Path("code-deploy-trust.json"),
                IamRolePolicyDocument   = Roles.Path("code-deploy-policy.json"),
                Bucket      = "aws-deployment-tools-tests",
                RoleName    = "CodeDeployRole",
                AwsEndpoint = TestConfiguration.AwsEndpoint,
                Credentials = new TestSuiteCredentials()
            };

            _deployer = new Deployer(_awsConfiguration);

            DeletePreviousTestStack();
            _stack = _deployer.CreateStack(new StackTemplate
            {
                StackName    = StackName,
                TemplatePath = CloudFormationTemplates.Path("example-windows-vpc.template")
            });
            _hasCreatedStack = true;
        }
Beispiel #2
0
        public void SetUp()
        {
            _awsConfiguration = new AwsConfiguration
            {
                AwsEndpoint = TestConfiguration.AwsEndpoint,
                Credentials = new TestSuiteCredentials()
            };

            _iamClient = new AmazonIdentityManagementServiceClient(
                new AmazonIdentityManagementServiceConfig
            {
                RegionEndpoint = _awsConfiguration.AwsEndpoint,
                ProxyHost      = _awsConfiguration.ProxyHost,
                ProxyPort      = _awsConfiguration.ProxyPort
            });

            var user = _iamClient.CreateUser(new CreateUserRequest
            {
                UserName = _userName
            }).User;

            _roleToAssume = _iamClient.CreateRoleToAssume(user);
            _awsConfiguration.RoleName = _roleToAssume.Arn;

            _s3Client = new AmazonS3Client(new AmazonS3Config {
                RegionEndpoint = _awsConfiguration.AwsEndpoint
            });

            DeletePreviousTestStack();
        }
Beispiel #3
0
        public void checkConfig()
        {
            bool configured = false;
            bool configCrashed = false;

            try
            {
                configured = CAwsConfig.Instance.isConfigured();
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message, "EC2 Bootstrapper", MessageBoxButton.OK,
                    MessageBoxImage.Error);
                configCrashed = true;
            }

            if(configured == true)
            {
                configurationReady();
            }
            else if (configCrashed == true)
            {
                configMenu.IsEnabled = false;
            }
            else
            {
                ProgBar.Visibility = Visibility.Hidden;

                AwsConfiguration config = new AwsConfiguration();
                config.dashboard = this;
                config.ShowDialog();
            }
        }
 public AmazonProductApi(AwsConfiguration configuration)
 {
     this._awskey = configuration.AwsKey;
     this._awsSecretKey = configuration.AwsSecretKey;
     this._destination = configuration.Destination;
     this._xmlnamespace = configuration.XmlNamespace;
     requestparameters = new Dictionary<string, string>() { { "Service", "AWSECommerceService" }, { "Version", configuration.ApiVersion }, { "AssociateTag", configuration.AssociateTag } };
 }
        public AmazonProductApiTests()
        {
            var awsconfiguration = new AwsConfiguration(awskey, awsSecretKey, destination, apiVersion, associateTag, xmlnamespace);
            amazonapi = new AmazonProductApi(awsconfiguration);
            productids = new string[] { "B004YLCJXC", "B006GOSIYY", "B00KHR4T8U", "B00MHIWT8O", "B00NH2VLGK" };
            retrievelfunc = (url) => Task.FromResult(XDocument.Load(@"Assets\amazon.xml"));
            funcForAddToCart = (url) => Task.FromResult(XDocument.Load(@"Assets\addtocart.xml"));
            funcForCreteCart = (url) => Task.FromResult(XDocument.Load(@"Assets\createcart.xml"));
            funcForGetCart = (url) => Task.FromResult(XDocument.Load(@"Assets\getcart.xml"));
            funcForItemSearch = (url) => Task.FromResult(XDocument.Load(@"Assets\ItemSearch.xml"));
            AppDomain.CurrentDomain.SetData("DataDirectory", AppDomain.CurrentDomain.BaseDirectory);

        }
Beispiel #6
0
        private void SetUp(string stackName)
        {
            _awsConfiguration = new AwsConfiguration
            {
                AwsEndpoint = TestConfiguration.AwsEndpoint,
                Credentials = new TestSuiteCredentials(),
                Bucket      = "aws-deployment-tools-tests"
            };

            _cloudFormationClient =
                new AmazonCloudFormationClient(new AmazonCloudFormationConfig
            {
                RegionEndpoint = _awsConfiguration.AwsEndpoint
            });

            _ec2Client = new AmazonEC2Client(new AmazonEC2Config {
                RegionEndpoint = _awsConfiguration.AwsEndpoint
            });

            DeletePreviousTestStack(stackName);
        }
Beispiel #7
0
        public void SetUp()
        {
            var awsEndpoint = TestConfiguration.AwsEndpoint;
            var credentials = new TestSuiteCredentials();

            _s3Client  = new AmazonS3Client(awsEndpoint);
            _iamClient = new AmazonIdentityManagementServiceClient(awsEndpoint);

            _awsConfiguration = new AwsConfiguration
            {
                IamRolePolicyDocument   = Roles.Path("s3-policy-new-bucket.json"),
                AssumeRoleTrustDocument = Roles.Path("code-deploy-trust.json"),
                Bucket      = "s3-push-test",
                RoleName    = "SomeNewRole",
                AwsEndpoint = awsEndpoint,
                Credentials = credentials
            };

            _deployer            = new Deployer(_awsConfiguration);
            _localBuildDirectory = ExampleRevisions.Directory("HelloWorld-1.2.3");
            _applicationSetName  = "HelloWorld";
            _version             = "1.1.1";
            DeleteRolesAndPolicies();
        }
Beispiel #8
0
        public void EnsureStackExists()
        {
            if (_hasCreatedStack)
            {
                return;
            }

            _awsConfiguration = new AwsConfiguration
            {
                AssumeRoleTrustDocument = Roles.Path("code-deploy-trust.json"),
                IamRolePolicyDocument   = Roles.Path("code-deploy-policy.json"),
                Bucket      = "aws-deployment-tools-tests",
                RoleName    = "CodeDeployRole",
                AwsEndpoint = TestConfiguration.AwsEndpoint,
                Credentials = new TestSuiteCredentials()
            };

            _iamClient = new AmazonIdentityManagementServiceClient(
                new AmazonIdentityManagementServiceConfig
            {
                RegionEndpoint = _awsConfiguration.AwsEndpoint,
                ProxyHost      = _awsConfiguration.ProxyHost,
                ProxyPort      = _awsConfiguration.ProxyPort
            });

            DeletePreviousTestStack();

            _deployer = new Deployer(_awsConfiguration);

            _stack = _deployer.CreateStack(new StackTemplate
            {
                StackName    = StackName,
                TemplatePath = CloudFormationTemplates.Path("example-windows-vpc-autoscaling-group.template")
            });
            _hasCreatedStack = true;
        }
        public async void GetCartShouldNotBeEmptyOrNull()
        {
            string asin = "B00MHIWT8O";
            string offerlistingid = "GT5MOtJKMw77jOdMW4BTQj5%2B7tzBJuDfhgPgizmTlVpta1FvMD5GdoAedgwNH%2FFLrD1ZTXIliEGoE0VilYpxIUpnga3C%2BgE7ak6ILebxaKlu6Dl8Ad5%2BGNwqV8dM9uHbNqzTCj7n6C8c%2F13NocmgVdqxvviGmfNh";
            funcForAddToCart = (url) => Task.FromResult(XDocument.Load(@"Assets\cartcreate.xml"));
            var awsconfigurationforcartCreate = new AwsConfiguration(awskey, awsSecretKey, destination, apiVersion, associateTag, "http://webservices.amazon.com/AWSECommerceService/2011-08-01");
            var amazonapiforcartCreate = new AmazonProductApi(awsconfigurationforcartCreate);
            AmazonShoppingCart shoppingCart = await amazonapiforcartCreate.AddToCart(offerlistingid, asin, funcForAddToCart);

            // add multiple items..
            string secondOfferlistingId = "zd2pVJTM5AmYa6u1atwuQvHljDgDEozIAObG38viMz21SO5PNOSFB4Y4uke%2BRImUem3L2A6uciG6%2F2EjYgnufv0eZv%2BVcQ2FRL54S8LHhwitXUkG4ZFMgA%3D%3D";
            asin = "B00ZQ4JQAA";
            funcForAddToCart = (url) => Task.FromResult(XDocument.Load(@"Assets\addtocartmultipleitem.xml"));
            AmazonShoppingCart shoppingCartItems = await amazonapiforcartCreate.AddToCart(secondOfferlistingId, asin, shoppingCart.CartId, shoppingCart.Hmac, funcForAddToCart);

            ////get the cart details with getcart operations...
            var getCart = await amazonapi.GetCart(shoppingCart.CartId, shoppingCart.Hmac);
            Assert.Contains(associateTag, getCart.PurchaseUrl);
        }
Beispiel #10
0
 public S3(AwsConfiguration config)
 {
     _config = config;
 }
Beispiel #11
0
 public S3BucketStorage(IS3BucketSettings bucketSettings, AwsConfiguration configuration) : base(configuration)
 {
     _bucketSettings  = bucketSettings;
     _rootFolderParts = bucketSettings.RootFolder?.Split(_filePathDelimiters, StringSplitOptions.RemoveEmptyEntries) ??
                        Array.Empty <string>();
 }
 public UploadExtension(IPortalApplication portalApplication, AwsConfiguration aws) : base(portalApplication)
 {
     Aws = aws;
 }
 public S3FileStorage(IAmazonS3 s3Client, AwsConfiguration awsConfiguration)
 {
     _s3Client         = s3Client;
     _awsConfiguration = awsConfiguration;
 }
Beispiel #14
0
 //view menu
 private void configureMenu_Click(object sender, RoutedEventArgs e)
 {
     AwsConfiguration config = new AwsConfiguration();
     config.dashboard = this;
     config.ShowDialog();
 }
Beispiel #15
0
 public RekognitionService(IOptions <AwsConfiguration> awsOptions)
 {
     configuration = awsOptions.Value;
 }
 public async void AddToCartUrlShouldContainAssociateTag()
 {
     string asin = "B00MHIWT8O";
     string offerlistingid = "GT5MOtJKMw77jOdMW4BTQj5%2B7tzBJuDfhgPgizmTlVpta1FvMD5GdoAedgwNH%2FFLrD1ZTXIliEGoE0VilYpxIUpnga3C%2BgE7ak6ILebxaKlu6Dl8Ad5%2BGNwqV8dM9uHbNqzTCj7n6C8c%2F13NocmgVdqxvviGmfNh";
     funcForAddToCart = (url) => Task.FromResult(XDocument.Load(@"Assets\cartcreate.xml"));
     var awsconfigurationforcartCreate = new AwsConfiguration(awskey, awsSecretKey, destination, apiVersion, associateTag, "http://webservices.amazon.com/AWSECommerceService/2011-08-01");
     var amazonapiforcartCreate = new AmazonProductApi(awsconfigurationforcartCreate);
     AmazonShoppingCart shoppingCart = await amazonapiforcartCreate.AddToCart(offerlistingid, asin, funcForAddToCart);
     Assert.Contains(associateTag, shoppingCart.PurchaseUrl);
 }
Beispiel #17
0
 public S3Business(AwsConfiguration config)
 {
     _config = config;
 }
Beispiel #18
0
 protected S3BucketStorageBase(AwsConfiguration configuration)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _s3Client      = new Lazy <IAmazonS3>(CreateS3Client, LazyThreadSafetyMode.ExecutionAndPublication);
 }