github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/appmesh/virtualRouter.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 appmesh 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 an AWS App Mesh virtual router resource. 16 // 17 // ## Breaking Changes 18 // 19 // Because of backward incompatible API changes (read [here](https://github.com/awslabs/aws-app-mesh-examples/issues/92) and [here](https://github.com/awslabs/aws-app-mesh-examples/issues/94)), `appmesh.VirtualRouter` resource definitions created with provider versions earlier than v2.3.0 will need to be modified: 20 // 21 // * Remove service `serviceNames` from the `spec` argument. AWS has created a `appmesh.VirtualService` resource for each service name. Import these resource using `pulumi import`. 22 // 23 // * Add a `listener` configuration block to the `spec` argument. 24 // 25 // The state associated with existing resources will automatically be migrated. 26 // 27 // ## Example Usage 28 // 29 // <!--Start PulumiCodeChooser --> 30 // ```go 31 // package main 32 // 33 // import ( 34 // 35 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appmesh" 36 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 37 // 38 // ) 39 // 40 // func main() { 41 // pulumi.Run(func(ctx *pulumi.Context) error { 42 // _, err := appmesh.NewVirtualRouter(ctx, "serviceb", &appmesh.VirtualRouterArgs{ 43 // Name: pulumi.String("serviceB"), 44 // MeshName: pulumi.Any(simple.Id), 45 // Spec: &appmesh.VirtualRouterSpecArgs{ 46 // Listeners: appmesh.VirtualRouterSpecListenerArray{ 47 // &appmesh.VirtualRouterSpecListenerArgs{ 48 // PortMapping: &appmesh.VirtualRouterSpecListenerPortMappingArgs{ 49 // Port: pulumi.Int(8080), 50 // Protocol: pulumi.String("http"), 51 // }, 52 // }, 53 // }, 54 // }, 55 // }) 56 // if err != nil { 57 // return err 58 // } 59 // return nil 60 // }) 61 // } 62 // 63 // ``` 64 // <!--End PulumiCodeChooser --> 65 // 66 // ## Import 67 // 68 // Using `pulumi import`, import App Mesh virtual routers using `mesh_name` together with the virtual router's `name`. For example: 69 // 70 // ```sh 71 // $ pulumi import aws:appmesh/virtualRouter:VirtualRouter serviceb simpleapp/serviceB 72 // ``` 73 type VirtualRouter struct { 74 pulumi.CustomResourceState 75 76 // ARN of the virtual router. 77 Arn pulumi.StringOutput `pulumi:"arn"` 78 // Creation date of the virtual router. 79 CreatedDate pulumi.StringOutput `pulumi:"createdDate"` 80 // Last update date of the virtual router. 81 LastUpdatedDate pulumi.StringOutput `pulumi:"lastUpdatedDate"` 82 // Name of the service mesh in which to create the virtual router. Must be between 1 and 255 characters in length. 83 MeshName pulumi.StringOutput `pulumi:"meshName"` 84 // AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to. 85 MeshOwner pulumi.StringOutput `pulumi:"meshOwner"` 86 // Name to use for the virtual router. Must be between 1 and 255 characters in length. 87 Name pulumi.StringOutput `pulumi:"name"` 88 // Resource owner's AWS account ID. 89 ResourceOwner pulumi.StringOutput `pulumi:"resourceOwner"` 90 // Virtual router specification to apply. 91 Spec VirtualRouterSpecOutput `pulumi:"spec"` 92 // 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. 93 Tags pulumi.StringMapOutput `pulumi:"tags"` 94 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 95 // 96 // Deprecated: Please use `tags` instead. 97 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 98 } 99 100 // NewVirtualRouter registers a new resource with the given unique name, arguments, and options. 101 func NewVirtualRouter(ctx *pulumi.Context, 102 name string, args *VirtualRouterArgs, opts ...pulumi.ResourceOption) (*VirtualRouter, error) { 103 if args == nil { 104 return nil, errors.New("missing one or more required arguments") 105 } 106 107 if args.MeshName == nil { 108 return nil, errors.New("invalid value for required argument 'MeshName'") 109 } 110 if args.Spec == nil { 111 return nil, errors.New("invalid value for required argument 'Spec'") 112 } 113 opts = internal.PkgResourceDefaultOpts(opts) 114 var resource VirtualRouter 115 err := ctx.RegisterResource("aws:appmesh/virtualRouter:VirtualRouter", name, args, &resource, opts...) 116 if err != nil { 117 return nil, err 118 } 119 return &resource, nil 120 } 121 122 // GetVirtualRouter gets an existing VirtualRouter resource's state with the given name, ID, and optional 123 // state properties that are used to uniquely qualify the lookup (nil if not required). 124 func GetVirtualRouter(ctx *pulumi.Context, 125 name string, id pulumi.IDInput, state *VirtualRouterState, opts ...pulumi.ResourceOption) (*VirtualRouter, error) { 126 var resource VirtualRouter 127 err := ctx.ReadResource("aws:appmesh/virtualRouter:VirtualRouter", name, id, state, &resource, opts...) 128 if err != nil { 129 return nil, err 130 } 131 return &resource, nil 132 } 133 134 // Input properties used for looking up and filtering VirtualRouter resources. 135 type virtualRouterState struct { 136 // ARN of the virtual router. 137 Arn *string `pulumi:"arn"` 138 // Creation date of the virtual router. 139 CreatedDate *string `pulumi:"createdDate"` 140 // Last update date of the virtual router. 141 LastUpdatedDate *string `pulumi:"lastUpdatedDate"` 142 // Name of the service mesh in which to create the virtual router. Must be between 1 and 255 characters in length. 143 MeshName *string `pulumi:"meshName"` 144 // AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to. 145 MeshOwner *string `pulumi:"meshOwner"` 146 // Name to use for the virtual router. Must be between 1 and 255 characters in length. 147 Name *string `pulumi:"name"` 148 // Resource owner's AWS account ID. 149 ResourceOwner *string `pulumi:"resourceOwner"` 150 // Virtual router specification to apply. 151 Spec *VirtualRouterSpec `pulumi:"spec"` 152 // 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. 153 Tags map[string]string `pulumi:"tags"` 154 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 155 // 156 // Deprecated: Please use `tags` instead. 157 TagsAll map[string]string `pulumi:"tagsAll"` 158 } 159 160 type VirtualRouterState struct { 161 // ARN of the virtual router. 162 Arn pulumi.StringPtrInput 163 // Creation date of the virtual router. 164 CreatedDate pulumi.StringPtrInput 165 // Last update date of the virtual router. 166 LastUpdatedDate pulumi.StringPtrInput 167 // Name of the service mesh in which to create the virtual router. Must be between 1 and 255 characters in length. 168 MeshName pulumi.StringPtrInput 169 // AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to. 170 MeshOwner pulumi.StringPtrInput 171 // Name to use for the virtual router. Must be between 1 and 255 characters in length. 172 Name pulumi.StringPtrInput 173 // Resource owner's AWS account ID. 174 ResourceOwner pulumi.StringPtrInput 175 // Virtual router specification to apply. 176 Spec VirtualRouterSpecPtrInput 177 // 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. 178 Tags pulumi.StringMapInput 179 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 180 // 181 // Deprecated: Please use `tags` instead. 182 TagsAll pulumi.StringMapInput 183 } 184 185 func (VirtualRouterState) ElementType() reflect.Type { 186 return reflect.TypeOf((*virtualRouterState)(nil)).Elem() 187 } 188 189 type virtualRouterArgs struct { 190 // Name of the service mesh in which to create the virtual router. Must be between 1 and 255 characters in length. 191 MeshName string `pulumi:"meshName"` 192 // AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to. 193 MeshOwner *string `pulumi:"meshOwner"` 194 // Name to use for the virtual router. Must be between 1 and 255 characters in length. 195 Name *string `pulumi:"name"` 196 // Virtual router specification to apply. 197 Spec VirtualRouterSpec `pulumi:"spec"` 198 // 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. 199 Tags map[string]string `pulumi:"tags"` 200 } 201 202 // The set of arguments for constructing a VirtualRouter resource. 203 type VirtualRouterArgs struct { 204 // Name of the service mesh in which to create the virtual router. Must be between 1 and 255 characters in length. 205 MeshName pulumi.StringInput 206 // AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to. 207 MeshOwner pulumi.StringPtrInput 208 // Name to use for the virtual router. Must be between 1 and 255 characters in length. 209 Name pulumi.StringPtrInput 210 // Virtual router specification to apply. 211 Spec VirtualRouterSpecInput 212 // 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 } 215 216 func (VirtualRouterArgs) ElementType() reflect.Type { 217 return reflect.TypeOf((*virtualRouterArgs)(nil)).Elem() 218 } 219 220 type VirtualRouterInput interface { 221 pulumi.Input 222 223 ToVirtualRouterOutput() VirtualRouterOutput 224 ToVirtualRouterOutputWithContext(ctx context.Context) VirtualRouterOutput 225 } 226 227 func (*VirtualRouter) ElementType() reflect.Type { 228 return reflect.TypeOf((**VirtualRouter)(nil)).Elem() 229 } 230 231 func (i *VirtualRouter) ToVirtualRouterOutput() VirtualRouterOutput { 232 return i.ToVirtualRouterOutputWithContext(context.Background()) 233 } 234 235 func (i *VirtualRouter) ToVirtualRouterOutputWithContext(ctx context.Context) VirtualRouterOutput { 236 return pulumi.ToOutputWithContext(ctx, i).(VirtualRouterOutput) 237 } 238 239 // VirtualRouterArrayInput is an input type that accepts VirtualRouterArray and VirtualRouterArrayOutput values. 240 // You can construct a concrete instance of `VirtualRouterArrayInput` via: 241 // 242 // VirtualRouterArray{ VirtualRouterArgs{...} } 243 type VirtualRouterArrayInput interface { 244 pulumi.Input 245 246 ToVirtualRouterArrayOutput() VirtualRouterArrayOutput 247 ToVirtualRouterArrayOutputWithContext(context.Context) VirtualRouterArrayOutput 248 } 249 250 type VirtualRouterArray []VirtualRouterInput 251 252 func (VirtualRouterArray) ElementType() reflect.Type { 253 return reflect.TypeOf((*[]*VirtualRouter)(nil)).Elem() 254 } 255 256 func (i VirtualRouterArray) ToVirtualRouterArrayOutput() VirtualRouterArrayOutput { 257 return i.ToVirtualRouterArrayOutputWithContext(context.Background()) 258 } 259 260 func (i VirtualRouterArray) ToVirtualRouterArrayOutputWithContext(ctx context.Context) VirtualRouterArrayOutput { 261 return pulumi.ToOutputWithContext(ctx, i).(VirtualRouterArrayOutput) 262 } 263 264 // VirtualRouterMapInput is an input type that accepts VirtualRouterMap and VirtualRouterMapOutput values. 265 // You can construct a concrete instance of `VirtualRouterMapInput` via: 266 // 267 // VirtualRouterMap{ "key": VirtualRouterArgs{...} } 268 type VirtualRouterMapInput interface { 269 pulumi.Input 270 271 ToVirtualRouterMapOutput() VirtualRouterMapOutput 272 ToVirtualRouterMapOutputWithContext(context.Context) VirtualRouterMapOutput 273 } 274 275 type VirtualRouterMap map[string]VirtualRouterInput 276 277 func (VirtualRouterMap) ElementType() reflect.Type { 278 return reflect.TypeOf((*map[string]*VirtualRouter)(nil)).Elem() 279 } 280 281 func (i VirtualRouterMap) ToVirtualRouterMapOutput() VirtualRouterMapOutput { 282 return i.ToVirtualRouterMapOutputWithContext(context.Background()) 283 } 284 285 func (i VirtualRouterMap) ToVirtualRouterMapOutputWithContext(ctx context.Context) VirtualRouterMapOutput { 286 return pulumi.ToOutputWithContext(ctx, i).(VirtualRouterMapOutput) 287 } 288 289 type VirtualRouterOutput struct{ *pulumi.OutputState } 290 291 func (VirtualRouterOutput) ElementType() reflect.Type { 292 return reflect.TypeOf((**VirtualRouter)(nil)).Elem() 293 } 294 295 func (o VirtualRouterOutput) ToVirtualRouterOutput() VirtualRouterOutput { 296 return o 297 } 298 299 func (o VirtualRouterOutput) ToVirtualRouterOutputWithContext(ctx context.Context) VirtualRouterOutput { 300 return o 301 } 302 303 // ARN of the virtual router. 304 func (o VirtualRouterOutput) Arn() pulumi.StringOutput { 305 return o.ApplyT(func(v *VirtualRouter) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 306 } 307 308 // Creation date of the virtual router. 309 func (o VirtualRouterOutput) CreatedDate() pulumi.StringOutput { 310 return o.ApplyT(func(v *VirtualRouter) pulumi.StringOutput { return v.CreatedDate }).(pulumi.StringOutput) 311 } 312 313 // Last update date of the virtual router. 314 func (o VirtualRouterOutput) LastUpdatedDate() pulumi.StringOutput { 315 return o.ApplyT(func(v *VirtualRouter) pulumi.StringOutput { return v.LastUpdatedDate }).(pulumi.StringOutput) 316 } 317 318 // Name of the service mesh in which to create the virtual router. Must be between 1 and 255 characters in length. 319 func (o VirtualRouterOutput) MeshName() pulumi.StringOutput { 320 return o.ApplyT(func(v *VirtualRouter) pulumi.StringOutput { return v.MeshName }).(pulumi.StringOutput) 321 } 322 323 // AWS account ID of the service mesh's owner. Defaults to the account ID the AWS provider is currently connected to. 324 func (o VirtualRouterOutput) MeshOwner() pulumi.StringOutput { 325 return o.ApplyT(func(v *VirtualRouter) pulumi.StringOutput { return v.MeshOwner }).(pulumi.StringOutput) 326 } 327 328 // Name to use for the virtual router. Must be between 1 and 255 characters in length. 329 func (o VirtualRouterOutput) Name() pulumi.StringOutput { 330 return o.ApplyT(func(v *VirtualRouter) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 331 } 332 333 // Resource owner's AWS account ID. 334 func (o VirtualRouterOutput) ResourceOwner() pulumi.StringOutput { 335 return o.ApplyT(func(v *VirtualRouter) pulumi.StringOutput { return v.ResourceOwner }).(pulumi.StringOutput) 336 } 337 338 // Virtual router specification to apply. 339 func (o VirtualRouterOutput) Spec() VirtualRouterSpecOutput { 340 return o.ApplyT(func(v *VirtualRouter) VirtualRouterSpecOutput { return v.Spec }).(VirtualRouterSpecOutput) 341 } 342 343 // 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. 344 func (o VirtualRouterOutput) Tags() pulumi.StringMapOutput { 345 return o.ApplyT(func(v *VirtualRouter) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 346 } 347 348 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 349 // 350 // Deprecated: Please use `tags` instead. 351 func (o VirtualRouterOutput) TagsAll() pulumi.StringMapOutput { 352 return o.ApplyT(func(v *VirtualRouter) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 353 } 354 355 type VirtualRouterArrayOutput struct{ *pulumi.OutputState } 356 357 func (VirtualRouterArrayOutput) ElementType() reflect.Type { 358 return reflect.TypeOf((*[]*VirtualRouter)(nil)).Elem() 359 } 360 361 func (o VirtualRouterArrayOutput) ToVirtualRouterArrayOutput() VirtualRouterArrayOutput { 362 return o 363 } 364 365 func (o VirtualRouterArrayOutput) ToVirtualRouterArrayOutputWithContext(ctx context.Context) VirtualRouterArrayOutput { 366 return o 367 } 368 369 func (o VirtualRouterArrayOutput) Index(i pulumi.IntInput) VirtualRouterOutput { 370 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VirtualRouter { 371 return vs[0].([]*VirtualRouter)[vs[1].(int)] 372 }).(VirtualRouterOutput) 373 } 374 375 type VirtualRouterMapOutput struct{ *pulumi.OutputState } 376 377 func (VirtualRouterMapOutput) ElementType() reflect.Type { 378 return reflect.TypeOf((*map[string]*VirtualRouter)(nil)).Elem() 379 } 380 381 func (o VirtualRouterMapOutput) ToVirtualRouterMapOutput() VirtualRouterMapOutput { 382 return o 383 } 384 385 func (o VirtualRouterMapOutput) ToVirtualRouterMapOutputWithContext(ctx context.Context) VirtualRouterMapOutput { 386 return o 387 } 388 389 func (o VirtualRouterMapOutput) MapIndex(k pulumi.StringInput) VirtualRouterOutput { 390 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VirtualRouter { 391 return vs[0].(map[string]*VirtualRouter)[vs[1].(string)] 392 }).(VirtualRouterOutput) 393 } 394 395 func init() { 396 pulumi.RegisterInputType(reflect.TypeOf((*VirtualRouterInput)(nil)).Elem(), &VirtualRouter{}) 397 pulumi.RegisterInputType(reflect.TypeOf((*VirtualRouterArrayInput)(nil)).Elem(), VirtualRouterArray{}) 398 pulumi.RegisterInputType(reflect.TypeOf((*VirtualRouterMapInput)(nil)).Elem(), VirtualRouterMap{}) 399 pulumi.RegisterOutputType(VirtualRouterOutput{}) 400 pulumi.RegisterOutputType(VirtualRouterArrayOutput{}) 401 pulumi.RegisterOutputType(VirtualRouterMapOutput{}) 402 }