github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/amp/alertManagerDefinition.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 amp
     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  // Manages an Amazon Managed Service for Prometheus (AMP) Alert Manager Definition
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amp"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			demo, err := amp.NewWorkspace(ctx, "demo", nil)
    33  //			if err != nil {
    34  //				return err
    35  //			}
    36  //			_, err = amp.NewAlertManagerDefinition(ctx, "demo", &amp.AlertManagerDefinitionArgs{
    37  //				WorkspaceId: demo.ID(),
    38  //				Definition: pulumi.String(`alertmanager_config: |
    39  //	  route:
    40  //	    receiver: 'default'
    41  //	  receivers:
    42  //	    - name: 'default'
    43  //
    44  // `),
    45  //
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ## Import
    58  //
    59  // Using `pulumi import`, import the prometheus alert manager definition using the workspace identifier. For example:
    60  //
    61  // ```sh
    62  // $ pulumi import aws:amp/alertManagerDefinition:AlertManagerDefinition demo ws-C6DCB907-F2D7-4D96-957B-66691F865D8B
    63  // ```
    64  type AlertManagerDefinition struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
    68  	Definition pulumi.StringOutput `pulumi:"definition"`
    69  	// ID of the prometheus workspace the alert manager definition should be linked to
    70  	WorkspaceId pulumi.StringOutput `pulumi:"workspaceId"`
    71  }
    72  
    73  // NewAlertManagerDefinition registers a new resource with the given unique name, arguments, and options.
    74  func NewAlertManagerDefinition(ctx *pulumi.Context,
    75  	name string, args *AlertManagerDefinitionArgs, opts ...pulumi.ResourceOption) (*AlertManagerDefinition, error) {
    76  	if args == nil {
    77  		return nil, errors.New("missing one or more required arguments")
    78  	}
    79  
    80  	if args.Definition == nil {
    81  		return nil, errors.New("invalid value for required argument 'Definition'")
    82  	}
    83  	if args.WorkspaceId == nil {
    84  		return nil, errors.New("invalid value for required argument 'WorkspaceId'")
    85  	}
    86  	opts = internal.PkgResourceDefaultOpts(opts)
    87  	var resource AlertManagerDefinition
    88  	err := ctx.RegisterResource("aws:amp/alertManagerDefinition:AlertManagerDefinition", name, args, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // GetAlertManagerDefinition gets an existing AlertManagerDefinition resource's state with the given name, ID, and optional
    96  // state properties that are used to uniquely qualify the lookup (nil if not required).
    97  func GetAlertManagerDefinition(ctx *pulumi.Context,
    98  	name string, id pulumi.IDInput, state *AlertManagerDefinitionState, opts ...pulumi.ResourceOption) (*AlertManagerDefinition, error) {
    99  	var resource AlertManagerDefinition
   100  	err := ctx.ReadResource("aws:amp/alertManagerDefinition:AlertManagerDefinition", name, id, state, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // Input properties used for looking up and filtering AlertManagerDefinition resources.
   108  type alertManagerDefinitionState struct {
   109  	// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
   110  	Definition *string `pulumi:"definition"`
   111  	// ID of the prometheus workspace the alert manager definition should be linked to
   112  	WorkspaceId *string `pulumi:"workspaceId"`
   113  }
   114  
   115  type AlertManagerDefinitionState struct {
   116  	// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
   117  	Definition pulumi.StringPtrInput
   118  	// ID of the prometheus workspace the alert manager definition should be linked to
   119  	WorkspaceId pulumi.StringPtrInput
   120  }
   121  
   122  func (AlertManagerDefinitionState) ElementType() reflect.Type {
   123  	return reflect.TypeOf((*alertManagerDefinitionState)(nil)).Elem()
   124  }
   125  
   126  type alertManagerDefinitionArgs struct {
   127  	// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
   128  	Definition string `pulumi:"definition"`
   129  	// ID of the prometheus workspace the alert manager definition should be linked to
   130  	WorkspaceId string `pulumi:"workspaceId"`
   131  }
   132  
   133  // The set of arguments for constructing a AlertManagerDefinition resource.
   134  type AlertManagerDefinitionArgs struct {
   135  	// the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
   136  	Definition pulumi.StringInput
   137  	// ID of the prometheus workspace the alert manager definition should be linked to
   138  	WorkspaceId pulumi.StringInput
   139  }
   140  
   141  func (AlertManagerDefinitionArgs) ElementType() reflect.Type {
   142  	return reflect.TypeOf((*alertManagerDefinitionArgs)(nil)).Elem()
   143  }
   144  
   145  type AlertManagerDefinitionInput interface {
   146  	pulumi.Input
   147  
   148  	ToAlertManagerDefinitionOutput() AlertManagerDefinitionOutput
   149  	ToAlertManagerDefinitionOutputWithContext(ctx context.Context) AlertManagerDefinitionOutput
   150  }
   151  
   152  func (*AlertManagerDefinition) ElementType() reflect.Type {
   153  	return reflect.TypeOf((**AlertManagerDefinition)(nil)).Elem()
   154  }
   155  
   156  func (i *AlertManagerDefinition) ToAlertManagerDefinitionOutput() AlertManagerDefinitionOutput {
   157  	return i.ToAlertManagerDefinitionOutputWithContext(context.Background())
   158  }
   159  
   160  func (i *AlertManagerDefinition) ToAlertManagerDefinitionOutputWithContext(ctx context.Context) AlertManagerDefinitionOutput {
   161  	return pulumi.ToOutputWithContext(ctx, i).(AlertManagerDefinitionOutput)
   162  }
   163  
   164  // AlertManagerDefinitionArrayInput is an input type that accepts AlertManagerDefinitionArray and AlertManagerDefinitionArrayOutput values.
   165  // You can construct a concrete instance of `AlertManagerDefinitionArrayInput` via:
   166  //
   167  //	AlertManagerDefinitionArray{ AlertManagerDefinitionArgs{...} }
   168  type AlertManagerDefinitionArrayInput interface {
   169  	pulumi.Input
   170  
   171  	ToAlertManagerDefinitionArrayOutput() AlertManagerDefinitionArrayOutput
   172  	ToAlertManagerDefinitionArrayOutputWithContext(context.Context) AlertManagerDefinitionArrayOutput
   173  }
   174  
   175  type AlertManagerDefinitionArray []AlertManagerDefinitionInput
   176  
   177  func (AlertManagerDefinitionArray) ElementType() reflect.Type {
   178  	return reflect.TypeOf((*[]*AlertManagerDefinition)(nil)).Elem()
   179  }
   180  
   181  func (i AlertManagerDefinitionArray) ToAlertManagerDefinitionArrayOutput() AlertManagerDefinitionArrayOutput {
   182  	return i.ToAlertManagerDefinitionArrayOutputWithContext(context.Background())
   183  }
   184  
   185  func (i AlertManagerDefinitionArray) ToAlertManagerDefinitionArrayOutputWithContext(ctx context.Context) AlertManagerDefinitionArrayOutput {
   186  	return pulumi.ToOutputWithContext(ctx, i).(AlertManagerDefinitionArrayOutput)
   187  }
   188  
   189  // AlertManagerDefinitionMapInput is an input type that accepts AlertManagerDefinitionMap and AlertManagerDefinitionMapOutput values.
   190  // You can construct a concrete instance of `AlertManagerDefinitionMapInput` via:
   191  //
   192  //	AlertManagerDefinitionMap{ "key": AlertManagerDefinitionArgs{...} }
   193  type AlertManagerDefinitionMapInput interface {
   194  	pulumi.Input
   195  
   196  	ToAlertManagerDefinitionMapOutput() AlertManagerDefinitionMapOutput
   197  	ToAlertManagerDefinitionMapOutputWithContext(context.Context) AlertManagerDefinitionMapOutput
   198  }
   199  
   200  type AlertManagerDefinitionMap map[string]AlertManagerDefinitionInput
   201  
   202  func (AlertManagerDefinitionMap) ElementType() reflect.Type {
   203  	return reflect.TypeOf((*map[string]*AlertManagerDefinition)(nil)).Elem()
   204  }
   205  
   206  func (i AlertManagerDefinitionMap) ToAlertManagerDefinitionMapOutput() AlertManagerDefinitionMapOutput {
   207  	return i.ToAlertManagerDefinitionMapOutputWithContext(context.Background())
   208  }
   209  
   210  func (i AlertManagerDefinitionMap) ToAlertManagerDefinitionMapOutputWithContext(ctx context.Context) AlertManagerDefinitionMapOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(AlertManagerDefinitionMapOutput)
   212  }
   213  
   214  type AlertManagerDefinitionOutput struct{ *pulumi.OutputState }
   215  
   216  func (AlertManagerDefinitionOutput) ElementType() reflect.Type {
   217  	return reflect.TypeOf((**AlertManagerDefinition)(nil)).Elem()
   218  }
   219  
   220  func (o AlertManagerDefinitionOutput) ToAlertManagerDefinitionOutput() AlertManagerDefinitionOutput {
   221  	return o
   222  }
   223  
   224  func (o AlertManagerDefinitionOutput) ToAlertManagerDefinitionOutputWithContext(ctx context.Context) AlertManagerDefinitionOutput {
   225  	return o
   226  }
   227  
   228  // the alert manager definition that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html).
   229  func (o AlertManagerDefinitionOutput) Definition() pulumi.StringOutput {
   230  	return o.ApplyT(func(v *AlertManagerDefinition) pulumi.StringOutput { return v.Definition }).(pulumi.StringOutput)
   231  }
   232  
   233  // ID of the prometheus workspace the alert manager definition should be linked to
   234  func (o AlertManagerDefinitionOutput) WorkspaceId() pulumi.StringOutput {
   235  	return o.ApplyT(func(v *AlertManagerDefinition) pulumi.StringOutput { return v.WorkspaceId }).(pulumi.StringOutput)
   236  }
   237  
   238  type AlertManagerDefinitionArrayOutput struct{ *pulumi.OutputState }
   239  
   240  func (AlertManagerDefinitionArrayOutput) ElementType() reflect.Type {
   241  	return reflect.TypeOf((*[]*AlertManagerDefinition)(nil)).Elem()
   242  }
   243  
   244  func (o AlertManagerDefinitionArrayOutput) ToAlertManagerDefinitionArrayOutput() AlertManagerDefinitionArrayOutput {
   245  	return o
   246  }
   247  
   248  func (o AlertManagerDefinitionArrayOutput) ToAlertManagerDefinitionArrayOutputWithContext(ctx context.Context) AlertManagerDefinitionArrayOutput {
   249  	return o
   250  }
   251  
   252  func (o AlertManagerDefinitionArrayOutput) Index(i pulumi.IntInput) AlertManagerDefinitionOutput {
   253  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AlertManagerDefinition {
   254  		return vs[0].([]*AlertManagerDefinition)[vs[1].(int)]
   255  	}).(AlertManagerDefinitionOutput)
   256  }
   257  
   258  type AlertManagerDefinitionMapOutput struct{ *pulumi.OutputState }
   259  
   260  func (AlertManagerDefinitionMapOutput) ElementType() reflect.Type {
   261  	return reflect.TypeOf((*map[string]*AlertManagerDefinition)(nil)).Elem()
   262  }
   263  
   264  func (o AlertManagerDefinitionMapOutput) ToAlertManagerDefinitionMapOutput() AlertManagerDefinitionMapOutput {
   265  	return o
   266  }
   267  
   268  func (o AlertManagerDefinitionMapOutput) ToAlertManagerDefinitionMapOutputWithContext(ctx context.Context) AlertManagerDefinitionMapOutput {
   269  	return o
   270  }
   271  
   272  func (o AlertManagerDefinitionMapOutput) MapIndex(k pulumi.StringInput) AlertManagerDefinitionOutput {
   273  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AlertManagerDefinition {
   274  		return vs[0].(map[string]*AlertManagerDefinition)[vs[1].(string)]
   275  	}).(AlertManagerDefinitionOutput)
   276  }
   277  
   278  func init() {
   279  	pulumi.RegisterInputType(reflect.TypeOf((*AlertManagerDefinitionInput)(nil)).Elem(), &AlertManagerDefinition{})
   280  	pulumi.RegisterInputType(reflect.TypeOf((*AlertManagerDefinitionArrayInput)(nil)).Elem(), AlertManagerDefinitionArray{})
   281  	pulumi.RegisterInputType(reflect.TypeOf((*AlertManagerDefinitionMapInput)(nil)).Elem(), AlertManagerDefinitionMap{})
   282  	pulumi.RegisterOutputType(AlertManagerDefinitionOutput{})
   283  	pulumi.RegisterOutputType(AlertManagerDefinitionArrayOutput{})
   284  	pulumi.RegisterOutputType(AlertManagerDefinitionMapOutput{})
   285  }