github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/amp/ruleGroupNamespace.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) Rule Group Namespace
    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.NewRuleGroupNamespace(ctx, "demo", &amp.RuleGroupNamespaceArgs{
    37  //				Name:        pulumi.String("rules"),
    38  //				WorkspaceId: demo.ID(),
    39  //				Data: pulumi.String(`groups:
    40  //	  - name: test
    41  //	    rules:
    42  //	    - record: metric:recording_rule
    43  //	      expr: avg(rate(container_cpu_usage_seconds_total[5m]))
    44  //
    45  // `),
    46  //
    47  //			})
    48  //			if err != nil {
    49  //				return err
    50  //			}
    51  //			return nil
    52  //		})
    53  //	}
    54  //
    55  // ```
    56  // <!--End PulumiCodeChooser -->
    57  //
    58  // ## Import
    59  //
    60  // Using `pulumi import`, import the prometheus rule group namespace using the arn. For example:
    61  //
    62  // ```sh
    63  // $ pulumi import aws:amp/ruleGroupNamespace:RuleGroupNamespace demo arn:aws:aps:us-west-2:123456789012:rulegroupsnamespace/IDstring/namespace_name
    64  // ```
    65  type RuleGroupNamespace struct {
    66  	pulumi.CustomResourceState
    67  
    68  	// the rule group namespace data that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-Ruler.html).
    69  	Data pulumi.StringOutput `pulumi:"data"`
    70  	// The name of the rule group namespace
    71  	Name pulumi.StringOutput `pulumi:"name"`
    72  	// ID of the prometheus workspace the rule group namespace should be linked to
    73  	WorkspaceId pulumi.StringOutput `pulumi:"workspaceId"`
    74  }
    75  
    76  // NewRuleGroupNamespace registers a new resource with the given unique name, arguments, and options.
    77  func NewRuleGroupNamespace(ctx *pulumi.Context,
    78  	name string, args *RuleGroupNamespaceArgs, opts ...pulumi.ResourceOption) (*RuleGroupNamespace, error) {
    79  	if args == nil {
    80  		return nil, errors.New("missing one or more required arguments")
    81  	}
    82  
    83  	if args.Data == nil {
    84  		return nil, errors.New("invalid value for required argument 'Data'")
    85  	}
    86  	if args.WorkspaceId == nil {
    87  		return nil, errors.New("invalid value for required argument 'WorkspaceId'")
    88  	}
    89  	opts = internal.PkgResourceDefaultOpts(opts)
    90  	var resource RuleGroupNamespace
    91  	err := ctx.RegisterResource("aws:amp/ruleGroupNamespace:RuleGroupNamespace", name, args, &resource, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	return &resource, nil
    96  }
    97  
    98  // GetRuleGroupNamespace gets an existing RuleGroupNamespace 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 GetRuleGroupNamespace(ctx *pulumi.Context,
   101  	name string, id pulumi.IDInput, state *RuleGroupNamespaceState, opts ...pulumi.ResourceOption) (*RuleGroupNamespace, error) {
   102  	var resource RuleGroupNamespace
   103  	err := ctx.ReadResource("aws:amp/ruleGroupNamespace:RuleGroupNamespace", 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 RuleGroupNamespace resources.
   111  type ruleGroupNamespaceState struct {
   112  	// the rule group namespace data that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-Ruler.html).
   113  	Data *string `pulumi:"data"`
   114  	// The name of the rule group namespace
   115  	Name *string `pulumi:"name"`
   116  	// ID of the prometheus workspace the rule group namespace should be linked to
   117  	WorkspaceId *string `pulumi:"workspaceId"`
   118  }
   119  
   120  type RuleGroupNamespaceState struct {
   121  	// the rule group namespace data that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-Ruler.html).
   122  	Data pulumi.StringPtrInput
   123  	// The name of the rule group namespace
   124  	Name pulumi.StringPtrInput
   125  	// ID of the prometheus workspace the rule group namespace should be linked to
   126  	WorkspaceId pulumi.StringPtrInput
   127  }
   128  
   129  func (RuleGroupNamespaceState) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*ruleGroupNamespaceState)(nil)).Elem()
   131  }
   132  
   133  type ruleGroupNamespaceArgs struct {
   134  	// the rule group namespace data that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-Ruler.html).
   135  	Data string `pulumi:"data"`
   136  	// The name of the rule group namespace
   137  	Name *string `pulumi:"name"`
   138  	// ID of the prometheus workspace the rule group namespace should be linked to
   139  	WorkspaceId string `pulumi:"workspaceId"`
   140  }
   141  
   142  // The set of arguments for constructing a RuleGroupNamespace resource.
   143  type RuleGroupNamespaceArgs struct {
   144  	// the rule group namespace data that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-Ruler.html).
   145  	Data pulumi.StringInput
   146  	// The name of the rule group namespace
   147  	Name pulumi.StringPtrInput
   148  	// ID of the prometheus workspace the rule group namespace should be linked to
   149  	WorkspaceId pulumi.StringInput
   150  }
   151  
   152  func (RuleGroupNamespaceArgs) ElementType() reflect.Type {
   153  	return reflect.TypeOf((*ruleGroupNamespaceArgs)(nil)).Elem()
   154  }
   155  
   156  type RuleGroupNamespaceInput interface {
   157  	pulumi.Input
   158  
   159  	ToRuleGroupNamespaceOutput() RuleGroupNamespaceOutput
   160  	ToRuleGroupNamespaceOutputWithContext(ctx context.Context) RuleGroupNamespaceOutput
   161  }
   162  
   163  func (*RuleGroupNamespace) ElementType() reflect.Type {
   164  	return reflect.TypeOf((**RuleGroupNamespace)(nil)).Elem()
   165  }
   166  
   167  func (i *RuleGroupNamespace) ToRuleGroupNamespaceOutput() RuleGroupNamespaceOutput {
   168  	return i.ToRuleGroupNamespaceOutputWithContext(context.Background())
   169  }
   170  
   171  func (i *RuleGroupNamespace) ToRuleGroupNamespaceOutputWithContext(ctx context.Context) RuleGroupNamespaceOutput {
   172  	return pulumi.ToOutputWithContext(ctx, i).(RuleGroupNamespaceOutput)
   173  }
   174  
   175  // RuleGroupNamespaceArrayInput is an input type that accepts RuleGroupNamespaceArray and RuleGroupNamespaceArrayOutput values.
   176  // You can construct a concrete instance of `RuleGroupNamespaceArrayInput` via:
   177  //
   178  //	RuleGroupNamespaceArray{ RuleGroupNamespaceArgs{...} }
   179  type RuleGroupNamespaceArrayInput interface {
   180  	pulumi.Input
   181  
   182  	ToRuleGroupNamespaceArrayOutput() RuleGroupNamespaceArrayOutput
   183  	ToRuleGroupNamespaceArrayOutputWithContext(context.Context) RuleGroupNamespaceArrayOutput
   184  }
   185  
   186  type RuleGroupNamespaceArray []RuleGroupNamespaceInput
   187  
   188  func (RuleGroupNamespaceArray) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*[]*RuleGroupNamespace)(nil)).Elem()
   190  }
   191  
   192  func (i RuleGroupNamespaceArray) ToRuleGroupNamespaceArrayOutput() RuleGroupNamespaceArrayOutput {
   193  	return i.ToRuleGroupNamespaceArrayOutputWithContext(context.Background())
   194  }
   195  
   196  func (i RuleGroupNamespaceArray) ToRuleGroupNamespaceArrayOutputWithContext(ctx context.Context) RuleGroupNamespaceArrayOutput {
   197  	return pulumi.ToOutputWithContext(ctx, i).(RuleGroupNamespaceArrayOutput)
   198  }
   199  
   200  // RuleGroupNamespaceMapInput is an input type that accepts RuleGroupNamespaceMap and RuleGroupNamespaceMapOutput values.
   201  // You can construct a concrete instance of `RuleGroupNamespaceMapInput` via:
   202  //
   203  //	RuleGroupNamespaceMap{ "key": RuleGroupNamespaceArgs{...} }
   204  type RuleGroupNamespaceMapInput interface {
   205  	pulumi.Input
   206  
   207  	ToRuleGroupNamespaceMapOutput() RuleGroupNamespaceMapOutput
   208  	ToRuleGroupNamespaceMapOutputWithContext(context.Context) RuleGroupNamespaceMapOutput
   209  }
   210  
   211  type RuleGroupNamespaceMap map[string]RuleGroupNamespaceInput
   212  
   213  func (RuleGroupNamespaceMap) ElementType() reflect.Type {
   214  	return reflect.TypeOf((*map[string]*RuleGroupNamespace)(nil)).Elem()
   215  }
   216  
   217  func (i RuleGroupNamespaceMap) ToRuleGroupNamespaceMapOutput() RuleGroupNamespaceMapOutput {
   218  	return i.ToRuleGroupNamespaceMapOutputWithContext(context.Background())
   219  }
   220  
   221  func (i RuleGroupNamespaceMap) ToRuleGroupNamespaceMapOutputWithContext(ctx context.Context) RuleGroupNamespaceMapOutput {
   222  	return pulumi.ToOutputWithContext(ctx, i).(RuleGroupNamespaceMapOutput)
   223  }
   224  
   225  type RuleGroupNamespaceOutput struct{ *pulumi.OutputState }
   226  
   227  func (RuleGroupNamespaceOutput) ElementType() reflect.Type {
   228  	return reflect.TypeOf((**RuleGroupNamespace)(nil)).Elem()
   229  }
   230  
   231  func (o RuleGroupNamespaceOutput) ToRuleGroupNamespaceOutput() RuleGroupNamespaceOutput {
   232  	return o
   233  }
   234  
   235  func (o RuleGroupNamespaceOutput) ToRuleGroupNamespaceOutputWithContext(ctx context.Context) RuleGroupNamespaceOutput {
   236  	return o
   237  }
   238  
   239  // the rule group namespace data that you want to be applied. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-Ruler.html).
   240  func (o RuleGroupNamespaceOutput) Data() pulumi.StringOutput {
   241  	return o.ApplyT(func(v *RuleGroupNamespace) pulumi.StringOutput { return v.Data }).(pulumi.StringOutput)
   242  }
   243  
   244  // The name of the rule group namespace
   245  func (o RuleGroupNamespaceOutput) Name() pulumi.StringOutput {
   246  	return o.ApplyT(func(v *RuleGroupNamespace) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   247  }
   248  
   249  // ID of the prometheus workspace the rule group namespace should be linked to
   250  func (o RuleGroupNamespaceOutput) WorkspaceId() pulumi.StringOutput {
   251  	return o.ApplyT(func(v *RuleGroupNamespace) pulumi.StringOutput { return v.WorkspaceId }).(pulumi.StringOutput)
   252  }
   253  
   254  type RuleGroupNamespaceArrayOutput struct{ *pulumi.OutputState }
   255  
   256  func (RuleGroupNamespaceArrayOutput) ElementType() reflect.Type {
   257  	return reflect.TypeOf((*[]*RuleGroupNamespace)(nil)).Elem()
   258  }
   259  
   260  func (o RuleGroupNamespaceArrayOutput) ToRuleGroupNamespaceArrayOutput() RuleGroupNamespaceArrayOutput {
   261  	return o
   262  }
   263  
   264  func (o RuleGroupNamespaceArrayOutput) ToRuleGroupNamespaceArrayOutputWithContext(ctx context.Context) RuleGroupNamespaceArrayOutput {
   265  	return o
   266  }
   267  
   268  func (o RuleGroupNamespaceArrayOutput) Index(i pulumi.IntInput) RuleGroupNamespaceOutput {
   269  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RuleGroupNamespace {
   270  		return vs[0].([]*RuleGroupNamespace)[vs[1].(int)]
   271  	}).(RuleGroupNamespaceOutput)
   272  }
   273  
   274  type RuleGroupNamespaceMapOutput struct{ *pulumi.OutputState }
   275  
   276  func (RuleGroupNamespaceMapOutput) ElementType() reflect.Type {
   277  	return reflect.TypeOf((*map[string]*RuleGroupNamespace)(nil)).Elem()
   278  }
   279  
   280  func (o RuleGroupNamespaceMapOutput) ToRuleGroupNamespaceMapOutput() RuleGroupNamespaceMapOutput {
   281  	return o
   282  }
   283  
   284  func (o RuleGroupNamespaceMapOutput) ToRuleGroupNamespaceMapOutputWithContext(ctx context.Context) RuleGroupNamespaceMapOutput {
   285  	return o
   286  }
   287  
   288  func (o RuleGroupNamespaceMapOutput) MapIndex(k pulumi.StringInput) RuleGroupNamespaceOutput {
   289  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RuleGroupNamespace {
   290  		return vs[0].(map[string]*RuleGroupNamespace)[vs[1].(string)]
   291  	}).(RuleGroupNamespaceOutput)
   292  }
   293  
   294  func init() {
   295  	pulumi.RegisterInputType(reflect.TypeOf((*RuleGroupNamespaceInput)(nil)).Elem(), &RuleGroupNamespace{})
   296  	pulumi.RegisterInputType(reflect.TypeOf((*RuleGroupNamespaceArrayInput)(nil)).Elem(), RuleGroupNamespaceArray{})
   297  	pulumi.RegisterInputType(reflect.TypeOf((*RuleGroupNamespaceMapInput)(nil)).Elem(), RuleGroupNamespaceMap{})
   298  	pulumi.RegisterOutputType(RuleGroupNamespaceOutput{})
   299  	pulumi.RegisterOutputType(RuleGroupNamespaceArrayOutput{})
   300  	pulumi.RegisterOutputType(RuleGroupNamespaceMapOutput{})
   301  }