api

package
v0.9.22 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package api defines all APIs supported by the STS service of BCE.

Index

Constants

View Source
const (
	DEFAULT_DURATION_SECONDS = 43200                 // default duration is 12 hours
	URI_PREFIX               = bce.URI_PREFIX + "v1" // sts service not support uri without prefix "v1"
	REQUEST_URI              = "/sessionToken"

	DEFAULT_ASSUMEROLE_DURATION_SECONDS = 7200 // default duration is 2 hours
	REQUEST_ASSUMEROLE_URI              = "/credential"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssumeRoleArgs added in v0.9.22

type AssumeRoleArgs struct {
	DurationSeconds int
	AccountId       string
	UserId          string
	RoleName        string
	Acl             string
}

type Credential added in v0.9.22

type Credential struct {
	AccessKeyId     string
	SecretAccessKey string
	SessionToken    string
	CreateTime      time.Time
	Expiration      time.Time
	UserId          string
	RoleId          string
}

func AssumeRole added in v0.9.22

func AssumeRole(cli bce.Client, args *AssumeRoleArgs) (*Credential, error)

AssumeRole - get the credential for the assume role from the STS service

PARAMS:

  • cli: the client object which can perform sending request
  • args: the args for assumeRole

RETURNS:

  • *Credential: result of this api
  • error: nil if ok otherwise the specific error

type GetSessionTokenResult

type GetSessionTokenResult struct {
	AccessKeyId     string
	SecretAccessKey string
	SessionToken    string
	CreateTime      string
	Expiration      string
	UserId          string
}

func GetSessionToken

func GetSessionToken(cli bce.Client, durationSec int, acl string) (*GetSessionTokenResult, error)

GetSessionToken - get the session token from the STS service

PARAMS:

  • cli: the client object which can perform sending request
  • durationSec: the duration seconds of the token
  • acl: the acl string

RETURNS:

  • *GetSessionTokenResult: result of this api
  • error: nil if ok otherwise the specific error

Jump to

Keyboard shortcuts

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