public CloudFormationDictionary AddNode(string name) { var returnValue = new CloudFormationDictionary(this.ResourceRef); this.Add(name, returnValue); return(returnValue); }
protected SsmRuntime() { this.Properties = new T(); var runtimeConfig = new CloudFormationDictionary(); runtimeConfig.Add(this.Properties.RuntimeConfigName, this.Properties); this.Add("runtimeConfig", runtimeConfig); }
public void AddOutputs() { foreach (var resource in this.Resources) { var valueDictionary = new CloudFormationDictionary(); valueDictionary.Add("Value", new ReferenceProperty(resource.Key)); this.Outputs.Add(resource.Key, valueDictionary); } }
protected SecurityGroupIngressEgressBase(ILogicalId logicalId, Protocol protocol, Ports fromPort, Ports toPort) : this((int)fromPort, (int)toPort, protocol.ToString()) { var fnJoinDictionary = new CloudFormationDictionary(); var fnGetAttDictionary = new CloudFormationDictionary(); var privateIp = new string[] { logicalId.LogicalId, "PrivateIp" }; fnGetAttDictionary.Add("Fn::GetAtt", privateIp); fnJoinDictionary.SetFnJoin(fnGetAttDictionary, "/32"); CidrIp = fnJoinDictionary; }
public AutoScalingGroup() : base(ResourceType.AwsAutoScalingAutoScalingGroup) { this.Properties["AvailabilityZones"] = new List <string>(); this.Properties["VPCZoneIdentifier"] = new List <ReferenceProperty>(); var d = new CloudFormationDictionary(); d.Add("Granularity", "1Minute"); string[] sizes = new[] { "GroupMinSize", "GroupMaxSize" }; d.Add("Metrics", sizes); this.MetricsCollection = new object[] { d }; DesiredCapacity = 1.ToString(); }
public Template(string name, string description) { Outputs = new CloudFormationDictionary(); AwsTemplateFormatVersion = AwsTemplateFormatVersion20100909; this.StackName = name.Replace('.', '-'); if (!string.IsNullOrEmpty(description)) { this.Description = description; } this.Resources = new ObservableDictionary <string, ResourceBase>(); this.Resources.CollectionChanged += Resources_CollectionChanged; this.Parameters = new CloudFormationDictionary(); }
protected override void OnTemplateSet(Template template) { base.OnTemplateSet(template); if (!this.Template.Parameters.ContainsKey(Template.ParameterKeyPairName)) { throw new InvalidOperationException($"Template must contain a Parameter named {Template.ParameterKeyPairName} which contains the default encryption key name for the instance."); } UserData = new CloudFormationDictionary(this); UserData.Add("Fn::Base64", ""); this.EnableHup(); SetUserData(); this.DisableFirewall(); this.SetTimeZone(); if (this.Rename && OperatingSystem == OperatingSystem.Windows && this.Type != ResourceType.AwsAutoScalingLaunchConfiguration) { this.AddRename(); } }
public override void AddToLaunchConfiguration(LaunchConfiguration configuration) { base.AddToLaunchConfiguration(configuration); var secondConfigSetName = $"ConfigSet{this.ConfigName}HttpToHttps"; var secondConfigName = $"Config{this.ConfigName}HttpToHttps"; var secondConfig = configuration.Metadata.Init.ConfigSets.GetConfigSet(secondConfigSetName).GetConfig(secondConfigName); secondConfig.Files.GetFile("c:/inetpub/wwwroot/web.config").Source = "https://s3.amazonaws.com/gtbb/web.config"; secondConfig.Files.GetFile("c:/inetpub/wwwroot/healthcheck.htm").Source = "https://s3.amazonaws.com/gtbb/healthcheck.htm"; var msiUri = new Uri("https://s3.amazonaws.com/gtbb/software/rewrite_amd64.msi"); var fileName = System.IO.Path.GetFileNameWithoutExtension(msiUri.AbsolutePath).Replace(".", string.Empty).Replace("-", String.Empty); var msi = new CloudFormationDictionary(); secondConfig.Packages.Add("msi", msi); msi.Add(fileName, msiUri.AbsoluteUri); msiUri = new Uri($"https://s3.amazonaws.com/{BucketName}/software/WebDeploy_amd64_en-US.msi"); fileName = System.IO.Path.GetFileNameWithoutExtension(msiUri.AbsolutePath).Replace(".", string.Empty).Replace("-", String.Empty); msi.Add(fileName, msiUri.AbsoluteUri); }
public virtual void AddToLaunchConfiguration(LaunchConfiguration configuration) { this.Instance = configuration; if (!string.IsNullOrEmpty(this.SnapshotId)) { BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping(this.Instance, this.Instance.GetAvailableDevice()); blockDeviceMapping.Ebs.SnapshotId = this.SnapshotId; this.Instance.BlockDeviceMappings.Add(blockDeviceMapping); } if (this.Msi != null) { var fileName = System.IO.Path.GetFileNameWithoutExtension(Msi.AbsolutePath).Replace(".", string.Empty).Replace("-", String.Empty); var configSet = this.Config; if (!configSet.Packages.ContainsKey("msi")) { var msi = new CloudFormationDictionary(); msi.Add(fileName, Msi.AbsoluteUri); configSet.Packages.Add("msi", msi); } } if (!string.IsNullOrEmpty(this.BucketName)) { var appSettingsReader = new AppSettingsReader(); string accessKeyString = (string)appSettingsReader.GetValue("S3AccessKey", typeof(string)); string secretKeyString = (string)appSettingsReader.GetValue("S3SecretKey", typeof(string)); if (!configuration.Metadata.Authentication.ContainsKey("S3AccessCreds")) { var auth = configuration.Metadata.Authentication.Add("S3AccessCreds", new S3Authentication(accessKeyString, secretKeyString, new string[] { BucketName })); auth.Type = "S3"; } } }