github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/schemas/discoverer.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 schemas
     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  // Provides an EventBridge Schema Discoverer resource.
    16  //
    17  // > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/schemas"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			messenger, err := cloudwatch.NewEventBus(ctx, "messenger", &cloudwatch.EventBusArgs{
    36  //				Name: pulumi.String("chat-messages"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			_, err = schemas.NewDiscoverer(ctx, "test", &schemas.DiscovererArgs{
    42  //				SourceArn:   messenger.Arn,
    43  //				Description: pulumi.String("Auto discover event schemas"),
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  //
    55  // ## Import
    56  //
    57  // Using `pulumi import`, import EventBridge discoverers using the `id`. For example:
    58  //
    59  // ```sh
    60  // $ pulumi import aws:schemas/discoverer:Discoverer test 123
    61  // ```
    62  type Discoverer struct {
    63  	pulumi.CustomResourceState
    64  
    65  	// The Amazon Resource Name (ARN) of the discoverer.
    66  	Arn pulumi.StringOutput `pulumi:"arn"`
    67  	// The description of the discoverer. Maximum of 256 characters.
    68  	Description pulumi.StringPtrOutput `pulumi:"description"`
    69  	// The ARN of the event bus to discover event schemas on.
    70  	SourceArn pulumi.StringOutput `pulumi:"sourceArn"`
    71  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    72  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    73  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    74  	//
    75  	// Deprecated: Please use `tags` instead.
    76  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    77  }
    78  
    79  // NewDiscoverer registers a new resource with the given unique name, arguments, and options.
    80  func NewDiscoverer(ctx *pulumi.Context,
    81  	name string, args *DiscovererArgs, opts ...pulumi.ResourceOption) (*Discoverer, error) {
    82  	if args == nil {
    83  		return nil, errors.New("missing one or more required arguments")
    84  	}
    85  
    86  	if args.SourceArn == nil {
    87  		return nil, errors.New("invalid value for required argument 'SourceArn'")
    88  	}
    89  	opts = internal.PkgResourceDefaultOpts(opts)
    90  	var resource Discoverer
    91  	err := ctx.RegisterResource("aws:schemas/discoverer:Discoverer", name, args, &resource, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	return &resource, nil
    96  }
    97  
    98  // GetDiscoverer gets an existing Discoverer resource's state with the given name, ID, and optional
    99  // state properties that are used to uniquely qualify the lookup (nil if not required).
   100  func GetDiscoverer(ctx *pulumi.Context,
   101  	name string, id pulumi.IDInput, state *DiscovererState, opts ...pulumi.ResourceOption) (*Discoverer, error) {
   102  	var resource Discoverer
   103  	err := ctx.ReadResource("aws:schemas/discoverer:Discoverer", name, id, state, &resource, opts...)
   104  	if err != nil {
   105  		return nil, err
   106  	}
   107  	return &resource, nil
   108  }
   109  
   110  // Input properties used for looking up and filtering Discoverer resources.
   111  type discovererState struct {
   112  	// The Amazon Resource Name (ARN) of the discoverer.
   113  	Arn *string `pulumi:"arn"`
   114  	// The description of the discoverer. Maximum of 256 characters.
   115  	Description *string `pulumi:"description"`
   116  	// The ARN of the event bus to discover event schemas on.
   117  	SourceArn *string `pulumi:"sourceArn"`
   118  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   119  	Tags map[string]string `pulumi:"tags"`
   120  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   121  	//
   122  	// Deprecated: Please use `tags` instead.
   123  	TagsAll map[string]string `pulumi:"tagsAll"`
   124  }
   125  
   126  type DiscovererState struct {
   127  	// The Amazon Resource Name (ARN) of the discoverer.
   128  	Arn pulumi.StringPtrInput
   129  	// The description of the discoverer. Maximum of 256 characters.
   130  	Description pulumi.StringPtrInput
   131  	// The ARN of the event bus to discover event schemas on.
   132  	SourceArn pulumi.StringPtrInput
   133  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   134  	Tags pulumi.StringMapInput
   135  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   136  	//
   137  	// Deprecated: Please use `tags` instead.
   138  	TagsAll pulumi.StringMapInput
   139  }
   140  
   141  func (DiscovererState) ElementType() reflect.Type {
   142  	return reflect.TypeOf((*discovererState)(nil)).Elem()
   143  }
   144  
   145  type discovererArgs struct {
   146  	// The description of the discoverer. Maximum of 256 characters.
   147  	Description *string `pulumi:"description"`
   148  	// The ARN of the event bus to discover event schemas on.
   149  	SourceArn string `pulumi:"sourceArn"`
   150  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   151  	Tags map[string]string `pulumi:"tags"`
   152  }
   153  
   154  // The set of arguments for constructing a Discoverer resource.
   155  type DiscovererArgs struct {
   156  	// The description of the discoverer. Maximum of 256 characters.
   157  	Description pulumi.StringPtrInput
   158  	// The ARN of the event bus to discover event schemas on.
   159  	SourceArn pulumi.StringInput
   160  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   161  	Tags pulumi.StringMapInput
   162  }
   163  
   164  func (DiscovererArgs) ElementType() reflect.Type {
   165  	return reflect.TypeOf((*discovererArgs)(nil)).Elem()
   166  }
   167  
   168  type DiscovererInput interface {
   169  	pulumi.Input
   170  
   171  	ToDiscovererOutput() DiscovererOutput
   172  	ToDiscovererOutputWithContext(ctx context.Context) DiscovererOutput
   173  }
   174  
   175  func (*Discoverer) ElementType() reflect.Type {
   176  	return reflect.TypeOf((**Discoverer)(nil)).Elem()
   177  }
   178  
   179  func (i *Discoverer) ToDiscovererOutput() DiscovererOutput {
   180  	return i.ToDiscovererOutputWithContext(context.Background())
   181  }
   182  
   183  func (i *Discoverer) ToDiscovererOutputWithContext(ctx context.Context) DiscovererOutput {
   184  	return pulumi.ToOutputWithContext(ctx, i).(DiscovererOutput)
   185  }
   186  
   187  // DiscovererArrayInput is an input type that accepts DiscovererArray and DiscovererArrayOutput values.
   188  // You can construct a concrete instance of `DiscovererArrayInput` via:
   189  //
   190  //	DiscovererArray{ DiscovererArgs{...} }
   191  type DiscovererArrayInput interface {
   192  	pulumi.Input
   193  
   194  	ToDiscovererArrayOutput() DiscovererArrayOutput
   195  	ToDiscovererArrayOutputWithContext(context.Context) DiscovererArrayOutput
   196  }
   197  
   198  type DiscovererArray []DiscovererInput
   199  
   200  func (DiscovererArray) ElementType() reflect.Type {
   201  	return reflect.TypeOf((*[]*Discoverer)(nil)).Elem()
   202  }
   203  
   204  func (i DiscovererArray) ToDiscovererArrayOutput() DiscovererArrayOutput {
   205  	return i.ToDiscovererArrayOutputWithContext(context.Background())
   206  }
   207  
   208  func (i DiscovererArray) ToDiscovererArrayOutputWithContext(ctx context.Context) DiscovererArrayOutput {
   209  	return pulumi.ToOutputWithContext(ctx, i).(DiscovererArrayOutput)
   210  }
   211  
   212  // DiscovererMapInput is an input type that accepts DiscovererMap and DiscovererMapOutput values.
   213  // You can construct a concrete instance of `DiscovererMapInput` via:
   214  //
   215  //	DiscovererMap{ "key": DiscovererArgs{...} }
   216  type DiscovererMapInput interface {
   217  	pulumi.Input
   218  
   219  	ToDiscovererMapOutput() DiscovererMapOutput
   220  	ToDiscovererMapOutputWithContext(context.Context) DiscovererMapOutput
   221  }
   222  
   223  type DiscovererMap map[string]DiscovererInput
   224  
   225  func (DiscovererMap) ElementType() reflect.Type {
   226  	return reflect.TypeOf((*map[string]*Discoverer)(nil)).Elem()
   227  }
   228  
   229  func (i DiscovererMap) ToDiscovererMapOutput() DiscovererMapOutput {
   230  	return i.ToDiscovererMapOutputWithContext(context.Background())
   231  }
   232  
   233  func (i DiscovererMap) ToDiscovererMapOutputWithContext(ctx context.Context) DiscovererMapOutput {
   234  	return pulumi.ToOutputWithContext(ctx, i).(DiscovererMapOutput)
   235  }
   236  
   237  type DiscovererOutput struct{ *pulumi.OutputState }
   238  
   239  func (DiscovererOutput) ElementType() reflect.Type {
   240  	return reflect.TypeOf((**Discoverer)(nil)).Elem()
   241  }
   242  
   243  func (o DiscovererOutput) ToDiscovererOutput() DiscovererOutput {
   244  	return o
   245  }
   246  
   247  func (o DiscovererOutput) ToDiscovererOutputWithContext(ctx context.Context) DiscovererOutput {
   248  	return o
   249  }
   250  
   251  // The Amazon Resource Name (ARN) of the discoverer.
   252  func (o DiscovererOutput) Arn() pulumi.StringOutput {
   253  	return o.ApplyT(func(v *Discoverer) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   254  }
   255  
   256  // The description of the discoverer. Maximum of 256 characters.
   257  func (o DiscovererOutput) Description() pulumi.StringPtrOutput {
   258  	return o.ApplyT(func(v *Discoverer) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   259  }
   260  
   261  // The ARN of the event bus to discover event schemas on.
   262  func (o DiscovererOutput) SourceArn() pulumi.StringOutput {
   263  	return o.ApplyT(func(v *Discoverer) pulumi.StringOutput { return v.SourceArn }).(pulumi.StringOutput)
   264  }
   265  
   266  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   267  func (o DiscovererOutput) Tags() pulumi.StringMapOutput {
   268  	return o.ApplyT(func(v *Discoverer) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   269  }
   270  
   271  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   272  //
   273  // Deprecated: Please use `tags` instead.
   274  func (o DiscovererOutput) TagsAll() pulumi.StringMapOutput {
   275  	return o.ApplyT(func(v *Discoverer) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   276  }
   277  
   278  type DiscovererArrayOutput struct{ *pulumi.OutputState }
   279  
   280  func (DiscovererArrayOutput) ElementType() reflect.Type {
   281  	return reflect.TypeOf((*[]*Discoverer)(nil)).Elem()
   282  }
   283  
   284  func (o DiscovererArrayOutput) ToDiscovererArrayOutput() DiscovererArrayOutput {
   285  	return o
   286  }
   287  
   288  func (o DiscovererArrayOutput) ToDiscovererArrayOutputWithContext(ctx context.Context) DiscovererArrayOutput {
   289  	return o
   290  }
   291  
   292  func (o DiscovererArrayOutput) Index(i pulumi.IntInput) DiscovererOutput {
   293  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Discoverer {
   294  		return vs[0].([]*Discoverer)[vs[1].(int)]
   295  	}).(DiscovererOutput)
   296  }
   297  
   298  type DiscovererMapOutput struct{ *pulumi.OutputState }
   299  
   300  func (DiscovererMapOutput) ElementType() reflect.Type {
   301  	return reflect.TypeOf((*map[string]*Discoverer)(nil)).Elem()
   302  }
   303  
   304  func (o DiscovererMapOutput) ToDiscovererMapOutput() DiscovererMapOutput {
   305  	return o
   306  }
   307  
   308  func (o DiscovererMapOutput) ToDiscovererMapOutputWithContext(ctx context.Context) DiscovererMapOutput {
   309  	return o
   310  }
   311  
   312  func (o DiscovererMapOutput) MapIndex(k pulumi.StringInput) DiscovererOutput {
   313  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Discoverer {
   314  		return vs[0].(map[string]*Discoverer)[vs[1].(string)]
   315  	}).(DiscovererOutput)
   316  }
   317  
   318  func init() {
   319  	pulumi.RegisterInputType(reflect.TypeOf((*DiscovererInput)(nil)).Elem(), &Discoverer{})
   320  	pulumi.RegisterInputType(reflect.TypeOf((*DiscovererArrayInput)(nil)).Elem(), DiscovererArray{})
   321  	pulumi.RegisterInputType(reflect.TypeOf((*DiscovererMapInput)(nil)).Elem(), DiscovererMap{})
   322  	pulumi.RegisterOutputType(DiscovererOutput{})
   323  	pulumi.RegisterOutputType(DiscovererArrayOutput{})
   324  	pulumi.RegisterOutputType(DiscovererMapOutput{})
   325  }