Ejemplo n.º 1
0
        public void Initialize()
        {
            if (!_initialized)
            {
                _retrievalStrategy.Initialize();
                _securitySettings = new SecurityGroup
                {
                    EncryptionKey        = _retrievalStrategy.GetCoreConfigurationValue <string>("Security", "EncryptionKey"),
                    EncryptionSalt       = _retrievalStrategy.GetCoreConfigurationValue <string>("Security", "EncryptionSalt"),
                    EncryptionIV         = _retrievalStrategy.GetCoreConfigurationValue <string>("Security", "EncryptionIV"),
                    AccessDeniedRedirect = _retrievalStrategy.GetCoreConfigurationValue <string>("Security", "AccessDeniedRedirect"),
                    EnableInternetUser   = _retrievalStrategy.GetCoreConfigurationValue <bool>("Security", "EnableInternetUser"),
                    EnableRememberMe     = _retrievalStrategy.GetCoreConfigurationValue <bool>("Security", "EnableRememberMe"),

                    AdministratorRole       = _retrievalStrategy.GetCoreConfigurationValue <Guid>("Security", "AdministratorRole"),
                    UseWindowAuthentication = _retrievalStrategy.GetCoreConfigurationValue <bool>("Security", "UseWindowAuthentication")
                };

                _baseSettings = new GeneralSettingGroup()
                {
                    ConnectionString             = ConfigurationManager.ConnectionStrings["Connection"].ConnectionString,
                    DefaultPassword              = _retrievalStrategy.GetCoreConfigurationValue <string>("General", "DefaultPassword"),
                    UploadDocumentFolder         = _retrievalStrategy.GetCoreConfigurationValue <string>("General", "UploadDocumentFolder"),
                    UploadImgValidFileExtensions = _retrievalStrategy.GetCoreConfigurationValue <string>("General", "UploadImgValidFileExts"),
                    UploadDocumentValidFileExts  = _retrievalStrategy.GetCoreConfigurationValue <string>("General", "UploadDocumentValidFileExts"),
                };


                _smtpSettings = new SmtpSettingConfiguration()
                {
                    SmtpFrom = _retrievalStrategy.SmtpConfigurationSection.From
                };
                _initialized = true;
            }
        }
        private void CheckIngresPortAndIPAdress(SecurityGroupOptions securityGroup, ISecurityGroup sg, SecurityGroupRuleOptions ingressRule, bool ipAddressIsEmpty, SecurityGroupRuleType securityGroupRuleType)
        {
            if (ingressRule.Port != null)
            {
                if (ipAddressIsEmpty)
                {
                    var securityGroupAllowed = LocateSecurityGroup(ingressRule.SecurityGroupId,
                                                                   $"The security group id {ingressRule.SecurityGroupId} was found in the list of ingress rules of the security group {securityGroup.SecurityGroupName}, that security group does not exist");

                    if (securityGroupRuleType == SecurityGroupRuleType.IngressRule)
                    {
                        sg.AddIngressRule(securityGroupAllowed, Port.Tcp(ingressRule.Port.Value), ingressRule.Description);
                    }
                    else
                    {
                        sg.AddEgressRule(securityGroupAllowed, Port.Tcp(ingressRule.Port.Value), ingressRule.Description);
                    }
                }
                else
                {
                    if (securityGroupRuleType == SecurityGroupRuleType.IngressRule)
                    {
                        sg.AddIngressRule(Peer.Ipv4(ingressRule.IpAddress), Port.Tcp(ingressRule.Port.Value), ingressRule.Description);
                    }
                    else
                    {
                        sg.AddEgressRule(Peer.Ipv4(ingressRule.IpAddress), Port.Tcp(ingressRule.Port.Value), ingressRule.Description);
                    }
                }
            }
        }
