-
Notifications
You must be signed in to change notification settings - Fork 616
/
api_op_DescribeNotificationRule.go
262 lines (211 loc) · 7.97 KB
/
api_op_DescribeNotificationRule.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package codestarnotifications
import (
"context"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
type DescribeNotificationRuleInput struct {
_ struct{} `type:"structure"`
// The Amazon Resource Name (ARN) of the notification rule.
//
// Arn is a required field
Arn *string `type:"string" required:"true"`
}
// String returns the string representation
func (s DescribeNotificationRuleInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *DescribeNotificationRuleInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "DescribeNotificationRuleInput"}
if s.Arn == nil {
invalidParams.Add(aws.NewErrParamRequired("Arn"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s DescribeNotificationRuleInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.Arn != nil {
v := *s.Arn
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "Arn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
type DescribeNotificationRuleOutput struct {
_ struct{} `type:"structure"`
// The Amazon Resource Name (ARN) of the notification rule.
//
// Arn is a required field
Arn *string `type:"string" required:"true"`
// The name or email alias of the person who created the notification rule.
CreatedBy *string `min:"1" type:"string"`
// The date and time the notification rule was created, in timestamp format.
CreatedTimestamp *time.Time `type:"timestamp"`
// The level of detail included in the notifications for this resource. BASIC
// will include only the contents of the event as it would appear in AWS CloudWatch.
// FULL will include any supplemental information provided by AWS CodeStar Notifications
// and/or the service for the resource for which the notification is created.
DetailType DetailType `type:"string" enum:"true"`
// A list of the event types associated with the notification rule.
EventTypes []EventTypeSummary `type:"list"`
// The date and time the notification rule was most recently updated, in timestamp
// format.
LastModifiedTimestamp *time.Time `type:"timestamp"`
// The name of the notification rule.
Name *string `min:"1" type:"string" sensitive:"true"`
// The Amazon Resource Name (ARN) of the resource associated with the notification
// rule.
Resource *string `type:"string"`
// The status of the notification rule. Valid statuses are on (sending notifications)
// or off (not sending notifications).
Status NotificationRuleStatus `type:"string" enum:"true"`
// The tags associated with the notification rule.
Tags map[string]string `type:"map"`
// A list of the SNS topics associated with the notification rule.
Targets []TargetSummary `type:"list"`
}
// String returns the string representation
func (s DescribeNotificationRuleOutput) String() string {
return awsutil.Prettify(s)
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s DescribeNotificationRuleOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.Arn != nil {
v := *s.Arn
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "Arn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.CreatedBy != nil {
v := *s.CreatedBy
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "CreatedBy", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.CreatedTimestamp != nil {
v := *s.CreatedTimestamp
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "CreatedTimestamp",
protocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)
}
if len(s.DetailType) > 0 {
v := s.DetailType
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "DetailType", protocol.QuotedValue{ValueMarshaler: v}, metadata)
}
if s.EventTypes != nil {
v := s.EventTypes
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "EventTypes", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddFields(v1)
}
ls0.End()
}
if s.LastModifiedTimestamp != nil {
v := *s.LastModifiedTimestamp
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "LastModifiedTimestamp",
protocol.TimeValue{V: v, Format: protocol.UnixTimeFormatName, QuotedFormatTime: true}, metadata)
}
if s.Name != nil {
v := *s.Name
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "Name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.Resource != nil {
v := *s.Resource
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "Resource", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if len(s.Status) > 0 {
v := s.Status
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "Status", protocol.QuotedValue{ValueMarshaler: v}, metadata)
}
if s.Tags != nil {
v := s.Tags
metadata := protocol.Metadata{}
ms0 := e.Map(protocol.BodyTarget, "Tags", metadata)
ms0.Start()
for k1, v1 := range v {
ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})
}
ms0.End()
}
if s.Targets != nil {
v := s.Targets
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "Targets", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddFields(v1)
}
ls0.End()
}
return nil
}
const opDescribeNotificationRule = "DescribeNotificationRule"
// DescribeNotificationRuleRequest returns a request value for making API operation for
// AWS CodeStar Notifications.
//
// Returns information about a specified notification rule.
//
// // Example sending a request using DescribeNotificationRuleRequest.
// req := client.DescribeNotificationRuleRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/codestar-notifications-2019-10-15/DescribeNotificationRule
func (c *Client) DescribeNotificationRuleRequest(input *DescribeNotificationRuleInput) DescribeNotificationRuleRequest {
op := &aws.Operation{
Name: opDescribeNotificationRule,
HTTPMethod: "POST",
HTTPPath: "/describeNotificationRule",
}
if input == nil {
input = &DescribeNotificationRuleInput{}
}
req := c.newRequest(op, input, &DescribeNotificationRuleOutput{})
return DescribeNotificationRuleRequest{Request: req, Input: input, Copy: c.DescribeNotificationRuleRequest}
}
// DescribeNotificationRuleRequest is the request type for the
// DescribeNotificationRule API operation.
type DescribeNotificationRuleRequest struct {
*aws.Request
Input *DescribeNotificationRuleInput
Copy func(*DescribeNotificationRuleInput) DescribeNotificationRuleRequest
}
// Send marshals and sends the DescribeNotificationRule API request.
func (r DescribeNotificationRuleRequest) Send(ctx context.Context) (*DescribeNotificationRuleResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &DescribeNotificationRuleResponse{
DescribeNotificationRuleOutput: r.Request.Data.(*DescribeNotificationRuleOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// DescribeNotificationRuleResponse is the response type for the
// DescribeNotificationRule API operation.
type DescribeNotificationRuleResponse struct {
*DescribeNotificationRuleOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// DescribeNotificationRule request.
func (r *DescribeNotificationRuleResponse) SDKResponseMetdata() *aws.Response {
return r.response
}