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

AWS CloudFormation Update (2018-07-24) #104

Merged
merged 1 commit into from
Jul 24, 2018
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
165 changes: 165 additions & 0 deletions cloudformation/aws-amazonmq-broker.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
package cloudformation

import (
"encoding/json"
"errors"
"fmt"
)

// AWSAmazonMQBroker AWS CloudFormation Resource (AWS::AmazonMQ::Broker)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html
type AWSAmazonMQBroker struct {

// AutoMinorVersionUpgrade AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-autominorversionupgrade
AutoMinorVersionUpgrade bool `json:"AutoMinorVersionUpgrade,omitempty"`

// BrokerName AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-brokername
BrokerName string `json:"BrokerName,omitempty"`

// Configuration AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-configuration
Configuration *AWSAmazonMQBroker_ConfigurationId `json:"Configuration,omitempty"`

// DeploymentMode AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-deploymentmode
DeploymentMode string `json:"DeploymentMode,omitempty"`

// EngineType AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-enginetype
EngineType string `json:"EngineType,omitempty"`

// EngineVersion AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-engineversion
EngineVersion string `json:"EngineVersion,omitempty"`

// HostInstanceType AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-hostinstancetype
HostInstanceType string `json:"HostInstanceType,omitempty"`

// MaintenanceWindowStartTime AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-maintenancewindowstarttime
MaintenanceWindowStartTime *AWSAmazonMQBroker_MaintenanceWindow `json:"MaintenanceWindowStartTime,omitempty"`

// PubliclyAccessible AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-publiclyaccessible
PubliclyAccessible bool `json:"PubliclyAccessible,omitempty"`

// SecurityGroups AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-securitygroups
SecurityGroups []string `json:"SecurityGroups,omitempty"`

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

// Users AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-users
Users []AWSAmazonMQBroker_User `json:"Users,omitempty"`
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSAmazonMQBroker) AWSCloudFormationType() string {
return "AWS::AmazonMQ::Broker"
}

// 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 *AWSAmazonMQBroker) MarshalJSON() ([]byte, error) {
type Properties AWSAmazonMQBroker
return json.Marshal(&struct {
Type string
Properties Properties
}{
Type: r.AWSCloudFormationType(),
Properties: (Properties)(*r),
})
}

// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer
// AWS CloudFormation resource object, and just keeps the 'Properties' field.
func (r *AWSAmazonMQBroker) UnmarshalJSON(b []byte) error {
type Properties AWSAmazonMQBroker
res := &struct {
Type string
Properties *Properties
}{}
if err := json.Unmarshal(b, &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 = AWSAmazonMQBroker(*res.Properties)
}

return nil
}

// GetAllAWSAmazonMQBrokerResources retrieves all AWSAmazonMQBroker items from an AWS CloudFormation template
func (t *Template) GetAllAWSAmazonMQBrokerResources() map[string]AWSAmazonMQBroker {
results := map[string]AWSAmazonMQBroker{}
for name, untyped := range t.Resources {
switch resource := untyped.(type) {
case AWSAmazonMQBroker:
// We found a strongly typed resource of the correct type; use it
results[name] = resource
case map[string]interface{}:
// We found an untyped resource (likely from JSON) which *might* be
// the correct type, but we need to check it's 'Type' field
if resType, ok := resource["Type"]; ok {
if resType == "AWS::AmazonMQ::Broker" {
// The resource is correct, unmarshal it into the results
if b, err := json.Marshal(resource); err == nil {
var result AWSAmazonMQBroker
if err := json.Unmarshal(b, &result); err == nil {
results[name] = result
}
}
}
}
}
}
return results
}

// GetAWSAmazonMQBrokerWithName retrieves all AWSAmazonMQBroker items from an AWS CloudFormation template
// whose logical ID matches the provided name. Returns an error if not found.
func (t *Template) GetAWSAmazonMQBrokerWithName(name string) (AWSAmazonMQBroker, error) {
if untyped, ok := t.Resources[name]; ok {
switch resource := untyped.(type) {
case AWSAmazonMQBroker:
// We found a strongly typed resource of the correct type; use it
return resource, nil
case map[string]interface{}:
// We found an untyped resource (likely from JSON) which *might* be
// the correct type, but we need to check it's 'Type' field
if resType, ok := resource["Type"]; ok {
if resType == "AWS::AmazonMQ::Broker" {
// The resource is correct, unmarshal it into the results
if b, err := json.Marshal(resource); err == nil {
var result AWSAmazonMQBroker
if err := json.Unmarshal(b, &result); err == nil {
return result, nil
}
}
}
}
}
}
return AWSAmazonMQBroker{}, errors.New("resource not found")
}
21 changes: 21 additions & 0 deletions cloudformation/aws-amazonmq-broker_configurationid.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cloudformation

// AWSAmazonMQBroker_ConfigurationId AWS CloudFormation Resource (AWS::AmazonMQ::Broker.ConfigurationId)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-configurationid.html
type AWSAmazonMQBroker_ConfigurationId struct {

// Id AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-configurationid.html#cfn-amazonmq-broker-configurationid-id
Id string `json:"Id,omitempty"`

// Revision AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-configurationid.html#cfn-amazonmq-broker-configurationid-revision
Revision int `json:"Revision,omitempty"`
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSAmazonMQBroker_ConfigurationId) AWSCloudFormationType() string {
return "AWS::AmazonMQ::Broker.ConfigurationId"
}
26 changes: 26 additions & 0 deletions cloudformation/aws-amazonmq-broker_maintenancewindow.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package cloudformation

