github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/rum/metricsDestination.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 rum 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 CloudWatch RUM Metrics Destination resource. 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/rum" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // _, err := rum.NewMetricsDestination(ctx, "example", &rum.MetricsDestinationArgs{ 33 // AppMonitorName: pulumi.Any(exampleAwsRumAppMonitor.Name), 34 // Destination: pulumi.String("CloudWatch"), 35 // }) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 // 46 // ## Import 47 // 48 // Using `pulumi import`, import Cloudwatch RUM Metrics Destination using the `id`. For example: 49 // 50 // ```sh 51 // $ pulumi import aws:rum/metricsDestination:MetricsDestination example example 52 // ``` 53 type MetricsDestination struct { 54 pulumi.CustomResourceState 55 56 // The name of the CloudWatch RUM app monitor that will send the metrics. 57 AppMonitorName pulumi.StringOutput `pulumi:"appMonitorName"` 58 // Defines the destination to send the metrics to. Valid values are `CloudWatch` and `Evidently`. If you specify `Evidently`, you must also specify the ARN of the CloudWatchEvidently experiment that is to be the destination and an IAM role that has permission to write to the experiment. 59 Destination pulumi.StringOutput `pulumi:"destination"` 60 // Use this parameter only if Destination is Evidently. This parameter specifies the ARN of the Evidently experiment that will receive the extended metrics. 61 DestinationArn pulumi.StringPtrOutput `pulumi:"destinationArn"` 62 // This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter. 63 IamRoleArn pulumi.StringPtrOutput `pulumi:"iamRoleArn"` 64 } 65 66 // NewMetricsDestination registers a new resource with the given unique name, arguments, and options. 67 func NewMetricsDestination(ctx *pulumi.Context, 68 name string, args *MetricsDestinationArgs, opts ...pulumi.ResourceOption) (*MetricsDestination, error) { 69 if args == nil { 70 return nil, errors.New("missing one or more required arguments") 71 } 72 73 if args.AppMonitorName == nil { 74 return nil, errors.New("invalid value for required argument 'AppMonitorName'") 75 } 76 if args.Destination == nil { 77 return nil, errors.New("invalid value for required argument 'Destination'") 78 } 79 opts = internal.PkgResourceDefaultOpts(opts) 80 var resource MetricsDestination 81 err := ctx.RegisterResource("aws:rum/metricsDestination:MetricsDestination", name, args, &resource, opts...) 82 if err != nil { 83 return nil, err 84 } 85 return &resource, nil 86 } 87 88 // GetMetricsDestination gets an existing MetricsDestination resource's state with the given name, ID, and optional 89 // state properties that are used to uniquely qualify the lookup (nil if not required). 90 func GetMetricsDestination(ctx *pulumi.Context, 91 name string, id pulumi.IDInput, state *MetricsDestinationState, opts ...pulumi.ResourceOption) (*MetricsDestination, error) { 92 var resource MetricsDestination 93 err := ctx.ReadResource("aws:rum/metricsDestination:MetricsDestination", name, id, state, &resource, opts...) 94 if err != nil { 95 return nil, err 96 } 97 return &resource, nil 98 } 99 100 // Input properties used for looking up and filtering MetricsDestination resources. 101 type metricsDestinationState struct { 102 // The name of the CloudWatch RUM app monitor that will send the metrics. 103 AppMonitorName *string `pulumi:"appMonitorName"` 104 // Defines the destination to send the metrics to. Valid values are `CloudWatch` and `Evidently`. If you specify `Evidently`, you must also specify the ARN of the CloudWatchEvidently experiment that is to be the destination and an IAM role that has permission to write to the experiment. 105 Destination *string `pulumi:"destination"` 106 // Use this parameter only if Destination is Evidently. This parameter specifies the ARN of the Evidently experiment that will receive the extended metrics. 107 DestinationArn *string `pulumi:"destinationArn"` 108 // This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter. 109 IamRoleArn *string `pulumi:"iamRoleArn"` 110 } 111 112 type MetricsDestinationState struct { 113 // The name of the CloudWatch RUM app monitor that will send the metrics. 114 AppMonitorName pulumi.StringPtrInput 115 // Defines the destination to send the metrics to. Valid values are `CloudWatch` and `Evidently`. If you specify `Evidently`, you must also specify the ARN of the CloudWatchEvidently experiment that is to be the destination and an IAM role that has permission to write to the experiment. 116 Destination pulumi.StringPtrInput 117 // Use this parameter only if Destination is Evidently. This parameter specifies the ARN of the Evidently experiment that will receive the extended metrics. 118 DestinationArn pulumi.StringPtrInput 119 // This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter. 120 IamRoleArn pulumi.StringPtrInput 121 } 122 123 func (MetricsDestinationState) ElementType() reflect.Type { 124 return reflect.TypeOf((*metricsDestinationState)(nil)).Elem() 125 } 126 127 type metricsDestinationArgs struct { 128 // The name of the CloudWatch RUM app monitor that will send the metrics. 129 AppMonitorName string `pulumi:"appMonitorName"` 130 // Defines the destination to send the metrics to. Valid values are `CloudWatch` and `Evidently`. If you specify `Evidently`, you must also specify the ARN of the CloudWatchEvidently experiment that is to be the destination and an IAM role that has permission to write to the experiment. 131 Destination string `pulumi:"destination"` 132 // Use this parameter only if Destination is Evidently. This parameter specifies the ARN of the Evidently experiment that will receive the extended metrics. 133 DestinationArn *string `pulumi:"destinationArn"` 134 // This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter. 135 IamRoleArn *string `pulumi:"iamRoleArn"` 136 } 137 138 // The set of arguments for constructing a MetricsDestination resource. 139 type MetricsDestinationArgs struct { 140 // The name of the CloudWatch RUM app monitor that will send the metrics. 141 AppMonitorName pulumi.StringInput 142 // Defines the destination to send the metrics to. Valid values are `CloudWatch` and `Evidently`. If you specify `Evidently`, you must also specify the ARN of the CloudWatchEvidently experiment that is to be the destination and an IAM role that has permission to write to the experiment. 143 Destination pulumi.StringInput 144 // Use this parameter only if Destination is Evidently. This parameter specifies the ARN of the Evidently experiment that will receive the extended metrics. 145 DestinationArn pulumi.StringPtrInput 146 // This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter. 147 IamRoleArn pulumi.StringPtrInput 148 } 149 150 func (MetricsDestinationArgs) ElementType() reflect.Type { 151 return reflect.TypeOf((*metricsDestinationArgs)(nil)).Elem() 152 } 153 154 type MetricsDestinationInput interface { 155 pulumi.Input 156 157 ToMetricsDestinationOutput() MetricsDestinationOutput 158 ToMetricsDestinationOutputWithContext(ctx context.Context) MetricsDestinationOutput 159 } 160 161 func (*MetricsDestination) ElementType() reflect.Type { 162 return reflect.TypeOf((**MetricsDestination)(nil)).Elem() 163 } 164 165 func (i *MetricsDestination) ToMetricsDestinationOutput() MetricsDestinationOutput { 166 return i.ToMetricsDestinationOutputWithContext(context.Background()) 167 } 168 169 func (i *MetricsDestination) ToMetricsDestinationOutputWithContext(ctx context.Context) MetricsDestinationOutput { 170 return pulumi.ToOutputWithContext(ctx, i).(MetricsDestinationOutput) 171 } 172 173 // MetricsDestinationArrayInput is an input type that accepts MetricsDestinationArray and MetricsDestinationArrayOutput values. 174 // You can construct a concrete instance of `MetricsDestinationArrayInput` via: 175 // 176 // MetricsDestinationArray{ MetricsDestinationArgs{...} } 177 type MetricsDestinationArrayInput interface { 178 pulumi.Input 179 180 ToMetricsDestinationArrayOutput() MetricsDestinationArrayOutput 181 ToMetricsDestinationArrayOutputWithContext(context.Context) MetricsDestinationArrayOutput 182 } 183 184 type MetricsDestinationArray []MetricsDestinationInput 185 186 func (MetricsDestinationArray) ElementType() reflect.Type { 187 return reflect.TypeOf((*[]*MetricsDestination)(nil)).Elem() 188 } 189 190 func (i MetricsDestinationArray) ToMetricsDestinationArrayOutput() MetricsDestinationArrayOutput { 191 return i.ToMetricsDestinationArrayOutputWithContext(context.Background()) 192 } 193 194 func (i MetricsDestinationArray) ToMetricsDestinationArrayOutputWithContext(ctx context.Context) MetricsDestinationArrayOutput { 195 return pulumi.ToOutputWithContext(ctx, i).(MetricsDestinationArrayOutput) 196 } 197 198 // MetricsDestinationMapInput is an input type that accepts MetricsDestinationMap and MetricsDestinationMapOutput values. 199 // You can construct a concrete instance of `MetricsDestinationMapInput` via: 200 // 201 // MetricsDestinationMap{ "key": MetricsDestinationArgs{...} } 202 type MetricsDestinationMapInput interface { 203 pulumi.Input 204 205 ToMetricsDestinationMapOutput() MetricsDestinationMapOutput 206 ToMetricsDestinationMapOutputWithContext(context.Context) MetricsDestinationMapOutput 207 } 208 209 type MetricsDestinationMap map[string]MetricsDestinationInput 210 211 func (MetricsDestinationMap) ElementType() reflect.Type { 212 return reflect.TypeOf((*map[string]*MetricsDestination)(nil)).Elem() 213 } 214 215 func (i MetricsDestinationMap) ToMetricsDestinationMapOutput() MetricsDestinationMapOutput { 216 return i.ToMetricsDestinationMapOutputWithContext(context.Background()) 217 } 218 219 func (i MetricsDestinationMap) ToMetricsDestinationMapOutputWithContext(ctx context.Context) MetricsDestinationMapOutput { 220 return pulumi.ToOutputWithContext(ctx, i).(MetricsDestinationMapOutput) 221 } 222 223 type MetricsDestinationOutput struct{ *pulumi.OutputState } 224 225 func (MetricsDestinationOutput) ElementType() reflect.Type { 226 return reflect.TypeOf((**MetricsDestination)(nil)).Elem() 227 } 228 229 func (o MetricsDestinationOutput) ToMetricsDestinationOutput() MetricsDestinationOutput { 230 return o 231 } 232 233 func (o MetricsDestinationOutput) ToMetricsDestinationOutputWithContext(ctx context.Context) MetricsDestinationOutput { 234 return o 235 } 236 237 // The name of the CloudWatch RUM app monitor that will send the metrics. 238 func (o MetricsDestinationOutput) AppMonitorName() pulumi.StringOutput { 239 return o.ApplyT(func(v *MetricsDestination) pulumi.StringOutput { return v.AppMonitorName }).(pulumi.StringOutput) 240 } 241 242 // Defines the destination to send the metrics to. Valid values are `CloudWatch` and `Evidently`. If you specify `Evidently`, you must also specify the ARN of the CloudWatchEvidently experiment that is to be the destination and an IAM role that has permission to write to the experiment. 243 func (o MetricsDestinationOutput) Destination() pulumi.StringOutput { 244 return o.ApplyT(func(v *MetricsDestination) pulumi.StringOutput { return v.Destination }).(pulumi.StringOutput) 245 } 246 247 // Use this parameter only if Destination is Evidently. This parameter specifies the ARN of the Evidently experiment that will receive the extended metrics. 248 func (o MetricsDestinationOutput) DestinationArn() pulumi.StringPtrOutput { 249 return o.ApplyT(func(v *MetricsDestination) pulumi.StringPtrOutput { return v.DestinationArn }).(pulumi.StringPtrOutput) 250 } 251 252 // This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter. 253 func (o MetricsDestinationOutput) IamRoleArn() pulumi.StringPtrOutput { 254 return o.ApplyT(func(v *MetricsDestination) pulumi.StringPtrOutput { return v.IamRoleArn }).(pulumi.StringPtrOutput) 255 } 256 257 type MetricsDestinationArrayOutput struct{ *pulumi.OutputState } 258 259 func (MetricsDestinationArrayOutput) ElementType() reflect.Type { 260 return reflect.TypeOf((*[]*MetricsDestination)(nil)).Elem() 261 } 262 263 func (o MetricsDestinationArrayOutput) ToMetricsDestinationArrayOutput() MetricsDestinationArrayOutput { 264 return o 265 } 266 267 func (o MetricsDestinationArrayOutput) ToMetricsDestinationArrayOutputWithContext(ctx context.Context) MetricsDestinationArrayOutput { 268 return o 269 } 270 271 func (o MetricsDestinationArrayOutput) Index(i pulumi.IntInput) MetricsDestinationOutput { 272 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *MetricsDestination { 273 return vs[0].([]*MetricsDestination)[vs[1].(int)] 274 }).(MetricsDestinationOutput) 275 } 276 277 type MetricsDestinationMapOutput struct{ *pulumi.OutputState } 278 279 func (MetricsDestinationMapOutput) ElementType() reflect.Type { 280 return reflect.TypeOf((*map[string]*MetricsDestination)(nil)).Elem() 281 } 282 283 func (o MetricsDestinationMapOutput) ToMetricsDestinationMapOutput() MetricsDestinationMapOutput { 284 return o 285 } 286 287 func (o MetricsDestinationMapOutput) ToMetricsDestinationMapOutputWithContext(ctx context.Context) MetricsDestinationMapOutput { 288 return o 289 } 290 291 func (o MetricsDestinationMapOutput) MapIndex(k pulumi.StringInput) MetricsDestinationOutput { 292 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *MetricsDestination { 293 return vs[0].(map[string]*MetricsDestination)[vs[1].(string)] 294 }).(MetricsDestinationOutput) 295 } 296 297 func init() { 298 pulumi.RegisterInputType(reflect.TypeOf((*MetricsDestinationInput)(nil)).Elem(), &MetricsDestination{}) 299 pulumi.RegisterInputType(reflect.TypeOf((*MetricsDestinationArrayInput)(nil)).Elem(), MetricsDestinationArray{}) 300 pulumi.RegisterInputType(reflect.TypeOf((*MetricsDestinationMapInput)(nil)).Elem(), MetricsDestinationMap{}) 301 pulumi.RegisterOutputType(MetricsDestinationOutput{}) 302 pulumi.RegisterOutputType(MetricsDestinationArrayOutput{}) 303 pulumi.RegisterOutputType(MetricsDestinationMapOutput{}) 304 }