Ejemplo n.º 3
0
    public void Initialize()
    {
      if (!_initialized)
      {
        _retrievalStrategy.Initialize();
        _securitySettings = new SecurityGroup
        {
          EncryptionKey = _retrievalStrategy.GetCoreConfigurationValue<string>("Security", "EncryptionKey"),
          EncryptionSalt = _retrievalStrategy.GetCoreConfigurationValue<string>("Security", "EncryptionSalt"),
          EncryptionIV = _retrievalStrategy.GetCoreConfigurationValue<string>("Security", "EncryptionIV"),
          AccessDeniedRedirect = _retrievalStrategy.GetCoreConfigurationValue<string>("Security", "AccessDeniedRedirect"),
          EnableInternetUser = _retrievalStrategy.GetCoreConfigurationValue<bool>("Security", "EnableInternetUser"),
          EnableRememberMe = _retrievalStrategy.GetCoreConfigurationValue<bool>("Security", "EnableRememberMe"),

          AdministratorRole = _retrievalStrategy.GetCoreConfigurationValue<Guid>("Security", "AdministratorRole"),
          UseWindowAuthentication = _retrievalStrategy.GetCoreConfigurationValue<bool>("Security", "UseWindowAuthentication")
        };

        _baseSettings = new GeneralSettingGroup()
        {
          ConnectionString = ConfigurationManager.ConnectionStrings["Connection"].ConnectionString,
          DefaultPassword = _retrievalStrategy.GetCoreConfigurationValue<string>("General", "DefaultPassword"),
          UploadDocumentFolder = _retrievalStrategy.GetCoreConfigurationValue<string>("General", "UploadDocumentFolder"),
          UploadImgValidFileExtensions = _retrievalStrategy.GetCoreConfigurationValue<string>("General", "UploadImgValidFileExts"),
          UploadDocumentValidFileExts = _retrievalStrategy.GetCoreConfigurationValue<string>("General", "UploadDocumentValidFileExts"),
        };


        _smtpSettings = new SmtpSettingConfiguration()
        {
          SmtpFrom = _retrievalStrategy.SmtpConfigurationSection.From
        };
        _initialized = true;
      }
    }
 private static void AddRuleWithIPAddress(ISecurityGroup sg, SecurityGroupRuleOptions securitygroupRuleOptions, SecurityGroupRuleType securityGroupRuleType)
 {
     if (securityGroupRuleType == SecurityGroupRuleType.IngressRule)
     {
         sg.AddIngressRule(Peer.Ipv4(securitygroupRuleOptions.IpAddress), Port.TcpRange(securitygroupRuleOptions.PortRangeStart.Value, securitygroupRuleOptions.PortRangeEnd.Value), securitygroupRuleOptions.Description);
     }
     else
     {
         sg.AddEgressRule(Peer.Ipv4(securitygroupRuleOptions.IpAddress), Port.TcpRange(securitygroupRuleOptions.PortRangeStart.Value, securitygroupRuleOptions.PortRangeEnd.Value), securitygroupRuleOptions.Description);
     }
 }
        private void AddRuleWithEMptyIPAddress(SecurityGroupOptions securityGroup, ISecurityGroup sg, SecurityGroupRuleOptions securitygroupRuleOptions, SecurityGroupRuleType securityGroupRuleType)
        {
            var securityGroupAllowed = LocateSecurityGroup(securitygroupRuleOptions.SecurityGroupId,
                                                           $"The security group id {securitygroupRuleOptions.SecurityGroupId} was found in the list of ingress rules of the security group {securityGroup.SecurityGroupName}, that security group does not exist");

            if (securityGroupRuleType == SecurityGroupRuleType.IngressRule)
            {
                sg.AddIngressRule(securityGroupAllowed, Port.TcpRange(securitygroupRuleOptions.PortRangeStart.Value, securitygroupRuleOptions.PortRangeEnd.Value), securitygroupRuleOptions.Description);
            }
            else
            {
                sg.AddEgressRule(securityGroupAllowed, Port.TcpRange(securitygroupRuleOptions.PortRangeStart.Value, securitygroupRuleOptions.PortRangeEnd.Value), securitygroupRuleOptions.Description);
            }
        }
