/
api_op_PutRetentionSettings.go
186 lines (152 loc) · 5.82 KB
/
api_op_PutRetentionSettings.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 chime
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 PutRetentionSettingsInput struct {
_ struct{} `type:"structure"`
// The Amazon Chime account ID.
//
// AccountId is a required field
AccountId *string `location:"uri" locationName:"accountId" type:"string" required:"true"`
// The retention settings.
//
// RetentionSettings is a required field
RetentionSettings *RetentionSettings `type:"structure" required:"true"`
}
// String returns the string representation
func (s PutRetentionSettingsInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *PutRetentionSettingsInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "PutRetentionSettingsInput"}
if s.AccountId == nil {
invalidParams.Add(aws.NewErrParamRequired("AccountId"))
}
if s.RetentionSettings == nil {
invalidParams.Add(aws.NewErrParamRequired("RetentionSettings"))
}
if s.RetentionSettings != nil {
if err := s.RetentionSettings.Validate(); err != nil {
invalidParams.AddNested("RetentionSettings", err.(aws.ErrInvalidParams))
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s PutRetentionSettingsInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.RetentionSettings != nil {
v := s.RetentionSettings
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "RetentionSettings", v, metadata)
}
if s.AccountId != nil {
v := *s.AccountId
metadata := protocol.Metadata{}
e.SetValue(protocol.PathTarget, "accountId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
type PutRetentionSettingsOutput struct {
_ struct{} `type:"structure"`
// The timestamp representing the time at which the specified items are permanently
// deleted, in ISO 8601 format.
InitiateDeletionTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
// The retention settings.
RetentionSettings *RetentionSettings `type:"structure"`
}
// String returns the string representation
func (s PutRetentionSettingsOutput) String() string {
return awsutil.Prettify(s)
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s PutRetentionSettingsOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.InitiateDeletionTimestamp != nil {
v := *s.InitiateDeletionTimestamp
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "InitiateDeletionTimestamp",
protocol.TimeValue{V: v, Format: "iso8601", QuotedFormatTime: true}, metadata)
}
if s.RetentionSettings != nil {
v := s.RetentionSettings
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "RetentionSettings", v, metadata)
}
return nil
}
const opPutRetentionSettings = "PutRetentionSettings"
// PutRetentionSettingsRequest returns a request value for making API operation for
// Amazon Chime.
//
// Puts retention settings for the specified Amazon Chime Enterprise account.
// We recommend using AWS CloudTrail to monitor usage of this API for your account.
// For more information, see Logging Amazon Chime API Calls with AWS CloudTrail
// (https://docs.aws.amazon.com/chime/latest/ag/cloudtrail.html) in the Amazon
// Chime Administration Guide.
//
// To turn off existing retention settings, remove the number of days from the
// corresponding RetentionDays field in the RetentionSettings object. For more
// information about retention settings, see Managing Chat Retention Policies
// (https://docs.aws.amazon.com/chime/latest/ag/chat-retention.html) in the
// Amazon Chime Administration Guide.
//
// // Example sending a request using PutRetentionSettingsRequest.
// req := client.PutRetentionSettingsRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/chime-2018-05-01/PutRetentionSettings
func (c *Client) PutRetentionSettingsRequest(input *PutRetentionSettingsInput) PutRetentionSettingsRequest {
op := &aws.Operation{
Name: opPutRetentionSettings,
HTTPMethod: "PUT",
HTTPPath: "/accounts/{accountId}/retention-settings",
}
if input == nil {
input = &PutRetentionSettingsInput{}
}
req := c.newRequest(op, input, &PutRetentionSettingsOutput{})
return PutRetentionSettingsRequest{Request: req, Input: input, Copy: c.PutRetentionSettingsRequest}
}
// PutRetentionSettingsRequest is the request type for the
// PutRetentionSettings API operation.
type PutRetentionSettingsRequest struct {
*aws.Request
Input *PutRetentionSettingsInput
Copy func(*PutRetentionSettingsInput) PutRetentionSettingsRequest
}
// Send marshals and sends the PutRetentionSettings API request.
func (r PutRetentionSettingsRequest) Send(ctx context.Context) (*PutRetentionSettingsResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &PutRetentionSettingsResponse{
PutRetentionSettingsOutput: r.Request.Data.(*PutRetentionSettingsOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// PutRetentionSettingsResponse is the response type for the
// PutRetentionSettings API operation.
type PutRetentionSettingsResponse struct {
*PutRetentionSettingsOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// PutRetentionSettings request.
func (r *PutRetentionSettingsResponse) SDKResponseMetdata() *aws.Response {
return r.response
}