dtkyayvldeaqhl7151 2018-01-17 20:00
浏览 38

storagegateway.ListGateways()返回“无效资源”,状态码为:400

I am having trouble using the go sdk to list all of the storage gateways in a region using the following code:

package main

import (
    "fmt"

    "github.com/aws/aws-sdk-go/aws"
    "github.com/aws/aws-sdk-go/aws/session"
    "github.com/aws/aws-sdk-go/service/storagegateway"
)

func newSess() (sess *session.Session) {
    sess, err := session.NewSession(&aws.Config{
        Region: aws.String("us-east-2"),
    })

    if err != nil {
        fmt.Printf("Error creating session: %s
", err)
        return
    }

    return sess
}

func main() {
    sgw := storagegateway.New(newSess())

    input := &storagegateway.ListGatewaysInput{
        Limit:  aws.Int64(5),
        Marker: aws.String("1"),
    }

    result, err := sgw.ListGateways(input)
    if err != nil {
        fmt.Printf("Error listing gateways %s
", err)
        return
    }

    fmt.Println(result)

}

My environment is the following:

  • Go version: 1.9.2 darwin/amd64
  • Operating system: macOS 10.13.2
  • aws-sdk-go: v1.12.63

The SDK is using the default profile specified in ~/.aws/config as it should and the credentials are correct as well. Furthermore, I am able to list the gateways using the awscli alone.

This could very well be something simple that I have overlooked as I am no expert. That said, any help would be greatly appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序
    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 Centos / PETSc / PETGEM