Ejemplo n.º 6
0
        private void GetLambdaResources(LambdaOptions lambda, out IRole role, out ISecurityGroup securityGroup, out IVpc vpc, out ISubnet[] subnets, out IBucket bucket, out Dictionary <string, string> environmentVariables)
        {
            // Locate role
            role = LocateRole(lambda.Role, $"The role {lambda.Role} of the lambda {lambda.FunctionName} was not found");

            // Locate security group
            securityGroup = LocateSecurityGroup(lambda.SecurityGroupId, $"The security group {lambda.SecurityGroupId} of the lambda {lambda.FunctionName} was not found");

            // Locate vpc
            vpc = LocateVpc(lambda.VpcId, $"The VPC {lambda.VpcId} of the lambda {lambda.FunctionName} was not found");

            // Locate subnets
            if (lambda.SubnetIds?.Any() != true)
            {
                subnets = null;
            }
            else
            {
                var subnetList = new List <ISubnet>(lambda.SubnetIds.Length);
                foreach (var subnetId in lambda.SubnetIds)
                {
                    subnetList.Add(LocateSubnet(subnetId,
                                                $"The subnet {subnetId} of the lambda {lambda.FunctionName} was not found",
                                                $"The subnet ids of the lambda {lambda.FunctionName} can not be empty"));
                }
                subnets = subnetList.ToArray();
            }

            // Locate bucket
            bucket = LocateBucket(lambda.SourceCode?.CodeBucket?.BucketName, $"The bucket {lambda.SourceCode.CodeBucket.BucketName} of the lambda {lambda.FunctionName} was not found");

            if (lambda.LambdaEnvironmentVariables?.Any() == true)
            {
                environmentVariables = new Dictionary <string, string>();
                foreach (var environmentVariable in lambda.LambdaEnvironmentVariables)
                {
                    environmentVariables.Add(environmentVariable.EnvironmentVariableName, environmentVariable.EnvironmentVariableValue);
                }
            }
            else
            {
                environmentVariables = null;
            }
        }
        private void AddSecurityGroupRules(SecurityGroupOptions securityGroup, ISecurityGroup sg, SecurityGroupRuleType securityGroupRuleType)
        {
            if (securityGroup.IngressRules?.Any() != true)
            {
                return;
            }

            foreach (var ingressRule in securityGroup.IngressRules)
            {
                var securityGroupIdIsEmpty = string.IsNullOrWhiteSpace(ingressRule.SecurityGroupId);
                var ipAddressIsEmpty       = string.IsNullOrWhiteSpace(ingressRule.IpAddress);

                CheckSecurityGroupIngressRulesParams(ingressRule, securityGroupIdIsEmpty, ipAddressIsEmpty, securityGroupRuleType);

                CheckIngresPortAndIPAdress(securityGroup, sg, ingressRule, ipAddressIsEmpty, securityGroupRuleType);

                CheckPortRangeStart(securityGroup, sg, ingressRule, ipAddressIsEmpty, securityGroupRuleType);
            }
        }
 private void CheckPortRangeStart(SecurityGroupOptions securityGroup, ISecurityGroup sg, SecurityGroupRuleOptions securitygroupRuleOptions, bool ipAddressIsEmpty, SecurityGroupRuleType securityGroupRuleType)
 {
     if ((securitygroupRuleOptions.PortRangeStart != null || securitygroupRuleOptions.PortRangeEnd != null) && (securitygroupRuleOptions.PortRangeStart == null || securitygroupRuleOptions.PortRangeEnd == null))
     {
         throw new ArgumentException("A Port Range must specify both a start port and an end port");
     }
     else
     {
         if (securitygroupRuleOptions.PortRangeStart != null && securitygroupRuleOptions.PortRangeEnd != null)
         {
             if (ipAddressIsEmpty)
             {
                 AddRuleWithEMptyIPAddress(securityGroup, sg, securitygroupRuleOptions, securityGroupRuleType);
             }
             else
             {
                 AddRuleWithIPAddress(sg, securitygroupRuleOptions, securityGroupRuleType);
             }
         }
     }
 }
        public void GetDmsReplicationInstancesResources(DmsReplicationInstanceOptions replicationInstanceOption, out string[] vpcSecurityGroupsIds, out string subnetGroupName, out bool publiclyAccessible)
        {
            // Locate subnet group
            if (!string.IsNullOrWhiteSpace(replicationInstanceOption.SubnetGroupId))
            {
                if (!StackResources.DmsReplicationSubnetGroups.TryGetValue(replicationInstanceOption.SubnetGroupId, out var subnetGroup))
                {
                    throw new ArgumentException($"The subnet group id { replicationInstanceOption.SubnetGroupId } of the replication instance { replicationInstanceOption.Name } was not found");
                }
                else
                {
                    subnetGroupName = subnetGroup.ReplicationSubnetGroupIdentifier;
                }
            }
            else
            {
                throw new ArgumentException($"The replication instance { replicationInstanceOption.Name } must have a subnet group id");
            }

            // Locate security group Ids
            vpcSecurityGroupsIds = null;
            if (replicationInstanceOption.SecurityGroupIds?.Any() == true)
            {
                List <string> vpcSecurityGroupsIdsList = new List <string>();
                foreach (var securityGroupOption in replicationInstanceOption.SecurityGroupIds)
                {
                    ISecurityGroup securityGroup = LocateSecurityGroup(securityGroupOption,
                                                                       $"The security group {securityGroupOption} of the replicationInstance {replicationInstanceOption.Name} was not found");
                    vpcSecurityGroupsIdsList.Add(securityGroup.SecurityGroupId);
                }
                vpcSecurityGroupsIds = vpcSecurityGroupsIdsList.ToArray();
            }

            // Is public accessible
            publiclyAccessible = replicationInstanceOption.PubliclyAccessible ?? false;
        }
 public void AddPermissions(Entity entity, PermissionTypes permissionTypes, ISecurityGroup source = null)
 {
     this.EntityPermissionsRepository.AddPermission(entity, this.SecurityGroupRepository.Find(source?.Guid ?? this.UserSession.LoggedInUser.Guid), permissionTypes);
 }
