Skip to content

Commit

Permalink
feat(schema): AWS CloudFormation Update (2019-10-26) (awslabs#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-goformation authored and PaulMaddox committed Oct 26, 2019
1 parent 8bd90f2 commit 63ca311
Show file tree
Hide file tree
Showing 13 changed files with 748 additions and 20 deletions.
25 changes: 25 additions & 0 deletions cloudformation/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func AllResources() map[string]Resource {
"AWS::ElasticLoadBalancingV2::LoadBalancer": &resources.AWSElasticLoadBalancingV2LoadBalancer{},
"AWS::ElasticLoadBalancingV2::TargetGroup": &resources.AWSElasticLoadBalancingV2TargetGroup{},
"AWS::Elasticsearch::Domain": &resources.AWSElasticsearchDomain{},
"AWS::Events::EventBus": &resources.AWSEventsEventBus{},
"AWS::Events::EventBusPolicy": &resources.AWSEventsEventBusPolicy{},
"AWS::Events::Rule": &resources.AWSEventsRule{},
"AWS::FSx::FileSystem": &resources.AWSFSxFileSystem{},
Expand Down Expand Up @@ -5707,6 +5708,30 @@ func (t *Template) GetAWSElasticsearchDomainWithName(name string) (*resources.AW
return nil, fmt.Errorf("resource %q of type AWSElasticsearchDomain not found", name)
}

// GetAllAWSEventsEventBusResources retrieves all AWSEventsEventBus items from an AWS CloudFormation template
func (t *Template) GetAllAWSEventsEventBusResources() map[string]*resources.AWSEventsEventBus {
results := map[string]*resources.AWSEventsEventBus{}
for name, untyped := range t.Resources {
switch resource := untyped.(type) {
case *resources.AWSEventsEventBus:
results[name] = resource
}
}
return results
}

// GetAWSEventsEventBusWithName retrieves all AWSEventsEventBus items from an AWS CloudFormation template
// whose logical ID matches the provided name. Returns an error if not found.
func (t *Template) GetAWSEventsEventBusWithName(name string) (*resources.AWSEventsEventBus, error) {
if untyped, ok := t.Resources[name]; ok {
switch resource := untyped.(type) {
case *resources.AWSEventsEventBus:
return resource, nil
}
}
return nil, fmt.Errorf("resource %q of type AWSEventsEventBus not found", name)
}

// GetAllAWSEventsEventBusPolicyResources retrieves all AWSEventsEventBusPolicy items from an AWS CloudFormation template
func (t *Template) GetAllAWSEventsEventBusPolicyResources() map[string]*resources.AWSEventsEventBusPolicy {
results := map[string]*resources.AWSEventsEventBusPolicy{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import "github.com/awslabs/goformation/cloudformation/policies"
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html
type AWSBatchComputeEnvironment_ComputeResources struct {

// AllocationStrategy AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-allocationstrategy
AllocationStrategy string `json:"AllocationStrategy,omitempty"`

// BidPercentage AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-computeresources.html#cfn-batch-computeenvironment-computeresources-bidpercentage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ type AWSCognitoIdentityPoolRoleAttachment_RoleMapping struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rolemapping.html#cfn-cognito-identitypoolroleattachment-rolemapping-ambiguousroleresolution
AmbiguousRoleResolution string `json:"AmbiguousRoleResolution,omitempty"`

// IdentityProvider AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rolemapping.html#cfn-cognito-identitypoolroleattachment-rolemapping-identityprovider
IdentityProvider string `json:"IdentityProvider,omitempty"`

// RulesConfiguration AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rolemapping.html#cfn-cognito-identitypoolroleattachment-rolemapping-rulesconfiguration
Expand Down
4 changes: 2 additions & 2 deletions cloudformation/resources/aws-ec2-trafficmirrorfilterrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type AWSEC2TrafficMirrorFilterRule struct {
// DestinationPortRange AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-destinationportrange
DestinationPortRange *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRangeRequest `json:"DestinationPortRange,omitempty"`
DestinationPortRange *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange `json:"DestinationPortRange,omitempty"`

// Protocol AWS CloudFormation Property
// Required: false
Expand All @@ -49,7 +49,7 @@ type AWSEC2TrafficMirrorFilterRule struct {
// SourcePortRange AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-sourceportrange
SourcePortRange *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRangeRequest `json:"SourcePortRange,omitempty"`
SourcePortRange *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange `json:"SourcePortRange,omitempty"`

// TrafficDirection AWS CloudFormation Property
// Required: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package resources

import "github.com/awslabs/goformation/cloudformation/policies"

// AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange AWS CloudFormation Resource (AWS::EC2::TrafficMirrorFilterRule.TrafficMirrorPortRange)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-trafficmirrorfilterrule-trafficmirrorportrange.html
type AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange struct {

// FromPort AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-trafficmirrorfilterrule-trafficmirrorportrange.html#cfn-ec2-trafficmirrorfilterrule-trafficmirrorportrange-fromport
FromPort int `json:"FromPort"`

// ToPort AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-trafficmirrorfilterrule-trafficmirrorportrange.html#cfn-ec2-trafficmirrorfilterrule-trafficmirrorportrange-toport
ToPort int `json:"ToPort"`

// _deletionPolicy represents a CloudFormation DeletionPolicy
_deletionPolicy policies.DeletionPolicy

// _dependsOn stores the logical ID of the resources to be created before this resource
_dependsOn []string

// _metadata stores structured data associated with this resource
_metadata map[string]interface{}
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange) AWSCloudFormationType() string {
return "AWS::EC2::TrafficMirrorFilterRule.TrafficMirrorPortRange"
}

// DependsOn returns a slice of logical ID names this resource depends on.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
func (r *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange) DependsOn() []string {
return r._dependsOn
}

// SetDependsOn specify that the creation of this resource follows another.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
func (r *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange) SetDependsOn(dependencies []string) {
r._dependsOn = dependencies
}

// Metadata returns the metadata associated with this resource.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
func (r *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange) Metadata() map[string]interface{} {
return r._metadata
}

// SetMetadata enables you to associate structured data with this resource.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
func (r *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange) SetMetadata(metadata map[string]interface{}) {
r._metadata = metadata
}

// DeletionPolicy returns the AWS CloudFormation DeletionPolicy to this resource
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
func (r *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange) DeletionPolicy() policies.DeletionPolicy {
return r._deletionPolicy
}

// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
func (r *AWSEC2TrafficMirrorFilterRule_TrafficMirrorPortRange) SetDeletionPolicy(policy policies.DeletionPolicy) {
r._deletionPolicy = policy
}
128 changes: 128 additions & 0 deletions cloudformation/resources/aws-events-eventbus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package resources

import (
"bytes"
"encoding/json"
"fmt"
"github.com/awslabs/goformation/cloudformation/policies"
)

// AWSEventsEventBus AWS CloudFormation Resource (AWS::Events::EventBus)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html
type AWSEventsEventBus struct {

// EventSourceName AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-eventsourcename
EventSourceName string `json:"EventSourceName,omitempty"`

// Name AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-name
Name string `json:"Name,omitempty"`

// _deletionPolicy represents a CloudFormation DeletionPolicy
_deletionPolicy policies.DeletionPolicy

// _dependsOn stores the logical ID of the resources to be created before this resource
_dependsOn []string

// _metadata stores structured data associated with this resource
_metadata map[string]interface{}
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSEventsEventBus) AWSCloudFormationType() string {
return "AWS::Events::EventBus"
}

// DependsOn returns a slice of logical ID names this resource depends on.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
func (r *AWSEventsEventBus) DependsOn() []string {
return r._dependsOn
}

// SetDependsOn specify that the creation of this resource follows another.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
func (r *AWSEventsEventBus) SetDependsOn(dependencies []string) {
r._dependsOn = dependencies
}

// Metadata returns the metadata associated with this resource.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
func (r *AWSEventsEventBus) Metadata() map[string]interface{} {
return r._metadata
}

// SetMetadata enables you to associate structured data with this resource.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
func (r *AWSEventsEventBus) SetMetadata(metadata map[string]interface{}) {
r._metadata = metadata
}

// DeletionPolicy returns the AWS CloudFormation DeletionPolicy to this resource
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
func (r *AWSEventsEventBus) DeletionPolicy() policies.DeletionPolicy {
return r._deletionPolicy
}

// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
func (r *AWSEventsEventBus) SetDeletionPolicy(policy policies.DeletionPolicy) {
r._deletionPolicy = policy
}

// MarshalJSON is a custom JSON marshalling hook that embeds this object into
// an AWS CloudFormation JSON resource's 'Properties' field and adds a 'Type'.
func (r AWSEventsEventBus) MarshalJSON() ([]byte, error) {
type Properties AWSEventsEventBus
return json.Marshal(&struct {
Type string
Properties Properties
DependsOn []string `json:"DependsOn,omitempty"`
Metadata map[string]interface{} `json:"Metadata,omitempty"`
DeletionPolicy policies.DeletionPolicy `json:"DeletionPolicy,omitempty"`
}{
Type: r.AWSCloudFormationType(),
Properties: (Properties)(r),
DependsOn: r._dependsOn,
Metadata: r._metadata,
DeletionPolicy: r._deletionPolicy,
})
}

// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer
// AWS CloudFormation resource object, and just keeps the 'Properties' field.
func (r *AWSEventsEventBus) UnmarshalJSON(b []byte) error {
type Properties AWSEventsEventBus
res := &struct {
Type string
Properties *Properties
DependsOn []string
Metadata map[string]interface{}
DeletionPolicy string
}{}

dec := json.NewDecoder(bytes.NewReader(b))
dec.DisallowUnknownFields() // Force error if unknown field is found

if err := dec.Decode(&res); err != nil {
fmt.Printf("ERROR: %s\n", err)
return err
}

// If the resource has no Properties set, it could be nil
if res.Properties != nil {
*r = AWSEventsEventBus(*res.Properties)
}
if res.DependsOn != nil {
r._dependsOn = res.DependsOn
}
if res.Metadata != nil {
r._metadata = res.Metadata
}
if res.DeletionPolicy != "" {
r._deletionPolicy = policies.DeletionPolicy(res.DeletionPolicy)
}
return nil
}
4 changes: 2 additions & 2 deletions cloudformation/resources/aws-fsx-filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type AWSFSxFileSystem struct {
BackupId string `json:"BackupId,omitempty"`

// FileSystemType AWS CloudFormation Property
// Required: false
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-fsx-filesystem.html#cfn-fsx-filesystem-filesystemtype
FileSystemType string `json:"FileSystemType,omitempty"`

Expand All @@ -42,7 +42,7 @@ type AWSFSxFileSystem struct {
StorageCapacity int `json:"StorageCapacity,omitempty"`

// SubnetIds AWS CloudFormation Property
// Required: false
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-fsx-filesystem.html#cfn-fsx-filesystem-subnetids
SubnetIds []string `json:"SubnetIds,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package resources

import "github.com/awslabs/goformation/cloudformation/policies"

// AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration AWS CloudFormation Resource (AWS::FSx::FileSystem.SelfManagedActiveDirectoryConfiguration)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration.html
type AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration struct {

// DnsIps AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration.html#cfn-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration-dnsips
DnsIps []string `json:"DnsIps,omitempty"`

// DomainName AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration.html#cfn-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration-domainname
DomainName string `json:"DomainName,omitempty"`

// FileSystemAdministratorsGroup AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration.html#cfn-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration-filesystemadministratorsgroup
FileSystemAdministratorsGroup string `json:"FileSystemAdministratorsGroup,omitempty"`

// OrganizationalUnitDistinguishedName AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration.html#cfn-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration-organizationalunitdistinguishedname
OrganizationalUnitDistinguishedName string `json:"OrganizationalUnitDistinguishedName,omitempty"`

// Password AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration.html#cfn-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration-password
Password string `json:"Password,omitempty"`

// UserName AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration.html#cfn-fsx-filesystem-windowsconfiguration-selfmanagedactivedirectoryconfiguration-username
UserName string `json:"UserName,omitempty"`

// _deletionPolicy represents a CloudFormation DeletionPolicy
_deletionPolicy policies.DeletionPolicy

// _dependsOn stores the logical ID of the resources to be created before this resource
_dependsOn []string

// _metadata stores structured data associated with this resource
_metadata map[string]interface{}
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration) AWSCloudFormationType() string {
return "AWS::FSx::FileSystem.SelfManagedActiveDirectoryConfiguration"
}

// DependsOn returns a slice of logical ID names this resource depends on.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
func (r *AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration) DependsOn() []string {
return r._dependsOn
}

// SetDependsOn specify that the creation of this resource follows another.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html
func (r *AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration) SetDependsOn(dependencies []string) {
r._dependsOn = dependencies
}

// Metadata returns the metadata associated with this resource.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
func (r *AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration) Metadata() map[string]interface{} {
return r._metadata
}

// SetMetadata enables you to associate structured data with this resource.
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html
func (r *AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration) SetMetadata(metadata map[string]interface{}) {
r._metadata = metadata
}

// DeletionPolicy returns the AWS CloudFormation DeletionPolicy to this resource
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
func (r *AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration) DeletionPolicy() policies.DeletionPolicy {
return r._deletionPolicy
}

// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource
// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
func (r *AWSFSxFileSystem_SelfManagedActiveDirectoryConfiguration) SetDeletionPolicy(policy policies.DeletionPolicy) {
r._deletionPolicy = policy
}
Loading

0 comments on commit 63ca311

Please sign in to comment.