Skip to content

Commit

Permalink
fix(schema): CloudFormation Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulMaddox committed Mar 26, 2021
1 parent 11131de commit 1fe6191
Show file tree
Hide file tree
Showing 51 changed files with 6,751 additions and 262 deletions.
153 changes: 153 additions & 0 deletions cloudformation/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/awslabs/goformation/v4/cloudformation/apigatewayv2"
"github.com/awslabs/goformation/v4/cloudformation/appconfig"
"github.com/awslabs/goformation/v4/cloudformation/appflow"
"github.com/awslabs/goformation/v4/cloudformation/appintegrations"
"github.com/awslabs/goformation/v4/cloudformation/applicationautoscaling"
"github.com/awslabs/goformation/v4/cloudformation/applicationinsights"
"github.com/awslabs/goformation/v4/cloudformation/appmesh"
Expand Down Expand Up @@ -44,6 +45,7 @@ import (
"github.com/awslabs/goformation/v4/cloudformation/codestarnotifications"
"github.com/awslabs/goformation/v4/cloudformation/cognito"
"github.com/awslabs/goformation/v4/cloudformation/config"
"github.com/awslabs/goformation/v4/cloudformation/customerprofiles"
"github.com/awslabs/goformation/v4/cloudformation/databrew"
"github.com/awslabs/goformation/v4/cloudformation/datapipeline"
"github.com/awslabs/goformation/v4/cloudformation/datasync"
Expand Down Expand Up @@ -99,6 +101,7 @@ import (
"github.com/awslabs/goformation/v4/cloudformation/lambda"
"github.com/awslabs/goformation/v4/cloudformation/licensemanager"
"github.com/awslabs/goformation/v4/cloudformation/logs"
"github.com/awslabs/goformation/v4/cloudformation/lookoutmetrics"
"github.com/awslabs/goformation/v4/cloudformation/lookoutvision"
"github.com/awslabs/goformation/v4/cloudformation/macie"
"github.com/awslabs/goformation/v4/cloudformation/managedblockchain"
Expand Down Expand Up @@ -205,6 +208,7 @@ func AllResources() map[string]Resource {
"AWS::AppConfig::HostedConfigurationVersion": &appconfig.HostedConfigurationVersion{},
"AWS::AppFlow::ConnectorProfile": &appflow.ConnectorProfile{},
"AWS::AppFlow::Flow": &appflow.Flow{},
"AWS::AppIntegrations::EventIntegration": &appintegrations.EventIntegration{},
"AWS::AppMesh::GatewayRoute": &appmesh.GatewayRoute{},
"AWS::AppMesh::Mesh": &appmesh.Mesh{},
"AWS::AppMesh::Route": &appmesh.Route{},
Expand Down Expand Up @@ -319,6 +323,9 @@ func AllResources() map[string]Resource {
"AWS::Config::OrganizationConformancePack": &config.OrganizationConformancePack{},
"AWS::Config::RemediationConfiguration": &config.RemediationConfiguration{},
"AWS::Config::StoredQuery": &config.StoredQuery{},
"AWS::CustomerProfiles::Domain": &customerprofiles.Domain{},
"AWS::CustomerProfiles::Integration": &customerprofiles.Integration{},
"AWS::CustomerProfiles::ObjectType": &customerprofiles.ObjectType{},
"AWS::DAX::Cluster": &dax.Cluster{},
"AWS::DAX::ParameterGroup": &dax.ParameterGroup{},
"AWS::DAX::SubnetGroup": &dax.SubnetGroup{},
Expand Down Expand Up @@ -633,6 +640,8 @@ func AllResources() map[string]Resource {
"AWS::Logs::LogStream": &logs.LogStream{},
"AWS::Logs::MetricFilter": &logs.MetricFilter{},
"AWS::Logs::SubscriptionFilter": &logs.SubscriptionFilter{},
"AWS::LookoutMetrics::Alert": &lookoutmetrics.Alert{},
"AWS::LookoutMetrics::AnomalyDetector": &lookoutmetrics.AnomalyDetector{},
"AWS::LookoutVision::Project": &lookoutvision.Project{},
"AWS::MSK::Cluster": &msk.Cluster{},
"AWS::MWAA::Environment": &mwaa.Environment{},
Expand Down Expand Up @@ -2079,6 +2088,30 @@ func (t *Template) GetAppFlowFlowWithName(name string) (*appflow.Flow, error) {
return nil, fmt.Errorf("resource %q of type appflow.Flow not found", name)
}

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

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

// GetAllAppMeshGatewayRouteResources retrieves all appmesh.GatewayRoute items from an AWS CloudFormation template
func (t *Template) GetAllAppMeshGatewayRouteResources() map[string]*appmesh.GatewayRoute {
results := map[string]*appmesh.GatewayRoute{}
Expand Down Expand Up @@ -4815,6 +4848,78 @@ func (t *Template) GetConfigStoredQueryWithName(name string) (*config.StoredQuer
return nil, fmt.Errorf("resource %q of type config.StoredQuery not found", name)
}

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

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

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

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

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

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

// GetAllDAXClusterResources retrieves all dax.Cluster items from an AWS CloudFormation template
func (t *Template) GetAllDAXClusterResources() map[string]*dax.Cluster {
results := map[string]*dax.Cluster{}
Expand Down Expand Up @@ -12351,6 +12456,54 @@ func (t *Template) GetLogsSubscriptionFilterWithName(name string) (*logs.Subscri
return nil, fmt.Errorf("resource %q of type logs.SubscriptionFilter not found", name)
}

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

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

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

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

// GetAllLookoutVisionProjectResources retrieves all lookoutvision.Project items from an AWS CloudFormation template
func (t *Template) GetAllLookoutVisionProjectResources() map[string]*lookoutvision.Project {
results := map[string]*lookoutvision.Project{}
Expand Down
127 changes: 127 additions & 0 deletions cloudformation/appintegrations/aws-appintegrations-eventintegration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
package appintegrations

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

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

// EventIntegration AWS CloudFormation Resource (AWS::AppIntegrations::EventIntegration)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appintegrations-eventintegration.html
type EventIntegration struct {

// Description AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appintegrations-eventintegration.html#cfn-appintegrations-eventintegration-description
Description string `json:"Description,omitempty"`

// EventBridgeBus AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appintegrations-eventintegration.html#cfn-appintegrations-eventintegration-eventbridgebus
EventBridgeBus string `json:"EventBridgeBus,omitempty"`

// EventFilter AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appintegrations-eventintegration.html#cfn-appintegrations-eventintegration-eventfilter
EventFilter interface{} `json:"EventFilter,omitempty"`

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

// Tags AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appintegrations-eventintegration.html#cfn-appintegrations-eventintegration-tags
Tags []tags.Tag `json:"Tags,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 *EventIntegration) AWSCloudFormationType() string {
return "AWS::AppIntegrations::EventIntegration"
}

// 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 EventIntegration) MarshalJSON() ([]byte, error) {
type Properties EventIntegration
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 *EventIntegration) UnmarshalJSON(b []byte) error {
type Properties EventIntegration
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 = EventIntegration(*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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package appintegrations

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

// EventIntegration_EventFilter AWS CloudFormation Resource (AWS::AppIntegrations::EventIntegration.EventFilter)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appintegrations-eventintegration-eventfilter.html
type EventIntegration_EventFilter struct {

// Source AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appintegrations-eventintegration-eventfilter.html#cfn-appintegrations-eventintegration-eventfilter-source
Source string `json:"Source,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 *EventIntegration_EventFilter) AWSCloudFormationType() string {
return "AWS::AppIntegrations::EventIntegration.EventFilter"
}
Loading

0 comments on commit 1fe6191

Please sign in to comment.