Ejemplo n.º 11
0
 public IFunctionProps CreateLambdaProperties(string codeFilePath, string lambdaHandler, IRole lambdaRole, Runtime runtime, string lambdaName, IVpc vpc, ISecurityGroup securityGroup, ISubnet[] subnets, double memorySize = 512, int timeOutSeconds = 30, IDictionary <string, string> environmentVariables = null)
 {
     return(HandlerResources.AwsCdkLambdaHandler.CreateLambdaProperties(codeFilePath, lambdaHandler, lambdaRole, runtime, lambdaName, vpc, securityGroup, subnets, memorySize, timeOutSeconds, environmentVariables));
 }
Ejemplo n.º 12
0
        public static InstanceProps InstanceProps(IVpc vpc, ISubnet subnet, IRole role, ISecurityGroup securityGroup, IvrInstanceProps props, string privateIpAddress = null)
        {
            var instanceProps = new InstanceProps
            {
                Vpc        = vpc,
                VpcSubnets = new SubnetSelection
                {
                    //SubnetType = SubnetType.PUBLIC,
                    //SubnetGroupName = subnetGroupName,
                    Subnets = new ISubnet[] { subnet },
                },
                InstanceType = InstanceType.Of(props.InstanceClass, props.InstanceSize),
                MachineImage = new WindowsImage(props.WindowsVersion),
                BlockDevices = new BlockDevice[] {
                    new BlockDevice {
                        DeviceName = "/dev/sda1",
                        Volume     = BlockDeviceVolume.Ebs(props.VolumeSize, new EbsDeviceOptions {
                            VolumeType = props.VolumeType,
                            Encrypted  = true,
                        }),
                    },
                },
                Role          = role,
                SecurityGroup = securityGroup,
            };

            if (!string.IsNullOrWhiteSpace(privateIpAddress))
            {
                instanceProps.PrivateIpAddress = privateIpAddress;
            }
            return(instanceProps);
        }
 public IFunctionProps CreateLambdaProperties(string codeFilePath, string lambdaHandler, IRole lambdaRole, Runtime runtime, string lambdaName, IVpc vpc, ISecurityGroup securityGroup, ISubnet[] subnets, double memorySize = 512, int timeOutSeconds = 30, IDictionary <string, string> environmentVariables = null)
 {
     return(new FunctionProps
     {
         Code = Code.FromAsset(codeFilePath),
         Handler = lambdaHandler,
         Runtime = runtime,
         MemorySize = memorySize,
         Timeout = Duration.Seconds(timeOutSeconds),
         FunctionName = lambdaName,
         Role = lambdaRole,
         Vpc = vpc,
         SecurityGroups = new ISecurityGroup[]
         {
             securityGroup
         },
         VpcSubnets = new SubnetSelection
         {
             Subnets = subnets
         },
         Environment = environmentVariables
     });
 }
 public IDatabaseInstance AddDatabase(MysqlEngineVersion databaseEngineVersion, string identification, string databaseName, double?port, string userName, ISecret passwordSecret, StorageType storageType, InstanceClass instanceClass, InstanceSize instanceSize, IVpc vpc, ISecurityGroup securityGroup, ISubnetGroup subnetGroup, IParameterGroup parameterGroup = null, double?allocatedStorageGb = 5, RemovalPolicy removalPolicy = RemovalPolicy.DESTROY, bool deleteAutomatedBackups = false, int backupRetentionDays = 1, bool deletionProtection = false, string[] logTypes = null, bool?storageEncrypted = null, bool?enableIamAuthentication = null, Duration enhancedMonitoringInterval = null, bool multiAZEnabled = true, bool autoMinorVersionUpgrade = false)     //NOSONAR number of params
 {
     return(HandlerResources.AwsCdkDatabaseHandler.CreateDatabase(databaseEngineVersion, identification, databaseName, port, userName, passwordSecret, storageType,
                                                                  instanceClass, instanceSize, vpc, securityGroup, subnetGroup, parameterGroup, allocatedStorageGb, removalPolicy, deleteAutomatedBackups,
                                                                  backupRetentionDays, deletionProtection, logTypes, storageEncrypted, enableIamAuthentication, enhancedMonitoringInterval, multiAZEnabled, autoMinorVersionUpgrade));
 }
        public IDatabaseInstance CreateDatabaseSqlServer(DeputyBase databaseEngineVersion, string identification, string databaseName, string userName, string password, StorageType storageType, InstanceClass instanceClass, string instanceSize, IVpc vpc, ISecurityGroup security, string securityGroupId, string parameterGroupId = null, IRole[] roles = null, double?allocatedStorageGb = 5, RemovalPolicy removalPolicy = RemovalPolicy.DESTROY, bool deleteAutomatedBackups = false, int backupRetentionDays = 1, bool?deletionProtection = false, SubnetType subnetType = SubnetType.PRIVATE_ISOLATED, string defaultSubnetDomainSeparator = ",", string subnets = "", bool multiAZEnabled = true, bool?autoMinorVersionUpgrade = false, bool?storageEncrypted = true, string licenseOption = "LICENSE_INCLUDED", string edition = "ex")
        {
            BasicDatabaseInfraWithHardcodedPassword(vpc, subnetType, defaultSubnetDomainSeparator, subnets, out var subnetSelection);
            var engine = GetInstanceEngine(databaseEngineVersion, edition);

            return(new DatabaseInstance(Scope, identification, new DatabaseInstanceProps
            {
                Engine = engine,
                RemovalPolicy = removalPolicy,
                DeletionProtection = deletionProtection,
                Credentials = Credentials.FromPassword(userName, SecretValue.PlainText(password)),
                StorageType = storageType,
                DatabaseName = licenseOption == LicenseModel.LICENSE_INCLUDED.ToString() ? null : databaseName,
                VpcSubnets = subnetSelection,
                Vpc = vpc,
                SecurityGroups = new[]
                {
                    security
                },
                DeleteAutomatedBackups = deleteAutomatedBackups,
                BackupRetention = Duration.Days(backupRetentionDays),
                AllocatedStorage = allocatedStorageGb,
                InstanceType = InstanceType.Of(instanceClass, GetInstanceSize(instanceSize)),
                ParameterGroup = CreateClusterParameterGroup(parameterGroupId, engine, roles),
                MultiAz = multiAZEnabled,
                AutoMinorVersionUpgrade = autoMinorVersionUpgrade,
                StorageEncrypted = storageEncrypted,
                LicenseModel = GetLicenseModel(licenseOption)
            }));
        }
        private void BasicDatabaseInfra(IVpc vpc, string secretName, string securityId, string securityGroupId, SubnetType subnetType, string defaultSubnetDomainSeparator, string subnets, out ISecurityGroup securityGroup, out ISecret secret, out ISubnetSelection subnetSelection)                         //NOSONAR number of params
        {
            if (vpc == null)
            {
                throw new ArgumentException("The VPC provided to create the database is not valid");
            }

            securityGroup = AwsSecurityGroupHandler.Locate(securityId, securityGroupId);

            if (securityGroup == null)
            {
                throw new ArgumentException($"The Security group id {securityGroupId} provided to create the database is not valid");
            }

            secret          = AwsCdkSecretHandler.Create(secretName);
            subnetSelection = AwsCdkVpcHandler.GetVpcSubnetSelection(vpc, subnets, defaultSubnetDomainSeparator, subnetType);
        }
        public IDatabaseInstance CreateDatabase(DeputyBase databaseEngineVersion, string identification, string databaseName, double?port, string userName, ISecret passwordSecret, StorageType storageType, InstanceClass instanceClass, InstanceSize instanceSize, IVpc vpc, ISecurityGroup securityGroup, ISubnetGroup subnetGroup, IParameterGroup parameterGroup = null, double?allocatedStorageGb = 5, RemovalPolicy removalPolicy = RemovalPolicy.DESTROY, bool deleteAutomatedBackups = false, int backupRetentionDays = 1, bool deletionProtection = false, string[] logTypes = null, bool?storageEncrypted = null, bool?enableIamAuthentication = false, Duration enhancedMonitoringInterval = null, bool multiAZEnabled = true, bool autoMinorVersionUpgrade = false)
        {
            BasicDatabaseInfra(vpc);
            var engine = GetInstanceEngine(databaseEngineVersion);

            return(new DatabaseInstance(Scope, identification, new DatabaseInstanceProps
            {
                Engine = engine,
                RemovalPolicy = removalPolicy,
                DeletionProtection = deletionProtection,
                Credentials = Credentials.FromPassword(userName, passwordSecret.SecretValue),
                StorageType = storageType,
                DatabaseName = databaseName,
                Port = port,
                SubnetGroup = subnetGroup,
                Vpc = vpc,
                SecurityGroups = new[]
                {
                    securityGroup
                },
                DeleteAutomatedBackups = deleteAutomatedBackups,
                BackupRetention = Duration.Days(backupRetentionDays),
                AllocatedStorage = allocatedStorageGb,
                InstanceType = InstanceType.Of(instanceClass, instanceSize),
                ParameterGroup = parameterGroup,
                CloudwatchLogsExports = logTypes,
                StorageEncrypted = storageEncrypted,
                IamAuthentication = enableIamAuthentication,
                MonitoringInterval = enhancedMonitoringInterval,
                MultiAz = multiAZEnabled,
                AutoMinorVersionUpgrade = autoMinorVersionUpgrade
            }));
        }
