forked from crewjam/go-cloudformation
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create interfaces Stringable, StringListable that represent objects r…
…epresentable as StringExpr and StringListExpr respectively. This reduces typing considerably because we can reply on the golang type system to perform conversions implicitly. We get to replace some instances of: var foo Stringable = *Ref(“foo”).String() with: var foo Stringable = Ref(“foo”)
- Loading branch information
Showing
19 changed files
with
183 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// This program emits a cloudformation document for `app` to stdout | ||
package main | ||
|
||
import cf "github.com/crewjam/go-cloudformation" | ||
|
||
// makeTemplateTheOldWay is an implementation of makeTemplate that uses the | ||
// older pre-Stringable syntax. If this file builds, then maybe we haven't broken | ||
// backcompat. | ||
func makeTemplateTheOldWay() *cf.Template { | ||
t := cf.NewTemplate() | ||
t.Description = "example production infrastructure" | ||
t.Parameters["DnsName"] = cf.Parameter{ | ||
Description: "The top level DNS name for the infrastructure", | ||
Type: "String", | ||
Default: "preview.example.io", | ||
} | ||
|
||
t.AddResource("ServerLoadBalancer", cf.ElasticLoadBalancingLoadBalancer{ | ||
ConnectionDrainingPolicy: &cf.ElasticLoadBalancingConnectionDrainingPolicy{ | ||
Enabled: cf.Bool(true), | ||
Timeout: cf.Integer(30), | ||
}, | ||
CrossZone: cf.Bool(true), | ||
HealthCheck: &cf.ElasticLoadBalancingHealthCheck{ | ||
HealthyThreshold: cf.String("2"), | ||
Interval: cf.String("60"), | ||
Target: cf.String("HTTP:80/"), | ||
Timeout: cf.String("5"), | ||
UnhealthyThreshold: cf.String("2"), | ||
}, | ||
Listeners: &cf.ElasticLoadBalancingListenerList{ | ||
cf.ElasticLoadBalancingListener{ | ||
InstancePort: cf.String("8000"), | ||
InstanceProtocol: cf.String("TCP"), | ||
LoadBalancerPort: cf.String("443"), | ||
Protocol: cf.String("SSL"), | ||
SSLCertificateId: cf.Join("", | ||
*cf.String("arn:aws:iam::"), | ||
*cf.Ref("AWS::AccountID").String(), | ||
*cf.String(":server-certificate/"), | ||
*cf.Ref("DnsName").String()).String(), | ||
}, | ||
}, | ||
Policies: &cf.ElasticLoadBalancingPolicyList{ | ||
cf.ElasticLoadBalancingPolicy{ | ||
PolicyName: cf.String("EnableProxyProtocol"), | ||
PolicyType: cf.String("ProxyProtocolPolicyType"), | ||
Attributes: []map[string]interface{}{ | ||
map[string]interface{}{ | ||
"Name": "ProxyProtocol", | ||
"Value": "true", | ||
}, | ||
}, | ||
InstancePorts: []int{8000}, | ||
}, | ||
}, | ||
Subnets: cf.StringList( | ||
*cf.Ref("VpcSubnetA").String(), | ||
*cf.Ref("VpcSubnetB").String(), | ||
*cf.Ref("VpcSubnetC").String(), | ||
), | ||
SecurityGroups: cf.StringList(*cf.Ref("LoadBalancerSecurityGroup").String()), | ||
}) | ||
|
||
return t | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.