Upgrade Azure Go SDK to v14.6.0

This commit is contained in:
Pengfei Ni
2018-04-24 14:31:34 +08:00
parent 3dbcd1ddce
commit b1b930a39b
134 changed files with 14672 additions and 21634 deletions

View File

@@ -97,13 +97,13 @@ func (t *Table) Get(timeout uint, ml MetadataLevel) error {
if err != nil {
return err
}
defer readAndCloseBody(resp.body)
defer resp.Body.Close()
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
return err
}
respBody, err := ioutil.ReadAll(resp.body)
respBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
@@ -143,20 +143,20 @@ func (t *Table) Create(timeout uint, ml MetadataLevel, options *TableOptions) er
if err != nil {
return err
}
defer readAndCloseBody(resp.body)
defer resp.Body.Close()
if ml == EmptyPayload {
if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil {
if err := checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
return err
}
} else {
if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil {
if err := checkRespCode(resp, []int{http.StatusCreated}); err != nil {
return err
}
}
if ml != EmptyPayload {
data, err := ioutil.ReadAll(resp.body)
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
@@ -186,9 +186,9 @@ func (t *Table) Delete(timeout uint, options *TableOptions) error {
if err != nil {
return err
}
defer readAndCloseBody(resp.body)
defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusNoContent})
return checkRespCode(resp, []int{http.StatusNoContent})
}
// QueryOptions includes options for a query entities operation.
@@ -269,9 +269,9 @@ func (t *Table) SetPermissions(tap []TableAccessPolicy, timeout uint, options *T
if err != nil {
return err
}
defer readAndCloseBody(resp.body)
defer readAndCloseBody(resp.Body)
return checkRespCode(resp.statusCode, []int{http.StatusNoContent})
return checkRespCode(resp, []int{http.StatusNoContent})
}
func generateTableACLPayload(policies []TableAccessPolicy) (io.Reader, int, error) {
@@ -301,14 +301,14 @@ func (t *Table) GetPermissions(timeout int, options *TableOptions) ([]TableAcces
if err != nil {
return nil, err
}
defer resp.body.Close()
defer resp.Body.Close()
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
return nil, err
}
var ap AccessPolicy
err = xmlUnmarshal(resp.body, &ap.SignedIdentifiersList)
err = xmlUnmarshal(resp.Body, &ap.SignedIdentifiersList)
if err != nil {
return nil, err
}
@@ -325,13 +325,13 @@ func (t *Table) queryEntities(uri string, headers map[string]string, ml Metadata
if err != nil {
return nil, err
}
defer resp.body.Close()
defer resp.Body.Close()
if err = checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
return nil, err
}
data, err := ioutil.ReadAll(resp.body)
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
@@ -346,7 +346,7 @@ func (t *Table) queryEntities(uri string, headers map[string]string, ml Metadata
}
entities.table = t
contToken := extractContinuationTokenFromHeaders(resp.headers)
contToken := extractContinuationTokenFromHeaders(resp.Header)
if contToken == nil {
entities.NextLink = nil
} else {