-
Notifications
You must be signed in to change notification settings - Fork 598
/
api_op_GetOpenIdToken.go
143 lines (118 loc) · 4.32 KB
/
api_op_GetOpenIdToken.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
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cognitoidentity
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
// Input to the GetOpenIdToken action.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdTokenInput
type GetOpenIdTokenInput struct {
_ struct{} `type:"structure"`
// A unique identifier in the format REGION:GUID.
//
// IdentityId is a required field
IdentityId *string `min:"1" type:"string" required:"true"`
// A set of optional name-value pairs that map provider names to provider tokens.
// When using graph.facebook.com and www.amazon.com, supply the access_token
// returned from the provider's authflow. For accounts.google.com, an Amazon
// Cognito user pool provider, or any other OpenId Connect provider, always
// include the id_token.
Logins map[string]string `type:"map"`
}
// String returns the string representation
func (s GetOpenIdTokenInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *GetOpenIdTokenInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "GetOpenIdTokenInput"}
if s.IdentityId == nil {
invalidParams.Add(aws.NewErrParamRequired("IdentityId"))
}
if s.IdentityId != nil && len(*s.IdentityId) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("IdentityId", 1))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// Returned in response to a successful GetOpenIdToken request.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdTokenResponse
type GetOpenIdTokenOutput struct {
_ struct{} `type:"structure"`
// A unique identifier in the format REGION:GUID. Note that the IdentityId returned
// may not match the one passed on input.
IdentityId *string `min:"1" type:"string"`
// An OpenID token, valid for 10 minutes.
Token *string `type:"string"`
}
// String returns the string representation
func (s GetOpenIdTokenOutput) String() string {
return awsutil.Prettify(s)
}
const opGetOpenIdToken = "GetOpenIdToken"
// GetOpenIdTokenRequest returns a request value for making API operation for
// Amazon Cognito Identity.
//
// Gets an OpenID token, using a known Cognito ID. This known Cognito ID is
// returned by GetId. You can optionally add additional logins for the identity.
// Supplying multiple logins creates an implicit link.
//
// The OpenId token is valid for 10 minutes.
//
// This is a public API. You do not need any credentials to call this API.
//
// // Example sending a request using GetOpenIdTokenRequest.
// req := client.GetOpenIdTokenRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-identity-2014-06-30/GetOpenIdToken
func (c *Client) GetOpenIdTokenRequest(input *GetOpenIdTokenInput) GetOpenIdTokenRequest {
op := &aws.Operation{
Name: opGetOpenIdToken,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &GetOpenIdTokenInput{}
}
req := c.newRequest(op, input, &GetOpenIdTokenOutput{})
req.Config.Credentials = aws.AnonymousCredentials
return GetOpenIdTokenRequest{Request: req, Input: input, Copy: c.GetOpenIdTokenRequest}
}
// GetOpenIdTokenRequest is the request type for the
// GetOpenIdToken API operation.
type GetOpenIdTokenRequest struct {
*aws.Request
Input *GetOpenIdTokenInput
Copy func(*GetOpenIdTokenInput) GetOpenIdTokenRequest
}
// Send marshals and sends the GetOpenIdToken API request.
func (r GetOpenIdTokenRequest) Send(ctx context.Context) (*GetOpenIdTokenResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &GetOpenIdTokenResponse{
GetOpenIdTokenOutput: r.Request.Data.(*GetOpenIdTokenOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// GetOpenIdTokenResponse is the response type for the
// GetOpenIdToken API operation.
type GetOpenIdTokenResponse struct {
*GetOpenIdTokenOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// GetOpenIdToken request.
func (r *GetOpenIdTokenResponse) SDKResponseMetdata() *aws.Response {
return r.response
}