github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/route53/getZone.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 route53 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 // `route53.Zone` provides details about a specific Route 53 Hosted Zone. 15 // 16 // This data source allows to find a Hosted Zone ID given Hosted Zone name and certain search criteria. 17 // 18 // ## Example Usage 19 // 20 // The following example shows how to get a Hosted Zone from its name and from this data how to create a Record Set. 21 // 22 // <!--Start PulumiCodeChooser --> 23 // ```go 24 // package main 25 // 26 // import ( 27 // 28 // "fmt" 29 // 30 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // selected, err := route53.LookupZone(ctx, &route53.LookupZoneArgs{ 38 // Name: pulumi.StringRef("test.com."), 39 // PrivateZone: pulumi.BoolRef(true), 40 // }, nil) 41 // if err != nil { 42 // return err 43 // } 44 // _, err = route53.NewRecord(ctx, "www", &route53.RecordArgs{ 45 // ZoneId: pulumi.String(selected.ZoneId), 46 // Name: pulumi.String(fmt.Sprintf("www.%v", selected.Name)), 47 // Type: pulumi.String(route53.RecordTypeA), 48 // Ttl: pulumi.Int(300), 49 // Records: pulumi.StringArray{ 50 // pulumi.String("10.0.0.1"), 51 // }, 52 // }) 53 // if err != nil { 54 // return err 55 // } 56 // return nil 57 // }) 58 // } 59 // 60 // ``` 61 // <!--End PulumiCodeChooser --> 62 func LookupZone(ctx *pulumi.Context, args *LookupZoneArgs, opts ...pulumi.InvokeOption) (*LookupZoneResult, error) { 63 opts = internal.PkgInvokeDefaultOpts(opts) 64 var rv LookupZoneResult 65 err := ctx.Invoke("aws:route53/getZone:getZone", args, &rv, opts...) 66 if err != nil { 67 return nil, err 68 } 69 return &rv, nil 70 } 71 72 // A collection of arguments for invoking getZone. 73 type LookupZoneArgs struct { 74 // Hosted Zone name of the desired Hosted Zone. 75 Name *string `pulumi:"name"` 76 // Used with `name` field to get a private Hosted Zone. 77 PrivateZone *bool `pulumi:"privateZone"` 78 // The number of Record Set in the Hosted Zone. 79 ResourceRecordSetCount *int `pulumi:"resourceRecordSetCount"` 80 // Used with `name` field. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone. 81 Tags map[string]string `pulumi:"tags"` 82 // Used with `name` field to get a private Hosted Zone associated with the vpcId (in this case, privateZone is not mandatory). 83 VpcId *string `pulumi:"vpcId"` 84 // Hosted Zone id of the desired Hosted Zone. 85 ZoneId *string `pulumi:"zoneId"` 86 } 87 88 // A collection of values returned by getZone. 89 type LookupZoneResult struct { 90 // ARN of the Hosted Zone. 91 Arn string `pulumi:"arn"` 92 // Caller Reference of the Hosted Zone. 93 CallerReference string `pulumi:"callerReference"` 94 // Comment field of the Hosted Zone. 95 Comment string `pulumi:"comment"` 96 // The provider-assigned unique ID for this managed resource. 97 Id string `pulumi:"id"` 98 // The description provided by the service that created the Hosted Zone (e.g., `arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx`). 99 LinkedServiceDescription string `pulumi:"linkedServiceDescription"` 100 // The service that created the Hosted Zone (e.g., `servicediscovery.amazonaws.com`). 101 LinkedServicePrincipal string `pulumi:"linkedServicePrincipal"` 102 Name string `pulumi:"name"` 103 // List of DNS name servers for the Hosted Zone. 104 NameServers []string `pulumi:"nameServers"` 105 // The Route 53 name server that created the SOA record. 106 PrimaryNameServer string `pulumi:"primaryNameServer"` 107 PrivateZone *bool `pulumi:"privateZone"` 108 // The number of Record Set in the Hosted Zone. 109 ResourceRecordSetCount int `pulumi:"resourceRecordSetCount"` 110 Tags map[string]string `pulumi:"tags"` 111 VpcId string `pulumi:"vpcId"` 112 ZoneId string `pulumi:"zoneId"` 113 } 114 115 func LookupZoneOutput(ctx *pulumi.Context, args LookupZoneOutputArgs, opts ...pulumi.InvokeOption) LookupZoneResultOutput { 116 return pulumi.ToOutputWithContext(context.Background(), args). 117 ApplyT(func(v interface{}) (LookupZoneResult, error) { 118 args := v.(LookupZoneArgs) 119 r, err := LookupZone(ctx, &args, opts...) 120 var s LookupZoneResult 121 if r != nil { 122 s = *r 123 } 124 return s, err 125 }).(LookupZoneResultOutput) 126 } 127 128 // A collection of arguments for invoking getZone. 129 type LookupZoneOutputArgs struct { 130 // Hosted Zone name of the desired Hosted Zone. 131 Name pulumi.StringPtrInput `pulumi:"name"` 132 // Used with `name` field to get a private Hosted Zone. 133 PrivateZone pulumi.BoolPtrInput `pulumi:"privateZone"` 134 // The number of Record Set in the Hosted Zone. 135 ResourceRecordSetCount pulumi.IntPtrInput `pulumi:"resourceRecordSetCount"` 136 // Used with `name` field. A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone. 137 Tags pulumi.StringMapInput `pulumi:"tags"` 138 // Used with `name` field to get a private Hosted Zone associated with the vpcId (in this case, privateZone is not mandatory). 139 VpcId pulumi.StringPtrInput `pulumi:"vpcId"` 140 // Hosted Zone id of the desired Hosted Zone. 141 ZoneId pulumi.StringPtrInput `pulumi:"zoneId"` 142 } 143 144 func (LookupZoneOutputArgs) ElementType() reflect.Type { 145 return reflect.TypeOf((*LookupZoneArgs)(nil)).Elem() 146 } 147 148 // A collection of values returned by getZone. 149 type LookupZoneResultOutput struct{ *pulumi.OutputState } 150 151 func (LookupZoneResultOutput) ElementType() reflect.Type { 152 return reflect.TypeOf((*LookupZoneResult)(nil)).Elem() 153 } 154 155 func (o LookupZoneResultOutput) ToLookupZoneResultOutput() LookupZoneResultOutput { 156 return o 157 } 158 159 func (o LookupZoneResultOutput) ToLookupZoneResultOutputWithContext(ctx context.Context) LookupZoneResultOutput { 160 return o 161 } 162 163 // ARN of the Hosted Zone. 164 func (o LookupZoneResultOutput) Arn() pulumi.StringOutput { 165 return o.ApplyT(func(v LookupZoneResult) string { return v.Arn }).(pulumi.StringOutput) 166 } 167 168 // Caller Reference of the Hosted Zone. 169 func (o LookupZoneResultOutput) CallerReference() pulumi.StringOutput { 170 return o.ApplyT(func(v LookupZoneResult) string { return v.CallerReference }).(pulumi.StringOutput) 171 } 172 173 // Comment field of the Hosted Zone. 174 func (o LookupZoneResultOutput) Comment() pulumi.StringOutput { 175 return o.ApplyT(func(v LookupZoneResult) string { return v.Comment }).(pulumi.StringOutput) 176 } 177 178 // The provider-assigned unique ID for this managed resource. 179 func (o LookupZoneResultOutput) Id() pulumi.StringOutput { 180 return o.ApplyT(func(v LookupZoneResult) string { return v.Id }).(pulumi.StringOutput) 181 } 182 183 // The description provided by the service that created the Hosted Zone (e.g., `arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx`). 184 func (o LookupZoneResultOutput) LinkedServiceDescription() pulumi.StringOutput { 185 return o.ApplyT(func(v LookupZoneResult) string { return v.LinkedServiceDescription }).(pulumi.StringOutput) 186 } 187 188 // The service that created the Hosted Zone (e.g., `servicediscovery.amazonaws.com`). 189 func (o LookupZoneResultOutput) LinkedServicePrincipal() pulumi.StringOutput { 190 return o.ApplyT(func(v LookupZoneResult) string { return v.LinkedServicePrincipal }).(pulumi.StringOutput) 191 } 192 193 func (o LookupZoneResultOutput) Name() pulumi.StringOutput { 194 return o.ApplyT(func(v LookupZoneResult) string { return v.Name }).(pulumi.StringOutput) 195 } 196 197 // List of DNS name servers for the Hosted Zone. 198 func (o LookupZoneResultOutput) NameServers() pulumi.StringArrayOutput { 199 return o.ApplyT(func(v LookupZoneResult) []string { return v.NameServers }).(pulumi.StringArrayOutput) 200 } 201 202 // The Route 53 name server that created the SOA record. 203 func (o LookupZoneResultOutput) PrimaryNameServer() pulumi.StringOutput { 204 return o.ApplyT(func(v LookupZoneResult) string { return v.PrimaryNameServer }).(pulumi.StringOutput) 205 } 206 207 func (o LookupZoneResultOutput) PrivateZone() pulumi.BoolPtrOutput { 208 return o.ApplyT(func(v LookupZoneResult) *bool { return v.PrivateZone }).(pulumi.BoolPtrOutput) 209 } 210 211 // The number of Record Set in the Hosted Zone. 212 func (o LookupZoneResultOutput) ResourceRecordSetCount() pulumi.IntOutput { 213 return o.ApplyT(func(v LookupZoneResult) int { return v.ResourceRecordSetCount }).(pulumi.IntOutput) 214 } 215 216 func (o LookupZoneResultOutput) Tags() pulumi.StringMapOutput { 217 return o.ApplyT(func(v LookupZoneResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 218 } 219 220 func (o LookupZoneResultOutput) VpcId() pulumi.StringOutput { 221 return o.ApplyT(func(v LookupZoneResult) string { return v.VpcId }).(pulumi.StringOutput) 222 } 223 224 func (o LookupZoneResultOutput) ZoneId() pulumi.StringOutput { 225 return o.ApplyT(func(v LookupZoneResult) string { return v.ZoneId }).(pulumi.StringOutput) 226 } 227 228 func init() { 229 pulumi.RegisterOutputType(LookupZoneResultOutput{}) 230 }