Switch to using the dep tool and update all the dependencies
This commit is contained in:
parent
5135ff73cb
commit
98c2d2c41b
5321 changed files with 4483201 additions and 5922 deletions
1
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go
generated
vendored
1
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go
generated
vendored
|
@ -131,7 +131,6 @@ func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag refl
|
|||
continue
|
||||
}
|
||||
|
||||
|
||||
mTag := field.Tag
|
||||
if mTag.Get("location") != "" { // skip non-body members
|
||||
continue
|
||||
|
|
7
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go
generated
vendored
7
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go
generated
vendored
|
@ -15,7 +15,10 @@ import (
|
|||
// needs to match the shape of the XML expected to be decoded.
|
||||
// If the shape doesn't match unmarshaling will fail.
|
||||
func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error {
|
||||
n, _ := XMLToStruct(d, nil)
|
||||
n, err := XMLToStruct(d, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if n.Children != nil {
|
||||
for _, root := range n.Children {
|
||||
for _, c := range root {
|
||||
|
@ -23,7 +26,7 @@ func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error {
|
|||
c = wrappedChild[0] // pull out wrapped element
|
||||
}
|
||||
|
||||
err := parse(reflect.ValueOf(v), c, "")
|
||||
err = parse(reflect.ValueOf(v), c, "")
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
|
|
142
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go
generated
vendored
Normal file
142
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal_test.go
generated
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
package xmlutil
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awsutil"
|
||||
)
|
||||
|
||||
type mockBody struct {
|
||||
DoneErr error
|
||||
Body io.Reader
|
||||
}
|
||||
|
||||
func (m *mockBody) Read(p []byte) (int, error) {
|
||||
n, err := m.Body.Read(p)
|
||||
if (n == 0 || err == io.EOF) && m.DoneErr != nil {
|
||||
return n, m.DoneErr
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
|
||||
type mockOutput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
String *string `type:"string"`
|
||||
Integer *int64 `type:"integer"`
|
||||
Nested *mockNestedStruct `type:"structure"`
|
||||
List []*mockListElem `locationName:"List" locationNameList:"Elem" type:"list"`
|
||||
Closed *mockClosedTags `type:"structure"`
|
||||
}
|
||||
type mockNestedStruct struct {
|
||||
_ struct{} `type:"structure"`
|
||||
NestedString *string `type:"string"`
|
||||
NestedInt *int64 `type:"integer"`
|
||||
}
|
||||
type mockClosedTags struct {
|
||||
_ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
|
||||
Attr *string `locationName:"xsi:attrval" type:"string" xmlAttribute:"true"`
|
||||
}
|
||||
type mockListElem struct {
|
||||
_ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
|
||||
String *string `type:"string"`
|
||||
NestedElem *mockNestedListElem `type:"structure"`
|
||||
}
|
||||
type mockNestedListElem struct {
|
||||
_ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"`
|
||||
|
||||
String *string `type:"string"`
|
||||
Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true"`
|
||||
}
|
||||
|
||||
func TestUnmarshal(t *testing.T) {
|
||||
const xmlBodyStr = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MockResponse xmlns="http://xmlns.example.com">
|
||||
<String>string value</String>
|
||||
<Integer>123</Integer>
|
||||
<Closed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:attrval="attr value"/>
|
||||
<Nested>
|
||||
<NestedString>nested string value</NestedString>
|
||||
<NestedInt>321</NestedInt>
|
||||
</Nested>
|
||||
<List>
|
||||
<Elem>
|
||||
<NestedElem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="type">
|
||||
<String>nested elem string value</String>
|
||||
</NestedElem>
|
||||
<String>elem string value</String>
|
||||
</Elem>
|
||||
</List>
|
||||
</MockResponse>`
|
||||
|
||||
expect := mockOutput{
|
||||
String: aws.String("string value"),
|
||||
Integer: aws.Int64(123),
|
||||
Closed: &mockClosedTags{
|
||||
Attr: aws.String("attr value"),
|
||||
},
|
||||
Nested: &mockNestedStruct{
|
||||
NestedString: aws.String("nested string value"),
|
||||
NestedInt: aws.Int64(321),
|
||||
},
|
||||
List: []*mockListElem{
|
||||
{
|
||||
String: aws.String("elem string value"),
|
||||
NestedElem: &mockNestedListElem{
|
||||
String: aws.String("nested elem string value"),
|
||||
Type: aws.String("type"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
actual := mockOutput{}
|
||||
decoder := xml.NewDecoder(strings.NewReader(xmlBodyStr))
|
||||
err := UnmarshalXML(&actual, decoder, "")
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, got %v", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(expect, actual) {
|
||||
t.Errorf("expect unmarshal to match\nExpect: %s\nActual: %s",
|
||||
awsutil.Prettify(expect), awsutil.Prettify(actual))
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshal_UnexpectedEOF(t *testing.T) {
|
||||
const partialXMLBody = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<First>first value</First>
|
||||
<Second>Second val`
|
||||
|
||||
out := struct {
|
||||
First *string `locationName:"First" type:"string"`
|
||||
Second *string `locationName:"Second" type:"string"`
|
||||
}{}
|
||||
|
||||
expect := out
|
||||
expect.First = aws.String("first")
|
||||
expect.Second = aws.String("second")
|
||||
|
||||
expectErr := fmt.Errorf("expected read error")
|
||||
|
||||
body := &mockBody{
|
||||
DoneErr: expectErr,
|
||||
Body: strings.NewReader(partialXMLBody),
|
||||
}
|
||||
|
||||
decoder := xml.NewDecoder(body)
|
||||
err := UnmarshalXML(&out, decoder, "")
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("expect error, got none")
|
||||
}
|
||||
if e, a := expectErr, err; e != a {
|
||||
t.Errorf("expect %v error in %v, but was not", e, a)
|
||||
}
|
||||
}
|
13
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go
generated
vendored
13
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go
generated
vendored
|
@ -40,11 +40,16 @@ func XMLToStruct(d *xml.Decoder, s *xml.StartElement) (*XMLNode, error) {
|
|||
out := &XMLNode{}
|
||||
for {
|
||||
tok, err := d.Token()
|
||||
if tok == nil || err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return out, err
|
||||
if err == io.EOF {
|
||||
break
|
||||
} else {
|
||||
return out, err
|
||||
}
|
||||
}
|
||||
|
||||
if tok == nil {
|
||||
break
|
||||
}
|
||||
|
||||
switch typed := tok.(type) {
|
||||
|
|
66
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct_test.go
generated
vendored
Normal file
66
vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct_test.go
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
package xmlutil_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
)
|
||||
|
||||
func TestUnmarshal(t *testing.T) {
|
||||
xmlVal := []byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
||||
<Owner>
|
||||
<ID>foo-id</ID>
|
||||
<DisplayName>user</DisplayName>
|
||||
</Owner>
|
||||
<AccessControlList>
|
||||
<Grant>
|
||||
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="type">
|
||||
<ID>foo-id</ID>
|
||||
<DisplayName>user</DisplayName>
|
||||
</Grantee>
|
||||
<Permission>FULL_CONTROL</Permission>
|
||||
</Grant>
|
||||
</AccessControlList>
|
||||
</AccessControlPolicy>`)
|
||||
|
||||
var server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(xmlVal)
|
||||
}))
|
||||
|
||||
sess := unit.Session
|
||||
sess.Config.Endpoint = &server.URL
|
||||
sess.Config.S3ForcePathStyle = aws.Bool(true)
|
||||
svc := s3.New(sess)
|
||||
|
||||
out, err := svc.GetBucketAcl(&s3.GetBucketAclInput{
|
||||
Bucket: aws.String("foo"),
|
||||
})
|
||||
|
||||
assert.NoError(t, err)
|
||||
|
||||
expected := &s3.GetBucketAclOutput{
|
||||
Grants: []*s3.Grant{
|
||||
{
|
||||
Grantee: &s3.Grantee{
|
||||
DisplayName: aws.String("user"),
|
||||
ID: aws.String("foo-id"),
|
||||
Type: aws.String("type"),
|
||||
},
|
||||
Permission: aws.String("FULL_CONTROL"),
|
||||
},
|
||||
},
|
||||
|
||||
Owner: &s3.Owner{
|
||||
DisplayName: aws.String("user"),
|
||||
ID: aws.String("foo-id"),
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expected, out)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue