Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IAM : GetReport is returning unencoded bytes instead of base64 encoded data as per documentation #559

Closed
pmbapat opened this issue Feb 17, 2016 · 1 comment
Assignees
Labels
documentation This is a problem with documentation. guidance Question that needs advice or information.

Comments

@pmbapat
Copy link

pmbapat commented Feb 17, 2016

I'm running this example code.

package main

import (
    "fmt"

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

func main() {
    svc := iam.New(session.New())

    resp, err := svc.GenerateCredentialReport(&iam.GenerateCredentialReportInput{})
    if err != nil {
        fmt.Println(err.Error())
    }

    if *resp.State == "COMPLETE" {
        resp, _ := svc.GetCredentialReport(&iam.GetCredentialReportInput{})
        fmt.Println(string(resp.Content))
    }
}

As per the documentation, resp.Content should have base64 encoded data. But instead string(resp.Content) has the actual data. Is this the expected behavior or is the documentation wrong?

@jasdel
Copy link
Contributor

jasdel commented Feb 17, 2016

Hi @pmbapat thanks for pointing this out. The SDK will automatically convert blob AWS service API fields from base64 to a []byte the Content value will be the decoded raw bytes of the credentials report.

For fields which the service models as blobs the AWS SDKs will automatically apply special logic to decode the base64 encoded string into raw bytes as a convenience when unmarshalling the api operation response.

@jasdel jasdel added guidance Question that needs advice or information. documentation This is a problem with documentation. labels Feb 17, 2016
@jasdel jasdel self-assigned this Feb 17, 2016
jasdel added a commit that referenced this issue Mar 14, 2016
Adds custome doc string to blob types to document the fact the SDK will
automatically encode and decode the value as it goes across the wire.
Presending the user with a raw binary []byte type. Without needing to
manually encode/decode the value.

Fix #559
jasdel added a commit that referenced this issue Mar 14, 2016
Adds custom doc string to blob types to document the fact the SDK will
automatically encode and decode the value as it goes across the wire.
Presenting the user with a raw binary []byte type. Without needing to
manually encode/decode the value.

Fix #559
jasdel added a commit that referenced this issue Mar 18, 2016
xibz pushed a commit to xibz/aws-sdk-go that referenced this issue Apr 18, 2016
Adds custom doc string to blob types to document the fact the SDK will
automatically encode and decode the value as it goes across the wire.
Presenting the user with a raw binary []byte type. Without needing to
manually encode/decode the value.

Fix aws#559
xibz pushed a commit to xibz/aws-sdk-go that referenced this issue Apr 18, 2016
xibz pushed a commit to xibz/aws-sdk-go that referenced this issue Apr 18, 2016
Adds custom doc string to blob types to document the fact the SDK will
automatically encode and decode the value as it goes across the wire.
Presenting the user with a raw binary []byte type. Without needing to
manually encode/decode the value.

Fix aws#559
xibz pushed a commit to xibz/aws-sdk-go that referenced this issue Apr 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants