-
Notifications
You must be signed in to change notification settings - Fork 151
/
getService.go
220 lines (198 loc) · 7.05 KB
/
getService.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
// 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 aws
import (
"context"
"reflect"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to compose and decompose AWS service DNS names.
//
// ## Example Usage
//
// ### Get Service DNS Name
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// current, err := aws.GetRegion(ctx, nil, nil)
// if err != nil {
// return err
// }
// _, err = aws.GetService(ctx, &aws.GetServiceArgs{
// Region: pulumi.StringRef(current.Name),
// ServiceId: pulumi.StringRef("ec2"),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ### Use Service Reverse DNS Name to Get Components
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := aws.GetService(ctx, &aws.GetServiceArgs{
// ReverseDnsName: pulumi.StringRef("cn.com.amazonaws.cn-north-1.s3"),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ### Determine Regional Support for a Service
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := aws.GetService(ctx, &aws.GetServiceArgs{
// ReverseDnsName: pulumi.StringRef("com.amazonaws.us-gov-west-1.waf"),
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func GetService(ctx *pulumi.Context, args *GetServiceArgs, opts ...pulumi.InvokeOption) (*GetServiceResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv GetServiceResult
err := ctx.Invoke("aws:index/getService:getService", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getService.
type GetServiceArgs struct {
// DNS name of the service (_e.g.,_ `rds.us-east-1.amazonaws.com`). One of `dnsName`, `reverseDnsName`, or `serviceId` is required.
DnsName *string `pulumi:"dnsName"`
Id *string `pulumi:"id"`
// Region of the service (_e.g.,_ `us-west-2`, `ap-northeast-1`).
Region *string `pulumi:"region"`
// Reverse DNS name of the service (_e.g.,_ `com.amazonaws.us-west-2.s3`). One of `dnsName`, `reverseDnsName`, or `serviceId` is required.
ReverseDnsName *string `pulumi:"reverseDnsName"`
// Prefix of the service (_e.g.,_ `com.amazonaws` in AWS Commercial, `cn.com.amazonaws` in AWS China).
ReverseDnsPrefix *string `pulumi:"reverseDnsPrefix"`
// Service (_e.g.,_ `s3`, `rds`, `ec2`). One of `dnsName`, `reverseDnsName`, or `serviceId` is required.
ServiceId *string `pulumi:"serviceId"`
}
// A collection of values returned by getService.
type GetServiceResult struct {
DnsName string `pulumi:"dnsName"`
Id string `pulumi:"id"`
Partition string `pulumi:"partition"`
Region string `pulumi:"region"`
ReverseDnsName string `pulumi:"reverseDnsName"`
ReverseDnsPrefix string `pulumi:"reverseDnsPrefix"`
ServiceId string `pulumi:"serviceId"`
// Whether the service is supported in the region's partition. New services may not be listed immediately as supported.
Supported bool `pulumi:"supported"`
}
func GetServiceOutput(ctx *pulumi.Context, args GetServiceOutputArgs, opts ...pulumi.InvokeOption) GetServiceResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (GetServiceResult, error) {
args := v.(GetServiceArgs)
r, err := GetService(ctx, &args, opts...)
var s GetServiceResult
if r != nil {
s = *r
}
return s, err
}).(GetServiceResultOutput)
}
// A collection of arguments for invoking getService.
type GetServiceOutputArgs struct {
// DNS name of the service (_e.g.,_ `rds.us-east-1.amazonaws.com`). One of `dnsName`, `reverseDnsName`, or `serviceId` is required.
DnsName pulumi.StringPtrInput `pulumi:"dnsName"`
Id pulumi.StringPtrInput `pulumi:"id"`
// Region of the service (_e.g.,_ `us-west-2`, `ap-northeast-1`).
Region pulumi.StringPtrInput `pulumi:"region"`
// Reverse DNS name of the service (_e.g.,_ `com.amazonaws.us-west-2.s3`). One of `dnsName`, `reverseDnsName`, or `serviceId` is required.
ReverseDnsName pulumi.StringPtrInput `pulumi:"reverseDnsName"`
// Prefix of the service (_e.g.,_ `com.amazonaws` in AWS Commercial, `cn.com.amazonaws` in AWS China).
ReverseDnsPrefix pulumi.StringPtrInput `pulumi:"reverseDnsPrefix"`
// Service (_e.g.,_ `s3`, `rds`, `ec2`). One of `dnsName`, `reverseDnsName`, or `serviceId` is required.
ServiceId pulumi.StringPtrInput `pulumi:"serviceId"`
}
func (GetServiceOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*GetServiceArgs)(nil)).Elem()
}
// A collection of values returned by getService.
type GetServiceResultOutput struct{ *pulumi.OutputState }
func (GetServiceResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*GetServiceResult)(nil)).Elem()
}
func (o GetServiceResultOutput) ToGetServiceResultOutput() GetServiceResultOutput {
return o
}
func (o GetServiceResultOutput) ToGetServiceResultOutputWithContext(ctx context.Context) GetServiceResultOutput {
return o
}
func (o GetServiceResultOutput) DnsName() pulumi.StringOutput {
return o.ApplyT(func(v GetServiceResult) string { return v.DnsName }).(pulumi.StringOutput)
}
func (o GetServiceResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v GetServiceResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o GetServiceResultOutput) Partition() pulumi.StringOutput {
return o.ApplyT(func(v GetServiceResult) string { return v.Partition }).(pulumi.StringOutput)
}
func (o GetServiceResultOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v GetServiceResult) string { return v.Region }).(pulumi.StringOutput)
}
func (o GetServiceResultOutput) ReverseDnsName() pulumi.StringOutput {
return o.ApplyT(func(v GetServiceResult) string { return v.ReverseDnsName }).(pulumi.StringOutput)
}
func (o GetServiceResultOutput) ReverseDnsPrefix() pulumi.StringOutput {
return o.ApplyT(func(v GetServiceResult) string { return v.ReverseDnsPrefix }).(pulumi.StringOutput)
}
func (o GetServiceResultOutput) ServiceId() pulumi.StringOutput {
return o.ApplyT(func(v GetServiceResult) string { return v.ServiceId }).(pulumi.StringOutput)
}
// Whether the service is supported in the region's partition. New services may not be listed immediately as supported.
func (o GetServiceResultOutput) Supported() pulumi.BoolOutput {
return o.ApplyT(func(v GetServiceResult) bool { return v.Supported }).(pulumi.BoolOutput)
}
func init() {
pulumi.RegisterOutputType(GetServiceResultOutput{})
}