-
Notifications
You must be signed in to change notification settings - Fork 623
/
api_op_CreateResolverEndpoint.go
186 lines (156 loc) · 5.98 KB
/
api_op_CreateResolverEndpoint.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
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package route53resolver
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type CreateResolverEndpointInput struct {
_ struct{} `type:"structure"`
// A unique string that identifies the request and that allows failed requests
// to be retried without the risk of executing the operation twice. CreatorRequestId
// can be any unique string, for example, a date/time stamp.
//
// CreatorRequestId is a required field
CreatorRequestId *string `min:"1" type:"string" required:"true"`
// Specify the applicable value:
//
// * INBOUND: Resolver forwards DNS queries to the DNS service for a VPC
// from your network or another VPC
//
// * OUTBOUND: Resolver forwards DNS queries from the DNS service for a VPC
// to your network or another VPC
//
// Direction is a required field
Direction ResolverEndpointDirection `type:"string" required:"true" enum:"true"`
// The subnets and IP addresses in your VPC that you want DNS queries to pass
// through on the way from your VPCs to your network (for outbound endpoints)
// or on the way from your network to your VPCs (for inbound resolver endpoints).
//
// IpAddresses is a required field
IpAddresses []IpAddressRequest `min:"1" type:"list" required:"true"`
// A friendly name that lets you easily find a configuration in the Resolver
// dashboard in the Route 53 console.
Name *string `type:"string"`
// The ID of one or more security groups that you want to use to control access
// to this VPC. The security group that you specify must include one or more
// inbound rules (for inbound resolver endpoints) or outbound rules (for outbound
// resolver endpoints).
//
// SecurityGroupIds is a required field
SecurityGroupIds []string `type:"list" required:"true"`
// A list of the tag keys and values that you want to associate with the endpoint.
Tags []Tag `type:"list"`
}
// String returns the string representation
func (s CreateResolverEndpointInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *CreateResolverEndpointInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "CreateResolverEndpointInput"}
if s.CreatorRequestId == nil {
invalidParams.Add(aws.NewErrParamRequired("CreatorRequestId"))
}
if s.CreatorRequestId != nil && len(*s.CreatorRequestId) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("CreatorRequestId", 1))
}
if len(s.Direction) == 0 {
invalidParams.Add(aws.NewErrParamRequired("Direction"))
}
if s.IpAddresses == nil {
invalidParams.Add(aws.NewErrParamRequired("IpAddresses"))
}
if s.IpAddresses != nil && len(s.IpAddresses) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("IpAddresses", 1))
}
if s.SecurityGroupIds == nil {
invalidParams.Add(aws.NewErrParamRequired("SecurityGroupIds"))
}
if s.IpAddresses != nil {
for i, v := range s.IpAddresses {
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "IpAddresses", i), err.(aws.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
type CreateResolverEndpointOutput struct {
_ struct{} `type:"structure"`
// Information about the CreateResolverEndpoint request, including the status
// of the request.
ResolverEndpoint *ResolverEndpoint `type:"structure"`
}
// String returns the string representation
func (s CreateResolverEndpointOutput) String() string {
return awsutil.Prettify(s)
}
const opCreateResolverEndpoint = "CreateResolverEndpoint"
// CreateResolverEndpointRequest returns a request value for making API operation for
// Amazon Route 53 Resolver.
//
// Creates a resolver endpoint. There are two types of resolver endpoints, inbound
// and outbound:
//
// * An inbound resolver endpoint forwards DNS queries to the DNS service
// for a VPC from your network or another VPC.
//
// * An outbound resolver endpoint forwards DNS queries from the DNS service
// for a VPC to your network or another VPC.
//
// // Example sending a request using CreateResolverEndpointRequest.
// req := client.CreateResolverEndpointRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/route53resolver-2018-04-01/CreateResolverEndpoint
func (c *Client) CreateResolverEndpointRequest(input *CreateResolverEndpointInput) CreateResolverEndpointRequest {
op := &aws.Operation{
Name: opCreateResolverEndpoint,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &CreateResolverEndpointInput{}
}
req := c.newRequest(op, input, &CreateResolverEndpointOutput{})
return CreateResolverEndpointRequest{Request: req, Input: input, Copy: c.CreateResolverEndpointRequest}
}
// CreateResolverEndpointRequest is the request type for the
// CreateResolverEndpoint API operation.
type CreateResolverEndpointRequest struct {
*aws.Request
Input *CreateResolverEndpointInput
Copy func(*CreateResolverEndpointInput) CreateResolverEndpointRequest
}
// Send marshals and sends the CreateResolverEndpoint API request.
func (r CreateResolverEndpointRequest) Send(ctx context.Context) (*CreateResolverEndpointResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &CreateResolverEndpointResponse{
CreateResolverEndpointOutput: r.Request.Data.(*CreateResolverEndpointOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// CreateResolverEndpointResponse is the response type for the
// CreateResolverEndpoint API operation.
type CreateResolverEndpointResponse struct {
*CreateResolverEndpointOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// CreateResolverEndpoint request.
func (r *CreateResolverEndpointResponse) SDKResponseMetdata() *aws.Response {
return r.response
}