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

2021-01-31 kickoff #1191

Merged
merged 2 commits into from
Dec 4, 2020
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
3 changes: 2 additions & 1 deletion .sha256sum
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
6af6acfb5a47d821b2349cadedf8790553f3f8254317744319793aace3322e0b swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-10-31-preview/redhatopenshift.json
d2e11a7924d0cbb70672fb0dd6b1a387ccaec8b97a6968adf5a1516d325374eb swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-04-30/redhatopenshift.json
2f52e1bc8b90c095ed57470cf057ee3c6e1a60873749986192ba94ca7b714d4f swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2021-01-31-preview/redhatopenshift.json
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ clean:
find python -type d -name __pycache__ -delete

client: generate
hack/build-client.sh 2020-10-31-preview
hack/build-client.sh 2020-04-30 2021-01-31-preview

generate:
go generate ./...
Expand Down
2 changes: 1 addition & 1 deletion cmd/aro/rp.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
_ "github.com/Azure/ARO-RP/pkg/api/admin"
_ "github.com/Azure/ARO-RP/pkg/api/v20191231preview"
_ "github.com/Azure/ARO-RP/pkg/api/v20200430"
_ "github.com/Azure/ARO-RP/pkg/api/v20201031preview"
_ "github.com/Azure/ARO-RP/pkg/api/v20210131preview"
"github.com/Azure/ARO-RP/pkg/backend"
"github.com/Azure/ARO-RP/pkg/database"
"github.com/Azure/ARO-RP/pkg/env"
Expand Down
41 changes: 26 additions & 15 deletions hack/build-client.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash
#!/bin/bash -e

function clean() {
local API_VERSION=$1

rm .sha256sum
local FOLDER=$2

rm -rf pkg/client/services/redhatopenshift/mgmt/"$API_VERSION"
mkdir pkg/client/services/redhatopenshift/mgmt/"$API_VERSION"
Expand All @@ -13,21 +12,25 @@ function clean() {
}

function checksum() {
sha256sum swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/"$1"/redhatopenshift.json >> .sha256sum
local API_VERSION=$1
local FOLDER=$2

sha256sum swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/"$FOLDER"/"$API_VERSION"/redhatopenshift.json >> .sha256sum
}

function generate_golang() {
local API_VERSION=$1
local FOLDER=$2

sudo docker run \
--rm \
-v ${PWD}/pkg/client:/github.com/Azure/ARO-RP/pkg/client:z \
-v ${PWD}/swagger:/swagger:z \
-v $PWD/pkg/client:/github.com/Azure/ARO-RP/pkg/client:z \
-v $PWD/swagger:/swagger:z \
azuresdk/autorest \
--go \
--license-header=MICROSOFT_APACHE_NO_VERSION \
--namespace=redhatopenshift \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/"$API_VERSION"/redhatopenshift.json \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/"$FOLDER"/"$API_VERSION"/redhatopenshift.json \
--output-folder=/github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/"$API_VERSION"/redhatopenshift

sudo chown -R $(id -un):$(id -gn) pkg/client
Expand All @@ -37,18 +40,19 @@ function generate_golang() {

function generate_python() {
local API_VERSION=$1
local FOLDER=$2

sudo docker run \
--rm \
-v ${PWD}/python/client:/python/client:z \
-v ${PWD}/swagger:/swagger:z \
-v $PWD/python/client:/python/client:z \
-v $PWD/swagger:/swagger:z \
azuresdk/autorest \
--use=@microsoft.azure/autorest.python@4.0.70 \
--python \
--azure-arm \
--license-header=MICROSOFT_APACHE_NO_VERSION \
--namespace=azure.mgmt.redhatopenshift.v"${API_VERSION//-/_}" \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/"$API_VERSION"/redhatopenshift.json \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/"$FOLDER"/"$API_VERSION"/redhatopenshift.json \
--output-folder=/python/client

sudo chown -R $(id -un):$(id -gn) python/client
Expand All @@ -57,10 +61,17 @@ function generate_python() {
}


for API in "$@"
rm -f .sha256sum

for API_VERSION in "$@"
do
clean "${API}"
checksum "${API}"
generate_golang "${API}"
generate_python "${API}"
FOLDER=stable
if [[ "$API_VERSION" =~ .*preview ]]; then
FOLDER=preview
fi

clean "$API_VERSION" "$FOLDER"
checksum "$API_VERSION" "$FOLDER"
generate_golang "$API_VERSION" "$FOLDER"
generate_python "$API_VERSION" "$FOLDER"
done
2 changes: 1 addition & 1 deletion hack/swagger/swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func main() {
if err := swagger.Run(os.Args[1]); err != nil {
if err := swagger.Run(os.Args[1], os.Args[2]); err != nil {
panic(err)
}
}
6 changes: 6 additions & 0 deletions pkg/api/v20200430/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:generate go run ../../../hack/swagger github.com/Azure/ARO-RP/pkg/api/v20200430 ../../../swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2020-04-30

package v20200430

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
6 changes: 0 additions & 6 deletions pkg/api/v20201031preview/generate.go

This file was deleted.

6 changes: 6 additions & 0 deletions pkg/api/v20210131preview/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:generate go run ../../../hack/swagger github.com/Azure/ARO-RP/pkg/api/v20210131preview ../../../swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2021-01-31-preview

package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v20201031preview
package v20210131preview

// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
Expand All @@ -9,7 +9,7 @@ import (
)

// APIVersion contains a version string as it will be used by clients
const APIVersion = "2020-12-31-preview"
const APIVersion = "2021-01-31-preview"

const (
resourceProviderNamespace = "Microsoft.RedHatOpenShift"
Expand Down

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

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

Loading