Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

CloudFormation Updates #367

Merged
merged 1 commit into from
Apr 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions cloudformation/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ func AllResources() map[string]Resource {
"AWS::EC2::EIP": &ec2.EIP{},
"AWS::EC2::EIPAssociation": &ec2.EIPAssociation{},
"AWS::EC2::EgressOnlyInternetGateway": &ec2.EgressOnlyInternetGateway{},
"AWS::EC2::EnclaveCertificateIamRoleAssociation": &ec2.EnclaveCertificateIamRoleAssociation{},
"AWS::EC2::FlowLog": &ec2.FlowLog{},
"AWS::EC2::GatewayRouteTableAssociation": &ec2.GatewayRouteTableAssociation{},
"AWS::EC2::Host": &ec2.Host{},
Expand Down Expand Up @@ -562,6 +563,7 @@ func AllResources() map[string]Resource {
"AWS::IAM::VirtualMFADevice": &iam.VirtualMFADevice{},
"AWS::IVS::Channel": &ivs.Channel{},
"AWS::IVS::PlaybackKeyPair": &ivs.PlaybackKeyPair{},
"AWS::IVS::RecordingConfiguration": &ivs.RecordingConfiguration{},
"AWS::IVS::StreamKey": &ivs.StreamKey{},
"AWS::ImageBuilder::Component": &imagebuilder.Component{},
"AWS::ImageBuilder::ContainerRecipe": &imagebuilder.ContainerRecipe{},
Expand Down Expand Up @@ -6083,6 +6085,30 @@ func (t *Template) GetEC2EgressOnlyInternetGatewayWithName(name string) (*ec2.Eg
return nil, fmt.Errorf("resource %q of type ec2.EgressOnlyInternetGateway not found", name)
}

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

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

// GetAllEC2FlowLogResources retrieves all ec2.FlowLog items from an AWS CloudFormation template
func (t *Template) GetAllEC2FlowLogResources() map[string]*ec2.FlowLog {
results := map[string]*ec2.FlowLog{}
Expand Down Expand Up @@ -10571,6 +10597,30 @@ func (t *Template) GetIVSPlaybackKeyPairWithName(name string) (*ivs.PlaybackKeyP
return nil, fmt.Errorf("resource %q of type ivs.PlaybackKeyPair not found", name)
}

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

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

// GetAllIVSStreamKeyResources retrieves all ivs.StreamKey items from an AWS CloudFormation template
func (t *Template) GetAllIVSStreamKeyResources() map[string]*ivs.StreamKey {
results := map[string]*ivs.StreamKey{}
Expand Down
5 changes: 5 additions & 0 deletions cloudformation/ce/aws-ce-costcategory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import (
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-costcategory.html
type CostCategory struct {

// DefaultValue AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-costcategory.html#cfn-ce-costcategory-defaultvalue
DefaultValue string `json:"DefaultValue,omitempty"`

// Name AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ce-costcategory.html#cfn-ce-costcategory-name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ type StackSet_OperationPreferences struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudformation-stackset-operationpreferences.html#cfn-cloudformation-stackset-operationpreferences-maxconcurrentpercentage
MaxConcurrentPercentage int `json:"MaxConcurrentPercentage,omitempty"`

// RegionConcurrencyType AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudformation-stackset-operationpreferences.html#cfn-cloudformation-stackset-operationpreferences-regionconcurrencytype
RegionConcurrencyType string `json:"RegionConcurrencyType,omitempty"`

// RegionOrder AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudformation-stackset-operationpreferences.html#cfn-cloudformation-stackset-operationpreferences-regionorder
Expand Down
5 changes: 5 additions & 0 deletions cloudformation/dms/aws-dms-endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ type Endpoint struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-redshiftsettings
RedshiftSettings *Endpoint_RedshiftSettings `json:"RedshiftSettings,omitempty"`

// ResourceIdentifier AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-resourceidentifier
ResourceIdentifier string `json:"ResourceIdentifier,omitempty"`

// S3Settings AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-endpoint.html#cfn-dms-endpoint-s3settings
Expand Down
5 changes: 5 additions & 0 deletions cloudformation/dms/aws-dms-replicationinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ type ReplicationInstance struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-replicationsubnetgroupidentifier
ReplicationSubnetGroupIdentifier string `json:"ReplicationSubnetGroupIdentifier,omitempty"`

// ResourceIdentifier AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-resourceidentifier
ResourceIdentifier string `json:"ResourceIdentifier,omitempty"`

// Tags AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationinstance.html#cfn-dms-replicationinstance-tags
Expand Down
5 changes: 5 additions & 0 deletions cloudformation/dms/aws-dms-replicationtask.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ type ReplicationTask struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-replicationtasksettings
ReplicationTaskSettings string `json:"ReplicationTaskSettings,omitempty"`

// ResourceIdentifier AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-resourceidentifier
ResourceIdentifier string `json:"ResourceIdentifier,omitempty"`

// SourceEndpointArn AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#cfn-dms-replicationtask-sourceendpointarn
Expand Down
5 changes: 5 additions & 0 deletions cloudformation/dynamodb/aws-dynamodb-table.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ type Table struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-keyschema
KeySchema []Table_KeySchema `json:"KeySchema,omitempty"`

// KinesisStreamSpecification AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-kinesisstreamspecification
KinesisStreamSpecification *Table_KinesisStreamSpecification `json:"KinesisStreamSpecification,omitempty"`

// LocalSecondaryIndexes AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-lsi
Expand Down
111 changes: 111 additions & 0 deletions cloudformation/ec2/aws-ec2-enclavecertificateiamroleassociation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package ec2

import (
"bytes"
"encoding/json"
"fmt"

"github.com/awslabs/goformation/v4/cloudformation/policies"
)

// EnclaveCertificateIamRoleAssociation AWS CloudFormation Resource (AWS::EC2::EnclaveCertificateIamRoleAssociation)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-enclavecertificateiamroleassociation.html
type EnclaveCertificateIamRoleAssociation struct {

// CertificateArn AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-enclavecertificateiamroleassociation.html#cfn-ec2-enclavecertificateiamroleassociation-certificatearn
CertificateArn string `json:"CertificateArn,omitempty"`

// RoleArn AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-enclavecertificateiamroleassociation.html#cfn-ec2-enclavecertificateiamroleassociation-rolearn
RoleArn string `json:"RoleArn,omitempty"`

// AWSCloudFormationDeletionPolicy represents a CloudFormation DeletionPolicy
AWSCloudFormationDeletionPolicy policies.DeletionPolicy `json:"-"`

// AWSCloudFormationUpdateReplacePolicy represents a CloudFormation UpdateReplacePolicy
AWSCloudFormationUpdateReplacePolicy policies.UpdateReplacePolicy `json:"-"`

// AWSCloudFormationDependsOn stores the logical ID of the resources to be created before this resource
AWSCloudFormationDependsOn []string `json:"-"`

// AWSCloudFormationMetadata stores structured data associated with this resource
AWSCloudFormationMetadata map[string]interface{} `json:"-"`

// AWSCloudFormationCondition stores the logical ID of the condition that must be satisfied for this resource to be created
AWSCloudFormationCondition string `json:"-"`
}

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

// 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 EnclaveCertificateIamRoleAssociation) MarshalJSON() ([]byte, error) {
type Properties EnclaveCertificateIamRoleAssociation
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"`
UpdateReplacePolicy policies.UpdateReplacePolicy `json:"UpdateReplacePolicy,omitempty"`
Condition string `json:"Condition,omitempty"`
}{
Type: r.AWSCloudFormationType(),
Properties: (Properties)(r),
DependsOn: r.AWSCloudFormationDependsOn,
Metadata: r.AWSCloudFormationMetadata,
DeletionPolicy: r.AWSCloudFormationDeletionPolicy,
UpdateReplacePolicy: r.AWSCloudFormationUpdateReplacePolicy,
Condition: r.AWSCloudFormationCondition,
})
}

// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer
// AWS CloudFormation resource object, and just keeps the 'Properties' field.
func (r *EnclaveCertificateIamRoleAssociation) UnmarshalJSON(b []byte) error {
type Properties EnclaveCertificateIamRoleAssociation
res := &struct {
Type string
Properties *Properties
DependsOn []string
Metadata map[string]interface{}
DeletionPolicy string
UpdateReplacePolicy string
Condition 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 = EnclaveCertificateIamRoleAssociation(*res.Properties)
}
if res.DependsOn != nil {
r.AWSCloudFormationDependsOn = res.DependsOn
}
if res.Metadata != nil {
r.AWSCloudFormationMetadata = res.Metadata
}
if res.DeletionPolicy != "" {
r.AWSCloudFormationDeletionPolicy = policies.DeletionPolicy(res.DeletionPolicy)
}
if res.UpdateReplacePolicy != "" {
r.AWSCloudFormationUpdateReplacePolicy = policies.UpdateReplacePolicy(res.UpdateReplacePolicy)
}
if res.Condition != "" {
r.AWSCloudFormationCondition = res.Condition
}
return nil
}
5 changes: 5 additions & 0 deletions cloudformation/efs/aws-efs-filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ type FileSystem struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-efs-filesystem-backuppolicy
BackupPolicy *FileSystem_BackupPolicy `json:"BackupPolicy,omitempty"`

// BypassPolicyLockoutSafetyCheck AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-efs-filesystem-bypasspolicylockoutsafetycheck
BypassPolicyLockoutSafetyCheck bool `json:"BypassPolicyLockoutSafetyCheck,omitempty"`

// Encrypted AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-efs-filesystem-encrypted
Expand Down
6 changes: 6 additions & 0 deletions cloudformation/elasticache/aws-elasticache-parametergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"

"github.com/awslabs/goformation/v4/cloudformation/policies"
"github.com/awslabs/goformation/v4/cloudformation/tags"
)

// ParameterGroup AWS CloudFormation Resource (AWS::ElastiCache::ParameterGroup)
Expand All @@ -27,6 +28,11 @@ type ParameterGroup struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html#cfn-elasticache-parametergroup-properties
Properties map[string]string `json:"Properties,omitempty"`

// Tags AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-parameter-group.html#cfn-elasticache-parametergroup-tags
Tags []tags.Tag `json:"Tags,omitempty"`

// AWSCloudFormationDeletionPolicy represents a CloudFormation DeletionPolicy
AWSCloudFormationDeletionPolicy policies.DeletionPolicy `json:"-"`

Expand Down
6 changes: 6 additions & 0 deletions cloudformation/elasticache/aws-elasticache-securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"

"github.com/awslabs/goformation/v4/cloudformation/policies"
"github.com/awslabs/goformation/v4/cloudformation/tags"
)

// SecurityGroup AWS CloudFormation Resource (AWS::ElastiCache::SecurityGroup)
Expand All @@ -17,6 +18,11 @@ type SecurityGroup struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-security-group.html#cfn-elasticache-securitygroup-description
Description string `json:"Description,omitempty"`

// Tags AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-security-group.html#cfn-elasticache-securitygroup-tags
Tags []tags.Tag `json:"Tags,omitempty"`

// AWSCloudFormationDeletionPolicy represents a CloudFormation DeletionPolicy
AWSCloudFormationDeletionPolicy policies.DeletionPolicy `json:"-"`

Expand Down
6 changes: 6 additions & 0 deletions cloudformation/elasticache/aws-elasticache-subnetgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"

"github.com/awslabs/goformation/v4/cloudformation/policies"
"github.com/awslabs/goformation/v4/cloudformation/tags"
)

