-
Notifications
You must be signed in to change notification settings - Fork 613
/
api_op_UpdateScript.go
194 lines (166 loc) · 6.05 KB
/
api_op_UpdateScript.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
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package gamelift
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type UpdateScriptInput struct {
_ struct{} `type:"structure"`
// A descriptive label that is associated with a script. Script names do not
// need to be unique.
Name *string `min:"1" type:"string"`
// A unique identifier for a Realtime script to update. You can use either the
// script ID or ARN value.
//
// ScriptId is a required field
ScriptId *string `type:"string" required:"true"`
// The location of the Amazon S3 bucket where a zipped file containing your
// Realtime scripts is stored. The storage location must specify the Amazon
// S3 bucket name, the zip file name (the "key"), and a role ARN that allows
// Amazon GameLift to access the Amazon S3 storage location. The S3 bucket must
// be in the same Region where you want to create a new script. By default,
// Amazon GameLift uploads the latest version of the zip file; if you have S3
// object versioning turned on, you can use the ObjectVersion parameter to specify
// an earlier version.
StorageLocation *S3Location `type:"structure"`
// The version that is associated with a build or script. Version strings do
// not need to be unique.
Version *string `min:"1" type:"string"`
// A data object containing your Realtime scripts and dependencies as a zip
// file. The zip file can have one or multiple files. Maximum size of a zip
// file is 5 MB.
//
// When using the AWS CLI tool to create a script, this parameter is set to
// the zip file name. It must be prepended with the string "fileb://" to indicate
// that the file data is a binary object. For example: --zip-file fileb://myRealtimeScript.zip.
//
// ZipFile is automatically base64 encoded/decoded by the SDK.
ZipFile []byte `type:"blob"`
}
// String returns the string representation
func (s UpdateScriptInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *UpdateScriptInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "UpdateScriptInput"}
if s.Name != nil && len(*s.Name) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("Name", 1))
}
if s.ScriptId == nil {
invalidParams.Add(aws.NewErrParamRequired("ScriptId"))
}
if s.Version != nil && len(*s.Version) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("Version", 1))
}
if s.StorageLocation != nil {
if err := s.StorageLocation.Validate(); err != nil {
invalidParams.AddNested("StorageLocation", err.(aws.ErrInvalidParams))
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
type UpdateScriptOutput struct {
_ struct{} `type:"structure"`
// The newly created script record with a unique script ID. The new script's
// storage location reflects an Amazon S3 location: (1) If the script was uploaded
// from an S3 bucket under your account, the storage location reflects the information
// that was provided in the CreateScript request; (2) If the script file was
// uploaded from a local zip file, the storage location reflects an S3 location
// controls by the Amazon GameLift service.
Script *Script `type:"structure"`
}
// String returns the string representation
func (s UpdateScriptOutput) String() string {
return awsutil.Prettify(s)
}
const opUpdateScript = "UpdateScript"
// UpdateScriptRequest returns a request value for making API operation for
// Amazon GameLift.
//
// Updates Realtime script metadata and content.
//
// To update script metadata, specify the script ID and provide updated name
// and/or version values.
//
// To update script content, provide an updated zip file by pointing to either
// a local file or an Amazon S3 bucket location. You can use either method regardless
// of how the original script was uploaded. Use the Version parameter to track
// updates to the script.
//
// If the call is successful, the updated metadata is stored in the script record
// and a revised script is uploaded to the Amazon GameLift service. Once the
// script is updated and acquired by a fleet instance, the new version is used
// for all new game sessions.
//
// Learn more
//
// Amazon GameLift Realtime Servers (https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-intro.html)
//
// Related operations
//
// * CreateScript
//
// * ListScripts
//
// * DescribeScript
//
// * UpdateScript
//
// * DeleteScript
//
// // Example sending a request using UpdateScriptRequest.
// req := client.UpdateScriptRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/gamelift-2015-10-01/UpdateScript
func (c *Client) UpdateScriptRequest(input *UpdateScriptInput) UpdateScriptRequest {
op := &aws.Operation{
Name: opUpdateScript,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &UpdateScriptInput{}
}
req := c.newRequest(op, input, &UpdateScriptOutput{})
return UpdateScriptRequest{Request: req, Input: input, Copy: c.UpdateScriptRequest}
}
// UpdateScriptRequest is the request type for the
// UpdateScript API operation.
type UpdateScriptRequest struct {
*aws.Request
Input *UpdateScriptInput
Copy func(*UpdateScriptInput) UpdateScriptRequest
}
// Send marshals and sends the UpdateScript API request.
func (r UpdateScriptRequest) Send(ctx context.Context) (*UpdateScriptResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &UpdateScriptResponse{
UpdateScriptOutput: r.Request.Data.(*UpdateScriptOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// UpdateScriptResponse is the response type for the
// UpdateScript API operation.
type UpdateScriptResponse struct {
*UpdateScriptOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// UpdateScript request.
func (r *UpdateScriptResponse) SDKResponseMetdata() *aws.Response {
return r.response
}