Skip to content

Commit

Permalink
fix(schema): CloudFormation Updates (awslabs#422)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Maddox <[email protected]>
  • Loading branch information
github-actions[bot] and PaulMaddox authored Feb 8, 2022
1 parent f9c153c commit 61378b5
Show file tree
Hide file tree
Showing 88 changed files with 12,640 additions and 1,172 deletions.
151 changes: 151 additions & 0 deletions cloudformation/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import (
"github.com/awslabs/goformation/v5/cloudformation/iotthingsgraph"
"github.com/awslabs/goformation/v5/cloudformation/iotwireless"
"github.com/awslabs/goformation/v5/cloudformation/ivs"
"github.com/awslabs/goformation/v5/cloudformation/kafkaconnect"
"github.com/awslabs/goformation/v5/cloudformation/kendra"
"github.com/awslabs/goformation/v5/cloudformation/kinesis"
"github.com/awslabs/goformation/v5/cloudformation/kinesisanalytics"
Expand Down Expand Up @@ -249,6 +250,7 @@ func AllResources() map[string]Resource {
"AWS::AppConfig::HostedConfigurationVersion": &appconfig.HostedConfigurationVersion{},
"AWS::AppFlow::ConnectorProfile": &appflow.ConnectorProfile{},
"AWS::AppFlow::Flow": &appflow.Flow{},
"AWS::AppIntegrations::DataIntegration": &appintegrations.DataIntegration{},
"AWS::AppIntegrations::EventIntegration": &appintegrations.EventIntegration{},
"AWS::AppMesh::GatewayRoute": &appmesh.GatewayRoute{},
"AWS::AppMesh::Mesh": &appmesh.Mesh{},
Expand Down Expand Up @@ -719,6 +721,7 @@ func AllResources() map[string]Resource {
"AWS::KMS::Alias": &kms.Alias{},
"AWS::KMS::Key": &kms.Key{},
"AWS::KMS::ReplicaKey": &kms.ReplicaKey{},
"AWS::KafkaConnect::Connector": &kafkaconnect.Connector{},
"AWS::Kendra::DataSource": &kendra.DataSource{},
"AWS::Kendra::Faq": &kendra.Faq{},
"AWS::Kendra::Index": &kendra.Index{},
Expand Down Expand Up @@ -754,8 +757,11 @@ func AllResources() map[string]Resource {
"AWS::LicenseManager::License": &licensemanager.License{},
"AWS::Lightsail::Alarm": &lightsail.Alarm{},
"AWS::Lightsail::Bucket": &lightsail.Bucket{},
"AWS::Lightsail::Certificate": &lightsail.Certificate{},
"AWS::Lightsail::Container": &lightsail.Container{},
"AWS::Lightsail::Database": &lightsail.Database{},
"AWS::Lightsail::Disk": &lightsail.Disk{},
"AWS::Lightsail::Distribution": &lightsail.Distribution{},
"AWS::Lightsail::Instance": &lightsail.Instance{},
"AWS::Lightsail::LoadBalancer": &lightsail.LoadBalancer{},
"AWS::Lightsail::LoadBalancerTlsCertificate": &lightsail.LoadBalancerTlsCertificate{},
Expand Down Expand Up @@ -897,6 +903,7 @@ func AllResources() map[string]Resource {
"AWS::RefactorSpaces::Environment": &refactorspaces.Environment{},
"AWS::RefactorSpaces::Route": &refactorspaces.Route{},
"AWS::RefactorSpaces::Service": &refactorspaces.Service{},
"AWS::Rekognition::Collection": &rekognition.Collection{},
"AWS::Rekognition::Project": &rekognition.Project{},
"AWS::ResilienceHub::App": &resiliencehub.App{},
"AWS::ResilienceHub::ResiliencyPolicy": &resiliencehub.ResiliencyPolicy{},
Expand Down Expand Up @@ -2402,6 +2409,30 @@ func (t *Template) GetAppFlowFlowWithName(name string) (*appflow.Flow, error) {
return nil, fmt.Errorf("resource %q of type appflow.Flow not found", name)
}

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

// GetAppIntegrationsDataIntegrationWithName retrieves all appintegrations.DataIntegration items from an AWS CloudFormation template
// whose logical ID matches the provided name. Returns an error if not found.
func (t *Template) GetAppIntegrationsDataIntegrationWithName(name string) (*appintegrations.DataIntegration, error) {
if untyped, ok := t.Resources[name]; ok {
switch resource := untyped.(type) {
case *appintegrations.DataIntegration:
return resource, nil
}
}
return nil, fmt.Errorf("resource %q of type appintegrations.DataIntegration 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{}
Expand Down Expand Up @@ -13682,6 +13713,30 @@ func (t *Template) GetKMSReplicaKeyWithName(name string) (*kms.ReplicaKey, error
return nil, fmt.Errorf("resource %q of type kms.ReplicaKey not found", name)
}

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

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

// GetAllKendraDataSourceResources retrieves all kendra.DataSource items from an AWS CloudFormation template
func (t *Template) GetAllKendraDataSourceResources() map[string]*kendra.DataSource {
results := map[string]*kendra.DataSource{}
Expand Down Expand Up @@ -14522,6 +14577,54 @@ func (t *Template) GetLightsailBucketWithName(name string) (*lightsail.Bucket, e
return nil, fmt.Errorf("resource %q of type lightsail.Bucket not found", name)
}

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

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

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

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

// GetAllLightsailDatabaseResources retrieves all lightsail.Database items from an AWS CloudFormation template
func (t *Template) GetAllLightsailDatabaseResources() map[string]*lightsail.Database {
results := map[string]*lightsail.Database{}
Expand Down Expand Up @@ -14570,6 +14673,30 @@ func (t *Template) GetLightsailDiskWithName(name string) (*lightsail.Disk, error
return nil, fmt.Errorf("resource %q of type lightsail.Disk not found", name)
}

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

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

// GetAllLightsailInstanceResources retrieves all lightsail.Instance items from an AWS CloudFormation template
func (t *Template) GetAllLightsailInstanceResources() map[string]*lightsail.Instance {
results := map[string]*lightsail.Instance{}
Expand Down Expand Up @@ -17954,6 +18081,30 @@ func (t *Template) GetRefactorSpacesServiceWithName(name string) (*refactorspace
return nil, fmt.Errorf("resource %q of type refactorspaces.Service not found", name)
}

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

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

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

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

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

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

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

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

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

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

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

// Tags AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appintegrations-dataintegration.html#cfn-appintegrations-dataintegration-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 *DataIntegration) AWSCloudFormationType() string {
return "AWS::AppIntegrations::DataIntegration"
}

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

Please sign in to comment.