github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getDedicatedHost.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 ec2
     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  // Use this data source to get information about an EC2 Dedicated Host.
    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/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			testDedicatedHost, err := ec2.NewDedicatedHost(ctx, "test", &ec2.DedicatedHostArgs{
    32  //				InstanceType:     pulumi.String("c5.18xlarge"),
    33  //				AvailabilityZone: pulumi.String("us-west-2a"),
    34  //			})
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			_ = ec2.LookupDedicatedHostOutput(ctx, ec2.GetDedicatedHostOutputArgs{
    39  //				HostId: testDedicatedHost.ID(),
    40  //			}, nil)
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ### Filter Example
    49  //
    50  // <!--Start PulumiCodeChooser -->
    51  // ```go
    52  // package main
    53  //
    54  // import (
    55  //
    56  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    57  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    58  //
    59  // )
    60  //
    61  //	func main() {
    62  //		pulumi.Run(func(ctx *pulumi.Context) error {
    63  //			_, err := ec2.LookupDedicatedHost(ctx, &ec2.LookupDedicatedHostArgs{
    64  //				Filters: []ec2.GetDedicatedHostFilter{
    65  //					{
    66  //						Name: "instance-type",
    67  //						Values: []string{
    68  //							"c5.18xlarge",
    69  //						},
    70  //					},
    71  //				},
    72  //			}, nil)
    73  //			if err != nil {
    74  //				return err
    75  //			}
    76  //			return nil
    77  //		})
    78  //	}
    79  //
    80  // ```
    81  // <!--End PulumiCodeChooser -->
    82  func LookupDedicatedHost(ctx *pulumi.Context, args *LookupDedicatedHostArgs, opts ...pulumi.InvokeOption) (*LookupDedicatedHostResult, error) {
    83  	opts = internal.PkgInvokeDefaultOpts(opts)
    84  	var rv LookupDedicatedHostResult
    85  	err := ctx.Invoke("aws:ec2/getDedicatedHost:getDedicatedHost", args, &rv, opts...)
    86  	if err != nil {
    87  		return nil, err
    88  	}
    89  	return &rv, nil
    90  }
    91  
    92  // A collection of arguments for invoking getDedicatedHost.
    93  type LookupDedicatedHostArgs struct {
    94  	// Configuration block. Detailed below.
    95  	Filters []GetDedicatedHostFilter `pulumi:"filters"`
    96  	// ID of the Dedicated Host.
    97  	HostId *string           `pulumi:"hostId"`
    98  	Tags   map[string]string `pulumi:"tags"`
    99  }
   100  
   101  // A collection of values returned by getDedicatedHost.
   102  type LookupDedicatedHostResult struct {
   103  	// ARN of the Dedicated Host.
   104  	Arn string `pulumi:"arn"`
   105  	// The ID of the Outpost hardware asset on which the Dedicated Host is allocated.
   106  	AssetId string `pulumi:"assetId"`
   107  	// Whether auto-placement is on or off.
   108  	AutoPlacement string `pulumi:"autoPlacement"`
   109  	// Availability Zone of the Dedicated Host.
   110  	AvailabilityZone string `pulumi:"availabilityZone"`
   111  	// Number of cores on the Dedicated Host.
   112  	Cores   int                      `pulumi:"cores"`
   113  	Filters []GetDedicatedHostFilter `pulumi:"filters"`
   114  	HostId  string                   `pulumi:"hostId"`
   115  	// Whether host recovery is enabled or disabled for the Dedicated Host.
   116  	HostRecovery string `pulumi:"hostRecovery"`
   117  	// The provider-assigned unique ID for this managed resource.
   118  	Id string `pulumi:"id"`
   119  	// Instance family supported by the Dedicated Host. For example, "m5".
   120  	InstanceFamily string `pulumi:"instanceFamily"`
   121  	// Instance type supported by the Dedicated Host. For example, "m5.large". If the host supports multiple instance types, no instanceType is returned.
   122  	InstanceType string `pulumi:"instanceType"`
   123  	// ARN of the AWS Outpost on which the Dedicated Host is allocated.
   124  	OutpostArn string `pulumi:"outpostArn"`
   125  	// ID of the AWS account that owns the Dedicated Host.
   126  	OwnerId string `pulumi:"ownerId"`
   127  	// Number of sockets on the Dedicated Host.
   128  	Sockets int               `pulumi:"sockets"`
   129  	Tags    map[string]string `pulumi:"tags"`
   130  	// Total number of vCPUs on the Dedicated Host.
   131  	TotalVcpus int `pulumi:"totalVcpus"`
   132  }
   133  
   134  func LookupDedicatedHostOutput(ctx *pulumi.Context, args LookupDedicatedHostOutputArgs, opts ...pulumi.InvokeOption) LookupDedicatedHostResultOutput {
   135  	return pulumi.ToOutputWithContext(context.Background(), args).
   136  		ApplyT(func(v interface{}) (LookupDedicatedHostResult, error) {
   137  			args := v.(LookupDedicatedHostArgs)
   138  			r, err := LookupDedicatedHost(ctx, &args, opts...)
   139  			var s LookupDedicatedHostResult
   140  			if r != nil {
   141  				s = *r
   142  			}
   143  			return s, err
   144  		}).(LookupDedicatedHostResultOutput)
   145  }
   146  
   147  // A collection of arguments for invoking getDedicatedHost.
   148  type LookupDedicatedHostOutputArgs struct {
   149  	// Configuration block. Detailed below.
   150  	Filters GetDedicatedHostFilterArrayInput `pulumi:"filters"`
   151  	// ID of the Dedicated Host.
   152  	HostId pulumi.StringPtrInput `pulumi:"hostId"`
   153  	Tags   pulumi.StringMapInput `pulumi:"tags"`
   154  }
   155  
   156  func (LookupDedicatedHostOutputArgs) ElementType() reflect.Type {
   157  	return reflect.TypeOf((*LookupDedicatedHostArgs)(nil)).Elem()
   158  }
   159  
   160  // A collection of values returned by getDedicatedHost.
   161  type LookupDedicatedHostResultOutput struct{ *pulumi.OutputState }
   162  
   163  func (LookupDedicatedHostResultOutput) ElementType() reflect.Type {
   164  	return reflect.TypeOf((*LookupDedicatedHostResult)(nil)).Elem()
   165  }
   166  
   167  func (o LookupDedicatedHostResultOutput) ToLookupDedicatedHostResultOutput() LookupDedicatedHostResultOutput {
   168  	return o
   169  }
   170  
   171  func (o LookupDedicatedHostResultOutput) ToLookupDedicatedHostResultOutputWithContext(ctx context.Context) LookupDedicatedHostResultOutput {
   172  	return o
   173  }
   174  
   175  // ARN of the Dedicated Host.
   176  func (o LookupDedicatedHostResultOutput) Arn() pulumi.StringOutput {
   177  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.Arn }).(pulumi.StringOutput)
   178  }
   179  
   180  // The ID of the Outpost hardware asset on which the Dedicated Host is allocated.
   181  func (o LookupDedicatedHostResultOutput) AssetId() pulumi.StringOutput {
   182  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.AssetId }).(pulumi.StringOutput)
   183  }
   184  
   185  // Whether auto-placement is on or off.
   186  func (o LookupDedicatedHostResultOutput) AutoPlacement() pulumi.StringOutput {
   187  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.AutoPlacement }).(pulumi.StringOutput)
   188  }
   189  
   190  // Availability Zone of the Dedicated Host.
   191  func (o LookupDedicatedHostResultOutput) AvailabilityZone() pulumi.StringOutput {
   192  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.AvailabilityZone }).(pulumi.StringOutput)
   193  }
   194  
   195  // Number of cores on the Dedicated Host.
   196  func (o LookupDedicatedHostResultOutput) Cores() pulumi.IntOutput {
   197  	return o.ApplyT(func(v LookupDedicatedHostResult) int { return v.Cores }).(pulumi.IntOutput)
   198  }
   199  
   200  func (o LookupDedicatedHostResultOutput) Filters() GetDedicatedHostFilterArrayOutput {
   201  	return o.ApplyT(func(v LookupDedicatedHostResult) []GetDedicatedHostFilter { return v.Filters }).(GetDedicatedHostFilterArrayOutput)
   202  }
   203  
   204  func (o LookupDedicatedHostResultOutput) HostId() pulumi.StringOutput {
   205  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.HostId }).(pulumi.StringOutput)
   206  }
   207  
   208  // Whether host recovery is enabled or disabled for the Dedicated Host.
   209  func (o LookupDedicatedHostResultOutput) HostRecovery() pulumi.StringOutput {
   210  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.HostRecovery }).(pulumi.StringOutput)
   211  }
   212  
   213  // The provider-assigned unique ID for this managed resource.
   214  func (o LookupDedicatedHostResultOutput) Id() pulumi.StringOutput {
   215  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.Id }).(pulumi.StringOutput)
   216  }
   217  
   218  // Instance family supported by the Dedicated Host. For example, "m5".
   219  func (o LookupDedicatedHostResultOutput) InstanceFamily() pulumi.StringOutput {
   220  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.InstanceFamily }).(pulumi.StringOutput)
   221  }
   222  
   223  // Instance type supported by the Dedicated Host. For example, "m5.large". If the host supports multiple instance types, no instanceType is returned.
   224  func (o LookupDedicatedHostResultOutput) InstanceType() pulumi.StringOutput {
   225  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.InstanceType }).(pulumi.StringOutput)
   226  }
   227  
   228  // ARN of the AWS Outpost on which the Dedicated Host is allocated.
   229  func (o LookupDedicatedHostResultOutput) OutpostArn() pulumi.StringOutput {
   230  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.OutpostArn }).(pulumi.StringOutput)
   231  }
   232  
   233  // ID of the AWS account that owns the Dedicated Host.
   234  func (o LookupDedicatedHostResultOutput) OwnerId() pulumi.StringOutput {
   235  	return o.ApplyT(func(v LookupDedicatedHostResult) string { return v.OwnerId }).(pulumi.StringOutput)
   236  }
   237  
   238  // Number of sockets on the Dedicated Host.
   239  func (o LookupDedicatedHostResultOutput) Sockets() pulumi.IntOutput {
   240  	return o.ApplyT(func(v LookupDedicatedHostResult) int { return v.Sockets }).(pulumi.IntOutput)
   241  }
   242  
   243  func (o LookupDedicatedHostResultOutput) Tags() pulumi.StringMapOutput {
   244  	return o.ApplyT(func(v LookupDedicatedHostResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   245  }
   246  
   247  // Total number of vCPUs on the Dedicated Host.
   248  func (o LookupDedicatedHostResultOutput) TotalVcpus() pulumi.IntOutput {
   249  	return o.ApplyT(func(v LookupDedicatedHostResult) int { return v.TotalVcpus }).(pulumi.IntOutput)
   250  }
   251  
   252  func init() {
   253  	pulumi.RegisterOutputType(LookupDedicatedHostResultOutput{})
   254  }