/
getManagedZone.go
175 lines (153 loc) · 6.19 KB
/
getManagedZone.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package dns
import (
"context"
"reflect"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides access to a zone's attributes within Google Cloud DNS.
// For more information see
// [the official documentation](https://cloud.google.com/dns/zones/)
// and
// [API](https://cloud.google.com/dns/api/v1/managedZones).
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/dns"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// envDnsZone, err := dns.LookupManagedZone(ctx, &dns.LookupManagedZoneArgs{
// Name: "qa-zone",
// }, nil)
// if err != nil {
// return err
// }
// _, err = dns.NewRecordSet(ctx, "dns", &dns.RecordSetArgs{
// Name: pulumi.String(fmt.Sprintf("my-address.%v", envDnsZone.DnsName)),
// Type: pulumi.String("TXT"),
// Ttl: pulumi.Int(300),
// ManagedZone: pulumi.String(envDnsZone.Name),
// Rrdatas: pulumi.StringArray{
// pulumi.String("test"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func LookupManagedZone(ctx *pulumi.Context, args *LookupManagedZoneArgs, opts ...pulumi.InvokeOption) (*LookupManagedZoneResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupManagedZoneResult
err := ctx.Invoke("gcp:dns/getManagedZone:getManagedZone", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getManagedZone.
type LookupManagedZoneArgs struct {
// A unique name for the resource.
Name string `pulumi:"name"`
// The ID of the project for the Google Cloud DNS zone. If this is not provided the default project will be used.
Project *string `pulumi:"project"`
}
// A collection of values returned by getManagedZone.
type LookupManagedZoneResult struct {
// A textual description field.
Description string `pulumi:"description"`
// The fully qualified DNS name of this zone, e.g. `example.io.`.
DnsName string `pulumi:"dnsName"`
Id string `pulumi:"id"`
ManagedZoneId int `pulumi:"managedZoneId"`
Name string `pulumi:"name"`
// The list of nameservers that will be authoritative for this
// domain. Use NS records to redirect from your DNS provider to these names,
// thus making Google Cloud DNS authoritative for this zone.
NameServers []string `pulumi:"nameServers"`
Project *string `pulumi:"project"`
// The zone's visibility: public zones are exposed to the Internet,
// while private zones are visible only to Virtual Private Cloud resources.
Visibility string `pulumi:"visibility"`
}
func LookupManagedZoneOutput(ctx *pulumi.Context, args LookupManagedZoneOutputArgs, opts ...pulumi.InvokeOption) LookupManagedZoneResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupManagedZoneResult, error) {
args := v.(LookupManagedZoneArgs)
r, err := LookupManagedZone(ctx, &args, opts...)
var s LookupManagedZoneResult
if r != nil {
s = *r
}
return s, err
}).(LookupManagedZoneResultOutput)
}
// A collection of arguments for invoking getManagedZone.
type LookupManagedZoneOutputArgs struct {
// A unique name for the resource.
Name pulumi.StringInput `pulumi:"name"`
// The ID of the project for the Google Cloud DNS zone. If this is not provided the default project will be used.
Project pulumi.StringPtrInput `pulumi:"project"`
}
func (LookupManagedZoneOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupManagedZoneArgs)(nil)).Elem()
}
// A collection of values returned by getManagedZone.
type LookupManagedZoneResultOutput struct{ *pulumi.OutputState }
func (LookupManagedZoneResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupManagedZoneResult)(nil)).Elem()
}
func (o LookupManagedZoneResultOutput) ToLookupManagedZoneResultOutput() LookupManagedZoneResultOutput {
return o
}
func (o LookupManagedZoneResultOutput) ToLookupManagedZoneResultOutputWithContext(ctx context.Context) LookupManagedZoneResultOutput {
return o
}
// A textual description field.
func (o LookupManagedZoneResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupManagedZoneResult) string { return v.Description }).(pulumi.StringOutput)
}
// The fully qualified DNS name of this zone, e.g. `example.io.`.
func (o LookupManagedZoneResultOutput) DnsName() pulumi.StringOutput {
return o.ApplyT(func(v LookupManagedZoneResult) string { return v.DnsName }).(pulumi.StringOutput)
}
func (o LookupManagedZoneResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupManagedZoneResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o LookupManagedZoneResultOutput) ManagedZoneId() pulumi.IntOutput {
return o.ApplyT(func(v LookupManagedZoneResult) int { return v.ManagedZoneId }).(pulumi.IntOutput)
}
func (o LookupManagedZoneResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupManagedZoneResult) string { return v.Name }).(pulumi.StringOutput)
}
// The list of nameservers that will be authoritative for this
// domain. Use NS records to redirect from your DNS provider to these names,
// thus making Google Cloud DNS authoritative for this zone.
func (o LookupManagedZoneResultOutput) NameServers() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupManagedZoneResult) []string { return v.NameServers }).(pulumi.StringArrayOutput)
}
func (o LookupManagedZoneResultOutput) Project() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupManagedZoneResult) *string { return v.Project }).(pulumi.StringPtrOutput)
}
// The zone's visibility: public zones are exposed to the Internet,
// while private zones are visible only to Virtual Private Cloud resources.
func (o LookupManagedZoneResultOutput) Visibility() pulumi.StringOutput {
return o.ApplyT(func(v LookupManagedZoneResult) string { return v.Visibility }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupManagedZoneResultOutput{})
}