azure-storage-file-go/swagger
Mohit Sharma 3c1754dc00
Upgrade to service version 2020-02-10 (#47)
* Generated Code

* Fixed Breaking Changes (Function Calls)

* Fixed Breaking Tests

* Reformatting + Added test case to check the limit of 4TiB for file and 5120GB for file share
2020-11-11 11:05:59 +05:30
..
README.md Upgrade to service version 2020-02-10 (#47) 2020-11-11 11:05:59 +05:30

README.md

Azure File Storage for Golang

see https://aka.ms/autorest

Generation

cd swagger
autorest README.md --use=@microsoft.azure/autorest.go@v3.0.63
gofmt -w Go_FileStorage/*

More modifications have to be made after generation in order to fix issues that the Go generator can't work around right now. Namely:

  • Under shareClient.getPermissionResponder and shareClient.createPermissionPreparer, change all xml.Marshal and xml.Unmarshal lines to json.Marshal and json.Unmarshal respectively

Settings

input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-02-10/file.json
go: true
output-folder: Go_FileStorage
namespace: azfile
go-export-clients: false
enable-xml: true
file-prefix: zz_generated_

Note: the following directives were copied over from Python

The dates should be string instead

directive:
- from: swagger-document
  where: $["x-ms-paths"]..responses..headers["x-ms-file-last-write-time"]
  transform: >
    $.format = "str";    
- from: swagger-document
  where: $["x-ms-paths"]..responses..headers["x-ms-file-change-time"]
  transform: >
    $.format = "str";    
- from: swagger-document
  where: $["x-ms-paths"]..responses..headers["x-ms-file-creation-time"]
  transform: >
    $.format = "str";    

Change new SMB file parameters to use default values

directive:
- from: swagger-document
  where: $.parameters.FileCreationTime
  transform: >
    $.format = "str";
    $.default = "now";    
- from: swagger-document
  where: $.parameters.FileLastWriteTime
  transform: >
    $.format = "str";
    $.default = "now";    
- from: swagger-document
  where: $.parameters.FileAttributes
  transform: >
    $.default = "none";    
- from: swagger-document
  where: $.parameters.FilePermission
  transform: >
    $.default = "inherit";    

FileRangeWriteFromUrl Constant

This value is supposed to be the constant value update and these changes turn it from a parameter into a constant.

directive:
- from: swagger-document
  where: $.parameters.FileRangeWriteFromUrl
  transform: >
    delete $.default;
    delete $["x-ms-enum"];
    $["x-ms-parameter-location"] = "method";    

TODO: Get rid of StorageError since we define it

attempt didn't work

clarify the purpose first