コード例 #1
0
        public void Execute(Guid profileId, string vpcId)
        {
            IAwsClient client;
            AwsProfile profile;

            if (!TryInitialize(profileId, out client, out profile))
            {
                return;
            }

            var    creator = new DefaultSecurityGroupCreator(client.SecurityGroupService);
            string groupId;

            try
            {
                groupId = creator.TryCreateDefaultSecurityGroup(vpcId);
            }
            catch (AmazonEC2Exception e)
            {
                // TODO: Once we create a billing profile type, we won't need to do this anymore
                // because the billing profile type will not need to create any kind of security group.
                if (e.Message.Contains(_unauthorizedMarker))
                {
                    return;
                }
                throw;
            }
            profile.DefaultSecurityGroupId = groupId;
            ProfileRepository.Update(profile);
        }
コード例 #2
0
        public void Execute(Guid profileId, string vpcId)
        {
            IAwsClient client;
            AwsProfile profile;
            if (!TryInitialize(profileId, out client, out profile))
            {
                return;
            }

            var creator = new DefaultSecurityGroupCreator(client.SecurityGroupService);
            string groupId;
            try
            {
                groupId = creator.TryCreateDefaultSecurityGroup(vpcId);
            }
            catch (AmazonEC2Exception e)
            {
                // TODO: Once we create a billing profile type, we won't need to do this anymore
                // because the billing profile type will not need to create any kind of security group.
                if (e.Message.Contains(_unauthorizedMarker))
                {
                    return;
                }
                throw;
            }
            profile.DefaultSecurityGroupId = groupId;
            ProfileRepository.Update(profile);
        }
コード例 #3
0
        public void SetUp()
        {
            AWSCredentials credentials = AmbientCredentials.GetCredentials();

            Ec2Client            = AWSClientFactory.CreateAmazonEC2Client(credentials);
            SecurityGroupService = new SecurityGroupService(Ec2Client);

            Creator = new DefaultSecurityGroupCreator(SecurityGroupService)
            {
                SecurityGroupName = _testSecurityGroupName
            };
        }