Rule class

Resource for managing an AWS RBin Rule.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.rbin.Rule("example", {
    retentionPeriod: {
        retentionPeriodValue: 10,
        retentionPeriodUnit: "DAYS",
    },
    resourceTags: [{
        resourceTagKey: "tag_key",
        resourceTagValue: "tag_value",
    }],
    description: "Example tag-level retention rule",
    resourceType: "EBS_SNAPSHOT",
    tags: {
        test_tag_key: "test_tag_value",
    },
});
import pulumi
import pulumi_aws as aws

example = aws.rbin.Rule("example",
    retention_period={
        "retention_period_value": 10,
        "retention_period_unit": "DAYS",
    },
    resource_tags=[{
        "resource_tag_key": "tag_key",
        "resource_tag_value": "tag_value",
    }],
    description="Example tag-level retention rule",
    resource_type="EBS_SNAPSHOT",
    tags={
        "test_tag_key": "test_tag_value",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Rbin.Rule("example", new()
    {
        RetentionPeriod = new Aws.Rbin.Inputs.RuleRetentionPeriodArgs
        {
            RetentionPeriodValue = 10,
            RetentionPeriodUnit = "DAYS",
        },
        ResourceTags = new[]
        {
            new Aws.Rbin.Inputs.RuleResourceTagArgs
            {
                ResourceTagKey = "tag_key",
                ResourceTagValue = "tag_value",
            },
        },
        Description = "Example tag-level retention rule",
        ResourceType = "EBS_SNAPSHOT",
        Tags =
        {
            { "test_tag_key", "test_tag_value" },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/rbin"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := rbin.NewRule(ctx, "example", &rbin.RuleArgs{
			RetentionPeriod: &rbin.RuleRetentionPeriodArgs{
				RetentionPeriodValue: pulumi.Int(10),
				RetentionPeriodUnit:  pulumi.String("DAYS"),
			},
			ResourceTags: rbin.RuleResourceTagArray{
				&rbin.RuleResourceTagArgs{
					ResourceTagKey:   pulumi.String("tag_key"),
					ResourceTagValue: pulumi.String("tag_value"),
				},
			},
			Description:  pulumi.String("Example tag-level retention rule"),
			ResourceType: pulumi.String("EBS_SNAPSHOT"),
			Tags: pulumi.StringMap{
				"test_tag_key": pulumi.String("test_tag_value"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_rbin_rule" "example" {
  retention_period = {
    retention_period_value = 10
    retention_period_unit  = "DAYS"
  }
  resource_tags {
    resource_tag_key   = "tag_key"
    resource_tag_value = "tag_value"
  }
  description   = "Example tag-level retention rule"
  resource_type = "EBS_SNAPSHOT"
  tags = {
    "test_tag_key" = "test_tag_value"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rbin.Rule;
import com.pulumi.aws.rbin.RuleArgs;
import com.pulumi.aws.rbin.inputs.RuleRetentionPeriodArgs;
import com.pulumi.aws.rbin.inputs.RuleResourceTagArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Rule("example", RuleArgs.builder()
            .retentionPeriod(RuleRetentionPeriodArgs.builder()
                .retentionPeriodValue(10)
                .retentionPeriodUnit("DAYS")
                .build())
            .resourceTags(RuleResourceTagArgs.builder()
                .resourceTagKey("tag_key")
                .resourceTagValue("tag_value")
                .build())
            .description("Example tag-level retention rule")
            .resourceType("EBS_SNAPSHOT")
            .tags(Map.of("test_tag_key", "test_tag_value"))
            .build());

    }
}
resources:
  example:
    type: aws:rbin:Rule
    properties:
      retentionPeriod:
        retentionPeriodValue: 10
        retentionPeriodUnit: DAYS
      resourceTags:
        - resourceTagKey: tag_key
          resourceTagValue: tag_value
      description: Example tag-level retention rule
      resourceType: EBS_SNAPSHOT
      tags:
        test_tag_key: test_tag_value

Region-Level Retention Rule

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.rbin.Rule("example", {
    retentionPeriod: {
        retentionPeriodValue: 10,
        retentionPeriodUnit: "DAYS",
    },
    excludeResourceTags: [{
        resourceTagKey: "tag_key",
        resourceTagValue: "tag_value",
    }],
    description: "Example region-level retention rule with exclusion tags",
    resourceType: "EC2_IMAGE",
    tags: {
        test_tag_key: "test_tag_value",
    },
});
import pulumi
import pulumi_aws as aws

example = aws.rbin.Rule("example",
    retention_period={
        "retention_period_value": 10,
        "retention_period_unit": "DAYS",
    },
    exclude_resource_tags=[{
        "resource_tag_key": "tag_key",
        "resource_tag_value": "tag_value",
    }],
    description="Example region-level retention rule with exclusion tags",
    resource_type="EC2_IMAGE",
    tags={
        "test_tag_key": "test_tag_value",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Rbin.Rule("example", new()
    {
        RetentionPeriod = new Aws.Rbin.Inputs.RuleRetentionPeriodArgs
        {
            RetentionPeriodValue = 10,
            RetentionPeriodUnit = "DAYS",
        },
        ExcludeResourceTags = new[]
        {
            new Aws.Rbin.Inputs.RuleExcludeResourceTagArgs
            {
                ResourceTagKey = "tag_key",
                ResourceTagValue = "tag_value",
            },
        },
        Description = "Example region-level retention rule with exclusion tags",
        ResourceType = "EC2_IMAGE",
        Tags =
        {
            { "test_tag_key", "test_tag_value" },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/rbin"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := rbin.NewRule(ctx, "example", &rbin.RuleArgs{
			RetentionPeriod: &rbin.RuleRetentionPeriodArgs{
				RetentionPeriodValue: pulumi.Int(10),
				RetentionPeriodUnit:  pulumi.String("DAYS"),
			},
			ExcludeResourceTags: rbin.RuleExcludeResourceTagArray{
				&rbin.RuleExcludeResourceTagArgs{
					ResourceTagKey:   pulumi.String("tag_key"),
					ResourceTagValue: pulumi.String("tag_value"),
				},
			},
			Description:  pulumi.String("Example region-level retention rule with exclusion tags"),
			ResourceType: pulumi.String("EC2_IMAGE"),
			Tags: pulumi.StringMap{
				"test_tag_key": pulumi.String("test_tag_value"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_rbin_rule" "example" {
  retention_period = {
    retention_period_value = 10
    retention_period_unit  = "DAYS"
  }
  exclude_resource_tags {
    resource_tag_key   = "tag_key"
    resource_tag_value = "tag_value"
  }
  description   = "Example region-level retention rule with exclusion tags"
  resource_type = "EC2_IMAGE"
  tags = {
    "test_tag_key" = "test_tag_value"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rbin.Rule;
import com.pulumi.aws.rbin.RuleArgs;
import com.pulumi.aws.rbin.inputs.RuleRetentionPeriodArgs;
import com.pulumi.aws.rbin.inputs.RuleExcludeResourceTagArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Rule("example", RuleArgs.builder()
            .retentionPeriod(RuleRetentionPeriodArgs.builder()
                .retentionPeriodValue(10)
                .retentionPeriodUnit("DAYS")
                .build())
            .excludeResourceTags(RuleExcludeResourceTagArgs.builder()
                .resourceTagKey("tag_key")
                .resourceTagValue("tag_value")
                .build())
            .description("Example region-level retention rule with exclusion tags")
            .resourceType("EC2_IMAGE")
            .tags(Map.of("test_tag_key", "test_tag_value"))
            .build());

    }
}
resources:
  example:
    type: aws:rbin:Rule
    properties:
      retentionPeriod:
        retentionPeriodValue: 10
        retentionPeriodUnit: DAYS
      excludeResourceTags:
        - resourceTagKey: tag_key
          resourceTagValue: tag_value
      description: Example region-level retention rule with exclusion tags
      resourceType: EC2_IMAGE
      tags:
        test_tag_key: test_tag_value

Import

Using pulumi import, import RBin Rule using the id. For example:

$ pulumi import aws:rbin/rule:Rule example examplerule

Constructors

Rule(String name, {RuleArgs? args, CustomResourceOptions? options})
Creates a new Rule. name The Pulumi resource name. args Arguments used to configure this Rule. The set of arguments for Rule. options Resource options controlling this resource's behavior.
Rule.reference(String urn)
Creates a typed reference to an existing Rule resource.

Properties

arn ↔ Output<String>
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
description ↔ Output<String>
Retention rule description.
latefinal
excludeResourceTags ↔ Output<List<RuleExcludeResourceTag>?>
Exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. See excludeResourceTags below.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
lockConfiguration ↔ Output<RuleLockConfiguration?>
Information about the retention rule lock configuration. See lockConfiguration below.
latefinal
lockEndTime ↔ Output<String>
(Timestamp) Date and time at which the unlock delay is set to expire. Only returned for retention rules that have been unlocked and that are still within the unlock delay period.
latefinal
lockState ↔ Output<String>
(Optional) Lock state of the retention rules to list. Only retention rules with the specified lock state are returned. Valid values are locked, pendingUnlock, unlocked.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTags ↔ Output<List<RuleResourceTag>?>
Resource tags to use to identify resources that are to be retained by a tag-level retention rule. See resourceTags below.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
resourceType ↔ Output<String>
Resource type to be retained by the retention rule. Valid values are EBS_SNAPSHOT and EC2_IMAGE.
latefinal
retentionPeriod ↔ Output<RuleRetentionPeriod>
Information about the retention period for which the retention rule is to retain resources. See retentionPeriod below.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status ↔ Output<String>
(String) State of the retention rule. Only retention rules that are in the available state retain resources. Valid values include pending and available.
latefinal
tags ↔ Output<Map<String, String>?>
latefinal
tagsAll ↔ Output<Map<String, String>>
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {RuleState? state, CustomResourceOptions? options}) → Rule
Gets an existing Rule resource's state with the given name and id.