github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/applicationinsights/application.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 applicationinsights
     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 a ApplicationInsights Application resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"encoding/json"
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/applicationinsights"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/resourcegroups"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    36  //				"ResourceTypeFilters": []string{
    37  //					"AWS::EC2::Instance",
    38  //				},
    39  //				"TagFilters": []map[string]interface{}{
    40  //					map[string]interface{}{
    41  //						"Key": "Stage",
    42  //						"Values": []string{
    43  //							"Test",
    44  //						},
    45  //					},
    46  //				},
    47  //			})
    48  //			if err != nil {
    49  //				return err
    50  //			}
    51  //			json0 := string(tmpJSON0)
    52  //			exampleGroup, err := resourcegroups.NewGroup(ctx, "example", &resourcegroups.GroupArgs{
    53  //				Name: pulumi.String("example"),
    54  //				ResourceQuery: &resourcegroups.GroupResourceQueryArgs{
    55  //					Query: pulumi.String(json0),
    56  //				},
    57  //			})
    58  //			if err != nil {
    59  //				return err
    60  //			}
    61  //			_, err = applicationinsights.NewApplication(ctx, "example", &applicationinsights.ApplicationArgs{
    62  //				ResourceGroupName: exampleGroup.Name,
    63  //			})
    64  //			if err != nil {
    65  //				return err
    66  //			}
    67  //			return nil
    68  //		})
    69  //	}
    70  //
    71  // ```
    72  // <!--End PulumiCodeChooser -->
    73  //
    74  // ## Import
    75  //
    76  // Using `pulumi import`, import ApplicationInsights Applications using the `resource_group_name`. For example:
    77  //
    78  // ```sh
    79  // $ pulumi import aws:applicationinsights/application:Application some some-application
    80  // ```
    81  type Application struct {
    82  	pulumi.CustomResourceState
    83  
    84  	// ARN of the Application.
    85  	Arn pulumi.StringOutput `pulumi:"arn"`
    86  	// Indicates whether Application Insights automatically configures unmonitored resources in the resource group.
    87  	AutoConfigEnabled pulumi.BoolPtrOutput `pulumi:"autoConfigEnabled"`
    88  	// Configures all of the resources in the resource group by applying the recommended configurations.
    89  	AutoCreate pulumi.BoolPtrOutput `pulumi:"autoCreate"`
    90  	// Indicates whether Application Insights can listen to CloudWatch events for the application resources, such as instance terminated, failed deployment, and others.
    91  	CweMonitorEnabled pulumi.BoolPtrOutput `pulumi:"cweMonitorEnabled"`
    92  	// Application Insights can create applications based on a resource group or on an account. To create an account-based application using all of the resources in the account, set this parameter to `ACCOUNT_BASED`.
    93  	GroupingType pulumi.StringPtrOutput `pulumi:"groupingType"`
    94  	// When set to `true`, creates opsItems for any problems detected on an application.
    95  	OpsCenterEnabled pulumi.BoolPtrOutput `pulumi:"opsCenterEnabled"`
    96  	// SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to receive notifications for updates to the opsItem.
    97  	OpsItemSnsTopicArn pulumi.StringPtrOutput `pulumi:"opsItemSnsTopicArn"`
    98  	// Name of the resource group.
    99  	//
   100  	// The following arguments are optional:
   101  	ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
   102  	// 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.
   103  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   104  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   105  	//
   106  	// Deprecated: Please use `tags` instead.
   107  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   108  }
   109  
   110  // NewApplication registers a new resource with the given unique name, arguments, and options.
   111  func NewApplication(ctx *pulumi.Context,
   112  	name string, args *ApplicationArgs, opts ...pulumi.ResourceOption) (*Application, error) {
   113  	if args == nil {
   114  		return nil, errors.New("missing one or more required arguments")
   115  	}
   116  
   117  	if args.ResourceGroupName == nil {
   118  		return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
   119  	}
   120  	opts = internal.PkgResourceDefaultOpts(opts)
   121  	var resource Application
   122  	err := ctx.RegisterResource("aws:applicationinsights/application:Application", name, args, &resource, opts...)
   123  	if err != nil {
   124  		return nil, err
   125  	}
   126  	return &resource, nil
   127  }
   128  
   129  // GetApplication gets an existing Application resource's state with the given name, ID, and optional
   130  // state properties that are used to uniquely qualify the lookup (nil if not required).
   131  func GetApplication(ctx *pulumi.Context,
   132  	name string, id pulumi.IDInput, state *ApplicationState, opts ...pulumi.ResourceOption) (*Application, error) {
   133  	var resource Application
   134  	err := ctx.ReadResource("aws:applicationinsights/application:Application", name, id, state, &resource, opts...)
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	return &resource, nil
   139  }
   140  
   141  // Input properties used for looking up and filtering Application resources.
   142  type applicationState struct {
   143  	// ARN of the Application.
   144  	Arn *string `pulumi:"arn"`
   145  	// Indicates whether Application Insights automatically configures unmonitored resources in the resource group.
   146  	AutoConfigEnabled *bool `pulumi:"autoConfigEnabled"`
   147  	// Configures all of the resources in the resource group by applying the recommended configurations.
   148  	AutoCreate *bool `pulumi:"autoCreate"`
   149  	// Indicates whether Application Insights can listen to CloudWatch events for the application resources, such as instance terminated, failed deployment, and others.
   150  	CweMonitorEnabled *bool `pulumi:"cweMonitorEnabled"`
   151  	// Application Insights can create applications based on a resource group or on an account. To create an account-based application using all of the resources in the account, set this parameter to `ACCOUNT_BASED`.
   152  	GroupingType *string `pulumi:"groupingType"`
   153  	// When set to `true`, creates opsItems for any problems detected on an application.
   154  	OpsCenterEnabled *bool `pulumi:"opsCenterEnabled"`
   155  	// SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to receive notifications for updates to the opsItem.
   156  	OpsItemSnsTopicArn *string `pulumi:"opsItemSnsTopicArn"`
   157  	// Name of the resource group.
   158  	//
   159  	// The following arguments are optional:
   160  	ResourceGroupName *string `pulumi:"resourceGroupName"`
   161  	// 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.
   162  	Tags map[string]string `pulumi:"tags"`
   163  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   164  	//
   165  	// Deprecated: Please use `tags` instead.
   166  	TagsAll map[string]string `pulumi:"tagsAll"`
   167  }
   168  
   169  type ApplicationState struct {
   170  	// ARN of the Application.
   171  	Arn pulumi.StringPtrInput
   172  	// Indicates whether Application Insights automatically configures unmonitored resources in the resource group.
   173  	AutoConfigEnabled pulumi.BoolPtrInput
   174  	// Configures all of the resources in the resource group by applying the recommended configurations.
   175  	AutoCreate pulumi.BoolPtrInput
   176  	// Indicates whether Application Insights can listen to CloudWatch events for the application resources, such as instance terminated, failed deployment, and others.
   177  	CweMonitorEnabled pulumi.BoolPtrInput
   178  	// Application Insights can create applications based on a resource group or on an account. To create an account-based application using all of the resources in the account, set this parameter to `ACCOUNT_BASED`.
   179  	GroupingType pulumi.StringPtrInput
   180  	// When set to `true`, creates opsItems for any problems detected on an application.
   181  	OpsCenterEnabled pulumi.BoolPtrInput
   182  	// SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to receive notifications for updates to the opsItem.
   183  	OpsItemSnsTopicArn pulumi.StringPtrInput
   184  	// Name of the resource group.
   185  	//
   186  	// The following arguments are optional:
   187  	ResourceGroupName pulumi.StringPtrInput
   188  	// 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.
   189  	Tags pulumi.StringMapInput
   190  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   191  	//
   192  	// Deprecated: Please use `tags` instead.
   193  	TagsAll pulumi.StringMapInput
   194  }
   195  
   196  func (ApplicationState) ElementType() reflect.Type {
   197  	return reflect.TypeOf((*applicationState)(nil)).Elem()
   198  }
   199  
   200  type applicationArgs struct {
   201  	// Indicates whether Application Insights automatically configures unmonitored resources in the resource group.
   202  	AutoConfigEnabled *bool `pulumi:"autoConfigEnabled"`
   203  	// Configures all of the resources in the resource group by applying the recommended configurations.
   204  	AutoCreate *bool `pulumi:"autoCreate"`
   205  	// Indicates whether Application Insights can listen to CloudWatch events for the application resources, such as instance terminated, failed deployment, and others.
   206  	CweMonitorEnabled *bool `pulumi:"cweMonitorEnabled"`
   207  	// Application Insights can create applications based on a resource group or on an account. To create an account-based application using all of the resources in the account, set this parameter to `ACCOUNT_BASED`.
   208  	GroupingType *string `pulumi:"groupingType"`
   209  	// When set to `true`, creates opsItems for any problems detected on an application.
   210  	OpsCenterEnabled *bool `pulumi:"opsCenterEnabled"`
   211  	// SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to receive notifications for updates to the opsItem.
   212  	OpsItemSnsTopicArn *string `pulumi:"opsItemSnsTopicArn"`
   213  	// Name of the resource group.
   214  	//
   215  	// The following arguments are optional:
   216  	ResourceGroupName string `pulumi:"resourceGroupName"`
   217  	// 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.
   218  	Tags map[string]string `pulumi:"tags"`
   219  }
   220  
   221  // The set of arguments for constructing a Application resource.
   222  type ApplicationArgs struct {
   223  	// Indicates whether Application Insights automatically configures unmonitored resources in the resource group.
   224  	AutoConfigEnabled pulumi.BoolPtrInput
   225  	// Configures all of the resources in the resource group by applying the recommended configurations.
   226  	AutoCreate pulumi.BoolPtrInput
   227  	// Indicates whether Application Insights can listen to CloudWatch events for the application resources, such as instance terminated, failed deployment, and others.
   228  	CweMonitorEnabled pulumi.BoolPtrInput
   229  	// Application Insights can create applications based on a resource group or on an account. To create an account-based application using all of the resources in the account, set this parameter to `ACCOUNT_BASED`.
   230  	GroupingType pulumi.StringPtrInput
   231  	// When set to `true`, creates opsItems for any problems detected on an application.
   232  	OpsCenterEnabled pulumi.BoolPtrInput
   233  	// SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to receive notifications for updates to the opsItem.
   234  	OpsItemSnsTopicArn pulumi.StringPtrInput
   235  	// Name of the resource group.
   236  	//
   237  	// The following arguments are optional:
   238  	ResourceGroupName pulumi.StringInput
   239  	// 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.
   240  	Tags pulumi.StringMapInput
   241  }
   242  
   243  func (ApplicationArgs) ElementType() reflect.Type {
   244  	return reflect.TypeOf((*applicationArgs)(nil)).Elem()
   245  }
   246  
   247  type ApplicationInput interface {
   248  	pulumi.Input
   249  
   250  	ToApplicationOutput() ApplicationOutput
   251  	ToApplicationOutputWithContext(ctx context.Context) ApplicationOutput
   252  }
   253  
   254  func (*Application) ElementType() reflect.Type {
   255  	return reflect.TypeOf((**Application)(nil)).Elem()
   256  }
   257  
   258  func (i *Application) ToApplicationOutput() ApplicationOutput {
   259  	return i.ToApplicationOutputWithContext(context.Background())
   260  }
   261  
   262  func (i *Application) ToApplicationOutputWithContext(ctx context.Context) ApplicationOutput {
   263  	return pulumi.ToOutputWithContext(ctx, i).(ApplicationOutput)
   264  }
   265  
   266  // ApplicationArrayInput is an input type that accepts ApplicationArray and ApplicationArrayOutput values.
   267  // You can construct a concrete instance of `ApplicationArrayInput` via:
   268  //
   269  //	ApplicationArray{ ApplicationArgs{...} }
   270  type ApplicationArrayInput interface {
   271  	pulumi.Input
   272  
   273  	ToApplicationArrayOutput() ApplicationArrayOutput
   274  	ToApplicationArrayOutputWithContext(context.Context) ApplicationArrayOutput
   275  }
   276  
   277  type ApplicationArray []ApplicationInput
   278  
   279  func (ApplicationArray) ElementType() reflect.Type {
   280  	return reflect.TypeOf((*[]*Application)(nil)).Elem()
   281  }
   282  
   283  func (i ApplicationArray) ToApplicationArrayOutput() ApplicationArrayOutput {
   284  	return i.ToApplicationArrayOutputWithContext(context.Background())
   285  }
   286  
   287  func (i ApplicationArray) ToApplicationArrayOutputWithContext(ctx context.Context) ApplicationArrayOutput {
   288  	return pulumi.ToOutputWithContext(ctx, i).(ApplicationArrayOutput)
   289  }
   290  
   291  // ApplicationMapInput is an input type that accepts ApplicationMap and ApplicationMapOutput values.
   292  // You can construct a concrete instance of `ApplicationMapInput` via:
   293  //
   294  //	ApplicationMap{ "key": ApplicationArgs{...} }
   295  type ApplicationMapInput interface {
   296  	pulumi.Input
   297  
   298  	ToApplicationMapOutput() ApplicationMapOutput
   299  	ToApplicationMapOutputWithContext(context.Context) ApplicationMapOutput
   300  }
   301  
   302  type ApplicationMap map[string]ApplicationInput
   303  
   304  func (ApplicationMap) ElementType() reflect.Type {
   305  	return reflect.TypeOf((*map[string]*Application)(nil)).Elem()
   306  }
   307  
   308  func (i ApplicationMap) ToApplicationMapOutput() ApplicationMapOutput {
   309  	return i.ToApplicationMapOutputWithContext(context.Background())
   310  }
   311  
   312  func (i ApplicationMap) ToApplicationMapOutputWithContext(ctx context.Context) ApplicationMapOutput {
   313  	return pulumi.ToOutputWithContext(ctx, i).(ApplicationMapOutput)
   314  }
   315  
   316  type ApplicationOutput struct{ *pulumi.OutputState }
   317  
   318  func (ApplicationOutput) ElementType() reflect.Type {
   319  	return reflect.TypeOf((**Application)(nil)).Elem()
   320  }
   321  
   322  func (o ApplicationOutput) ToApplicationOutput() ApplicationOutput {
   323  	return o
   324  }
   325  
   326  func (o ApplicationOutput) ToApplicationOutputWithContext(ctx context.Context) ApplicationOutput {
   327  	return o
   328  }
   329  
   330  // ARN of the Application.
   331  func (o ApplicationOutput) Arn() pulumi.StringOutput {
   332  	return o.ApplyT(func(v *Application) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   333  }
   334  
   335  // Indicates whether Application Insights automatically configures unmonitored resources in the resource group.
   336  func (o ApplicationOutput) AutoConfigEnabled() pulumi.BoolPtrOutput {
   337  	return o.ApplyT(func(v *Application) pulumi.BoolPtrOutput { return v.AutoConfigEnabled }).(pulumi.BoolPtrOutput)
   338  }
   339  
   340  // Configures all of the resources in the resource group by applying the recommended configurations.
   341  func (o ApplicationOutput) AutoCreate() pulumi.BoolPtrOutput {
   342  	return o.ApplyT(func(v *Application) pulumi.BoolPtrOutput { return v.AutoCreate }).(pulumi.BoolPtrOutput)
   343  }
   344  
   345  // Indicates whether Application Insights can listen to CloudWatch events for the application resources, such as instance terminated, failed deployment, and others.
   346  func (o ApplicationOutput) CweMonitorEnabled() pulumi.BoolPtrOutput {
   347  	return o.ApplyT(func(v *Application) pulumi.BoolPtrOutput { return v.CweMonitorEnabled }).(pulumi.BoolPtrOutput)
   348  }
   349  
   350  // Application Insights can create applications based on a resource group or on an account. To create an account-based application using all of the resources in the account, set this parameter to `ACCOUNT_BASED`.
   351  func (o ApplicationOutput) GroupingType() pulumi.StringPtrOutput {
   352  	return o.ApplyT(func(v *Application) pulumi.StringPtrOutput { return v.GroupingType }).(pulumi.StringPtrOutput)
   353  }
   354  
   355  // When set to `true`, creates opsItems for any problems detected on an application.
   356  func (o ApplicationOutput) OpsCenterEnabled() pulumi.BoolPtrOutput {
   357  	return o.ApplyT(func(v *Application) pulumi.BoolPtrOutput { return v.OpsCenterEnabled }).(pulumi.BoolPtrOutput)
   358  }
   359  
   360  // SNS topic provided to Application Insights that is associated to the created opsItem. Allows you to receive notifications for updates to the opsItem.
   361  func (o ApplicationOutput) OpsItemSnsTopicArn() pulumi.StringPtrOutput {
   362  	return o.ApplyT(func(v *Application) pulumi.StringPtrOutput { return v.OpsItemSnsTopicArn }).(pulumi.StringPtrOutput)
   363  }
   364  
   365  // Name of the resource group.
   366  //
   367  // The following arguments are optional:
   368  func (o ApplicationOutput) ResourceGroupName() pulumi.StringOutput {
   369  	return o.ApplyT(func(v *Application) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)
   370  }
   371  
   372  // 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.
   373  func (o ApplicationOutput) Tags() pulumi.StringMapOutput {
   374  	return o.ApplyT(func(v *Application) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   375  }
   376  
   377  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   378  //
   379  // Deprecated: Please use `tags` instead.
   380  func (o ApplicationOutput) TagsAll() pulumi.StringMapOutput {
   381  	return o.ApplyT(func(v *Application) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   382  }
   383  
   384  type ApplicationArrayOutput struct{ *pulumi.OutputState }
   385  
   386  func (ApplicationArrayOutput) ElementType() reflect.Type {
   387  	return reflect.TypeOf((*[]*Application)(nil)).Elem()
   388  }
   389  
   390  func (o ApplicationArrayOutput) ToApplicationArrayOutput() ApplicationArrayOutput {
   391  	return o
   392  }
   393  
   394  func (o ApplicationArrayOutput) ToApplicationArrayOutputWithContext(ctx context.Context) ApplicationArrayOutput {
   395  	return o
   396  }
   397  
   398  func (o ApplicationArrayOutput) Index(i pulumi.IntInput) ApplicationOutput {
   399  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Application {
   400  		return vs[0].([]*Application)[vs[1].(int)]
   401  	}).(ApplicationOutput)
   402  }
   403  
   404  type ApplicationMapOutput struct{ *pulumi.OutputState }
   405  
   406  func (ApplicationMapOutput) ElementType() reflect.Type {
   407  	return reflect.TypeOf((*map[string]*Application)(nil)).Elem()
   408  }
   409  
   410  func (o ApplicationMapOutput) ToApplicationMapOutput() ApplicationMapOutput {
   411  	return o
   412  }
   413  
   414  func (o ApplicationMapOutput) ToApplicationMapOutputWithContext(ctx context.Context) ApplicationMapOutput {
   415  	return o
   416  }
   417  
   418  func (o ApplicationMapOutput) MapIndex(k pulumi.StringInput) ApplicationOutput {
   419  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Application {
   420  		return vs[0].(map[string]*Application)[vs[1].(string)]
   421  	}).(ApplicationOutput)
   422  }
   423  
   424  func init() {
   425  	pulumi.RegisterInputType(reflect.TypeOf((*ApplicationInput)(nil)).Elem(), &Application{})
   426  	pulumi.RegisterInputType(reflect.TypeOf((*ApplicationArrayInput)(nil)).Elem(), ApplicationArray{})
   427  	pulumi.RegisterInputType(reflect.TypeOf((*ApplicationMapInput)(nil)).Elem(), ApplicationMap{})
   428  	pulumi.RegisterOutputType(ApplicationOutput{})
   429  	pulumi.RegisterOutputType(ApplicationArrayOutput{})
   430  	pulumi.RegisterOutputType(ApplicationMapOutput{})
   431  }