github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getManagedPrefixList.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 // `ec2.ManagedPrefixList` provides details about a specific AWS prefix list or 15 // customer-managed prefix list in the current region. 16 // 17 // ## Example Usage 18 // 19 // ### Find the regional DynamoDB prefix list 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "fmt" 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 30 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // current, err := aws.GetRegion(ctx, nil, nil) 38 // if err != nil { 39 // return err 40 // } 41 // _, err = ec2.LookupManagedPrefixList(ctx, &ec2.LookupManagedPrefixListArgs{ 42 // Name: pulumi.StringRef(fmt.Sprintf("com.amazonaws.%v.dynamodb", current.Name)), 43 // }, nil) 44 // if err != nil { 45 // return err 46 // } 47 // return nil 48 // }) 49 // } 50 // 51 // ``` 52 // <!--End PulumiCodeChooser --> 53 // 54 // ### Find a managed prefix list using filters 55 // 56 // <!--Start PulumiCodeChooser --> 57 // ```go 58 // package main 59 // 60 // import ( 61 // 62 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 63 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 64 // 65 // ) 66 // 67 // func main() { 68 // pulumi.Run(func(ctx *pulumi.Context) error { 69 // _, err := ec2.LookupManagedPrefixList(ctx, &ec2.LookupManagedPrefixListArgs{ 70 // Filters: []ec2.GetManagedPrefixListFilter{ 71 // { 72 // Name: "prefix-list-name", 73 // Values: []string{ 74 // "my-prefix-list", 75 // }, 76 // }, 77 // }, 78 // }, nil) 79 // if err != nil { 80 // return err 81 // } 82 // return nil 83 // }) 84 // } 85 // 86 // ``` 87 // <!--End PulumiCodeChooser --> 88 func LookupManagedPrefixList(ctx *pulumi.Context, args *LookupManagedPrefixListArgs, opts ...pulumi.InvokeOption) (*LookupManagedPrefixListResult, error) { 89 opts = internal.PkgInvokeDefaultOpts(opts) 90 var rv LookupManagedPrefixListResult 91 err := ctx.Invoke("aws:ec2/getManagedPrefixList:getManagedPrefixList", args, &rv, opts...) 92 if err != nil { 93 return nil, err 94 } 95 return &rv, nil 96 } 97 98 // A collection of arguments for invoking getManagedPrefixList. 99 type LookupManagedPrefixListArgs struct { 100 // Configuration block(s) for filtering. Detailed below. 101 Filters []GetManagedPrefixListFilter `pulumi:"filters"` 102 // ID of the prefix list to select. 103 Id *string `pulumi:"id"` 104 // Name of the prefix list to select. 105 Name *string `pulumi:"name"` 106 // Map of tags assigned to the resource. 107 Tags map[string]string `pulumi:"tags"` 108 } 109 110 // A collection of values returned by getManagedPrefixList. 111 type LookupManagedPrefixListResult struct { 112 // Address family of the prefix list. Valid values are `IPv4` and `IPv6`. 113 AddressFamily string `pulumi:"addressFamily"` 114 // ARN of the selected prefix list. 115 Arn string `pulumi:"arn"` 116 // Set of entries in this prefix list. Each entry is an object with `cidr` and `description`. 117 Entries []GetManagedPrefixListEntryType `pulumi:"entries"` 118 Filters []GetManagedPrefixListFilter `pulumi:"filters"` 119 // ID of the selected prefix list. 120 Id string `pulumi:"id"` 121 // When then prefix list is managed, the maximum number of entries it supports, or null otherwise. 122 MaxEntries int `pulumi:"maxEntries"` 123 // Name of the selected prefix list. 124 Name string `pulumi:"name"` 125 // Account ID of the owner of a customer-managed prefix list, or `AWS` otherwise. 126 OwnerId string `pulumi:"ownerId"` 127 // Map of tags assigned to the resource. 128 Tags map[string]string `pulumi:"tags"` 129 Version int `pulumi:"version"` 130 } 131 132 func LookupManagedPrefixListOutput(ctx *pulumi.Context, args LookupManagedPrefixListOutputArgs, opts ...pulumi.InvokeOption) LookupManagedPrefixListResultOutput { 133 return pulumi.ToOutputWithContext(context.Background(), args). 134 ApplyT(func(v interface{}) (LookupManagedPrefixListResult, error) { 135 args := v.(LookupManagedPrefixListArgs) 136 r, err := LookupManagedPrefixList(ctx, &args, opts...) 137 var s LookupManagedPrefixListResult 138 if r != nil { 139 s = *r 140 } 141 return s, err 142 }).(LookupManagedPrefixListResultOutput) 143 } 144 145 // A collection of arguments for invoking getManagedPrefixList. 146 type LookupManagedPrefixListOutputArgs struct { 147 // Configuration block(s) for filtering. Detailed below. 148 Filters GetManagedPrefixListFilterArrayInput `pulumi:"filters"` 149 // ID of the prefix list to select. 150 Id pulumi.StringPtrInput `pulumi:"id"` 151 // Name of the prefix list to select. 152 Name pulumi.StringPtrInput `pulumi:"name"` 153 // Map of tags assigned to the resource. 154 Tags pulumi.StringMapInput `pulumi:"tags"` 155 } 156 157 func (LookupManagedPrefixListOutputArgs) ElementType() reflect.Type { 158 return reflect.TypeOf((*LookupManagedPrefixListArgs)(nil)).Elem() 159 } 160 161 // A collection of values returned by getManagedPrefixList. 162 type LookupManagedPrefixListResultOutput struct{ *pulumi.OutputState } 163 164 func (LookupManagedPrefixListResultOutput) ElementType() reflect.Type { 165 return reflect.TypeOf((*LookupManagedPrefixListResult)(nil)).Elem() 166 } 167 168 func (o LookupManagedPrefixListResultOutput) ToLookupManagedPrefixListResultOutput() LookupManagedPrefixListResultOutput { 169 return o 170 } 171 172 func (o LookupManagedPrefixListResultOutput) ToLookupManagedPrefixListResultOutputWithContext(ctx context.Context) LookupManagedPrefixListResultOutput { 173 return o 174 } 175 176 // Address family of the prefix list. Valid values are `IPv4` and `IPv6`. 177 func (o LookupManagedPrefixListResultOutput) AddressFamily() pulumi.StringOutput { 178 return o.ApplyT(func(v LookupManagedPrefixListResult) string { return v.AddressFamily }).(pulumi.StringOutput) 179 } 180 181 // ARN of the selected prefix list. 182 func (o LookupManagedPrefixListResultOutput) Arn() pulumi.StringOutput { 183 return o.ApplyT(func(v LookupManagedPrefixListResult) string { return v.Arn }).(pulumi.StringOutput) 184 } 185 186 // Set of entries in this prefix list. Each entry is an object with `cidr` and `description`. 187 func (o LookupManagedPrefixListResultOutput) Entries() GetManagedPrefixListEntryTypeArrayOutput { 188 return o.ApplyT(func(v LookupManagedPrefixListResult) []GetManagedPrefixListEntryType { return v.Entries }).(GetManagedPrefixListEntryTypeArrayOutput) 189 } 190 191 func (o LookupManagedPrefixListResultOutput) Filters() GetManagedPrefixListFilterArrayOutput { 192 return o.ApplyT(func(v LookupManagedPrefixListResult) []GetManagedPrefixListFilter { return v.Filters }).(GetManagedPrefixListFilterArrayOutput) 193 } 194 195 // ID of the selected prefix list. 196 func (o LookupManagedPrefixListResultOutput) Id() pulumi.StringOutput { 197 return o.ApplyT(func(v LookupManagedPrefixListResult) string { return v.Id }).(pulumi.StringOutput) 198 } 199 200 // When then prefix list is managed, the maximum number of entries it supports, or null otherwise. 201 func (o LookupManagedPrefixListResultOutput) MaxEntries() pulumi.IntOutput { 202 return o.ApplyT(func(v LookupManagedPrefixListResult) int { return v.MaxEntries }).(pulumi.IntOutput) 203 } 204 205 // Name of the selected prefix list. 206 func (o LookupManagedPrefixListResultOutput) Name() pulumi.StringOutput { 207 return o.ApplyT(func(v LookupManagedPrefixListResult) string { return v.Name }).(pulumi.StringOutput) 208 } 209 210 // Account ID of the owner of a customer-managed prefix list, or `AWS` otherwise. 211 func (o LookupManagedPrefixListResultOutput) OwnerId() pulumi.StringOutput { 212 return o.ApplyT(func(v LookupManagedPrefixListResult) string { return v.OwnerId }).(pulumi.StringOutput) 213 } 214 215 // Map of tags assigned to the resource. 216 func (o LookupManagedPrefixListResultOutput) Tags() pulumi.StringMapOutput { 217 return o.ApplyT(func(v LookupManagedPrefixListResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 218 } 219 220 func (o LookupManagedPrefixListResultOutput) Version() pulumi.IntOutput { 221 return o.ApplyT(func(v LookupManagedPrefixListResult) int { return v.Version }).(pulumi.IntOutput) 222 } 223 224 func init() { 225 pulumi.RegisterOutputType(LookupManagedPrefixListResultOutput{}) 226 }