Ejemplo n.º 18
0
 public IAutoScalingGroup AddAutoScalingGroup(string id, string autoScalingGroupName, string instanceType, string machineImage, string machineAmiImage, IVpc vpc, bool allowAllOutbound, int minCapacity, int maxCapacity, int desiredCapacity, string region, ISecurityGroup securityGroup, string timeOutCreation, IRole role, ISubnet[] subnets, string keyPairName, bool enableProtectionFromScaleIn, List <BlockDevicesOptions> blockDevices = null, List <string> userData = null)
 {
     return(HandlerResources.AwsCdkAutoScalingGroupHandler.Create(id, autoScalingGroupName, instanceType, machineImage, machineAmiImage, vpc, allowAllOutbound, minCapacity, maxCapacity, desiredCapacity, region, securityGroup, timeOutCreation, role, subnets, keyPairName, enableProtectionFromScaleIn, blockDevices, userData));
 }
 public IDatabaseInstance AddDatabase(SqlServerEngineVersion databaseEngineVersion, string identification, string databaseName, string userName, string password, StorageType storageType, InstanceClass instanceClass, string instanceSize, IVpc vpc, ISecurityGroup securityGroup, string securityGroupName, string parameterGroupId = null, IRole[] roles = null, double?allocatedStorageGb = 5, RemovalPolicy removalPolicy = RemovalPolicy.DESTROY, bool deleteAutomatedBackups = false, int backupRetentionDays = 1, bool?deletionProtection = false, SubnetType subnetType = SubnetType.PUBLIC, bool allowGroupAllOutbound = true, string defaultSubnetDomainSeparator = ",", bool multiAZEnabled = true, bool?storageEncrypted = true, string licenseOption = "LICENSE_INCLUDED", string edition = "ex", bool?autoMinorVersionUpgrade = false)     //NOSONAR number of params
 {
     return(HandlerResources.AwsCdkDatabaseHandler.CreateDatabaseSqlServer(databaseEngineVersion, identification, databaseName, userName, password, storageType,
                                                                           instanceClass, instanceSize, vpc, securityGroup, identification, parameterGroupId, roles, allocatedStorageGb, removalPolicy, deleteAutomatedBackups,
                                                                           backupRetentionDays, deletionProtection, subnetType, defaultSubnetDomainSeparator, storageEncrypted: storageEncrypted, licenseOption: licenseOption, edition: edition, autoMinorVersionUpgrade: autoMinorVersionUpgrade));
 }
        public IAutoScalingGroup Create(string id, string instanceName, string instanceType, string machineImageType, string machineAmiImage, IVpc vpc, bool allowAllOutbound, int minCapacity, int maxCapacity, int desiredCapacity, string region, ISecurityGroup securityGroup, string timeOutCreation, IRole role, ISubnet[] subnets, string keyPairName, bool enableProtectionFromScaleIn, List <BlockDevicesOptions> blockDevicesOptions, List <string> userData)
        {
            var result = CreateInstance(new AutoScalingGroupEntity
            {
                Id      = id,
                Vpc     = vpc,
                Subnets = subnets,
                AutoScalingGroupName = instanceName,
                InstanceType         = new InstanceType(instanceType),
                MachineImage         = GetMachineImage(machineImageType, new Dictionary <string, string> {
                    { region, machineAmiImage }
                }),
                AllowAllOutbound            = allowAllOutbound,
                MinCapacity                 = minCapacity,
                MaxCapacity                 = maxCapacity,
                DesiredCapacity             = desiredCapacity,
                SecurityGroup               = securityGroup,
                TimeOutCreation             = timeOutCreation,
                Role                        = role,
                KeyPairName                 = keyPairName,
                BlockDevices                = CreateBlockDevices(blockDevicesOptions),
                EnableProtectionFromScaleIn = enableProtectionFromScaleIn,
                UserData                    = userData
            });

            TagHandler.LogTag(ApplicationName + EnvironmentName + instanceName, result);
            return(result);
        }
