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

Commit

Permalink
fix(schema): CloudFormation Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulMaddox committed Aug 13, 2021
1 parent 2b8e243 commit a4c792e
Show file tree
Hide file tree
Showing 15 changed files with 965 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cloudformation/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ func AllResources() map[string]Resource {
"AWS::WAFRegional::WebACLAssociation": &wafregional.WebACLAssociation{},
"AWS::WAFRegional::XssMatchSet": &wafregional.XssMatchSet{},
"AWS::WAFv2::IPSet": &wafv2.IPSet{},
"AWS::WAFv2::LoggingConfiguration": &wafv2.LoggingConfiguration{},
"AWS::WAFv2::RegexPatternSet": &wafv2.RegexPatternSet{},
"AWS::WAFv2::RuleGroup": &wafv2.RuleGroup{},
"AWS::WAFv2::WebACL": &wafv2.WebACL{},
Expand Down Expand Up @@ -19717,6 +19718,30 @@ func (t *Template) GetWAFv2IPSetWithName(name string) (*wafv2.IPSet, error) {
return nil, fmt.Errorf("resource %q of type wafv2.IPSet not found", name)
}

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

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

// GetAllWAFv2RegexPatternSetResources retrieves all wafv2.RegexPatternSet items from an AWS CloudFormation template
func (t *Template) GetAllWAFv2RegexPatternSetResources() map[string]*wafv2.RegexPatternSet {
results := map[string]*wafv2.RegexPatternSet{}
Expand Down
5 changes: 5 additions & 0 deletions cloudformation/apigateway/aws-apigateway-domainname.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ type DomainName struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-mutualtlsauthentication
MutualTlsAuthentication *DomainName_MutualTlsAuthentication `json:"MutualTlsAuthentication,omitempty"`

// OwnershipVerificationCertificateArn AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-ownershipverificationcertificatearn
OwnershipVerificationCertificateArn string `json:"OwnershipVerificationCertificateArn,omitempty"`

// RegionalCertificateArn AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-regionalcertificatearn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ type DomainName_DomainNameConfiguration struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-domainname-domainnameconfiguration.html#cfn-apigatewayv2-domainname-domainnameconfiguration-endpointtype
EndpointType string `json:"EndpointType,omitempty"`

// OwnershipVerificationCertificateArn AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-domainname-domainnameconfiguration.html#cfn-apigatewayv2-domainname-domainnameconfiguration-ownershipverificationcertificatearn
OwnershipVerificationCertificateArn string `json:"OwnershipVerificationCertificateArn,omitempty"`

// SecurityPolicy AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-domainname-domainnameconfiguration.html#cfn-apigatewayv2-domainname-domainnameconfiguration-securitypolicy
Expand Down
10 changes: 10 additions & 0 deletions cloudformation/codebuild/aws-codebuild-project.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ type Project struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-queuedtimeoutinminutes
QueuedTimeoutInMinutes int `json:"QueuedTimeoutInMinutes,omitempty"`

// ResourceAccessRole AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-resourceaccessrole
ResourceAccessRole string `json:"ResourceAccessRole,omitempty"`

// SecondaryArtifacts AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-secondaryartifacts
Expand Down Expand Up @@ -118,6 +123,11 @@ type Project struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-triggers
Triggers *Project_ProjectTriggers `json:"Triggers,omitempty"`

// Visibility AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-visibility
Visibility string `json:"Visibility,omitempty"`

// VpcConfig AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-vpcconfig
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package elasticsearch

import (
"github.com/awslabs/goformation/v5/cloudformation/policies"
)

// Domain_ColdStorageOptions AWS CloudFormation Resource (AWS::Elasticsearch::Domain.ColdStorageOptions)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-coldstorageoptions.html
type Domain_ColdStorageOptions struct {

// Enabled AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-coldstorageoptions.html#cfn-elasticsearch-domain-coldstorageoptions-enabled
Enabled bool `json:"Enabled,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 *Domain_ColdStorageOptions) AWSCloudFormationType() string {
return "AWS::Elasticsearch::Domain.ColdStorageOptions"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html
type Domain_ElasticsearchClusterConfig struct {

// ColdStorageOptions AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html#cfn-elasticsearch-domain-elasticsearchclusterconfig-coldstorageoptions
ColdStorageOptions *Domain_ColdStorageOptions `json:"ColdStorageOptions,omitempty"`

// DedicatedMasterCount AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-elasticsearchclusterconfig.html#cfn-elasticsearch-domain-elasticseachclusterconfig-dedicatedmastercount
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package iotanalytics

import (
"github.com/awslabs/goformation/v5/cloudformation/policies"
)

// Datastore_CustomerManagedS3Storage AWS CloudFormation Resource (AWS::IoTAnalytics::Datastore.CustomerManagedS3Storage)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-customermanageds3storage.html
type Datastore_CustomerManagedS3Storage struct {

// Bucket AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-customermanageds3storage.html#cfn-iotanalytics-datastore-customermanageds3storage-bucket
Bucket string `json:"Bucket,omitempty"`

// KeyPrefix AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-customermanageds3storage.html#cfn-iotanalytics-datastore-customermanageds3storage-keyprefix
KeyPrefix string `json:"KeyPrefix,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 *Datastore_CustomerManagedS3Storage) AWSCloudFormationType() string {
return "AWS::IoTAnalytics::Datastore.CustomerManagedS3Storage"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ type Datastore_DatastoreStorage struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-datastorestorage.html#cfn-iotanalytics-datastore-datastorestorage-customermanageds3
CustomerManagedS3 *Datastore_CustomerManagedS3 `json:"CustomerManagedS3,omitempty"`

// IotSiteWiseMultiLayerStorage AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-datastorestorage.html#cfn-iotanalytics-datastore-datastorestorage-iotsitewisemultilayerstorage
IotSiteWiseMultiLayerStorage *Datastore_IotSiteWiseMultiLayerStorage `json:"IotSiteWiseMultiLayerStorage,omitempty"`

// ServiceManagedS3 AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-datastorestorage.html#cfn-iotanalytics-datastore-datastorestorage-servicemanageds3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package iotanalytics

import (
"github.com/awslabs/goformation/v5/cloudformation/policies"
)

// Datastore_IotSiteWiseMultiLayerStorage AWS CloudFormation Resource (AWS::IoTAnalytics::Datastore.IotSiteWiseMultiLayerStorage)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-iotsitewisemultilayerstorage.html
type Datastore_IotSiteWiseMultiLayerStorage struct {

// CustomerManagedS3Storage AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-datastore-iotsitewisemultilayerstorage.html#cfn-iotanalytics-datastore-iotsitewisemultilayerstorage-customermanageds3storage
CustomerManagedS3Storage *Datastore_CustomerManagedS3Storage `json:"CustomerManagedS3Storage,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 *Datastore_IotSiteWiseMultiLayerStorage) AWSCloudFormationType() string {
return "AWS::IoTAnalytics::Datastore.IotSiteWiseMultiLayerStorage"
}
121 changes: 121 additions & 0 deletions cloudformation/wafv2/aws-wafv2-loggingconfiguration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package wafv2

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

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

// LoggingConfiguration AWS CloudFormation Resource (AWS::WAFv2::LoggingConfiguration)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-loggingconfiguration.html
type LoggingConfiguration struct {

// LogDestinationConfigs AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-loggingconfiguration.html#cfn-wafv2-loggingconfiguration-logdestinationconfigs
LogDestinationConfigs []string `json:"LogDestinationConfigs,omitempty"`

// LoggingFilter AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-loggingconfiguration.html#cfn-wafv2-loggingconfiguration-loggingfilter
LoggingFilter interface{} `json:"LoggingFilter,omitempty"`

// RedactedFields AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-loggingconfiguration.html#cfn-wafv2-loggingconfiguration-redactedfields
RedactedFields []LoggingConfiguration_FieldToMatch `json:"RedactedFields,omitempty"`

// ResourceArn AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-loggingconfiguration.html#cfn-wafv2-loggingconfiguration-resourcearn
ResourceArn string `json:"ResourceArn,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 *LoggingConfiguration) AWSCloudFormationType() string {
return "AWS::WAFv2::LoggingConfiguration"
}

// 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 LoggingConfiguration) MarshalJSON() ([]byte, error) {
type Properties LoggingConfiguration
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 *LoggingConfiguration) UnmarshalJSON(b []byte) error {
type Properties LoggingConfiguration
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 = LoggingConfiguration(*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
}
Loading

0 comments on commit a4c792e

Please sign in to comment.