| 1 | package sts |
| 2 | |
| 3 | import "github.com/denverdino/aliyungo/common" |
| 4 | |
| 5 | type AssumeRoleRequest struct { |
| 6 | RoleArn string |
| 7 | RoleSessionName string |
| 8 | DurationSeconds int |
| 9 | Policy string |
| 10 | } |
| 11 | |
| 12 | type AssumedRoleUser struct { |
| 13 | AssumedRoleId string |
| 14 | Arn string |
| 15 | } |
| 16 | |
| 17 | type AssumedRoleUserCredentials struct { |
| 18 | AccessKeySecret string |
| 19 | AccessKeyId string |
| 20 | Expiration string |
| 21 | SecurityToken string |
| 22 | } |
| 23 | |
| 24 | type AssumeRoleResponse struct { |
| 25 | common.Response |
| 26 | AssumedRoleUser AssumedRoleUser |
| 27 | Credentials AssumedRoleUserCredentials |
| 28 | } |
| 29 | |
| 30 | func (c *STSClient) AssumeRole(r AssumeRoleRequest) (AssumeRoleResponse, error) { |
| 31 | resp := AssumeRoleResponse{} |
| 32 | e := c.Invoke("AssumeRole", r, &resp) |
| 33 | if e != nil { |
| 34 | return AssumeRoleResponse{}, e |
| 35 | } |
| 36 | return resp, nil |
| 37 | } |