MCPcopy Index your code
hub / github.com/aliyun/aliyun-sts-go-sdk

github.com/aliyun/aliyun-sts-go-sdk @1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.0 ↗ · + Follow
19 symbols 48 edges 2 files 12 documented · 63%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Alibaba Cloud STS SDK for Go

GitHub Version Build Status Coverage Status Software License

关于

阿里云STS(Security Token Service) 是为阿里云账号(或RAM用户)提供短期访问权限管理的云服务。通过STS,您可以为联盟用户(您的本地账号系统所管理的用户)颁发一个自定义时效和访问权限的访问凭证。联盟用户可以使用STS短期访问凭证直接调用阿里云服务API,或登录阿里云管理控制台操作被授权访问的资源。

如果您需要快速掌握阿里云账号管理体系,请参看云栖社区

版本

  • 当前版本:1.0.0

运行环境

  • Go 1.5及以上

安装方法

  • 执行命令 go get github.com/aliyun/aliyun-sts-go-sdk/sts

使用方法

package main

import (
    "fmt"
    "os"

    "github.com/aliyun/aliyun-sts-go-sdk/sts"
)

func handleError(err error) {
    fmt.Println(err)
    os.Exit(-1)
}

const (
    accessKeyID     = "<AccessKeyID>"
    accessKeySecret = "<AccessKeySecret>"
    roleArn         = "<RoleArn>"
    sessionName     = "sts_demo"
)

func main() {
    stsClient := sts.NewClient(accessKeyID, accessKeySecret, roleArn, sessionName)

    resp, err := stsClient.AssumeRole(3600)
    if err != nil {
        handleError(err)
    }

    fmt.Printf("Credentials:\n")
    fmt.Printf("    AccessKeyID:%s\n", resp.Credentials.AccessKeyId)
    fmt.Printf("    AccessKeySecret:%s\n", resp.Credentials.AccessKeySecret)
    fmt.Printf("    SecurityToken:%s\n", resp.Credentials.SecurityToken)
    fmt.Printf("    Expiration:%s\n", resp.Credentials.Expiration)
}

作者

协议

Core symbols most depended-on inside this repo

NewClient
called by 6
sts/sts.go
handleResponse
called by 5
sts/sts.go
AssumeRole
called by 4
sts/sts.go
sendRequest
called by 3
sts/sts.go
generateSignedURL
called by 1
sts/sts.go
Error
called by 0
sts/sts.go

Shape

Method 11
Struct 6
Function 2

Languages

Go100%

Modules by API surface

sts/sts.go11 symbols
sts/sts_test.go8 symbols

For agents

$ claude mcp add aliyun-sts-go-sdk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page