github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/oam/link.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 oam
     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  // Resource for managing an AWS CloudWatch Observability Access Manager Link.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/oam"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := oam.NewLink(ctx, "example", &oam.LinkArgs{
    35  //				LabelTemplate: pulumi.String("$AccountName"),
    36  //				ResourceTypes: pulumi.StringArray{
    37  //					pulumi.String("AWS::CloudWatch::Metric"),
    38  //				},
    39  //				SinkIdentifier: pulumi.Any(test.Id),
    40  //				Tags: pulumi.StringMap{
    41  //					"Env": pulumi.String("prod"),
    42  //				},
    43  //			})
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			return nil
    48  //		})
    49  //	}
    50  //
    51  // ```
    52  // <!--End PulumiCodeChooser -->
    53  //
    54  // ## Import
    55  //
    56  // Using `pulumi import`, import CloudWatch Observability Access Manager Link using the `arn`. For example:
    57  //
    58  // ```sh
    59  // $ pulumi import aws:oam/link:Link example arn:aws:oam:us-west-2:123456789012:link/link-id
    60  // ```
    61  type Link struct {
    62  	pulumi.CustomResourceState
    63  
    64  	// ARN of the link.
    65  	Arn pulumi.StringOutput `pulumi:"arn"`
    66  	// Label that is assigned to this link.
    67  	Label pulumi.StringOutput `pulumi:"label"`
    68  	// Human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.
    69  	LabelTemplate pulumi.StringOutput `pulumi:"labelTemplate"`
    70  	// ID string that AWS generated as part of the link ARN.
    71  	LinkId pulumi.StringOutput `pulumi:"linkId"`
    72  	// Types of data that the source account shares with the monitoring account.
    73  	ResourceTypes pulumi.StringArrayOutput `pulumi:"resourceTypes"`
    74  	// ARN of the sink that is used for this link.
    75  	SinkArn pulumi.StringOutput `pulumi:"sinkArn"`
    76  	// Identifier of the sink to use to create this link.
    77  	//
    78  	// The following arguments are optional:
    79  	SinkIdentifier pulumi.StringOutput `pulumi:"sinkIdentifier"`
    80  	// 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.
    81  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    82  	// Deprecated: Please use `tags` instead.
    83  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    84  }
    85  
    86  // NewLink registers a new resource with the given unique name, arguments, and options.
    87  func NewLink(ctx *pulumi.Context,
    88  	name string, args *LinkArgs, opts ...pulumi.ResourceOption) (*Link, error) {
    89  	if args == nil {
    90  		return nil, errors.New("missing one or more required arguments")
    91  	}
    92  
    93  	if args.LabelTemplate == nil {
    94  		return nil, errors.New("invalid value for required argument 'LabelTemplate'")
    95  	}
    96  	if args.ResourceTypes == nil {
    97  		return nil, errors.New("invalid value for required argument 'ResourceTypes'")
    98  	}
    99  	if args.SinkIdentifier == nil {
   100  		return nil, errors.New("invalid value for required argument 'SinkIdentifier'")
   101  	}
   102  	opts = internal.PkgResourceDefaultOpts(opts)
   103  	var resource Link
   104  	err := ctx.RegisterResource("aws:oam/link:Link", name, args, &resource, opts...)
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  	return &resource, nil
   109  }
   110  
   111  // GetLink gets an existing Link resource's state with the given name, ID, and optional
   112  // state properties that are used to uniquely qualify the lookup (nil if not required).
   113  func GetLink(ctx *pulumi.Context,
   114  	name string, id pulumi.IDInput, state *LinkState, opts ...pulumi.ResourceOption) (*Link, error) {
   115  	var resource Link
   116  	err := ctx.ReadResource("aws:oam/link:Link", name, id, state, &resource, opts...)
   117  	if err != nil {
   118  		return nil, err
   119  	}
   120  	return &resource, nil
   121  }
   122  
   123  // Input properties used for looking up and filtering Link resources.
   124  type linkState struct {
   125  	// ARN of the link.
   126  	Arn *string `pulumi:"arn"`
   127  	// Label that is assigned to this link.
   128  	Label *string `pulumi:"label"`
   129  	// Human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.
   130  	LabelTemplate *string `pulumi:"labelTemplate"`
   131  	// ID string that AWS generated as part of the link ARN.
   132  	LinkId *string `pulumi:"linkId"`
   133  	// Types of data that the source account shares with the monitoring account.
   134  	ResourceTypes []string `pulumi:"resourceTypes"`
   135  	// ARN of the sink that is used for this link.
   136  	SinkArn *string `pulumi:"sinkArn"`
   137  	// Identifier of the sink to use to create this link.
   138  	//
   139  	// The following arguments are optional:
   140  	SinkIdentifier *string `pulumi:"sinkIdentifier"`
   141  	// 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.
   142  	Tags map[string]string `pulumi:"tags"`
   143  	// Deprecated: Please use `tags` instead.
   144  	TagsAll map[string]string `pulumi:"tagsAll"`
   145  }
   146  
   147  type LinkState struct {
   148  	// ARN of the link.
   149  	Arn pulumi.StringPtrInput
   150  	// Label that is assigned to this link.
   151  	Label pulumi.StringPtrInput
   152  	// Human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.
   153  	LabelTemplate pulumi.StringPtrInput
   154  	// ID string that AWS generated as part of the link ARN.
   155  	LinkId pulumi.StringPtrInput
   156  	// Types of data that the source account shares with the monitoring account.
   157  	ResourceTypes pulumi.StringArrayInput
   158  	// ARN of the sink that is used for this link.
   159  	SinkArn pulumi.StringPtrInput
   160  	// Identifier of the sink to use to create this link.
   161  	//
   162  	// The following arguments are optional:
   163  	SinkIdentifier pulumi.StringPtrInput
   164  	// 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.
   165  	Tags pulumi.StringMapInput
   166  	// Deprecated: Please use `tags` instead.
   167  	TagsAll pulumi.StringMapInput
   168  }
   169  
   170  func (LinkState) ElementType() reflect.Type {
   171  	return reflect.TypeOf((*linkState)(nil)).Elem()
   172  }
   173  
   174  type linkArgs struct {
   175  	// Human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.
   176  	LabelTemplate string `pulumi:"labelTemplate"`
   177  	// Types of data that the source account shares with the monitoring account.
   178  	ResourceTypes []string `pulumi:"resourceTypes"`
   179  	// Identifier of the sink to use to create this link.
   180  	//
   181  	// The following arguments are optional:
   182  	SinkIdentifier string `pulumi:"sinkIdentifier"`
   183  	// 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.
   184  	Tags map[string]string `pulumi:"tags"`
   185  }
   186  
   187  // The set of arguments for constructing a Link resource.
   188  type LinkArgs struct {
   189  	// Human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.
   190  	LabelTemplate pulumi.StringInput
   191  	// Types of data that the source account shares with the monitoring account.
   192  	ResourceTypes pulumi.StringArrayInput
   193  	// Identifier of the sink to use to create this link.
   194  	//
   195  	// The following arguments are optional:
   196  	SinkIdentifier pulumi.StringInput
   197  	// 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.
   198  	Tags pulumi.StringMapInput
   199  }
   200  
   201  func (LinkArgs) ElementType() reflect.Type {
   202  	return reflect.TypeOf((*linkArgs)(nil)).Elem()
   203  }
   204  
   205  type LinkInput interface {
   206  	pulumi.Input
   207  
   208  	ToLinkOutput() LinkOutput
   209  	ToLinkOutputWithContext(ctx context.Context) LinkOutput
   210  }
   211  
   212  func (*Link) ElementType() reflect.Type {
   213  	return reflect.TypeOf((**Link)(nil)).Elem()
   214  }
   215  
   216  func (i *Link) ToLinkOutput() LinkOutput {
   217  	return i.ToLinkOutputWithContext(context.Background())
   218  }
   219  
   220  func (i *Link) ToLinkOutputWithContext(ctx context.Context) LinkOutput {
   221  	return pulumi.ToOutputWithContext(ctx, i).(LinkOutput)
   222  }
   223  
   224  // LinkArrayInput is an input type that accepts LinkArray and LinkArrayOutput values.
   225  // You can construct a concrete instance of `LinkArrayInput` via:
   226  //
   227  //	LinkArray{ LinkArgs{...} }
   228  type LinkArrayInput interface {
   229  	pulumi.Input
   230  
   231  	ToLinkArrayOutput() LinkArrayOutput
   232  	ToLinkArrayOutputWithContext(context.Context) LinkArrayOutput
   233  }
   234  
   235  type LinkArray []LinkInput
   236  
   237  func (LinkArray) ElementType() reflect.Type {
   238  	return reflect.TypeOf((*[]*Link)(nil)).Elem()
   239  }
   240  
   241  func (i LinkArray) ToLinkArrayOutput() LinkArrayOutput {
   242  	return i.ToLinkArrayOutputWithContext(context.Background())
   243  }
   244  
   245  func (i LinkArray) ToLinkArrayOutputWithContext(ctx context.Context) LinkArrayOutput {
   246  	return pulumi.ToOutputWithContext(ctx, i).(LinkArrayOutput)
   247  }
   248  
   249  // LinkMapInput is an input type that accepts LinkMap and LinkMapOutput values.
   250  // You can construct a concrete instance of `LinkMapInput` via:
   251  //
   252  //	LinkMap{ "key": LinkArgs{...} }
   253  type LinkMapInput interface {
   254  	pulumi.Input
   255  
   256  	ToLinkMapOutput() LinkMapOutput
   257  	ToLinkMapOutputWithContext(context.Context) LinkMapOutput
   258  }
   259  
   260  type LinkMap map[string]LinkInput
   261  
   262  func (LinkMap) ElementType() reflect.Type {
   263  	return reflect.TypeOf((*map[string]*Link)(nil)).Elem()
   264  }
   265  
   266  func (i LinkMap) ToLinkMapOutput() LinkMapOutput {
   267  	return i.ToLinkMapOutputWithContext(context.Background())
   268  }
   269  
   270  func (i LinkMap) ToLinkMapOutputWithContext(ctx context.Context) LinkMapOutput {
   271  	return pulumi.ToOutputWithContext(ctx, i).(LinkMapOutput)
   272  }
   273  
   274  type LinkOutput struct{ *pulumi.OutputState }
   275  
   276  func (LinkOutput) ElementType() reflect.Type {
   277  	return reflect.TypeOf((**Link)(nil)).Elem()
   278  }
   279  
   280  func (o LinkOutput) ToLinkOutput() LinkOutput {
   281  	return o
   282  }
   283  
   284  func (o LinkOutput) ToLinkOutputWithContext(ctx context.Context) LinkOutput {
   285  	return o
   286  }
   287  
   288  // ARN of the link.
   289  func (o LinkOutput) Arn() pulumi.StringOutput {
   290  	return o.ApplyT(func(v *Link) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   291  }
   292  
   293  // Label that is assigned to this link.
   294  func (o LinkOutput) Label() pulumi.StringOutput {
   295  	return o.ApplyT(func(v *Link) pulumi.StringOutput { return v.Label }).(pulumi.StringOutput)
   296  }
   297  
   298  // Human-readable name to use to identify this source account when you are viewing data from it in the monitoring account.
   299  func (o LinkOutput) LabelTemplate() pulumi.StringOutput {
   300  	return o.ApplyT(func(v *Link) pulumi.StringOutput { return v.LabelTemplate }).(pulumi.StringOutput)
   301  }
   302  
   303  // ID string that AWS generated as part of the link ARN.
   304  func (o LinkOutput) LinkId() pulumi.StringOutput {
   305  	return o.ApplyT(func(v *Link) pulumi.StringOutput { return v.LinkId }).(pulumi.StringOutput)
   306  }
   307  
   308  // Types of data that the source account shares with the monitoring account.
   309  func (o LinkOutput) ResourceTypes() pulumi.StringArrayOutput {
   310  	return o.ApplyT(func(v *Link) pulumi.StringArrayOutput { return v.ResourceTypes }).(pulumi.StringArrayOutput)
   311  }
   312  
   313  // ARN of the sink that is used for this link.
   314  func (o LinkOutput) SinkArn() pulumi.StringOutput {
   315  	return o.ApplyT(func(v *Link) pulumi.StringOutput { return v.SinkArn }).(pulumi.StringOutput)
   316  }
   317  
   318  // Identifier of the sink to use to create this link.
   319  //
   320  // The following arguments are optional:
   321  func (o LinkOutput) SinkIdentifier() pulumi.StringOutput {
   322  	return o.ApplyT(func(v *Link) pulumi.StringOutput { return v.SinkIdentifier }).(pulumi.StringOutput)
   323  }
   324  
   325  // 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.
   326  func (o LinkOutput) Tags() pulumi.StringMapOutput {
   327  	return o.ApplyT(func(v *Link) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   328  }
   329  
   330  // Deprecated: Please use `tags` instead.
   331  func (o LinkOutput) TagsAll() pulumi.StringMapOutput {
   332  	return o.ApplyT(func(v *Link) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   333  }
   334  
   335  type LinkArrayOutput struct{ *pulumi.OutputState }
   336  
   337  func (LinkArrayOutput) ElementType() reflect.Type {
   338  	return reflect.TypeOf((*[]*Link)(nil)).Elem()
   339  }
   340  
   341  func (o LinkArrayOutput) ToLinkArrayOutput() LinkArrayOutput {
   342  	return o
   343  }
   344  
   345  func (o LinkArrayOutput) ToLinkArrayOutputWithContext(ctx context.Context) LinkArrayOutput {
   346  	return o
   347  }
   348  
   349  func (o LinkArrayOutput) Index(i pulumi.IntInput) LinkOutput {
   350  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Link {
   351  		return vs[0].([]*Link)[vs[1].(int)]
   352  	}).(LinkOutput)
   353  }
   354  
   355  type LinkMapOutput struct{ *pulumi.OutputState }
   356  
   357  func (LinkMapOutput) ElementType() reflect.Type {
   358  	return reflect.TypeOf((*map[string]*Link)(nil)).Elem()
   359  }
   360  
   361  func (o LinkMapOutput) ToLinkMapOutput() LinkMapOutput {
   362  	return o
   363  }
   364  
   365  func (o LinkMapOutput) ToLinkMapOutputWithContext(ctx context.Context) LinkMapOutput {
   366  	return o
   367  }
   368  
   369  func (o LinkMapOutput) MapIndex(k pulumi.StringInput) LinkOutput {
   370  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Link {
   371  		return vs[0].(map[string]*Link)[vs[1].(string)]
   372  	}).(LinkOutput)
   373  }
   374  
   375  func init() {
   376  	pulumi.RegisterInputType(reflect.TypeOf((*LinkInput)(nil)).Elem(), &Link{})
   377  	pulumi.RegisterInputType(reflect.TypeOf((*LinkArrayInput)(nil)).Elem(), LinkArray{})
   378  	pulumi.RegisterInputType(reflect.TypeOf((*LinkMapInput)(nil)).Elem(), LinkMap{})
   379  	pulumi.RegisterOutputType(LinkOutput{})
   380  	pulumi.RegisterOutputType(LinkArrayOutput{})
   381  	pulumi.RegisterOutputType(LinkMapOutput{})
   382  }