-
Notifications
You must be signed in to change notification settings - Fork 594
/
api_op_UpdateUser.go
230 lines (198 loc) · 8.53 KB
/
api_op_UpdateUser.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
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package transfer
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type UpdateUserInput struct {
_ struct{} `type:"structure"`
// Specifies the landing directory (folder) for a user when they log in to the
// file transfer protocol-enabled server using their file transfer protocol
// client.
//
// An example is your-Amazon-S3-bucket-name>/home/username.
HomeDirectory *string `type:"string"`
// Logical directory mappings that specify what Amazon S3 paths and keys should
// be visible to your user and how you want to make them visible. You will need
// to specify the "Entry" and "Target" pair, where Entry shows how the path
// is made visible and Target is the actual Amazon S3 path. If you only specify
// a target, it will be displayed as is. You will need to also make sure that
// your IAM role provides access to paths in Target. The following is an example.
//
// '[ "/bucket2/documentation", { "Entry": "your-personal-report.pdf", "Target":
// "/bucket3/customized-reports/${transfer:UserName}.pdf" } ]'
//
// In most cases, you can use this value instead of the scope-down policy to
// lock your user down to the designated home directory ("chroot"). To do this,
// you can set Entry to '/' and set Target to the HomeDirectory parameter value.
//
// If the target of a logical directory entry does not exist in Amazon S3, the
// entry will be ignored. As a workaround, you can use the Amazon S3 api to
// create 0 byte objects as place holders for your directory. If using the CLI,
// use the s3api call instead of s3 so you can use the put-object operation.
// For example, you use the following: aws s3api put-object --bucket bucketname
// --key path/to/folder/. Make sure that the end of the key name ends in a /
// for it to be considered a folder.
HomeDirectoryMappings []HomeDirectoryMapEntry `min:"1" type:"list"`
// The type of landing directory (folder) you want your users' home directory
// to be when they log into the file transfer protocol-enabled server. If you
// set it to PATH, the user will see the absolute Amazon S3 bucket paths as
// is in their file transfer protocol clients. If you set it LOGICAL, you will
// need to provide mappings in the HomeDirectoryMappings for how you want to
// make Amazon S3 paths visible to your users.
HomeDirectoryType HomeDirectoryType `type:"string" enum:"true"`
// Allows you to supply a scope-down policy for your user so you can use the
// same IAM role across multiple users. The policy scopes down user access to
// portions of your Amazon S3 bucket. Variables you can use inside this policy
// include ${Transfer:UserName}, ${Transfer:HomeDirectory}, and ${Transfer:HomeBucket}.
//
// For scope-down policies, AWS Transfer Family stores the policy as a JSON
// blob, instead of the Amazon Resource Name (ARN) of the policy. You save the
// policy as a JSON blob and pass it in the Policy argument.
//
// For an example of a scope-down policy, see Creating a scope-down policy (https://docs.aws.amazon.com/transfer/latest/userguide/users.html#users-policies-scope-down).
//
// For more information, see AssumeRole (https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html)
// in the AWS Security Token Service API Reference.
Policy *string `type:"string"`
// The IAM role that controls your users' access to your Amazon S3 bucket. The
// policies attached to this role will determine the level of access you want
// to provide your users when transferring files into and out of your Amazon
// S3 bucket or buckets. The IAM role should also contain a trust relationship
// that allows the file transfer protocol-enabled server to access your resources
// when servicing your users' transfer requests.
Role *string `min:"20" type:"string"`
// A system-assigned unique identifier for a file transfer protocol-enabled
// server instance that the user account is assigned to.
//
// ServerId is a required field
ServerId *string `min:"19" type:"string" required:"true"`
// A unique string that identifies a user and is associated with a file transfer
// protocol-enabled server as specified by the ServerId. This is the string
// that will be used by your user when they log in to your server. This user
// name is a minimum of 3 and a maximum of 32 characters long. The following
// are valid characters: a-z, A-Z, 0-9, underscore, and hyphen. The user name
// can't start with a hyphen.
//
// UserName is a required field
UserName *string `min:"3" type:"string" required:"true"`
}
// String returns the string representation
func (s UpdateUserInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *UpdateUserInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "UpdateUserInput"}
if s.HomeDirectoryMappings != nil && len(s.HomeDirectoryMappings) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("HomeDirectoryMappings", 1))
}
if s.Role != nil && len(*s.Role) < 20 {
invalidParams.Add(aws.NewErrParamMinLen("Role", 20))
}
if s.ServerId == nil {
invalidParams.Add(aws.NewErrParamRequired("ServerId"))
}
if s.ServerId != nil && len(*s.ServerId) < 19 {
invalidParams.Add(aws.NewErrParamMinLen("ServerId", 19))
}
if s.UserName == nil {
invalidParams.Add(aws.NewErrParamRequired("UserName"))
}
if s.UserName != nil && len(*s.UserName) < 3 {
invalidParams.Add(aws.NewErrParamMinLen("UserName", 3))
}
if s.HomeDirectoryMappings != nil {
for i, v := range s.HomeDirectoryMappings {
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "HomeDirectoryMappings", i), err.(aws.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// UpdateUserResponse returns the user name and file transfer protocol-enabled
// server identifier for the request to update a user's properties.
type UpdateUserOutput struct {
_ struct{} `type:"structure"`
// A system-assigned unique identifier for a file transfer protocol-enabled
// server instance that the user account is assigned to.
//
// ServerId is a required field
ServerId *string `min:"19" type:"string" required:"true"`
// The unique identifier for a user that is assigned to a file transfer protocol-enabled
// server instance that was specified in the request.
//
// UserName is a required field
UserName *string `min:"3" type:"string" required:"true"`
}
// String returns the string representation
func (s UpdateUserOutput) String() string {
return awsutil.Prettify(s)
}
const opUpdateUser = "UpdateUser"
// UpdateUserRequest returns a request value for making API operation for
// AWS Transfer Family.
//
// Assigns new properties to a user. Parameters you pass modify any or all of
// the following: the home directory, role, and policy for the UserName and
// ServerId you specify.
//
// The response returns the ServerId and the UserName for the updated user.
//
// // Example sending a request using UpdateUserRequest.
// req := client.UpdateUserRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/transfer-2018-11-05/UpdateUser
func (c *Client) UpdateUserRequest(input *UpdateUserInput) UpdateUserRequest {
op := &aws.Operation{
Name: opUpdateUser,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &UpdateUserInput{}
}
req := c.newRequest(op, input, &UpdateUserOutput{})
return UpdateUserRequest{Request: req, Input: input, Copy: c.UpdateUserRequest}
}
// UpdateUserRequest is the request type for the
// UpdateUser API operation.
type UpdateUserRequest struct {
*aws.Request
Input *UpdateUserInput
Copy func(*UpdateUserInput) UpdateUserRequest
}
// Send marshals and sends the UpdateUser API request.
func (r UpdateUserRequest) Send(ctx context.Context) (*UpdateUserResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &UpdateUserResponse{
UpdateUserOutput: r.Request.Data.(*UpdateUserOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// UpdateUserResponse is the response type for the
// UpdateUser API operation.
type UpdateUserResponse struct {
*UpdateUserOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// UpdateUser request.
func (r *UpdateUserResponse) SDKResponseMetdata() *aws.Response {
return r.response
}