github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iot/topicRuleDestination.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package iot
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // ## Example Usage
    16  //
    17  // <!--Start PulumiCodeChooser -->
    18  // ```go
    19  // package main
    20  //
    21  // import (
    22  //
    23  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iot"
    24  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    25  //
    26  // )
    27  // func main() {
    28  // pulumi.Run(func(ctx *pulumi.Context) error {
    29  // _, err := iot.NewTopicRuleDestination(ctx, "example", &iot.TopicRuleDestinationArgs{
    30  // VpcConfiguration: &iot.TopicRuleDestinationVpcConfigurationArgs{
    31  // RoleArn: pulumi.Any(exampleAwsIamRole.Arn),
    32  // SecurityGroups: pulumi.StringArray{
    33  // exampleAwsSecurityGroup.Id,
    34  // },
    35  // SubnetIds: %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:4,22-44),
    36  // VpcId: pulumi.Any(exampleAwsVpc.Id),
    37  // },
    38  // })
    39  // if err != nil {
    40  // return err
    41  // }
    42  // return nil
    43  // })
    44  // }
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import IoT topic rule destinations using the `arn`. For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:iot/topicRuleDestination:TopicRuleDestination example arn:aws:iot:us-west-2:123456789012:ruledestination/vpc/2ce781c8-68a6-4c52-9c62-63fe489ecc60
    54  // ```
    55  type TopicRuleDestination struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// The ARN of the topic rule destination
    59  	Arn pulumi.StringOutput `pulumi:"arn"`
    60  	// Whether or not to enable the destination. Default: `true`.
    61  	Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
    62  	// Configuration of the virtual private cloud (VPC) connection. For more info, see the [AWS documentation](https://docs.aws.amazon.com/iot/latest/developerguide/vpc-rule-action.html).
    63  	VpcConfiguration TopicRuleDestinationVpcConfigurationOutput `pulumi:"vpcConfiguration"`
    64  }
    65  
    66  // NewTopicRuleDestination registers a new resource with the given unique name, arguments, and options.
    67  func NewTopicRuleDestination(ctx *pulumi.Context,
    68  	name string, args *TopicRuleDestinationArgs, opts ...pulumi.ResourceOption) (*TopicRuleDestination, error) {
    69  	if args == nil {
    70  		return nil, errors.New("missing one or more required arguments")
    71  	}
    72  
    73  	if args.VpcConfiguration == nil {
    74  		return nil, errors.New("invalid value for required argument 'VpcConfiguration'")
    75  	}
    76  	opts = internal.PkgResourceDefaultOpts(opts)
    77  	var resource TopicRuleDestination
    78  	err := ctx.RegisterResource("aws:iot/topicRuleDestination:TopicRuleDestination", name, args, &resource, opts...)
    79  	if err != nil {
    80  		return nil, err
    81  	}
    82  	return &resource, nil
    83  }
    84  
    85  // GetTopicRuleDestination gets an existing TopicRuleDestination resource's state with the given name, ID, and optional
    86  // state properties that are used to uniquely qualify the lookup (nil if not required).
    87  func GetTopicRuleDestination(ctx *pulumi.Context,
    88  	name string, id pulumi.IDInput, state *TopicRuleDestinationState, opts ...pulumi.ResourceOption) (*TopicRuleDestination, error) {
    89  	var resource TopicRuleDestination
    90  	err := ctx.ReadResource("aws:iot/topicRuleDestination:TopicRuleDestination", name, id, state, &resource, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return &resource, nil
    95  }
    96  
    97  // Input properties used for looking up and filtering TopicRuleDestination resources.
    98  type topicRuleDestinationState struct {
    99  	// The ARN of the topic rule destination
   100  	Arn *string `pulumi:"arn"`
   101  	// Whether or not to enable the destination. Default: `true`.
   102  	Enabled *bool `pulumi:"enabled"`
   103  	// Configuration of the virtual private cloud (VPC) connection. For more info, see the [AWS documentation](https://docs.aws.amazon.com/iot/latest/developerguide/vpc-rule-action.html).
   104  	VpcConfiguration *TopicRuleDestinationVpcConfiguration `pulumi:"vpcConfiguration"`
   105  }
   106  
   107  type TopicRuleDestinationState struct {
   108  	// The ARN of the topic rule destination
   109  	Arn pulumi.StringPtrInput
   110  	// Whether or not to enable the destination. Default: `true`.
   111  	Enabled pulumi.BoolPtrInput
   112  	// Configuration of the virtual private cloud (VPC) connection. For more info, see the [AWS documentation](https://docs.aws.amazon.com/iot/latest/developerguide/vpc-rule-action.html).
   113  	VpcConfiguration TopicRuleDestinationVpcConfigurationPtrInput
   114  }
   115  
   116  func (TopicRuleDestinationState) ElementType() reflect.Type {
   117  	return reflect.TypeOf((*topicRuleDestinationState)(nil)).Elem()
   118  }
   119  
   120  type topicRuleDestinationArgs struct {
   121  	// Whether or not to enable the destination. Default: `true`.
   122  	Enabled *bool `pulumi:"enabled"`
   123  	// Configuration of the virtual private cloud (VPC) connection. For more info, see the [AWS documentation](https://docs.aws.amazon.com/iot/latest/developerguide/vpc-rule-action.html).
   124  	VpcConfiguration TopicRuleDestinationVpcConfiguration `pulumi:"vpcConfiguration"`
   125  }
   126  
   127  // The set of arguments for constructing a TopicRuleDestination resource.
   128  type TopicRuleDestinationArgs struct {
   129  	// Whether or not to enable the destination. Default: `true`.
   130  	Enabled pulumi.BoolPtrInput
   131  	// Configuration of the virtual private cloud (VPC) connection. For more info, see the [AWS documentation](https://docs.aws.amazon.com/iot/latest/developerguide/vpc-rule-action.html).
   132  	VpcConfiguration TopicRuleDestinationVpcConfigurationInput
   133  }
   134  
   135  func (TopicRuleDestinationArgs) ElementType() reflect.Type {
   136  	return reflect.TypeOf((*topicRuleDestinationArgs)(nil)).Elem()
   137  }
   138  
   139  type TopicRuleDestinationInput interface {
   140  	pulumi.Input
   141  
   142  	ToTopicRuleDestinationOutput() TopicRuleDestinationOutput
   143  	ToTopicRuleDestinationOutputWithContext(ctx context.Context) TopicRuleDestinationOutput
   144  }
   145  
   146  func (*TopicRuleDestination) ElementType() reflect.Type {
   147  	return reflect.TypeOf((**TopicRuleDestination)(nil)).Elem()
   148  }
   149  
   150  func (i *TopicRuleDestination) ToTopicRuleDestinationOutput() TopicRuleDestinationOutput {
   151  	return i.ToTopicRuleDestinationOutputWithContext(context.Background())
   152  }
   153  
   154  func (i *TopicRuleDestination) ToTopicRuleDestinationOutputWithContext(ctx context.Context) TopicRuleDestinationOutput {
   155  	return pulumi.ToOutputWithContext(ctx, i).(TopicRuleDestinationOutput)
   156  }
   157  
   158  // TopicRuleDestinationArrayInput is an input type that accepts TopicRuleDestinationArray and TopicRuleDestinationArrayOutput values.
   159  // You can construct a concrete instance of `TopicRuleDestinationArrayInput` via:
   160  //
   161  //	TopicRuleDestinationArray{ TopicRuleDestinationArgs{...} }
   162  type TopicRuleDestinationArrayInput interface {
   163  	pulumi.Input
   164  
   165  	ToTopicRuleDestinationArrayOutput() TopicRuleDestinationArrayOutput
   166  	ToTopicRuleDestinationArrayOutputWithContext(context.Context) TopicRuleDestinationArrayOutput
   167  }
   168  
   169  type TopicRuleDestinationArray []TopicRuleDestinationInput
   170  
   171  func (TopicRuleDestinationArray) ElementType() reflect.Type {
   172  	return reflect.TypeOf((*[]*TopicRuleDestination)(nil)).Elem()
   173  }
   174  
   175  func (i TopicRuleDestinationArray) ToTopicRuleDestinationArrayOutput() TopicRuleDestinationArrayOutput {
   176  	return i.ToTopicRuleDestinationArrayOutputWithContext(context.Background())
   177  }
   178  
   179  func (i TopicRuleDestinationArray) ToTopicRuleDestinationArrayOutputWithContext(ctx context.Context) TopicRuleDestinationArrayOutput {
   180  	return pulumi.ToOutputWithContext(ctx, i).(TopicRuleDestinationArrayOutput)
   181  }
   182  
   183  // TopicRuleDestinationMapInput is an input type that accepts TopicRuleDestinationMap and TopicRuleDestinationMapOutput values.
   184  // You can construct a concrete instance of `TopicRuleDestinationMapInput` via:
   185  //
   186  //	TopicRuleDestinationMap{ "key": TopicRuleDestinationArgs{...} }
   187  type TopicRuleDestinationMapInput interface {
   188  	pulumi.Input
   189  
   190  	ToTopicRuleDestinationMapOutput() TopicRuleDestinationMapOutput
   191  	ToTopicRuleDestinationMapOutputWithContext(context.Context) TopicRuleDestinationMapOutput
   192  }
   193  
   194  type TopicRuleDestinationMap map[string]TopicRuleDestinationInput
   195  
   196  func (TopicRuleDestinationMap) ElementType() reflect.Type {
   197  	return reflect.TypeOf((*map[string]*TopicRuleDestination)(nil)).Elem()
   198  }
   199  
   200  func (i TopicRuleDestinationMap) ToTopicRuleDestinationMapOutput() TopicRuleDestinationMapOutput {
   201  	return i.ToTopicRuleDestinationMapOutputWithContext(context.Background())
   202  }
   203  
   204  func (i TopicRuleDestinationMap) ToTopicRuleDestinationMapOutputWithContext(ctx context.Context) TopicRuleDestinationMapOutput {
   205  	return pulumi.ToOutputWithContext(ctx, i).(TopicRuleDestinationMapOutput)
   206  }
   207  
   208  type TopicRuleDestinationOutput struct{ *pulumi.OutputState }
   209  
   210  func (TopicRuleDestinationOutput) ElementType() reflect.Type {
   211  	return reflect.TypeOf((**TopicRuleDestination)(nil)).Elem()
   212  }
   213  
   214  func (o TopicRuleDestinationOutput) ToTopicRuleDestinationOutput() TopicRuleDestinationOutput {
   215  	return o
   216  }
   217  
   218  func (o TopicRuleDestinationOutput) ToTopicRuleDestinationOutputWithContext(ctx context.Context) TopicRuleDestinationOutput {
   219  	return o
   220  }
   221  
   222  // The ARN of the topic rule destination
   223  func (o TopicRuleDestinationOutput) Arn() pulumi.StringOutput {
   224  	return o.ApplyT(func(v *TopicRuleDestination) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   225  }
   226  
   227  // Whether or not to enable the destination. Default: `true`.
   228  func (o TopicRuleDestinationOutput) Enabled() pulumi.BoolPtrOutput {
   229  	return o.ApplyT(func(v *TopicRuleDestination) pulumi.BoolPtrOutput { return v.Enabled }).(pulumi.BoolPtrOutput)
   230  }
   231  
   232  // Configuration of the virtual private cloud (VPC) connection. For more info, see the [AWS documentation](https://docs.aws.amazon.com/iot/latest/developerguide/vpc-rule-action.html).
   233  func (o TopicRuleDestinationOutput) VpcConfiguration() TopicRuleDestinationVpcConfigurationOutput {
   234  	return o.ApplyT(func(v *TopicRuleDestination) TopicRuleDestinationVpcConfigurationOutput { return v.VpcConfiguration }).(TopicRuleDestinationVpcConfigurationOutput)
   235  }
   236  
   237  type TopicRuleDestinationArrayOutput struct{ *pulumi.OutputState }
   238  
   239  func (TopicRuleDestinationArrayOutput) ElementType() reflect.Type {
   240  	return reflect.TypeOf((*[]*TopicRuleDestination)(nil)).Elem()
   241  }
   242  
   243  func (o TopicRuleDestinationArrayOutput) ToTopicRuleDestinationArrayOutput() TopicRuleDestinationArrayOutput {
   244  	return o
   245  }
   246  
   247  func (o TopicRuleDestinationArrayOutput) ToTopicRuleDestinationArrayOutputWithContext(ctx context.Context) TopicRuleDestinationArrayOutput {
   248  	return o
   249  }
   250  
   251  func (o TopicRuleDestinationArrayOutput) Index(i pulumi.IntInput) TopicRuleDestinationOutput {
   252  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TopicRuleDestination {
   253  		return vs[0].([]*TopicRuleDestination)[vs[1].(int)]
   254  	}).(TopicRuleDestinationOutput)
   255  }
   256  
   257  type TopicRuleDestinationMapOutput struct{ *pulumi.OutputState }
   258  
   259  func (TopicRuleDestinationMapOutput) ElementType() reflect.Type {
   260  	return reflect.TypeOf((*map[string]*TopicRuleDestination)(nil)).Elem()
   261  }
   262  
   263  func (o TopicRuleDestinationMapOutput) ToTopicRuleDestinationMapOutput() TopicRuleDestinationMapOutput {
   264  	return o
   265  }
   266  
   267  func (o TopicRuleDestinationMapOutput) ToTopicRuleDestinationMapOutputWithContext(ctx context.Context) TopicRuleDestinationMapOutput {
   268  	return o
   269  }
   270  
   271  func (o TopicRuleDestinationMapOutput) MapIndex(k pulumi.StringInput) TopicRuleDestinationOutput {
   272  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TopicRuleDestination {
   273  		return vs[0].(map[string]*TopicRuleDestination)[vs[1].(string)]
   274  	}).(TopicRuleDestinationOutput)
   275  }
   276  
   277  func init() {
   278  	pulumi.RegisterInputType(reflect.TypeOf((*TopicRuleDestinationInput)(nil)).Elem(), &TopicRuleDestination{})
   279  	pulumi.RegisterInputType(reflect.TypeOf((*TopicRuleDestinationArrayInput)(nil)).Elem(), TopicRuleDestinationArray{})
   280  	pulumi.RegisterInputType(reflect.TypeOf((*TopicRuleDestinationMapInput)(nil)).Elem(), TopicRuleDestinationMap{})
   281  	pulumi.RegisterOutputType(TopicRuleDestinationOutput{})
   282  	pulumi.RegisterOutputType(TopicRuleDestinationArrayOutput{})
   283  	pulumi.RegisterOutputType(TopicRuleDestinationMapOutput{})
   284  }