github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getNetworkInterfaces.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 // ## Example Usage 15 // 16 // The following shows outputting all network interface ids in a region. 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 // example, err := ec2.GetNetworkInterfaces(ctx, nil, nil) 32 // if err != nil { 33 // return err 34 // } 35 // ctx.Export("example", example.Ids) 36 // return nil 37 // }) 38 // } 39 // 40 // ``` 41 // <!--End PulumiCodeChooser --> 42 // 43 // The following example retrieves a list of all network interface ids with a custom tag of `Name` set to a value of `test`. 44 // 45 // <!--Start PulumiCodeChooser --> 46 // ```go 47 // package main 48 // 49 // import ( 50 // 51 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 52 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 53 // 54 // ) 55 // 56 // func main() { 57 // pulumi.Run(func(ctx *pulumi.Context) error { 58 // example, err := ec2.GetNetworkInterfaces(ctx, &ec2.GetNetworkInterfacesArgs{ 59 // Tags: map[string]interface{}{ 60 // "Name": "test", 61 // }, 62 // }, nil) 63 // if err != nil { 64 // return err 65 // } 66 // ctx.Export("example1", example.Ids) 67 // return nil 68 // }) 69 // } 70 // 71 // ``` 72 // <!--End PulumiCodeChooser --> 73 // 74 // The following example retrieves a network interface ids which associated 75 // with specific subnet. 76 // 77 // <!--Start PulumiCodeChooser --> 78 // ```go 79 // package main 80 // 81 // import ( 82 // 83 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 84 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 85 // 86 // ) 87 // func main() { 88 // pulumi.Run(func(ctx *pulumi.Context) error { 89 // example, err := ec2.GetNetworkInterfaces(ctx, &ec2.GetNetworkInterfacesArgs{ 90 // Filters: []ec2.GetNetworkInterfacesFilter{ 91 // { 92 // Name: "subnet-id", 93 // Values: interface{}{ 94 // test.Id, 95 // }, 96 // }, 97 // }, 98 // }, nil); 99 // if err != nil { 100 // return err 101 // } 102 // ctx.Export("example", example.Ids) 103 // return nil 104 // }) 105 // } 106 // ``` 107 // <!--End PulumiCodeChooser --> 108 func GetNetworkInterfaces(ctx *pulumi.Context, args *GetNetworkInterfacesArgs, opts ...pulumi.InvokeOption) (*GetNetworkInterfacesResult, error) { 109 opts = internal.PkgInvokeDefaultOpts(opts) 110 var rv GetNetworkInterfacesResult 111 err := ctx.Invoke("aws:ec2/getNetworkInterfaces:getNetworkInterfaces", args, &rv, opts...) 112 if err != nil { 113 return nil, err 114 } 115 return &rv, nil 116 } 117 118 // A collection of arguments for invoking getNetworkInterfaces. 119 type GetNetworkInterfacesArgs struct { 120 // Custom filter block as described below. 121 // 122 // More complex filters can be expressed using one or more `filter` sub-blocks, 123 // which take the following arguments: 124 Filters []GetNetworkInterfacesFilter `pulumi:"filters"` 125 // Map of tags, each pair of which must exactly match 126 // a pair on the desired network interfaces. 127 Tags map[string]string `pulumi:"tags"` 128 } 129 130 // A collection of values returned by getNetworkInterfaces. 131 type GetNetworkInterfacesResult struct { 132 Filters []GetNetworkInterfacesFilter `pulumi:"filters"` 133 // The provider-assigned unique ID for this managed resource. 134 Id string `pulumi:"id"` 135 // List of all the network interface ids found. 136 Ids []string `pulumi:"ids"` 137 Tags map[string]string `pulumi:"tags"` 138 } 139 140 func GetNetworkInterfacesOutput(ctx *pulumi.Context, args GetNetworkInterfacesOutputArgs, opts ...pulumi.InvokeOption) GetNetworkInterfacesResultOutput { 141 return pulumi.ToOutputWithContext(context.Background(), args). 142 ApplyT(func(v interface{}) (GetNetworkInterfacesResult, error) { 143 args := v.(GetNetworkInterfacesArgs) 144 r, err := GetNetworkInterfaces(ctx, &args, opts...) 145 var s GetNetworkInterfacesResult 146 if r != nil { 147 s = *r 148 } 149 return s, err 150 }).(GetNetworkInterfacesResultOutput) 151 } 152 153 // A collection of arguments for invoking getNetworkInterfaces. 154 type GetNetworkInterfacesOutputArgs struct { 155 // Custom filter block as described below. 156 // 157 // More complex filters can be expressed using one or more `filter` sub-blocks, 158 // which take the following arguments: 159 Filters GetNetworkInterfacesFilterArrayInput `pulumi:"filters"` 160 // Map of tags, each pair of which must exactly match 161 // a pair on the desired network interfaces. 162 Tags pulumi.StringMapInput `pulumi:"tags"` 163 } 164 165 func (GetNetworkInterfacesOutputArgs) ElementType() reflect.Type { 166 return reflect.TypeOf((*GetNetworkInterfacesArgs)(nil)).Elem() 167 } 168 169 // A collection of values returned by getNetworkInterfaces. 170 type GetNetworkInterfacesResultOutput struct{ *pulumi.OutputState } 171 172 func (GetNetworkInterfacesResultOutput) ElementType() reflect.Type { 173 return reflect.TypeOf((*GetNetworkInterfacesResult)(nil)).Elem() 174 } 175 176 func (o GetNetworkInterfacesResultOutput) ToGetNetworkInterfacesResultOutput() GetNetworkInterfacesResultOutput { 177 return o 178 } 179 180 func (o GetNetworkInterfacesResultOutput) ToGetNetworkInterfacesResultOutputWithContext(ctx context.Context) GetNetworkInterfacesResultOutput { 181 return o 182 } 183 184 func (o GetNetworkInterfacesResultOutput) Filters() GetNetworkInterfacesFilterArrayOutput { 185 return o.ApplyT(func(v GetNetworkInterfacesResult) []GetNetworkInterfacesFilter { return v.Filters }).(GetNetworkInterfacesFilterArrayOutput) 186 } 187 188 // The provider-assigned unique ID for this managed resource. 189 func (o GetNetworkInterfacesResultOutput) Id() pulumi.StringOutput { 190 return o.ApplyT(func(v GetNetworkInterfacesResult) string { return v.Id }).(pulumi.StringOutput) 191 } 192 193 // List of all the network interface ids found. 194 func (o GetNetworkInterfacesResultOutput) Ids() pulumi.StringArrayOutput { 195 return o.ApplyT(func(v GetNetworkInterfacesResult) []string { return v.Ids }).(pulumi.StringArrayOutput) 196 } 197 198 func (o GetNetworkInterfacesResultOutput) Tags() pulumi.StringMapOutput { 199 return o.ApplyT(func(v GetNetworkInterfacesResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 200 } 201 202 func init() { 203 pulumi.RegisterOutputType(GetNetworkInterfacesResultOutput{}) 204 }