github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/amp/workspace.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 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Manages an Amazon Managed Service for Prometheus (AMP) Workspace. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amp" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // _, err := amp.NewWorkspace(ctx, "example", &.WorkspaceArgs{ 32 // Alias: pulumi.String("example"), 33 // Tags: pulumi.StringMap{ 34 // "Environment": pulumi.String("production"), 35 // }, 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // return nil 41 // }) 42 // } 43 // 44 // ``` 45 // <!--End PulumiCodeChooser --> 46 // 47 // ### CloudWatch Logging 48 // 49 // <!--Start PulumiCodeChooser --> 50 // ```go 51 // package main 52 // 53 // import ( 54 // 55 // "fmt" 56 // 57 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amp" 58 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch" 59 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 60 // 61 // ) 62 // 63 // func main() { 64 // pulumi.Run(func(ctx *pulumi.Context) error { 65 // example, err := cloudwatch.NewLogGroup(ctx, "example", &cloudwatch.LogGroupArgs{ 66 // Name: pulumi.String("example"), 67 // }) 68 // if err != nil { 69 // return err 70 // } 71 // _, err = amp.NewWorkspace(ctx, "example", &.WorkspaceArgs{ 72 // LoggingConfiguration: &.WorkspaceLoggingConfigurationArgs{ 73 // LogGroupArn: example.Arn.ApplyT(func(arn string) (string, error) { 74 // return fmt.Sprintf("%v:*", arn), nil 75 // }).(pulumi.StringOutput), 76 // }, 77 // }) 78 // if err != nil { 79 // return err 80 // } 81 // return nil 82 // }) 83 // } 84 // 85 // ``` 86 // <!--End PulumiCodeChooser --> 87 // 88 // ### AWS KMS Customer Managed Keys (CMK) 89 // 90 // <!--Start PulumiCodeChooser --> 91 // ```go 92 // package main 93 // 94 // import ( 95 // 96 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amp" 97 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms" 98 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 99 // 100 // ) 101 // 102 // func main() { 103 // pulumi.Run(func(ctx *pulumi.Context) error { 104 // exampleKey, err := kms.NewKey(ctx, "example", &kms.KeyArgs{ 105 // Description: pulumi.String("example"), 106 // DeletionWindowInDays: pulumi.Int(7), 107 // }) 108 // if err != nil { 109 // return err 110 // } 111 // _, err = amp.NewWorkspace(ctx, "example", &.WorkspaceArgs{ 112 // Alias: pulumi.String("example"), 113 // KmsKeyArn: exampleKey.Arn, 114 // }) 115 // if err != nil { 116 // return err 117 // } 118 // return nil 119 // }) 120 // } 121 // 122 // ``` 123 // <!--End PulumiCodeChooser --> 124 // 125 // ## Import 126 // 127 // Using `pulumi import`, import AMP Workspaces using the identifier. For example: 128 // 129 // ```sh 130 // $ pulumi import aws:amp/workspace:Workspace demo ws-C6DCB907-F2D7-4D96-957B-66691F865D8B 131 // ``` 132 type Workspace struct { 133 pulumi.CustomResourceState 134 135 // The alias of the prometheus workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html). 136 Alias pulumi.StringPtrOutput `pulumi:"alias"` 137 // Amazon Resource Name (ARN) of the workspace. 138 Arn pulumi.StringOutput `pulumi:"arn"` 139 // The ARN for the KMS encryption key. If this argument is not provided, then the AWS owned encryption key will be used to encrypt the data in the workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/encryption-at-rest-Amazon-Service-Prometheus.html) 140 KmsKeyArn pulumi.StringPtrOutput `pulumi:"kmsKeyArn"` 141 // Logging configuration for the workspace. See Logging Configuration below for details. 142 LoggingConfiguration WorkspaceLoggingConfigurationPtrOutput `pulumi:"loggingConfiguration"` 143 // Prometheus endpoint available for this workspace. 144 PrometheusEndpoint pulumi.StringOutput `pulumi:"prometheusEndpoint"` 145 // 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. 146 Tags pulumi.StringMapOutput `pulumi:"tags"` 147 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 148 // 149 // Deprecated: Please use `tags` instead. 150 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 151 } 152 153 // NewWorkspace registers a new resource with the given unique name, arguments, and options. 154 func NewWorkspace(ctx *pulumi.Context, 155 name string, args *WorkspaceArgs, opts ...pulumi.ResourceOption) (*Workspace, error) { 156 if args == nil { 157 args = &WorkspaceArgs{} 158 } 159 160 opts = internal.PkgResourceDefaultOpts(opts) 161 var resource Workspace 162 err := ctx.RegisterResource("aws:amp/workspace:Workspace", name, args, &resource, opts...) 163 if err != nil { 164 return nil, err 165 } 166 return &resource, nil 167 } 168 169 // GetWorkspace gets an existing Workspace resource's state with the given name, ID, and optional 170 // state properties that are used to uniquely qualify the lookup (nil if not required). 171 func GetWorkspace(ctx *pulumi.Context, 172 name string, id pulumi.IDInput, state *WorkspaceState, opts ...pulumi.ResourceOption) (*Workspace, error) { 173 var resource Workspace 174 err := ctx.ReadResource("aws:amp/workspace:Workspace", name, id, state, &resource, opts...) 175 if err != nil { 176 return nil, err 177 } 178 return &resource, nil 179 } 180 181 // Input properties used for looking up and filtering Workspace resources. 182 type workspaceState struct { 183 // The alias of the prometheus workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html). 184 Alias *string `pulumi:"alias"` 185 // Amazon Resource Name (ARN) of the workspace. 186 Arn *string `pulumi:"arn"` 187 // The ARN for the KMS encryption key. If this argument is not provided, then the AWS owned encryption key will be used to encrypt the data in the workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/encryption-at-rest-Amazon-Service-Prometheus.html) 188 KmsKeyArn *string `pulumi:"kmsKeyArn"` 189 // Logging configuration for the workspace. See Logging Configuration below for details. 190 LoggingConfiguration *WorkspaceLoggingConfiguration `pulumi:"loggingConfiguration"` 191 // Prometheus endpoint available for this workspace. 192 PrometheusEndpoint *string `pulumi:"prometheusEndpoint"` 193 // 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. 194 Tags map[string]string `pulumi:"tags"` 195 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 196 // 197 // Deprecated: Please use `tags` instead. 198 TagsAll map[string]string `pulumi:"tagsAll"` 199 } 200 201 type WorkspaceState struct { 202 // The alias of the prometheus workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html). 203 Alias pulumi.StringPtrInput 204 // Amazon Resource Name (ARN) of the workspace. 205 Arn pulumi.StringPtrInput 206 // The ARN for the KMS encryption key. If this argument is not provided, then the AWS owned encryption key will be used to encrypt the data in the workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/encryption-at-rest-Amazon-Service-Prometheus.html) 207 KmsKeyArn pulumi.StringPtrInput 208 // Logging configuration for the workspace. See Logging Configuration below for details. 209 LoggingConfiguration WorkspaceLoggingConfigurationPtrInput 210 // Prometheus endpoint available for this workspace. 211 PrometheusEndpoint pulumi.StringPtrInput 212 // 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. 213 Tags pulumi.StringMapInput 214 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 215 // 216 // Deprecated: Please use `tags` instead. 217 TagsAll pulumi.StringMapInput 218 } 219 220 func (WorkspaceState) ElementType() reflect.Type { 221 return reflect.TypeOf((*workspaceState)(nil)).Elem() 222 } 223 224 type workspaceArgs struct { 225 // The alias of the prometheus workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html). 226 Alias *string `pulumi:"alias"` 227 // The ARN for the KMS encryption key. If this argument is not provided, then the AWS owned encryption key will be used to encrypt the data in the workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/encryption-at-rest-Amazon-Service-Prometheus.html) 228 KmsKeyArn *string `pulumi:"kmsKeyArn"` 229 // Logging configuration for the workspace. See Logging Configuration below for details. 230 LoggingConfiguration *WorkspaceLoggingConfiguration `pulumi:"loggingConfiguration"` 231 // 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. 232 Tags map[string]string `pulumi:"tags"` 233 } 234 235 // The set of arguments for constructing a Workspace resource. 236 type WorkspaceArgs struct { 237 // The alias of the prometheus workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html). 238 Alias pulumi.StringPtrInput 239 // The ARN for the KMS encryption key. If this argument is not provided, then the AWS owned encryption key will be used to encrypt the data in the workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/encryption-at-rest-Amazon-Service-Prometheus.html) 240 KmsKeyArn pulumi.StringPtrInput 241 // Logging configuration for the workspace. See Logging Configuration below for details. 242 LoggingConfiguration WorkspaceLoggingConfigurationPtrInput 243 // 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. 244 Tags pulumi.StringMapInput 245 } 246 247 func (WorkspaceArgs) ElementType() reflect.Type { 248 return reflect.TypeOf((*workspaceArgs)(nil)).Elem() 249 } 250 251 type WorkspaceInput interface { 252 pulumi.Input 253 254 ToWorkspaceOutput() WorkspaceOutput 255 ToWorkspaceOutputWithContext(ctx context.Context) WorkspaceOutput 256 } 257 258 func (*Workspace) ElementType() reflect.Type { 259 return reflect.TypeOf((**Workspace)(nil)).Elem() 260 } 261 262 func (i *Workspace) ToWorkspaceOutput() WorkspaceOutput { 263 return i.ToWorkspaceOutputWithContext(context.Background()) 264 } 265 266 func (i *Workspace) ToWorkspaceOutputWithContext(ctx context.Context) WorkspaceOutput { 267 return pulumi.ToOutputWithContext(ctx, i).(WorkspaceOutput) 268 } 269 270 // WorkspaceArrayInput is an input type that accepts WorkspaceArray and WorkspaceArrayOutput values. 271 // You can construct a concrete instance of `WorkspaceArrayInput` via: 272 // 273 // WorkspaceArray{ WorkspaceArgs{...} } 274 type WorkspaceArrayInput interface { 275 pulumi.Input 276 277 ToWorkspaceArrayOutput() WorkspaceArrayOutput 278 ToWorkspaceArrayOutputWithContext(context.Context) WorkspaceArrayOutput 279 } 280 281 type WorkspaceArray []WorkspaceInput 282 283 func (WorkspaceArray) ElementType() reflect.Type { 284 return reflect.TypeOf((*[]*Workspace)(nil)).Elem() 285 } 286 287 func (i WorkspaceArray) ToWorkspaceArrayOutput() WorkspaceArrayOutput { 288 return i.ToWorkspaceArrayOutputWithContext(context.Background()) 289 } 290 291 func (i WorkspaceArray) ToWorkspaceArrayOutputWithContext(ctx context.Context) WorkspaceArrayOutput { 292 return pulumi.ToOutputWithContext(ctx, i).(WorkspaceArrayOutput) 293 } 294 295 // WorkspaceMapInput is an input type that accepts WorkspaceMap and WorkspaceMapOutput values. 296 // You can construct a concrete instance of `WorkspaceMapInput` via: 297 // 298 // WorkspaceMap{ "key": WorkspaceArgs{...} } 299 type WorkspaceMapInput interface { 300 pulumi.Input 301 302 ToWorkspaceMapOutput() WorkspaceMapOutput 303 ToWorkspaceMapOutputWithContext(context.Context) WorkspaceMapOutput 304 } 305 306 type WorkspaceMap map[string]WorkspaceInput 307 308 func (WorkspaceMap) ElementType() reflect.Type { 309 return reflect.TypeOf((*map[string]*Workspace)(nil)).Elem() 310 } 311 312 func (i WorkspaceMap) ToWorkspaceMapOutput() WorkspaceMapOutput { 313 return i.ToWorkspaceMapOutputWithContext(context.Background()) 314 } 315 316 func (i WorkspaceMap) ToWorkspaceMapOutputWithContext(ctx context.Context) WorkspaceMapOutput { 317 return pulumi.ToOutputWithContext(ctx, i).(WorkspaceMapOutput) 318 } 319 320 type WorkspaceOutput struct{ *pulumi.OutputState } 321 322 func (WorkspaceOutput) ElementType() reflect.Type { 323 return reflect.TypeOf((**Workspace)(nil)).Elem() 324 } 325 326 func (o WorkspaceOutput) ToWorkspaceOutput() WorkspaceOutput { 327 return o 328 } 329 330 func (o WorkspaceOutput) ToWorkspaceOutputWithContext(ctx context.Context) WorkspaceOutput { 331 return o 332 } 333 334 // The alias of the prometheus workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-onboard-create-workspace.html). 335 func (o WorkspaceOutput) Alias() pulumi.StringPtrOutput { 336 return o.ApplyT(func(v *Workspace) pulumi.StringPtrOutput { return v.Alias }).(pulumi.StringPtrOutput) 337 } 338 339 // Amazon Resource Name (ARN) of the workspace. 340 func (o WorkspaceOutput) Arn() pulumi.StringOutput { 341 return o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 342 } 343 344 // The ARN for the KMS encryption key. If this argument is not provided, then the AWS owned encryption key will be used to encrypt the data in the workspace. See more [in AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/encryption-at-rest-Amazon-Service-Prometheus.html) 345 func (o WorkspaceOutput) KmsKeyArn() pulumi.StringPtrOutput { 346 return o.ApplyT(func(v *Workspace) pulumi.StringPtrOutput { return v.KmsKeyArn }).(pulumi.StringPtrOutput) 347 } 348 349 // Logging configuration for the workspace. See Logging Configuration below for details. 350 func (o WorkspaceOutput) LoggingConfiguration() WorkspaceLoggingConfigurationPtrOutput { 351 return o.ApplyT(func(v *Workspace) WorkspaceLoggingConfigurationPtrOutput { return v.LoggingConfiguration }).(WorkspaceLoggingConfigurationPtrOutput) 352 } 353 354 // Prometheus endpoint available for this workspace. 355 func (o WorkspaceOutput) PrometheusEndpoint() pulumi.StringOutput { 356 return o.ApplyT(func(v *Workspace) pulumi.StringOutput { return v.PrometheusEndpoint }).(pulumi.StringOutput) 357 } 358 359 // 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. 360 func (o WorkspaceOutput) Tags() pulumi.StringMapOutput { 361 return o.ApplyT(func(v *Workspace) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 362 } 363 364 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 365 // 366 // Deprecated: Please use `tags` instead. 367 func (o WorkspaceOutput) TagsAll() pulumi.StringMapOutput { 368 return o.ApplyT(func(v *Workspace) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 369 } 370 371 type WorkspaceArrayOutput struct{ *pulumi.OutputState } 372 373 func (WorkspaceArrayOutput) ElementType() reflect.Type { 374 return reflect.TypeOf((*[]*Workspace)(nil)).Elem() 375 } 376 377 func (o WorkspaceArrayOutput) ToWorkspaceArrayOutput() WorkspaceArrayOutput { 378 return o 379 } 380 381 func (o WorkspaceArrayOutput) ToWorkspaceArrayOutputWithContext(ctx context.Context) WorkspaceArrayOutput { 382 return o 383 } 384 385 func (o WorkspaceArrayOutput) Index(i pulumi.IntInput) WorkspaceOutput { 386 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Workspace { 387 return vs[0].([]*Workspace)[vs[1].(int)] 388 }).(WorkspaceOutput) 389 } 390 391 type WorkspaceMapOutput struct{ *pulumi.OutputState } 392 393 func (WorkspaceMapOutput) ElementType() reflect.Type { 394 return reflect.TypeOf((*map[string]*Workspace)(nil)).Elem() 395 } 396 397 func (o WorkspaceMapOutput) ToWorkspaceMapOutput() WorkspaceMapOutput { 398 return o 399 } 400 401 func (o WorkspaceMapOutput) ToWorkspaceMapOutputWithContext(ctx context.Context) WorkspaceMapOutput { 402 return o 403 } 404 405 func (o WorkspaceMapOutput) MapIndex(k pulumi.StringInput) WorkspaceOutput { 406 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Workspace { 407 return vs[0].(map[string]*Workspace)[vs[1].(string)] 408 }).(WorkspaceOutput) 409 } 410 411 func init() { 412 pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceInput)(nil)).Elem(), &Workspace{}) 413 pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceArrayInput)(nil)).Elem(), WorkspaceArray{}) 414 pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceMapInput)(nil)).Elem(), WorkspaceMap{}) 415 pulumi.RegisterOutputType(WorkspaceOutput{}) 416 pulumi.RegisterOutputType(WorkspaceArrayOutput{}) 417 pulumi.RegisterOutputType(WorkspaceMapOutput{}) 418 }