forked from awslabs/goformation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(schema): AWS::CDK::Metadata resource should be automatically gene…
…rated (awslabs#421) * fix(schema): AWS::CDK::Metadata should be generated In PR awslabs#418, the AWS::CDK::Metadata was kindly added, however the resource was manually created, which lead to it being overwritten when `go generate` was run to update the goformation schema from CloudFormation/SAM specifications. This change adds a new `generate/cdk.json` file that contains a manually crafted version of the AWS::CDK::* specification (as I don't think an automatically published one exists), and automatically generates the `cdk/aws-cdk-metadata.go` resource from it. One side effect of this is that the `AWS::CDK::Metadata` resource is no longer in the main `cloudformation.schema.json` that some IDEs use for autocompletion/intellisense, and it now lives in an autogenerated `schema/cdk.schema.json` file (similar to how SAM is separate, as it's generated from a separate resource definition file). * Separate commit for generated CDK files * Separate commit for all other CloudFormation updates
- Loading branch information
1 parent
14866bd
commit 65569f7
Showing
90 changed files
with
269,574 additions
and
2,731 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
116 changes: 116 additions & 0 deletions
116
cloudformation/appstream/aws-appstream-applicationentitlementassociation.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
package appstream | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/awslabs/goformation/v5/cloudformation/policies" | ||
) | ||
|
||
// ApplicationEntitlementAssociation AWS CloudFormation Resource (AWS::AppStream::ApplicationEntitlementAssociation) | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-applicationentitlementassociation.html | ||
type ApplicationEntitlementAssociation struct { | ||
|
||
// ApplicationIdentifier AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-applicationentitlementassociation.html#cfn-appstream-applicationentitlementassociation-applicationidentifier | ||
ApplicationIdentifier string `json:"ApplicationIdentifier,omitempty"` | ||
|
||
// EntitlementName AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-applicationentitlementassociation.html#cfn-appstream-applicationentitlementassociation-entitlementname | ||
EntitlementName string `json:"EntitlementName,omitempty"` | ||
|
||
// StackName AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-applicationentitlementassociation.html#cfn-appstream-applicationentitlementassociation-stackname | ||
StackName string `json:"StackName,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 *ApplicationEntitlementAssociation) AWSCloudFormationType() string { | ||
return "AWS::AppStream::ApplicationEntitlementAssociation" | ||
} | ||
|
||
// 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 ApplicationEntitlementAssociation) MarshalJSON() ([]byte, error) { | ||
type Properties ApplicationEntitlementAssociation | ||
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 *ApplicationEntitlementAssociation) UnmarshalJSON(b []byte) error { | ||
type Properties ApplicationEntitlementAssociation | ||
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 = ApplicationEntitlementAssociation(*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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
package appstream | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/awslabs/goformation/v5/cloudformation/policies" | ||
) | ||
|
||
// Entitlement AWS CloudFormation Resource (AWS::AppStream::Entitlement) | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-entitlement.html | ||
type Entitlement struct { | ||
|
||
// AppVisibility AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-entitlement.html#cfn-appstream-entitlement-appvisibility | ||
AppVisibility string `json:"AppVisibility,omitempty"` | ||
|
||
// Attributes AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-entitlement.html#cfn-appstream-entitlement-attributes | ||
Attributes []Entitlement_Attribute `json:"Attributes,omitempty"` | ||
|
||
// Description AWS CloudFormation Property | ||
// Required: false | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-entitlement.html#cfn-appstream-entitlement-description | ||
Description string `json:"Description,omitempty"` | ||
|
||
// Name AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-entitlement.html#cfn-appstream-entitlement-name | ||
Name string `json:"Name,omitempty"` | ||
|
||
// StackName AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appstream-entitlement.html#cfn-appstream-entitlement-stackname | ||
StackName string `json:"StackName,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 *Entitlement) AWSCloudFormationType() string { | ||
return "AWS::AppStream::Entitlement" | ||
} | ||
|
||
// 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 Entitlement) MarshalJSON() ([]byte, error) { | ||
type Properties Entitlement | ||
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 *Entitlement) UnmarshalJSON(b []byte) error { | ||
type Properties Entitlement | ||
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 = Entitlement(*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 | ||
} |
40 changes: 40 additions & 0 deletions
40
cloudformation/appstream/aws-appstream-entitlement_attribute.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package appstream | ||
|
||
import ( | ||
"github.com/awslabs/goformation/v5/cloudformation/policies" | ||
) | ||
|
||
// Entitlement_Attribute AWS CloudFormation Resource (AWS::AppStream::Entitlement.Attribute) | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appstream-entitlement-attribute.html | ||
type Entitlement_Attribute struct { | ||
|
||
// Name AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appstream-entitlement-attribute.html#cfn-appstream-entitlement-attribute-name | ||
Name string `json:"Name,omitempty"` | ||
|
||
// Value AWS CloudFormation Property | ||
// Required: true | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appstream-entitlement-attribute.html#cfn-appstream-entitlement-attribute-value | ||
Value string `json:"Value,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 *Entitlement_Attribute) AWSCloudFormationType() string { | ||
return "AWS::AppStream::Entitlement.Attribute" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
cloudformation/autoscaling/aws-autoscaling-warmpool_instancereusepolicy.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package autoscaling | ||
|
||
import ( | ||
"github.com/awslabs/goformation/v5/cloudformation/policies" | ||
) | ||
|
||
// WarmPool_InstanceReusePolicy AWS CloudFormation Resource (AWS::AutoScaling::WarmPool.InstanceReusePolicy) | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-warmpool-instancereusepolicy.html | ||
type WarmPool_InstanceReusePolicy struct { | ||
|
||
// ReuseOnScaleIn AWS CloudFormation Property | ||
// Required: false | ||
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-warmpool-instancereusepolicy.html#cfn-autoscaling-warmpool-instancereusepolicy-reuseonscalein | ||
ReuseOnScaleIn bool `json:"ReuseOnScaleIn,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 *WarmPool_InstanceReusePolicy) AWSCloudFormationType() string { | ||
return "AWS::AutoScaling::WarmPool.InstanceReusePolicy" | ||
} |
Oops, something went wrong.