sts

package
v0.0.0-...-e71fdca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StsSignVersion sts sign version
	StsSignVersion = "1.0"
	// StsAPIVersion sts api version
	StsAPIVersion = "2015-04-01"
	// StsHost sts host
	StsHost = "https://sts.aliyuncs.com/"
	// TimeFormat time fomrat
	TimeFormat = "2006-01-02T15:04:05Z"
	// RespBodyFormat  respone body format
	RespBodyFormat = "JSON"
	// PercentEncode '/'
	PercentEncode = "%2F"
	// HTTPGet http get method
	HTTPGet = "GET"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssumedRoleUser

type AssumedRoleUser struct {
	Arn           string
	AssumedRoleId string
}

AssumedRoleUser the user to AssumedRole

type Client

type Client struct {
	AccessKeyId     string
	AccessKeySecret string
	RoleArn         string
	SessionName     string
	Policy          *Policy
}

Client sts client

func NewClient

func NewClient(accessKeyID, accessKeySecret, roleArn, sessionName string) *Client

NewClient New STS Client

func NewClientWithPolicy

func NewClientWithPolicy(accessKeyID, accessKeySecret, roleArn, sessionName string, policy *Policy) *Client

NewClientWithPolicy New STS Client With Policy

func (*Client) AssumeRole

func (c *Client) AssumeRole(expiredTime uint) (*Response, error)

AssumeRole assume role

type Credentials

type Credentials struct {
	AccessKeyId     string
	AccessKeySecret string
	Expiration      time.Time
	SecurityToken   string
}

Credentials the credentials obtained by AssumedRole, used for the peration of Alibaba Cloud service.

type Policy

type Policy struct {
	Version   string
	Statement []PolicyStatement
}

Policy sts policy

func (*Policy) ToString

func (p *Policy) ToString() (string, error)

ToString policy to json string

type PolicyStatement

type PolicyStatement struct {
	Effect   string
	Action   []string
	Resource []string
}

PolicyStatement policy statement

type Response

type Response struct {
	Credentials     Credentials
	AssumedRoleUser AssumedRoleUser
	RequestId       string
}

Response the response of AssumeRole

type ServiceError

type ServiceError struct {
	Code       string
	Message    string
	RequestId  string
	HostId     string
	RawMessage string
	StatusCode int
}

ServiceError sts service error

func (*ServiceError) Error

func (e *ServiceError) Error() string

Error implement interface error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL