// Code generated by generators/resource/main.go; DO NOT EDIT. package ce import ( "context" "regexp" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" . "github.com/hashicorp/terraform-provider-awscc/internal/generic" "github.com/hashicorp/terraform-provider-awscc/internal/registry" "github.com/hashicorp/terraform-provider-awscc/internal/validate" ) func init() { registry.AddResourceTypeFactory("awscc_ce_anomaly_subscription", anomalySubscriptionResourceType) } // anomalySubscriptionResourceType returns the Terraform awscc_ce_anomaly_subscription resource type. // This Terraform resource type corresponds to the CloudFormation AWS::CE::AnomalySubscription resource type. func anomalySubscriptionResourceType(ctx context.Context) (tfsdk.ResourceType, error) { attributes := map[string]tfsdk.Attribute{ "account_id": { // Property: AccountId // CloudFormation resource type schema: // { // "description": "The accountId", // "maxLength": 1024, // "minLength": 0, // "type": "string" // } Description: "The accountId", Type: types.StringType, Computed: true, PlanModifiers: []tfsdk.AttributePlanModifier{ tfsdk.UseStateForUnknown(), }, }, "frequency": { // Property: Frequency // CloudFormation resource type schema: // { // "description": "The frequency at which anomaly reports are sent over email. ", // "enum": [ // "DAILY", // "IMMEDIATE", // "WEEKLY" // ], // "type": "string" // } Description: "The frequency at which anomaly reports are sent over email. ", Type: types.StringType, Required: true, Validators: []tfsdk.AttributeValidator{ validate.StringInSlice([]string{ "DAILY", "IMMEDIATE", "WEEKLY", }), }, }, "monitor_arn_list": { // Property: MonitorArnList // CloudFormation resource type schema: // { // "description": "A list of cost anomaly monitors.", // "insertionOrder": false, // "items": { // "description": "Subscription ARN", // "pattern": "^arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+$", // "type": "string" // }, // "type": "array" // } Description: "A list of cost anomaly monitors.", Type: types.ListType{ElemType: types.StringType}, Required: true, Validators: []tfsdk.AttributeValidator{ validate.ArrayForEach(validate.StringMatch(regexp.MustCompile("^arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+$"), "")), }, PlanModifiers: []tfsdk.AttributePlanModifier{ Multiset(), }, }, "resource_tags": { // Property: ResourceTags // CloudFormation resource type schema: // { // "description": "Tags to assign to subscription.", // "insertionOrder": false, // "items": { // "additionalProperties": false, // "description": "A key-value pair to associate with a resource.", // "properties": { // "Key": { // "description": "The key name for the tag.", // "maxLength": 128, // "minLength": 1, // "pattern": "", // "type": "string" // }, // "Value": { // "description": "The value for the tag.", // "maxLength": 256, // "minLength": 0, // "type": "string" // } // }, // "required": [ // "Key", // "Value" // ], // "type": "object" // }, // "maxItems": 200, // "minItems": 0, // "type": "array" // } Description: "Tags to assign to subscription.", Attributes: tfsdk.ListNestedAttributes( map[string]tfsdk.Attribute{ "key": { // Property: Key Description: "The key name for the tag.", Type: types.StringType, Required: true, Validators: []tfsdk.AttributeValidator{ validate.StringLenBetween(1, 128), }, }, "value": { // Property: Value Description: "The value for the tag.", Type: types.StringType, Required: true, Validators: []tfsdk.AttributeValidator{ validate.StringLenBetween(0, 256), }, }, }, tfsdk.ListNestedAttributesOptions{}, ), Optional: true, Computed: true, Validators: []tfsdk.AttributeValidator{ validate.ArrayLenBetween(0, 200), }, PlanModifiers: []tfsdk.AttributePlanModifier{ Multiset(), tfsdk.UseStateForUnknown(), tfsdk.RequiresReplace(), }, }, "subscribers": { // Property: Subscribers // CloudFormation resource type schema: // { // "description": "A list of subscriber", // "insertionOrder": false, // "items": { // "additionalProperties": false, // "properties": { // "Address": { // "pattern": "(^[a-zA-Z0-9.!#$%\u0026'*+=?^_‘{|}~-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$)|(^arn:(aws[a-zA-Z-]*):sns:[a-zA-Z0-9-]+:[0-9]{12}:[a-zA-Z0-9_-]+(\\.fifo)?$)", // "type": "string" // }, // "Status": { // "enum": [ // "CONFIRMED", // "DECLINED" // ], // "type": "string" // }, // "Type": { // "enum": [ // "EMAIL", // "SNS" // ], // "type": "string" // } // }, // "required": [ // "Address", // "Type" // ], // "type": "object" // }, // "type": "array" // } Description: "A list of subscriber", Attributes: tfsdk.ListNestedAttributes( map[string]tfsdk.Attribute{ "address": { // Property: Address Type: types.StringType, Required: true, Validators: []tfsdk.AttributeValidator{ validate.StringMatch(regexp.MustCompile("(^[a-zA-Z0-9.!#$%&'*+=?^_‘{|}~-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$)|(^arn:(aws[a-zA-Z-]*):sns:[a-zA-Z0-9-]+:[0-9]{12}:[a-zA-Z0-9_-]+(\\.fifo)?$)"), ""), }, }, "status": { // Property: Status Type: types.StringType, Optional: true, Validators: []tfsdk.AttributeValidator{ validate.StringInSlice([]string{ "CONFIRMED", "DECLINED", }), }, }, "type": { // Property: Type Type: types.StringType, Required: true, Validators: []tfsdk.AttributeValidator{ validate.StringInSlice([]string{ "EMAIL", "SNS", }), }, }, }, tfsdk.ListNestedAttributesOptions{}, ), Required: true, PlanModifiers: []tfsdk.AttributePlanModifier{ Multiset(), }, }, "subscription_arn": { // Property: SubscriptionArn // CloudFormation resource type schema: // { // "description": "Subscription ARN", // "pattern": "^arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+$", // "type": "string" // } Description: "Subscription ARN", Type: types.StringType, Computed: true, PlanModifiers: []tfsdk.AttributePlanModifier{ tfsdk.UseStateForUnknown(), }, }, "subscription_name": { // Property: SubscriptionName // CloudFormation resource type schema: // { // "description": "The name of the subscription.", // "maxLength": 1024, // "minLength": 0, // "pattern": "[\\S\\s]*", // "type": "string" // } Description: "The name of the subscription.", Type: types.StringType, Required: true, Validators: []tfsdk.AttributeValidator{ validate.StringLenBetween(0, 1024), validate.StringMatch(regexp.MustCompile("[\\S\\s]*"), ""), }, }, "threshold": { // Property: Threshold // CloudFormation resource type schema: // { // "description": "The dollar value that triggers a notification if the threshold is exceeded. ", // "minimum": 0, // "type": "number" // } Description: "The dollar value that triggers a notification if the threshold is exceeded. ", Type: types.Float64Type, Required: true, Validators: []tfsdk.AttributeValidator{ validate.FloatAtLeast(0.000000), }, }, } attributes["id"] = tfsdk.Attribute{ Description: "Uniquely identifies the resource.", Type: types.StringType, Computed: true, PlanModifiers: []tfsdk.AttributePlanModifier{ tfsdk.UseStateForUnknown(), }, } schema := tfsdk.Schema{ Description: "AWS Cost Anomaly Detection leverages advanced Machine Learning technologies to identify anomalous spend and root causes, so you can quickly take action. Create subscription to be notified", Version: 1, Attributes: attributes, } var opts ResourceTypeOptions opts = opts.WithCloudFormationTypeName("AWS::CE::AnomalySubscription").WithTerraformTypeName("awscc_ce_anomaly_subscription") opts = opts.WithTerraformSchema(schema) opts = opts.WithSyntheticIDAttribute(true) opts = opts.WithAttributeNameMap(map[string]string{ "account_id": "AccountId", "address": "Address", "frequency": "Frequency", "key": "Key", "monitor_arn_list": "MonitorArnList", "resource_tags": "ResourceTags", "status": "Status", "subscribers": "Subscribers", "subscription_arn": "SubscriptionArn", "subscription_name": "SubscriptionName", "threshold": "Threshold", "type": "Type", "value": "Value", }) opts = opts.WithCreateTimeoutInMinutes(0).WithDeleteTimeoutInMinutes(0) opts = opts.WithUpdateTimeoutInMinutes(0) resourceType, err := NewResourceType(ctx, opts...) if err != nil { return nil, err } return resourceType, nil }