Beispiel #1
0
func TestDeprecatedProperties(t *testing.T) {
	res := Resource{
		Properties: Properties{
			"Deprecated": Schema{
				Type:       ValueString,
				Deprecated: deprecations.Deprecated("blah blah."),
			},

			"DeprecatedBy": Schema{
				Type:       ValueString,
				Deprecated: deprecations.ReplacedBy("SomethingElse", "blah blah."),
			},
		},
	}

	template := &parse.Template{}
	ctx := NewInitialContext(template, NewResourceDefinitions(map[string]Resource{
		"TestResource": res,
	}), ValidationOptions{})

	unexpected := ResourceWithDefinition{
		parse.NewTemplateResource("TestResource", map[string]interface{}{
			"Deprecated":   "value",
			"DeprecatedBy": "value",
		}),
		res,
	}

	if _, errs := res.Validate(NewResourceContext(ctx, unexpected)); !hasWarning(errs, "Deprecated: blah blah.") {
		t.Errorf("Deprecated property use should warn (errs: %s)", errs)
	}

	if _, errs := res.Validate(NewResourceContext(ctx, unexpected)); !hasWarning(errs, "Replaced by SomethingElse: blah blah.") {
		t.Errorf("Deprecated property use should warn (errs: %s)", errs)
	}
}
Beispiel #2
0
	. "github.com/jagregory/cfval/schema"
)

// see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk.html
var Application = Resource{
	AwsType: "AWS::ElasticBeanstalk::Application",

	// Name
	ReturnValue: Schema{
		Type: ValueString,
	},

	Properties: Properties{
		"ApplicationName": Schema{
			Type: ValueString,
		},

		"ApplicationVersions": Schema{
			Deprecated: deprecations.Deprecated("Application Versions should be created by using the separate AWS::ElasticBeanstalk::ApplicationVersion resource, and linked using the ApplicationName property."),
		},

		"ConfigurationTemplates": Schema{
			Deprecated: deprecations.Deprecated("Configuration Templates should be created by using the separate AWS::ElasticBeanstalk::ConfigurationTemplate resource, and linked using the ApplicationName property."),
		},

		"Description": Schema{
			Type: ValueString,
		},
	},
}
Beispiel #3
0
import (
	"github.com/jagregory/cfval/constraints"
	"github.com/jagregory/cfval/deprecations"
	. "github.com/jagregory/cfval/schema"
)

// see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-keyschema.html
var keySchema = NestedResource{
	Description: "DynamoDB Key Schema",

	Properties: Properties{
		"AttributeName": Schema{
			Type:         ValueString,
			Required:     constraints.Always,
			ValidateFunc: StringLengthValidate(1, 255),
		},

		"HashKeyElement": Schema{
			Deprecated: deprecations.Deprecated("The HashKeyElement should now be defined in the AttributeDefinitions property of the AWS::DynamoDB::Table resource, and the AttributeName property of the KeySchema used them together."),
		},

		"KeyType": Schema{
			Type: EnumValue{
				Description: "KeyType",
				Options:     []string{"HASH", "RANGE"},
			},
			Required: constraints.Always,
		},
	},
}
Beispiel #4
0
		},

		"MaxSize": Schema{
			Type: ValueString,
		},

		"MetricsCollection": Schema{
			Type: Multiple(metricsCollection),
		},

		"MinSize": Schema{
			Type: ValueString,
		},

		"NotificationConfiguration": Schema{
			Deprecated: deprecations.Deprecated("A single NotificationConfiguration should be specified as a list in the NotificationConfigurations property."),
		},

		"NotificationConfigurations": Schema{
			Type: Multiple(notificationConfiguration),
		},

		"PlacementGroup": Schema{
			Type: ValueString,
		},

		"Tags": Schema{
			Type: Multiple(autoScalingTag),
		},

		"TerminationPolicies": Schema{
Beispiel #5
0
	Description: "CloudFront DistributionConfig",
	Properties: Properties{
		"Aliases": Schema{
			Type: Multiple(ValueString),
		},

		"CacheBehaviors": Schema{
			Type: Multiple(cacheBehaviour),
		},

		"Comment": Schema{
			Type: ValueString,
		},

		"CNAMEs": Schema{
			Deprecated: deprecations.Deprecated("CNAMEs should be specified in the Aliases property."),
		},

		"CustomErrorResponses": Schema{
			Type: Multiple(customErrorResponse),
		},

		"CustomOrigin": Schema{
			Deprecated: deprecations.Deprecated("An CustomOrigin should be specified as an item in the Origins property."),
		},

		"DefaultCacheBehavior": Schema{
			Required: constraints.Always,
			Type:     defaultCacheBehaviour,
		},
Beispiel #6
0
			Type:      ValueNumber,
			Conflicts: constraints.PropertyIs("PolicyType", "SimpleScaling"),
		},

		"MetricAggregationType": Schema{
			Type:      metricAggregationType,
			Default:   "Average",
			Conflicts: constraints.PropertyIs("PolicyType", "SimpleScaling"),
		},

		"MinAdjustmentMagnitude": Schema{
			Type: ValueNumber,
		},

		"MinAdjustmentStep": Schema{
			Deprecated: deprecations.Deprecated("MinAdjustmentStep is deprecated, use the MinAdjustmentMagnitude property instead."),
		},

		"PolicyType": Schema{
			Type:    policyType,
			Default: "SimpleScaling",
		},

		"ScalingAdjustment": Schema{
			Type:      ValueNumber,
			Required:  constraints.PropertyIs("PolicyType", "SimpleScaling"),
			Conflicts: constraints.Not(constraints.PropertyIs("PolicyType", "SimpleScaling")),
		},

		"StepAdjustments": Schema{
			Type:      Multiple(stepAdjustment),