Ejemplo n.º 21
0
        private void GetDatabaseResources(DatabaseOptions databaseOption, out double?databasePort, out IVpc vpc, out ISecurityGroup securityGroup, out ISubnetGroup subnetGroup, out bool deletionProtection, out Duration enchancedMonitoringInterval, out ISecret passwordSecret, out IParameterGroup parameterGroup)  //NOSONAR number of params
        {
            // Parse database port
            databasePort = ParseDatabasePort(databaseOption);

            // Locate vpc
            vpc = LocateVPC(databaseOption);

            // Locate security group
            securityGroup = LocateSecurityGroup(databaseOption);

            // Locate subnet group
            subnetGroup = LocateSubnetGroup(databaseOption);

            // Locate parameter group
            parameterGroup = LocateParameterGroup(databaseOption);

            deletionProtection = databaseOption.DeletionProtection ?? false;

            enchancedMonitoringInterval = databaseOption.EnhancedMonitoringIntervalSeconds.HasValue ? Duration.Seconds(databaseOption.EnhancedMonitoringIntervalSeconds.Value) : null;

            passwordSecret = SetDatabasePassword(databaseOption);
        }
 public void AddPermissions(EmailMessage entity, PermissionTypes permissionTypes, ISecurityGroup source = null)
 {
     this.EntitySecurityProvider.AddPermissions(entity, permissionTypes, source);
 }
Ejemplo n.º 23
0
 void ISecurityProvider <object> .AddPermissions(object entity, PermissionTypes permissionTypes, ISecurityGroup source)
 {
     throw new NotImplementedException();
 }