forked from aws/amazon-ecs-agent
/
api.go
179 lines (151 loc) · 5.82 KB
/
api.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
// Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
// License is located at
//
// http://aws.amazon.com/apache2.0/
//
// or in the "license" file accompanying this file. This file is distributed
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing
// permissions and limitations under the License.
package ecr
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/request"
)
const opGetAuthorizationToken = "GetAuthorizationToken"
// GetAuthorizationTokenRequest generates a "aws/request.Request" representing the
// client's request for the GetAuthorizationToken operation. The "output" return
// value will be populated with the request's response once the request complets
// successfuly.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See GetAuthorizationToken for more information on using the GetAuthorizationToken
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
//
// // Example sending a request using the GetAuthorizationTokenRequest method.
// req, resp := client.GetAuthorizationTokenRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
func (c *ECR) GetAuthorizationTokenRequest(input *GetAuthorizationTokenInput) (req *request.Request, output *GetAuthorizationTokenOutput) {
op := &request.Operation{
Name: opGetAuthorizationToken,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &GetAuthorizationTokenInput{}
}
output = &GetAuthorizationTokenOutput{}
req = c.newRequest(op, input, output)
return
}
// GetAuthorizationToken API operation for Amazon EC2 Container Registry.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for Amazon EC2 Container Registry's
// API operation GetAuthorizationToken for usage and error information.
//
// Returned Error Codes:
// * ErrCodeServerException "ServerException"
//
// * ErrCodeInvalidParameterException "InvalidParameterException"
//
func (c *ECR) GetAuthorizationToken(input *GetAuthorizationTokenInput) (*GetAuthorizationTokenOutput, error) {
req, out := c.GetAuthorizationTokenRequest(input)
return out, req.Send()
}
// GetAuthorizationTokenWithContext is the same as GetAuthorizationToken with the addition of
// the ability to pass a context and additional request options.
//
// See GetAuthorizationToken for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *ECR) GetAuthorizationTokenWithContext(ctx aws.Context, input *GetAuthorizationTokenInput, opts ...request.Option) (*GetAuthorizationTokenOutput, error) {
req, out := c.GetAuthorizationTokenRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
type AuthorizationData struct {
_ struct{} `type:"structure"`
AuthorizationToken *string `locationName:"authorizationToken" type:"string"`
ExpiresAt *time.Time `locationName:"expiresAt" type:"timestamp" timestampFormat:"unix"`
ProxyEndpoint *string `locationName:"proxyEndpoint" type:"string"`
}
// String returns the string representation
func (s AuthorizationData) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s AuthorizationData) GoString() string {
return s.String()
}
// SetAuthorizationToken sets the AuthorizationToken field's value.
func (s *AuthorizationData) SetAuthorizationToken(v string) *AuthorizationData {
s.AuthorizationToken = &v
return s
}
// SetExpiresAt sets the ExpiresAt field's value.
func (s *AuthorizationData) SetExpiresAt(v time.Time) *AuthorizationData {
s.ExpiresAt = &v
return s
}
// SetProxyEndpoint sets the ProxyEndpoint field's value.
func (s *AuthorizationData) SetProxyEndpoint(v string) *AuthorizationData {
s.ProxyEndpoint = &v
return s
}
type GetAuthorizationTokenInput struct {
_ struct{} `type:"structure"`
RegistryIds []*string `locationName:"registryIds" type:"list"`
}
// String returns the string representation
func (s GetAuthorizationTokenInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s GetAuthorizationTokenInput) GoString() string {
return s.String()
}
// SetRegistryIds sets the RegistryIds field's value.
func (s *GetAuthorizationTokenInput) SetRegistryIds(v []*string) *GetAuthorizationTokenInput {
s.RegistryIds = v
return s
}
type GetAuthorizationTokenOutput struct {
_ struct{} `type:"structure"`
AuthorizationData []*AuthorizationData `locationName:"authorizationData" type:"list"`
}
// String returns the string representation
func (s GetAuthorizationTokenOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s GetAuthorizationTokenOutput) GoString() string {
return s.String()
}
// SetAuthorizationData sets the AuthorizationData field's value.
func (s *GetAuthorizationTokenOutput) SetAuthorizationData(v []*AuthorizationData) *GetAuthorizationTokenOutput {
s.AuthorizationData = v
return s
}