Skip to content

Commit

Permalink
[AzDatalake] Blob swagger update to latest 2021-12-02 (#22178)
Browse files Browse the repository at this point in the history
* blob swagger update to latest 2021-12-02

* Update sdk/storage/azdatalake/internal/generated_blob/autorest.md

Co-authored-by: Sourav Gupta <98318303+souravgupta-msft@users.noreply.github.com>

* unmarshall-xml list blobs

* unmarshall-xml list blobs

---------

Co-authored-by: Sourav Gupta <98318303+souravgupta-msft@users.noreply.github.com>
  • Loading branch information
tanyasethi-msft and souravgupta-msft committed Jan 2, 2024
1 parent 9a01230 commit 99b0c7e
Show file tree
Hide file tree
Showing 11 changed files with 412 additions and 142 deletions.
3 changes: 2 additions & 1 deletion sdk/storage/azdatalake/internal/generated_blob/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go: true
clear-output-folder: false
version: "^3.0.0"
license-header: MICROSOFT_MIT_NO_VERSION
input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/e515b6251fdc21015282d2e84b85beec7c091763/specification/storage/data-plane/Microsoft.BlobStorage/preview/2020-10-02/blob.json"
input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a32d0b2423d19835246bb2ef92941503bfd5e734/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/blob.json"
credential-scope: "https://storage.azure.com/.default"
output-folder: ../generated_blob
file-prefix: "zz_"
Expand Down Expand Up @@ -475,6 +475,7 @@ directive:
replace(/BlobItem/g, 'PathItem').
replace(/BlobPrefix/g, 'PathPrefix').
replace(/BlobPrefixes/g, 'PathPrefixes').
replace(/BlobName/g, 'PathName').
replace(/BlobProperties/g, 'PathProperties').
replace(/ContainerProperties/g, 'FileSystemProperties');
```
67 changes: 67 additions & 0 deletions sdk/storage/azdatalake/internal/generated_blob/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

package generated_blob

import (
"encoding/xml"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"net/url"
)

type TransactionalContentSetter interface {
SetCRC64([]byte)
SetMD5([]byte)
Expand Down Expand Up @@ -63,3 +69,64 @@ func (p *PageBlobClientUploadPagesFromURLOptions) SetSourceContentCRC64(v []byte
func (p *PageBlobClientUploadPagesFromURLOptions) SetSourceContentMD5(v []byte) {
p.SourceContentMD5 = v
}

// Custom UnmarshalXML functions for types that need special handling.

// UnmarshalXML implements the xml.Unmarshaller interface for type PathPrefix.
func (p *PathPrefix) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
type alias PathPrefix
aux := &struct {
*alias
PathName *PathName `xml:"Name"`
}{
alias: (*alias)(p),
}
if err := dec.DecodeElement(aux, &start); err != nil {
return err
}
if aux.PathName != nil {
if aux.PathName.Encoded != nil && *aux.PathName.Encoded {
name, err := url.QueryUnescape(*aux.PathName.Content)

if err != nil {
return err
}
p.Name = to.Ptr(string(name))
} else {
p.Name = aux.PathName.Content
}
}
return nil
}

// UnmarshalXML implements the xml.Unmarshaller interface for type PathItem.
func (p *PathItem) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
type alias PathItem
aux := &struct {
*alias
PathName *PathName `xml:"Name"`
Metadata additionalProperties `xml:"Metadata"`
OrMetadata additionalProperties `xml:"OrMetadata"`
}{
alias: (*alias)(p),
}
if err := dec.DecodeElement(aux, &start); err != nil {
return err
}
p.Metadata = (map[string]*string)(aux.Metadata)
p.OrMetadata = (map[string]*string)(aux.OrMetadata)
if aux.PathName != nil {
if aux.PathName.Encoded != nil && *aux.PathName.Encoded {
name, err := url.QueryUnescape(*aux.PathName.Content)

// name, err := base64.StdEncoding.DecodeString(*aux.PathName.Content)
if err != nil {
return err
}
p.Name = to.Ptr(string(name))
} else {
p.Name = aux.PathName.Content
}
}
return nil
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 99b0c7e

Please sign in to comment.