// AWSAmazonMQBroker_MaintenanceWindow AWS CloudFormation Resource (AWS::AmazonMQ::Broker.MaintenanceWindow)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-maintenancewindow.html
type AWSAmazonMQBroker_MaintenanceWindow struct {

// DayOfWeek AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-maintenancewindow.html#cfn-amazonmq-broker-maintenancewindow-dayofweek
DayOfWeek string `json:"DayOfWeek,omitempty"`

// TimeOfDay AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-maintenancewindow.html#cfn-amazonmq-broker-maintenancewindow-timeofday
TimeOfDay string `json:"TimeOfDay,omitempty"`

// TimeZone AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-maintenancewindow.html#cfn-amazonmq-broker-maintenancewindow-timezone
TimeZone string `json:"TimeZone,omitempty"`
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSAmazonMQBroker_MaintenanceWindow) AWSCloudFormationType() string {
return "AWS::AmazonMQ::Broker.MaintenanceWindow"
}
31 changes: 31 additions & 0 deletions cloudformation/aws-amazonmq-broker_user.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cloudformation

// AWSAmazonMQBroker_User AWS CloudFormation Resource (AWS::AmazonMQ::Broker.User)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html
type AWSAmazonMQBroker_User struct {

// ConsoleAccess AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-consoleaccess
ConsoleAccess bool `json:"ConsoleAccess,omitempty"`

// Groups AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-groups
Groups []string `json:"Groups,omitempty"`

// Password AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-password
Password string `json:"Password,omitempty"`

// Username AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-username
Username string `json:"Username,omitempty"`
}

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSAmazonMQBroker_User) AWSCloudFormationType() string {
return "AWS::AmazonMQ::Broker.User"
}
130 changes: 130 additions & 0 deletions cloudformation/aws-amazonmq-configuration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package cloudformation

import (
"encoding/json"
"errors"
"fmt"
)

// AWSAmazonMQConfiguration AWS CloudFormation Resource (AWS::AmazonMQ::Configuration)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html
type AWSAmazonMQConfiguration struct {

// Data AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html#cfn-amazonmq-configuration-data
Data string `json:"Data,omitempty"`

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

// EngineType AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html#cfn-amazonmq-configuration-enginetype
EngineType string `json:"EngineType,omitempty"`

// EngineVersion AWS CloudFormation Property
// Required: true
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html#cfn-amazonmq-configuration-engineversion
EngineVersion string `json:"EngineVersion,omitempty"`

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

// AWSCloudFormationType returns the AWS CloudFormation resource type
func (r *AWSAmazonMQConfiguration) AWSCloudFormationType() string {
return "AWS::AmazonMQ::Configuration"
}

// 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 *AWSAmazonMQConfiguration) MarshalJSON() ([]byte, error) {
type Properties AWSAmazonMQConfiguration
return json.Marshal(&struct {
Type string
Properties Properties
}{
Type: r.AWSCloudFormationType(),
Properties: (Properties)(*r),
})
}

// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer
// AWS CloudFormation resource object, and just keeps the 'Properties' field.
func (r *AWSAmazonMQConfiguration) UnmarshalJSON(b []byte) error {
type Properties AWSAmazonMQConfiguration
res := &struct {
Type string
Properties *Properties
}{}
if err := json.Unmarshal(b, &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 = AWSAmazonMQConfiguration(*res.Properties)
}

return nil
}

// GetAllAWSAmazonMQConfigurationResources retrieves all AWSAmazonMQConfiguration items from an AWS CloudFormation template
func (t *Template) GetAllAWSAmazonMQConfigurationResources() map[string]AWSAmazonMQConfiguration {
results := map[string]AWSAmazonMQConfiguration{}
for name, untyped := range t.Resources {
switch resource := untyped.(type) {
case AWSAmazonMQConfiguration:
// We found a strongly typed resource of the correct type; use it
results[name] = resource
case map[string]interface{}:
// We found an untyped resource (likely from JSON) which *might* be
// the correct type, but we need to check it's 'Type' field
if resType, ok := resource["Type"]; ok {
if resType == "AWS::AmazonMQ::Configuration" {
// The resource is correct, unmarshal it into the results
if b, err := json.Marshal(resource); err == nil {
var result AWSAmazonMQConfiguration
if err := json.Unmarshal(b, &result); err == nil {
results[name] = result
}
}
}
}
}
}
return results
}

// GetAWSAmazonMQConfigurationWithName retrieves all AWSAmazonMQConfiguration items from an AWS CloudFormation template
// whose logical ID matches the provided name. Returns an error if not found.
func (t *Template) GetAWSAmazonMQConfigurationWithName(name string) (AWSAmazonMQConfiguration, error) {
if untyped, ok := t.Resources[name]; ok {
switch resource := untyped.(type) {
case AWSAmazonMQConfiguration:
// We found a strongly typed resource of the correct type; use it
return resource, nil
case map[string]interface{}:
// We found an untyped resource (likely from JSON) which *might* be
// the correct type, but we need to check it's 'Type' field
if resType, ok := resource["Type"]; ok {
if resType == "AWS::AmazonMQ::Configuration" {
// The resource is correct, unmarshal it into the results
if b, err := json.Marshal(resource); err == nil {
var result AWSAmazonMQConfiguration
if err := json.Unmarshal(b, &result); err == nil {
return result, nil
}
}
}
}
}
}
return AWSAmazonMQConfiguration{}, errors.New("resource not found")
}
5 changes: 5 additions & 0 deletions cloudformation/aws-appsync-datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ type AWSAppSyncDataSource struct {
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-elasticsearchconfig
ElasticsearchConfig *AWSAppSyncDataSource_ElasticsearchConfig `json:"ElasticsearchConfig,omitempty"`

// HttpConfig AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-httpconfig
HttpConfig *AWSAppSyncDataSource_HttpConfig `json:"HttpConfig,omitempty"`

// LambdaConfig AWS CloudFormation Property
// Required: false
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-lambdaconfig
Expand Down
Loading