github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/servicecatalog/constraint.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 servicecatalog 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 a Service Catalog Constraint. 16 // 17 // > **NOTE:** This resource does not associate a Service Catalog product and portfolio. However, the product and portfolio must be associated (see the `servicecatalog.ProductPortfolioAssociation` resource) prior to creating a constraint or you will receive an error. 18 // 19 // ## Example Usage 20 // 21 // ### Basic Usage 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "encoding/json" 30 // 31 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/servicecatalog" 32 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 33 // 34 // ) 35 // 36 // func main() { 37 // pulumi.Run(func(ctx *pulumi.Context) error { 38 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 39 // "RoleArn": "arn:aws:iam::123456789012:role/LaunchRole", 40 // }) 41 // if err != nil { 42 // return err 43 // } 44 // json0 := string(tmpJSON0) 45 // _, err = servicecatalog.NewConstraint(ctx, "example", &servicecatalog.ConstraintArgs{ 46 // Description: pulumi.String("Back off, man. I'm a scientist."), 47 // PortfolioId: pulumi.Any(exampleAwsServicecatalogPortfolio.Id), 48 // ProductId: pulumi.Any(exampleAwsServicecatalogProduct.Id), 49 // Type: pulumi.String("LAUNCH"), 50 // Parameters: pulumi.String(json0), 51 // }) 52 // if err != nil { 53 // return err 54 // } 55 // return nil 56 // }) 57 // } 58 // 59 // ``` 60 // <!--End PulumiCodeChooser --> 61 // 62 // ## Import 63 // 64 // Using `pulumi import`, import `aws_servicecatalog_constraint` using the constraint ID. For example: 65 // 66 // ```sh 67 // $ pulumi import aws:servicecatalog/constraint:Constraint example cons-nmdkb6cgxfcrs 68 // ``` 69 type Constraint struct { 70 pulumi.CustomResourceState 71 72 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 73 AcceptLanguage pulumi.StringPtrOutput `pulumi:"acceptLanguage"` 74 // Description of the constraint. 75 Description pulumi.StringOutput `pulumi:"description"` 76 // Owner of the constraint. 77 Owner pulumi.StringOutput `pulumi:"owner"` 78 // Constraint parameters in JSON format. The syntax depends on the constraint type. See details below. 79 Parameters pulumi.StringOutput `pulumi:"parameters"` 80 // Portfolio identifier. 81 PortfolioId pulumi.StringOutput `pulumi:"portfolioId"` 82 // Product identifier. 83 ProductId pulumi.StringOutput `pulumi:"productId"` 84 Status pulumi.StringOutput `pulumi:"status"` 85 // Type of constraint. Valid values are `LAUNCH`, `NOTIFICATION`, `RESOURCE_UPDATE`, `STACKSET`, and `TEMPLATE`. 86 // 87 // The following arguments are optional: 88 Type pulumi.StringOutput `pulumi:"type"` 89 } 90 91 // NewConstraint registers a new resource with the given unique name, arguments, and options. 92 func NewConstraint(ctx *pulumi.Context, 93 name string, args *ConstraintArgs, opts ...pulumi.ResourceOption) (*Constraint, error) { 94 if args == nil { 95 return nil, errors.New("missing one or more required arguments") 96 } 97 98 if args.Parameters == nil { 99 return nil, errors.New("invalid value for required argument 'Parameters'") 100 } 101 if args.PortfolioId == nil { 102 return nil, errors.New("invalid value for required argument 'PortfolioId'") 103 } 104 if args.ProductId == nil { 105 return nil, errors.New("invalid value for required argument 'ProductId'") 106 } 107 if args.Type == nil { 108 return nil, errors.New("invalid value for required argument 'Type'") 109 } 110 opts = internal.PkgResourceDefaultOpts(opts) 111 var resource Constraint 112 err := ctx.RegisterResource("aws:servicecatalog/constraint:Constraint", name, args, &resource, opts...) 113 if err != nil { 114 return nil, err 115 } 116 return &resource, nil 117 } 118 119 // GetConstraint gets an existing Constraint resource's state with the given name, ID, and optional 120 // state properties that are used to uniquely qualify the lookup (nil if not required). 121 func GetConstraint(ctx *pulumi.Context, 122 name string, id pulumi.IDInput, state *ConstraintState, opts ...pulumi.ResourceOption) (*Constraint, error) { 123 var resource Constraint 124 err := ctx.ReadResource("aws:servicecatalog/constraint:Constraint", name, id, state, &resource, opts...) 125 if err != nil { 126 return nil, err 127 } 128 return &resource, nil 129 } 130 131 // Input properties used for looking up and filtering Constraint resources. 132 type constraintState struct { 133 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 134 AcceptLanguage *string `pulumi:"acceptLanguage"` 135 // Description of the constraint. 136 Description *string `pulumi:"description"` 137 // Owner of the constraint. 138 Owner *string `pulumi:"owner"` 139 // Constraint parameters in JSON format. The syntax depends on the constraint type. See details below. 140 Parameters *string `pulumi:"parameters"` 141 // Portfolio identifier. 142 PortfolioId *string `pulumi:"portfolioId"` 143 // Product identifier. 144 ProductId *string `pulumi:"productId"` 145 Status *string `pulumi:"status"` 146 // Type of constraint. Valid values are `LAUNCH`, `NOTIFICATION`, `RESOURCE_UPDATE`, `STACKSET`, and `TEMPLATE`. 147 // 148 // The following arguments are optional: 149 Type *string `pulumi:"type"` 150 } 151 152 type ConstraintState struct { 153 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 154 AcceptLanguage pulumi.StringPtrInput 155 // Description of the constraint. 156 Description pulumi.StringPtrInput 157 // Owner of the constraint. 158 Owner pulumi.StringPtrInput 159 // Constraint parameters in JSON format. The syntax depends on the constraint type. See details below. 160 Parameters pulumi.StringPtrInput 161 // Portfolio identifier. 162 PortfolioId pulumi.StringPtrInput 163 // Product identifier. 164 ProductId pulumi.StringPtrInput 165 Status pulumi.StringPtrInput 166 // Type of constraint. Valid values are `LAUNCH`, `NOTIFICATION`, `RESOURCE_UPDATE`, `STACKSET`, and `TEMPLATE`. 167 // 168 // The following arguments are optional: 169 Type pulumi.StringPtrInput 170 } 171 172 func (ConstraintState) ElementType() reflect.Type { 173 return reflect.TypeOf((*constraintState)(nil)).Elem() 174 } 175 176 type constraintArgs struct { 177 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 178 AcceptLanguage *string `pulumi:"acceptLanguage"` 179 // Description of the constraint. 180 Description *string `pulumi:"description"` 181 // Constraint parameters in JSON format. The syntax depends on the constraint type. See details below. 182 Parameters string `pulumi:"parameters"` 183 // Portfolio identifier. 184 PortfolioId string `pulumi:"portfolioId"` 185 // Product identifier. 186 ProductId string `pulumi:"productId"` 187 // Type of constraint. Valid values are `LAUNCH`, `NOTIFICATION`, `RESOURCE_UPDATE`, `STACKSET`, and `TEMPLATE`. 188 // 189 // The following arguments are optional: 190 Type string `pulumi:"type"` 191 } 192 193 // The set of arguments for constructing a Constraint resource. 194 type ConstraintArgs struct { 195 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 196 AcceptLanguage pulumi.StringPtrInput 197 // Description of the constraint. 198 Description pulumi.StringPtrInput 199 // Constraint parameters in JSON format. The syntax depends on the constraint type. See details below. 200 Parameters pulumi.StringInput 201 // Portfolio identifier. 202 PortfolioId pulumi.StringInput 203 // Product identifier. 204 ProductId pulumi.StringInput 205 // Type of constraint. Valid values are `LAUNCH`, `NOTIFICATION`, `RESOURCE_UPDATE`, `STACKSET`, and `TEMPLATE`. 206 // 207 // The following arguments are optional: 208 Type pulumi.StringInput 209 } 210 211 func (ConstraintArgs) ElementType() reflect.Type { 212 return reflect.TypeOf((*constraintArgs)(nil)).Elem() 213 } 214 215 type ConstraintInput interface { 216 pulumi.Input 217 218 ToConstraintOutput() ConstraintOutput 219 ToConstraintOutputWithContext(ctx context.Context) ConstraintOutput 220 } 221 222 func (*Constraint) ElementType() reflect.Type { 223 return reflect.TypeOf((**Constraint)(nil)).Elem() 224 } 225 226 func (i *Constraint) ToConstraintOutput() ConstraintOutput { 227 return i.ToConstraintOutputWithContext(context.Background()) 228 } 229 230 func (i *Constraint) ToConstraintOutputWithContext(ctx context.Context) ConstraintOutput { 231 return pulumi.ToOutputWithContext(ctx, i).(ConstraintOutput) 232 } 233 234 // ConstraintArrayInput is an input type that accepts ConstraintArray and ConstraintArrayOutput values. 235 // You can construct a concrete instance of `ConstraintArrayInput` via: 236 // 237 // ConstraintArray{ ConstraintArgs{...} } 238 type ConstraintArrayInput interface { 239 pulumi.Input 240 241 ToConstraintArrayOutput() ConstraintArrayOutput 242 ToConstraintArrayOutputWithContext(context.Context) ConstraintArrayOutput 243 } 244 245 type ConstraintArray []ConstraintInput 246 247 func (ConstraintArray) ElementType() reflect.Type { 248 return reflect.TypeOf((*[]*Constraint)(nil)).Elem() 249 } 250 251 func (i ConstraintArray) ToConstraintArrayOutput() ConstraintArrayOutput { 252 return i.ToConstraintArrayOutputWithContext(context.Background()) 253 } 254 255 func (i ConstraintArray) ToConstraintArrayOutputWithContext(ctx context.Context) ConstraintArrayOutput { 256 return pulumi.ToOutputWithContext(ctx, i).(ConstraintArrayOutput) 257 } 258 259 // ConstraintMapInput is an input type that accepts ConstraintMap and ConstraintMapOutput values. 260 // You can construct a concrete instance of `ConstraintMapInput` via: 261 // 262 // ConstraintMap{ "key": ConstraintArgs{...} } 263 type ConstraintMapInput interface { 264 pulumi.Input 265 266 ToConstraintMapOutput() ConstraintMapOutput 267 ToConstraintMapOutputWithContext(context.Context) ConstraintMapOutput 268 } 269 270 type ConstraintMap map[string]ConstraintInput 271 272 func (ConstraintMap) ElementType() reflect.Type { 273 return reflect.TypeOf((*map[string]*Constraint)(nil)).Elem() 274 } 275 276 func (i ConstraintMap) ToConstraintMapOutput() ConstraintMapOutput { 277 return i.ToConstraintMapOutputWithContext(context.Background()) 278 } 279 280 func (i ConstraintMap) ToConstraintMapOutputWithContext(ctx context.Context) ConstraintMapOutput { 281 return pulumi.ToOutputWithContext(ctx, i).(ConstraintMapOutput) 282 } 283 284 type ConstraintOutput struct{ *pulumi.OutputState } 285 286 func (ConstraintOutput) ElementType() reflect.Type { 287 return reflect.TypeOf((**Constraint)(nil)).Elem() 288 } 289 290 func (o ConstraintOutput) ToConstraintOutput() ConstraintOutput { 291 return o 292 } 293 294 func (o ConstraintOutput) ToConstraintOutputWithContext(ctx context.Context) ConstraintOutput { 295 return o 296 } 297 298 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 299 func (o ConstraintOutput) AcceptLanguage() pulumi.StringPtrOutput { 300 return o.ApplyT(func(v *Constraint) pulumi.StringPtrOutput { return v.AcceptLanguage }).(pulumi.StringPtrOutput) 301 } 302 303 // Description of the constraint. 304 func (o ConstraintOutput) Description() pulumi.StringOutput { 305 return o.ApplyT(func(v *Constraint) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput) 306 } 307 308 // Owner of the constraint. 309 func (o ConstraintOutput) Owner() pulumi.StringOutput { 310 return o.ApplyT(func(v *Constraint) pulumi.StringOutput { return v.Owner }).(pulumi.StringOutput) 311 } 312 313 // Constraint parameters in JSON format. The syntax depends on the constraint type. See details below. 314 func (o ConstraintOutput) Parameters() pulumi.StringOutput { 315 return o.ApplyT(func(v *Constraint) pulumi.StringOutput { return v.Parameters }).(pulumi.StringOutput) 316 } 317 318 // Portfolio identifier. 319 func (o ConstraintOutput) PortfolioId() pulumi.StringOutput { 320 return o.ApplyT(func(v *Constraint) pulumi.StringOutput { return v.PortfolioId }).(pulumi.StringOutput) 321 } 322 323 // Product identifier. 324 func (o ConstraintOutput) ProductId() pulumi.StringOutput { 325 return o.ApplyT(func(v *Constraint) pulumi.StringOutput { return v.ProductId }).(pulumi.StringOutput) 326 } 327 328 func (o ConstraintOutput) Status() pulumi.StringOutput { 329 return o.ApplyT(func(v *Constraint) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput) 330 } 331 332 // Type of constraint. Valid values are `LAUNCH`, `NOTIFICATION`, `RESOURCE_UPDATE`, `STACKSET`, and `TEMPLATE`. 333 // 334 // The following arguments are optional: 335 func (o ConstraintOutput) Type() pulumi.StringOutput { 336 return o.ApplyT(func(v *Constraint) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput) 337 } 338 339 type ConstraintArrayOutput struct{ *pulumi.OutputState } 340 341 func (ConstraintArrayOutput) ElementType() reflect.Type { 342 return reflect.TypeOf((*[]*Constraint)(nil)).Elem() 343 } 344 345 func (o ConstraintArrayOutput) ToConstraintArrayOutput() ConstraintArrayOutput { 346 return o 347 } 348 349 func (o ConstraintArrayOutput) ToConstraintArrayOutputWithContext(ctx context.Context) ConstraintArrayOutput { 350 return o 351 } 352 353 func (o ConstraintArrayOutput) Index(i pulumi.IntInput) ConstraintOutput { 354 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Constraint { 355 return vs[0].([]*Constraint)[vs[1].(int)] 356 }).(ConstraintOutput) 357 } 358 359 type ConstraintMapOutput struct{ *pulumi.OutputState } 360 361 func (ConstraintMapOutput) ElementType() reflect.Type { 362 return reflect.TypeOf((*map[string]*Constraint)(nil)).Elem() 363 } 364 365 func (o ConstraintMapOutput) ToConstraintMapOutput() ConstraintMapOutput { 366 return o 367 } 368 369 func (o ConstraintMapOutput) ToConstraintMapOutputWithContext(ctx context.Context) ConstraintMapOutput { 370 return o 371 } 372 373 func (o ConstraintMapOutput) MapIndex(k pulumi.StringInput) ConstraintOutput { 374 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Constraint { 375 return vs[0].(map[string]*Constraint)[vs[1].(string)] 376 }).(ConstraintOutput) 377 } 378 379 func init() { 380 pulumi.RegisterInputType(reflect.TypeOf((*ConstraintInput)(nil)).Elem(), &Constraint{}) 381 pulumi.RegisterInputType(reflect.TypeOf((*ConstraintArrayInput)(nil)).Elem(), ConstraintArray{}) 382 pulumi.RegisterInputType(reflect.TypeOf((*ConstraintMapInput)(nil)).Elem(), ConstraintMap{}) 383 pulumi.RegisterOutputType(ConstraintOutput{}) 384 pulumi.RegisterOutputType(ConstraintArrayOutput{}) 385 pulumi.RegisterOutputType(ConstraintMapOutput{}) 386 }