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

[AzDatalake] Blob swagger update to latest 2021-12-02 #22178

Merged
merged 5 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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