// SubnetGroup AWS CloudFormation Resource (AWS::ElastiCache::SubnetGroup)
Expand All @@ -27,6 +28,11 @@ type SubnetGroup struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html#cfn-elasticache-subnetgroup-subnetids
SubnetIds []string `json:"SubnetIds,omitempty"`

// Tags AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticache-subnetgroup.html#cfn-elasticache-subnetgroup-tags
Tags []tags.Tag `json:"Tags,omitempty"`

// AWSCloudFormationDeletionPolicy represents a CloudFormation DeletionPolicy
AWSCloudFormationDeletionPolicy policies.DeletionPolicy `json:"-"`

Expand Down
19 changes: 2 additions & 17 deletions cloudformation/gamelift/aws-gamelift-fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Fleet struct {
EC2InboundPermissions []Fleet_IpPermission `json:"EC2InboundPermissions,omitempty"`

// EC2InstanceType AWS CloudFormation Property
// Required: true
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-ec2instancetype
EC2InstanceType string `json:"EC2InstanceType,omitempty"`

Expand All @@ -52,11 +52,6 @@ type Fleet struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-instancerolearn
InstanceRoleARN string `json:"InstanceRoleARN,omitempty"`

// LogPaths AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-logpaths
LogPaths []string `json:"LogPaths,omitempty"`

// MaxSize AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-maxsize
Expand All @@ -73,7 +68,7 @@ type Fleet struct {
MinSize int `json:"MinSize,omitempty"`

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

Expand Down Expand Up @@ -107,16 +102,6 @@ type Fleet struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-scriptid
ScriptId string `json:"ScriptId,omitempty"`

// ServerLaunchParameters AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-serverlaunchparameters
ServerLaunchParameters string `json:"ServerLaunchParameters,omitempty"`

// ServerLaunchPath AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-fleet.html#cfn-gamelift-fleet-serverlaunchpath
ServerLaunchPath string `json:"ServerLaunchPath,omitempty"`

// AWSCloudFormationDeletionPolicy represents a CloudFormation DeletionPolicy
AWSCloudFormationDeletionPolicy policies.DeletionPolicy `json:"-"`

Expand Down
Loading