Skip to content

Commit

Permalink
V9 Generated (#569)
Browse files Browse the repository at this point in the history
* Running latest Go Generator on all released packages.

* Gen.go update (#547)

* Updated Gen.go to use new autorest builld system

* Comments from review

* It works as expected again

* Moving Storage to an Independent Repository (#556)

* Updating CI to use Go 1.8.

Go 1.8 was released on Thursday, February 16th. Many of our partners
have adopted and we need to ensure that we support the most recent
version.

* Replacing storage folder with submodule.

In order to allow for more independent growth of the storage package,
we've given it its own repository. This change updates the main
repository to use a submodule in order to prevent breaking changes for
folks using storage today who do not want to migrate to the new
repository.

* Updating submodule target URL.

There is an existing naming convention for Azure Storage repositories.
the repo has been updated to match that convention, this updates the
submodule to point to the new URL.

* Responding to review feedback.

* Updating submodule to ref v8.1.0 storage version.

* Fixing issues found while reviewing PR.

* Regenerating using latest swaggers.

Using Azure/azure-rest-api-specs commit: 7d9b6c0

* Regenerating with new API Version strategy & web composite.

The new API Version strategy associated the API Version to send across the wire with each method instead of at the client level. Doing so allows us to support a broader range of composite swaggers (the immediate example is the web composite swagger.)

It also means that making a call with an alternate API version is somewhat more difficult in this version. To do so, one would have to create their own Preparer for the request. In the future, we'll support multiple API Versions and allow for more stability by generating independent packages for each Operation Group in each API Version. We expect to have that done in the summer.

* Regenerating against most recent swaggers.

* Regenerating using latest preview version of compute.
  • Loading branch information
marstr authored Mar 31, 2017
1 parent 4897648 commit eb9eddf
Show file tree
Hide file tree
Showing 293 changed files with 38,527 additions and 33,171 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "storage"]
path = storage
url = https://github.com/Azure/azure-storage-go
branch = v0.1.0
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ sudo: false

language: go

go: 1.7
go:
- 1.7
- 1.8

install:
- go get -u github.com/golang/lint/golint
Expand All @@ -16,14 +18,10 @@ script:
- bash rungas.sh
- test -z "$(gofmt -s -l $(find ./arm/* -type d -print) | tee /dev/stderr)"
- test -z "$(gofmt -s -l -w management | tee /dev/stderr)"
- test -z "$(gofmt -s -l -w storage | tee /dev/stderr)"
- test -z "$(gofmt -s -l -w Gododir | tee /dev/stderr)"
- test -z "$(go build $(find ./* -type d -print | grep -v '^./vendor$') | tee /dev/stderr)"
- test -z "$(go vet $(find ./arm/* -type d -print) | tee /dev/stderr)"
- test -z "$(golint ./arm/... | tee /dev/stderr)"
- go test -v ./storage/... -check.v
- test -z "$(golint ./storage/... | tee /dev/stderr)"
- go vet ./storage/...
- go test -v ./management/...
- test -z "$(golint ./management/... | grep -v 'should have comment' | grep -v 'stutters' | tee /dev/stderr)"
- go vet ./management/...
Expand Down
207 changes: 129 additions & 78 deletions Gododir/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,31 @@ var (
Version: "2016-07-07",
Input: "apimanagement",
},
// {
// Name: "authorization",
// Version: "2015-07-01",
// },
// {
// Name: "batch",
// Version: "2017-01-01",
// Swagger: "BatchManagement",
// },
{
Name: "authorization",
Version: "2015-07-01",
},
{
Name: "batch",
Version: "2017-01-01",
Swagger: "BatchManagement",
},
{
Name: "billing",
Version: "2017-02-27-preview",
},
// {
// Name: "cdn",
// Version: "2016-10-02",
// },
{
Name: "cdn",
Version: "2016-10-02",
},
{
Name: "cognitiveservices",
Version: "2016-02-01-preview",
},
// {
// Name: "commerce",
// Version: "2015-06-01-preview",
// },
{
Name: "commerce",
Version: "2015-06-01-preview",
},
{
Name: "compute",
Version: "2016-04-30-preview",
Expand Down Expand Up @@ -120,30 +120,30 @@ var (
},
},
},
// {
// Name: "devtestlabs",
// Version: "2016-05-15",
// Swagger: "DTL",
// },
{
Name: "devtestlabs",
Version: "2016-05-15",
Swagger: "DTL",
},
{
Name: "disk",
Version: "2016-04-30-preview",
Swagger: "disk",
Input: "compute",
},
// {
// Name: "dns",
// Version: "2016-04-01",
// },
{
Name: "dns",
Version: "2016-04-01",
},
{
Name: "documentdb",
Version: "2015-04-08",
},
// {
// Name: "eventhub",
// Version: "2015-08-01",
// Swagger: "EventHub",
// },
{
Name: "eventhub",
Version: "2015-08-01",
Swagger: "EventHub",
},
{
Name: "graphrbac",
Version: "1.6",
Expand All @@ -165,11 +165,11 @@ var (
Name: "keyvault",
Version: "2015-06-01",
},
// {
// Name: "logic",
// Version: "2016-06-01",
// // composite swagger
// },
{
Name: "logic",
Version: "2016-06-01",
// composite swagger
},
{
Name: "machinelearning",
SubServices: []service{
Expand Down Expand Up @@ -206,10 +206,10 @@ var (
Swagger: "networkWatcher",
Input: "network",
},
// {
// Name: "notificationhubs",
// Version: "2016-03-01",
// },
{
Name: "notificationhubs",
Version: "2016-03-01",
},
{
Name: "operationalinsights",
Version: "2015-11-01-preview",
Expand All @@ -228,17 +228,17 @@ var (
// Version: "2016-06-01",
// // composite swagger
// },
// {
// Name: "redis",
// Version: "2016-04-01",
// },
{
Name: "redis",
Version: "2016-04-01",
},
{
Name: "resources",
SubServices: []service{
// {
// Name: "features",
// Version: "2015-12-01",
// },
{
Name: "features",
Version: "2015-12-01",
},
{
Name: "links",
Version: "2016-09-01",
Expand All @@ -255,10 +255,10 @@ var (
Name: "resources",
Version: "2016-09-01",
},
// {
// Name: "subscriptions",
// Version: "2016-06-01",
// },
{
Name: "subscriptions",
Version: "2016-06-01",
},
},
},
{
Expand All @@ -273,10 +273,10 @@ var (
Name: "servermanagement",
Version: "2016-07-01-preview",
},
// {
// Name: "servicebus",
// Version: "2015-08-01",
// },
{
Name: "servicebus",
Version: "2015-08-01",
},
{
Name: "service-map",
Version: "2015-11-01-preview",
Expand All @@ -287,14 +287,14 @@ var (
// Version: "2014-04-01",
// Swagger: "sql.core",
// },
// {
// Name: "storage",
// Version: "2016-12-01",
// },
// {
// Name: "storageimportexport",
// Version: "2016-11-01",
// },
{
Name: "storage",
Version: "2016-12-01",
},
{
Name: "storageimportexport",
Version: "2016-11-01",
},
{
Name: "trafficmanager",
Version: "2015-11-01",
Expand All @@ -307,9 +307,47 @@ var (
},
},
},
//{
// Plane: "dataplane",
// InputPrefix: "",
// Services: []service{
// {
// Name: "batch",
// Version: "2016-07-01.3.1",
// Swagger: "BatchService",
// },
// {
// Name: "insights",
// // composite swagger
// },
// {
// Name: "keyvault",
// Version: "2015-06-01",
// },
// {
// Name: "search",
// SubServices: []service{
// {
// Name: "searchindex",
// Version: "2015-02-28",
// Input: "search",
// },
// {
// Name: "searchservice",
// Version: "2015-02-28",
// Input: "search",
// },
// },
// },
// {
// Name: "servicefabric",
// Version: "2016-01-28",
// },
// },
//},
{
Plane: "dataplane",
InputPrefix: "",
Plane: "",
InputPrefix: "arm-",
Services: []service{
// {
// Name: "batch",
Expand Down Expand Up @@ -337,6 +375,16 @@ var (
// Version: "2015-02-28",
// Input: "search",
// },
// {
// Name: "datalake-analytics",
// SubServices: []service{
// {
// Name: "catalog",
// Version: "2016-11-01",
// },
// {
// Name: "job",
// Version: "2016-11-01",
// },
// },
// {
Expand Down Expand Up @@ -393,14 +441,14 @@ func initAndAddService(service *service, inputPrefix, plane string) {
}
packages := append(service.Packages, service.Name)
service.TaskName = fmt.Sprintf("%s>%s", plane, strings.Join(packages, ">"))
service.Fullname = fmt.Sprintf("%s/%s", plane, strings.Join(packages, "/"))
service.Fullname = filepath.Join(plane, strings.Join(packages, "/"))
if service.Input == "" {
service.Input = fmt.Sprintf("%s%s/%s/swagger/%s", inputPrefix, strings.Join(packages, "/"), service.Version, service.Swagger)
service.Input = filepath.Join(inputPrefix+strings.Join(packages, "/"), service.Version, "swagger", service.Swagger)
} else {
service.Input = fmt.Sprintf("%s%s/%s/swagger/%s", inputPrefix, service.Input, service.Version, service.Swagger)
service.Input = filepath.Join(inputPrefix+service.Input, service.Version, "swagger", service.Swagger)
}
service.Namespace = fmt.Sprintf("github.com/Azure/azure-sdk-for-go/%s", service.Fullname)
service.Output = fmt.Sprintf("%s/src/%s", gopath, service.Namespace)
service.Namespace = filepath.Join("github.com", "Azure", "azure-sdk-for-go", service.Fullname)
service.Output = filepath.Join(gopath, "src", service.Namespace)

if service.SubServices != nil {
for _, subs := range service.SubServices {
Expand All @@ -415,15 +463,15 @@ func initAndAddService(service *service, inputPrefix, plane string) {
}

func tasks(p *do.Project) {
p.Task("default", do.S{"setvars", "generate:all", "storage"}, nil)
p.Task("default", do.S{"setvars", "generate:all", "management"}, nil)
p.Task("setvars", nil, setVars)
p.Use("generate", generateTasks)
p.Use("gofmt", formatTasks)
p.Use("gobuild", buildTasks)
p.Use("golint", lintTasks)
p.Use("govet", vetTasks)
p.Use("delete", deleteTasks)
p.Task("storage", do.S{"setvars"}, storageVersion)
p.Task("management", do.S{"setvars"}, managementVersion)
}

func setVars(c *do.Context) {
Expand Down Expand Up @@ -459,8 +507,7 @@ func generate(service *service) {
"-OutputDirectory", service.Output,
"-Modeler", "Swagger",
"-pv", sdkVersion,
"-SkipValidation",
)
"-SkipValidation")
autorest.Dir = filepath.Join(autorestDir, "autorest")
err = runner(autorest)
if err != nil {
Expand Down Expand Up @@ -517,7 +564,7 @@ func lintTasks(p *do.Project) {

func lint(service *service) {
fmt.Printf("Linting %s...\n\n", service.Fullname)
golint := exec.Command(fmt.Sprintf("%s/bin/golint", gopath), service.Namespace)
golint := exec.Command(filepath.Join(gopath, "bin", "golint"), service.Namespace)
err := runner(golint)
if err != nil {
panic(fmt.Errorf("golint error: %s", err))
Expand All @@ -537,8 +584,12 @@ func vet(service *service) {
}
}

func storageVersion(c *do.Context) {
versionFile := "storage/version.go"
func managementVersion(c *do.Context) {
version("management")
}

func version(packageName string) {
versionFile := filepath.Join(packageName, "version.go")
os.Remove(versionFile)
template := `package storage
Expand Down
Loading

0 comments on commit eb9eddf

Please sign in to comment.