github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/servicediscovery/service.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 servicediscovery 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 // Provides a Service Discovery Service resource. 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/ec2" 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/servicediscovery" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // example, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{ 33 // CidrBlock: pulumi.String("10.0.0.0/16"), 34 // EnableDnsSupport: pulumi.Bool(true), 35 // EnableDnsHostnames: pulumi.Bool(true), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // examplePrivateDnsNamespace, err := servicediscovery.NewPrivateDnsNamespace(ctx, "example", &servicediscovery.PrivateDnsNamespaceArgs{ 41 // Name: pulumi.String("example.mydomain.local"), 42 // Description: pulumi.String("example"), 43 // Vpc: example.ID(), 44 // }) 45 // if err != nil { 46 // return err 47 // } 48 // _, err = servicediscovery.NewService(ctx, "example", &servicediscovery.ServiceArgs{ 49 // Name: pulumi.String("example"), 50 // DnsConfig: &servicediscovery.ServiceDnsConfigArgs{ 51 // NamespaceId: examplePrivateDnsNamespace.ID(), 52 // DnsRecords: servicediscovery.ServiceDnsConfigDnsRecordArray{ 53 // &servicediscovery.ServiceDnsConfigDnsRecordArgs{ 54 // Ttl: pulumi.Int(10), 55 // Type: pulumi.String("A"), 56 // }, 57 // }, 58 // RoutingPolicy: pulumi.String("MULTIVALUE"), 59 // }, 60 // HealthCheckCustomConfig: &servicediscovery.ServiceHealthCheckCustomConfigArgs{ 61 // FailureThreshold: pulumi.Int(1), 62 // }, 63 // }) 64 // if err != nil { 65 // return err 66 // } 67 // return nil 68 // }) 69 // } 70 // 71 // ``` 72 // <!--End PulumiCodeChooser --> 73 // 74 // <!--Start PulumiCodeChooser --> 75 // ```go 76 // package main 77 // 78 // import ( 79 // 80 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/servicediscovery" 81 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 82 // 83 // ) 84 // 85 // func main() { 86 // pulumi.Run(func(ctx *pulumi.Context) error { 87 // example, err := servicediscovery.NewPublicDnsNamespace(ctx, "example", &servicediscovery.PublicDnsNamespaceArgs{ 88 // Name: pulumi.String("example.mydomain.com"), 89 // Description: pulumi.String("example"), 90 // }) 91 // if err != nil { 92 // return err 93 // } 94 // _, err = servicediscovery.NewService(ctx, "example", &servicediscovery.ServiceArgs{ 95 // Name: pulumi.String("example"), 96 // DnsConfig: &servicediscovery.ServiceDnsConfigArgs{ 97 // NamespaceId: example.ID(), 98 // DnsRecords: servicediscovery.ServiceDnsConfigDnsRecordArray{ 99 // &servicediscovery.ServiceDnsConfigDnsRecordArgs{ 100 // Ttl: pulumi.Int(10), 101 // Type: pulumi.String("A"), 102 // }, 103 // }, 104 // }, 105 // HealthCheckConfig: &servicediscovery.ServiceHealthCheckConfigArgs{ 106 // FailureThreshold: pulumi.Int(10), 107 // ResourcePath: pulumi.String("path"), 108 // Type: pulumi.String("HTTP"), 109 // }, 110 // }) 111 // if err != nil { 112 // return err 113 // } 114 // return nil 115 // }) 116 // } 117 // 118 // ``` 119 // <!--End PulumiCodeChooser --> 120 // 121 // ## Import 122 // 123 // Using `pulumi import`, import Service Discovery Service using the service ID. For example: 124 // 125 // ```sh 126 // $ pulumi import aws:servicediscovery/service:Service example 0123456789 127 // ``` 128 type Service struct { 129 pulumi.CustomResourceState 130 131 // The ARN of the service. 132 Arn pulumi.StringOutput `pulumi:"arn"` 133 // The description of the service. 134 Description pulumi.StringPtrOutput `pulumi:"description"` 135 // A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance. 136 DnsConfig ServiceDnsConfigPtrOutput `pulumi:"dnsConfig"` 137 // A boolean that indicates all instances should be deleted from the service so that the service can be destroyed without error. These instances are not recoverable. 138 ForceDestroy pulumi.BoolPtrOutput `pulumi:"forceDestroy"` 139 // A complex type that contains settings for an optional health check. Only for Public DNS namespaces. 140 HealthCheckConfig ServiceHealthCheckConfigPtrOutput `pulumi:"healthCheckConfig"` 141 // A complex type that contains settings for ECS managed health checks. 142 HealthCheckCustomConfig ServiceHealthCheckCustomConfigPtrOutput `pulumi:"healthCheckCustomConfig"` 143 // The name of the service. 144 Name pulumi.StringOutput `pulumi:"name"` 145 // The ID of the namespace that you want to use to create the service. 146 NamespaceId pulumi.StringOutput `pulumi:"namespaceId"` 147 // A map of tags to assign to the service. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 148 Tags pulumi.StringMapOutput `pulumi:"tags"` 149 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 150 // 151 // Deprecated: Please use `tags` instead. 152 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 153 // If present, specifies that the service instances are only discoverable using the `DiscoverInstances` API operation. No DNS records is registered for the service instances. The only valid value is `HTTP`. 154 Type pulumi.StringOutput `pulumi:"type"` 155 } 156 157 // NewService registers a new resource with the given unique name, arguments, and options. 158 func NewService(ctx *pulumi.Context, 159 name string, args *ServiceArgs, opts ...pulumi.ResourceOption) (*Service, error) { 160 if args == nil { 161 args = &ServiceArgs{} 162 } 163 164 opts = internal.PkgResourceDefaultOpts(opts) 165 var resource Service 166 err := ctx.RegisterResource("aws:servicediscovery/service:Service", name, args, &resource, opts...) 167 if err != nil { 168 return nil, err 169 } 170 return &resource, nil 171 } 172 173 // GetService gets an existing Service resource's state with the given name, ID, and optional 174 // state properties that are used to uniquely qualify the lookup (nil if not required). 175 func GetService(ctx *pulumi.Context, 176 name string, id pulumi.IDInput, state *ServiceState, opts ...pulumi.ResourceOption) (*Service, error) { 177 var resource Service 178 err := ctx.ReadResource("aws:servicediscovery/service:Service", name, id, state, &resource, opts...) 179 if err != nil { 180 return nil, err 181 } 182 return &resource, nil 183 } 184 185 // Input properties used for looking up and filtering Service resources. 186 type serviceState struct { 187 // The ARN of the service. 188 Arn *string `pulumi:"arn"` 189 // The description of the service. 190 Description *string `pulumi:"description"` 191 // A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance. 192 DnsConfig *ServiceDnsConfig `pulumi:"dnsConfig"` 193 // A boolean that indicates all instances should be deleted from the service so that the service can be destroyed without error. These instances are not recoverable. 194 ForceDestroy *bool `pulumi:"forceDestroy"` 195 // A complex type that contains settings for an optional health check. Only for Public DNS namespaces. 196 HealthCheckConfig *ServiceHealthCheckConfig `pulumi:"healthCheckConfig"` 197 // A complex type that contains settings for ECS managed health checks. 198 HealthCheckCustomConfig *ServiceHealthCheckCustomConfig `pulumi:"healthCheckCustomConfig"` 199 // The name of the service. 200 Name *string `pulumi:"name"` 201 // The ID of the namespace that you want to use to create the service. 202 NamespaceId *string `pulumi:"namespaceId"` 203 // A map of tags to assign to the service. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 204 Tags map[string]string `pulumi:"tags"` 205 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 206 // 207 // Deprecated: Please use `tags` instead. 208 TagsAll map[string]string `pulumi:"tagsAll"` 209 // If present, specifies that the service instances are only discoverable using the `DiscoverInstances` API operation. No DNS records is registered for the service instances. The only valid value is `HTTP`. 210 Type *string `pulumi:"type"` 211 } 212 213 type ServiceState struct { 214 // The ARN of the service. 215 Arn pulumi.StringPtrInput 216 // The description of the service. 217 Description pulumi.StringPtrInput 218 // A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance. 219 DnsConfig ServiceDnsConfigPtrInput 220 // A boolean that indicates all instances should be deleted from the service so that the service can be destroyed without error. These instances are not recoverable. 221 ForceDestroy pulumi.BoolPtrInput 222 // A complex type that contains settings for an optional health check. Only for Public DNS namespaces. 223 HealthCheckConfig ServiceHealthCheckConfigPtrInput 224 // A complex type that contains settings for ECS managed health checks. 225 HealthCheckCustomConfig ServiceHealthCheckCustomConfigPtrInput 226 // The name of the service. 227 Name pulumi.StringPtrInput 228 // The ID of the namespace that you want to use to create the service. 229 NamespaceId pulumi.StringPtrInput 230 // A map of tags to assign to the service. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 231 Tags pulumi.StringMapInput 232 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 233 // 234 // Deprecated: Please use `tags` instead. 235 TagsAll pulumi.StringMapInput 236 // If present, specifies that the service instances are only discoverable using the `DiscoverInstances` API operation. No DNS records is registered for the service instances. The only valid value is `HTTP`. 237 Type pulumi.StringPtrInput 238 } 239 240 func (ServiceState) ElementType() reflect.Type { 241 return reflect.TypeOf((*serviceState)(nil)).Elem() 242 } 243 244 type serviceArgs struct { 245 // The description of the service. 246 Description *string `pulumi:"description"` 247 // A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance. 248 DnsConfig *ServiceDnsConfig `pulumi:"dnsConfig"` 249 // A boolean that indicates all instances should be deleted from the service so that the service can be destroyed without error. These instances are not recoverable. 250 ForceDestroy *bool `pulumi:"forceDestroy"` 251 // A complex type that contains settings for an optional health check. Only for Public DNS namespaces. 252 HealthCheckConfig *ServiceHealthCheckConfig `pulumi:"healthCheckConfig"` 253 // A complex type that contains settings for ECS managed health checks. 254 HealthCheckCustomConfig *ServiceHealthCheckCustomConfig `pulumi:"healthCheckCustomConfig"` 255 // The name of the service. 256 Name *string `pulumi:"name"` 257 // The ID of the namespace that you want to use to create the service. 258 NamespaceId *string `pulumi:"namespaceId"` 259 // A map of tags to assign to the service. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 260 Tags map[string]string `pulumi:"tags"` 261 // If present, specifies that the service instances are only discoverable using the `DiscoverInstances` API operation. No DNS records is registered for the service instances. The only valid value is `HTTP`. 262 Type *string `pulumi:"type"` 263 } 264 265 // The set of arguments for constructing a Service resource. 266 type ServiceArgs struct { 267 // The description of the service. 268 Description pulumi.StringPtrInput 269 // A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance. 270 DnsConfig ServiceDnsConfigPtrInput 271 // A boolean that indicates all instances should be deleted from the service so that the service can be destroyed without error. These instances are not recoverable. 272 ForceDestroy pulumi.BoolPtrInput 273 // A complex type that contains settings for an optional health check. Only for Public DNS namespaces. 274 HealthCheckConfig ServiceHealthCheckConfigPtrInput 275 // A complex type that contains settings for ECS managed health checks. 276 HealthCheckCustomConfig ServiceHealthCheckCustomConfigPtrInput 277 // The name of the service. 278 Name pulumi.StringPtrInput 279 // The ID of the namespace that you want to use to create the service. 280 NamespaceId pulumi.StringPtrInput 281 // A map of tags to assign to the service. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 282 Tags pulumi.StringMapInput 283 // If present, specifies that the service instances are only discoverable using the `DiscoverInstances` API operation. No DNS records is registered for the service instances. The only valid value is `HTTP`. 284 Type pulumi.StringPtrInput 285 } 286 287 func (ServiceArgs) ElementType() reflect.Type { 288 return reflect.TypeOf((*serviceArgs)(nil)).Elem() 289 } 290 291 type ServiceInput interface { 292 pulumi.Input 293 294 ToServiceOutput() ServiceOutput 295 ToServiceOutputWithContext(ctx context.Context) ServiceOutput 296 } 297 298 func (*Service) ElementType() reflect.Type { 299 return reflect.TypeOf((**Service)(nil)).Elem() 300 } 301 302 func (i *Service) ToServiceOutput() ServiceOutput { 303 return i.ToServiceOutputWithContext(context.Background()) 304 } 305 306 func (i *Service) ToServiceOutputWithContext(ctx context.Context) ServiceOutput { 307 return pulumi.ToOutputWithContext(ctx, i).(ServiceOutput) 308 } 309 310 // ServiceArrayInput is an input type that accepts ServiceArray and ServiceArrayOutput values. 311 // You can construct a concrete instance of `ServiceArrayInput` via: 312 // 313 // ServiceArray{ ServiceArgs{...} } 314 type ServiceArrayInput interface { 315 pulumi.Input 316 317 ToServiceArrayOutput() ServiceArrayOutput 318 ToServiceArrayOutputWithContext(context.Context) ServiceArrayOutput 319 } 320 321 type ServiceArray []ServiceInput 322 323 func (ServiceArray) ElementType() reflect.Type { 324 return reflect.TypeOf((*[]*Service)(nil)).Elem() 325 } 326 327 func (i ServiceArray) ToServiceArrayOutput() ServiceArrayOutput { 328 return i.ToServiceArrayOutputWithContext(context.Background()) 329 } 330 331 func (i ServiceArray) ToServiceArrayOutputWithContext(ctx context.Context) ServiceArrayOutput { 332 return pulumi.ToOutputWithContext(ctx, i).(ServiceArrayOutput) 333 } 334 335 // ServiceMapInput is an input type that accepts ServiceMap and ServiceMapOutput values. 336 // You can construct a concrete instance of `ServiceMapInput` via: 337 // 338 // ServiceMap{ "key": ServiceArgs{...} } 339 type ServiceMapInput interface { 340 pulumi.Input 341 342 ToServiceMapOutput() ServiceMapOutput 343 ToServiceMapOutputWithContext(context.Context) ServiceMapOutput 344 } 345 346 type ServiceMap map[string]ServiceInput 347 348 func (ServiceMap) ElementType() reflect.Type { 349 return reflect.TypeOf((*map[string]*Service)(nil)).Elem() 350 } 351 352 func (i ServiceMap) ToServiceMapOutput() ServiceMapOutput { 353 return i.ToServiceMapOutputWithContext(context.Background()) 354 } 355 356 func (i ServiceMap) ToServiceMapOutputWithContext(ctx context.Context) ServiceMapOutput { 357 return pulumi.ToOutputWithContext(ctx, i).(ServiceMapOutput) 358 } 359 360 type ServiceOutput struct{ *pulumi.OutputState } 361 362 func (ServiceOutput) ElementType() reflect.Type { 363 return reflect.TypeOf((**Service)(nil)).Elem() 364 } 365 366 func (o ServiceOutput) ToServiceOutput() ServiceOutput { 367 return o 368 } 369 370 func (o ServiceOutput) ToServiceOutputWithContext(ctx context.Context) ServiceOutput { 371 return o 372 } 373 374 // The ARN of the service. 375 func (o ServiceOutput) Arn() pulumi.StringOutput { 376 return o.ApplyT(func(v *Service) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 377 } 378 379 // The description of the service. 380 func (o ServiceOutput) Description() pulumi.StringPtrOutput { 381 return o.ApplyT(func(v *Service) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 382 } 383 384 // A complex type that contains information about the resource record sets that you want Amazon Route 53 to create when you register an instance. 385 func (o ServiceOutput) DnsConfig() ServiceDnsConfigPtrOutput { 386 return o.ApplyT(func(v *Service) ServiceDnsConfigPtrOutput { return v.DnsConfig }).(ServiceDnsConfigPtrOutput) 387 } 388 389 // A boolean that indicates all instances should be deleted from the service so that the service can be destroyed without error. These instances are not recoverable. 390 func (o ServiceOutput) ForceDestroy() pulumi.BoolPtrOutput { 391 return o.ApplyT(func(v *Service) pulumi.BoolPtrOutput { return v.ForceDestroy }).(pulumi.BoolPtrOutput) 392 } 393 394 // A complex type that contains settings for an optional health check. Only for Public DNS namespaces. 395 func (o ServiceOutput) HealthCheckConfig() ServiceHealthCheckConfigPtrOutput { 396 return o.ApplyT(func(v *Service) ServiceHealthCheckConfigPtrOutput { return v.HealthCheckConfig }).(ServiceHealthCheckConfigPtrOutput) 397 } 398 399 // A complex type that contains settings for ECS managed health checks. 400 func (o ServiceOutput) HealthCheckCustomConfig() ServiceHealthCheckCustomConfigPtrOutput { 401 return o.ApplyT(func(v *Service) ServiceHealthCheckCustomConfigPtrOutput { return v.HealthCheckCustomConfig }).(ServiceHealthCheckCustomConfigPtrOutput) 402 } 403 404 // The name of the service. 405 func (o ServiceOutput) Name() pulumi.StringOutput { 406 return o.ApplyT(func(v *Service) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 407 } 408 409 // The ID of the namespace that you want to use to create the service. 410 func (o ServiceOutput) NamespaceId() pulumi.StringOutput { 411 return o.ApplyT(func(v *Service) pulumi.StringOutput { return v.NamespaceId }).(pulumi.StringOutput) 412 } 413 414 // A map of tags to assign to the service. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 415 func (o ServiceOutput) Tags() pulumi.StringMapOutput { 416 return o.ApplyT(func(v *Service) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 417 } 418 419 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 420 // 421 // Deprecated: Please use `tags` instead. 422 func (o ServiceOutput) TagsAll() pulumi.StringMapOutput { 423 return o.ApplyT(func(v *Service) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 424 } 425 426 // If present, specifies that the service instances are only discoverable using the `DiscoverInstances` API operation. No DNS records is registered for the service instances. The only valid value is `HTTP`. 427 func (o ServiceOutput) Type() pulumi.StringOutput { 428 return o.ApplyT(func(v *Service) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput) 429 } 430 431 type ServiceArrayOutput struct{ *pulumi.OutputState } 432 433 func (ServiceArrayOutput) ElementType() reflect.Type { 434 return reflect.TypeOf((*[]*Service)(nil)).Elem() 435 } 436 437 func (o ServiceArrayOutput) ToServiceArrayOutput() ServiceArrayOutput { 438 return o 439 } 440 441 func (o ServiceArrayOutput) ToServiceArrayOutputWithContext(ctx context.Context) ServiceArrayOutput { 442 return o 443 } 444 445 func (o ServiceArrayOutput) Index(i pulumi.IntInput) ServiceOutput { 446 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Service { 447 return vs[0].([]*Service)[vs[1].(int)] 448 }).(ServiceOutput) 449 } 450 451 type ServiceMapOutput struct{ *pulumi.OutputState } 452 453 func (ServiceMapOutput) ElementType() reflect.Type { 454 return reflect.TypeOf((*map[string]*Service)(nil)).Elem() 455 } 456 457 func (o ServiceMapOutput) ToServiceMapOutput() ServiceMapOutput { 458 return o 459 } 460 461 func (o ServiceMapOutput) ToServiceMapOutputWithContext(ctx context.Context) ServiceMapOutput { 462 return o 463 } 464 465 func (o ServiceMapOutput) MapIndex(k pulumi.StringInput) ServiceOutput { 466 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Service { 467 return vs[0].(map[string]*Service)[vs[1].(string)] 468 }).(ServiceOutput) 469 } 470 471 func init() { 472 pulumi.RegisterInputType(reflect.TypeOf((*ServiceInput)(nil)).Elem(), &Service{}) 473 pulumi.RegisterInputType(reflect.TypeOf((*ServiceArrayInput)(nil)).Elem(), ServiceArray{}) 474 pulumi.RegisterInputType(reflect.TypeOf((*ServiceMapInput)(nil)).Elem(), ServiceMap{}) 475 pulumi.RegisterOutputType(ServiceOutput{}) 476 pulumi.RegisterOutputType(ServiceArrayOutput{}) 477 pulumi.RegisterOutputType(ServiceMapOutput{}) 478 }