Skip to content

Commit

Permalink
bump azure compute version to 2022-03-01
Browse files Browse the repository at this point in the history
Signed-off-by: MartinForReal <fanshangxiang@gmail.com>
  • Loading branch information
MartinForReal committed Oct 27, 2022
1 parent f2a784d commit b30f316
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"fmt"

"github.com/Azure/go-autorest/autorest/azure/auth"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck

"github.com/Azure/skewer"
)
Expand Down
12 changes: 6 additions & 6 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck
"github.com/Azure/go-autorest/autorest/to"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
Expand Down Expand Up @@ -176,7 +176,7 @@ func Test_Map(t *testing.T) {
})
}

func Test_Cache_Get(t *testing.T) { // nolint:funlen
func Test_Cache_Get(t *testing.T) { //nolint:funlen
cases := map[string]struct {
sku string
resourceType string
Expand Down Expand Up @@ -367,7 +367,7 @@ func Test_Cache_GetAvailabilityZones(t *testing.T) { //nolint:funlen
},
Restrictions: &[]compute.ResourceSkuRestrictions{
{
Type: compute.ResourceSkuRestrictionsTypeLocation,
Type: compute.Location,
Values: &[]string{"baz"},
},
},
Expand All @@ -391,7 +391,7 @@ func Test_Cache_GetAvailabilityZones(t *testing.T) { //nolint:funlen
},
Restrictions: &[]compute.ResourceSkuRestrictions{
{
Type: compute.ResourceSkuRestrictionsTypeZone,
Type: compute.Zone,
Values: &[]string{"baz"},
RestrictionInfo: &compute.ResourceSkuRestrictionInfo{
Zones: &[]string{"1"},
Expand Down Expand Up @@ -517,7 +517,7 @@ func Test_Cache_GetVirtualMachineAvailabilityZonesForSize(t *testing.T) { //noli
},
Restrictions: &[]compute.ResourceSkuRestrictions{
{
Type: compute.ResourceSkuRestrictionsTypeLocation,
Type: compute.Location,
Values: &[]string{"baz"},
},
},
Expand All @@ -541,7 +541,7 @@ func Test_Cache_GetVirtualMachineAvailabilityZonesForSize(t *testing.T) { //noli
},
Restrictions: &[]compute.ResourceSkuRestrictions{
{
Type: compute.ResourceSkuRestrictionsTypeZone,
Type: compute.Zone,
Values: &[]string{"baz"},
RestrictionInfo: &compute.ResourceSkuRestrictionInfo{
Zones: &[]string{"1"},
Expand Down
2 changes: 1 addition & 1 deletion clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package skewer
import (
"context"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck
"github.com/pkg/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
)
Expand All @@ -16,7 +16,7 @@ var (
expectedAvailabilityZones = []string{"1", "2", "3"}
)

// nolint:gocyclo,funlen
//nolint:gocyclo,funlen
func Test_Data(t *testing.T) {
dataWrapper, err := newDataWrapper("./testdata/eastus.json")
if err != nil {
Expand Down Expand Up @@ -202,7 +202,7 @@ func Test_Data(t *testing.T) {
}
if quantity, err := sku.GetCapabilityIntegerQuantity("PremiumIO"); quantity != -1 ||
!errors.As(err, &errCapabilityValueNil) ||
err.Error() != "PremiumIOCapabilityValueParse: failed to parse string 'False' as int64, error: 'strconv.ParseInt: parsing \"False\": invalid syntax'" { // nolint:lll
err.Error() != "PremiumIOCapabilityValueParse: failed to parse string 'False' as int64, error: 'strconv.ParseInt: parsing \"False\": invalid syntax'" { //nolint:lll
t.Errorf("expected standard_d2_v2 to fail parsing value for boolean premiumIO as int, got value '%d' and error '%s'", quantity, err)
}
if sku.HasZonalCapability(UltraSSDAvailable) {
Expand Down
6 changes: 3 additions & 3 deletions fakes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"os"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck
)

// dataWrapper is a convenience wrapper for deserializing json testdata
Expand Down Expand Up @@ -59,7 +59,7 @@ func (f *fakeResourceClient) ListComplete(ctx context.Context, filter, includeEx
return f.res, nil
}

// nolint:deadcode,unused
//nolint:deadcode,unused
func newFailingFakeResourceClient(reterr error) *fakeResourceClient {
return &fakeResourceClient{
res: compute.ResourceSkusResultIterator{},
Expand Down Expand Up @@ -99,7 +99,7 @@ func (f *fakeResourceProviderClient) List(ctx context.Context, filter, includeEx
return f.res, nil
}

// nolint:deadcode,unused
//nolint:deadcode,unused
func newFailingFakeResourceProviderClient(reterr error) *fakeResourceProviderClient {
return &fakeResourceProviderClient{
res: compute.ResourceSkusResultPage{},
Expand Down
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/Azure/skewer
go 1.17

require (
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.26 // indirect
github.com/Azure/azure-sdk-for-go v67.0.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/google/go-cmp v0.5.1
github.com/google/go-cmp v0.5.9
github.com/pkg/errors v0.9.1
)

Expand All @@ -18,6 +18,5 @@ require (
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
)
18 changes: 8 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible h1:bmmC38SlE8/E81nNADlgmVGurPWMHDX2YNXVQMrBpEE=
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v67.0.0+incompatible h1:SVBwznSETB0Sipd0uyGJr7khLhJOFRUEUb+0JgkCvDo=
github.com/Azure/azure-sdk-for-go v67.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.11.26 h1:W/MzvoAiFfL5h4nq81wm7axvITgbnOoifXXGkFrgF1g=
github.com/Azure/go-autorest/autorest v0.11.26/go.mod h1:7l8ybrIdUmGqZMTD0sRtAr8NvbHjfofbf8RSP2q7w7U=
github.com/Azure/go-autorest/autorest v0.11.28 h1:ndAExarwr5Y+GaHE6VCaY1kyS/HwwGGyuimVhWsHOEM=
github.com/Azure/go-autorest/autorest v0.11.28/go.mod h1:MrkzG3Y3AH668QyF9KRk5neJnGgmhQ6krbhR8Q5eMvA=
github.com/Azure/go-autorest/autorest/adal v0.9.18 h1:kLnPsRjzZZUF3K5REu/Kc+qMQrvuza2bwSnNdhmzLfQ=
github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ=
github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
Expand All @@ -24,8 +24,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU=
github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -34,8 +34,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -45,5 +45,3 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
2 changes: 1 addition & 1 deletion interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package skewer
import (
"context"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck
)

// ResourceClient is the required Azure client interface used to populate skewer's data.
Expand Down
12 changes: 6 additions & 6 deletions sku.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"
"strings"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -307,7 +307,7 @@ func (s *SKU) IsAvailable(location string) bool {
if s.Restrictions != nil {
for _, restriction := range *s.Restrictions {
// Can't deploy to any zones in this location. We're done.
if restriction.Type == compute.ResourceSkuRestrictionsTypeLocation {
if restriction.Type == compute.Location {
return false
}
}
Expand All @@ -331,7 +331,7 @@ func (s *SKU) IsRestricted(location string) bool {
}
for _, candidate := range *restriction.Values {
// Can't deploy in this location. We're done.
if locationEquals(candidate, location) && restriction.Type == compute.ResourceSkuRestrictionsTypeLocation {
if locationEquals(candidate, location) && restriction.Type == compute.Location {
return true
}
}
Expand Down Expand Up @@ -419,7 +419,7 @@ func (s *SKU) HasLocationRestriction(location string) bool {
}

for _, restriction := range *s.Restrictions {
if restriction.Type != compute.ResourceSkuRestrictionsTypeLocation {
if restriction.Type != compute.Location {
continue
}
if restriction.Values == nil {
Expand All @@ -436,7 +436,7 @@ func (s *SKU) HasLocationRestriction(location string) bool {
}

// AvailabilityZones returns the list of Availability Zones which have this resource SKU available and unrestricted.
func (s *SKU) AvailabilityZones(location string) map[string]bool { // nolint:gocyclo
func (s *SKU) AvailabilityZones(location string) map[string]bool { //nolint:gocyclo
if s.LocationInfo == nil {
return nil
}
Expand All @@ -463,7 +463,7 @@ func (s *SKU) AvailabilityZones(location string) map[string]bool { // nolint:goc
if restriction.Values != nil {
for _, candidate := range *restriction.Values {
if locationEquals(candidate, location) {
if restriction.Type == compute.ResourceSkuRestrictionsTypeLocation {
if restriction.Type == compute.Location {
// Can't deploy in this location. We're done.
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions sku_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck
"github.com/Azure/go-autorest/autorest/to"
"github.com/google/go-cmp/cmp"
)
Expand Down Expand Up @@ -38,7 +38,7 @@ func Test_SKU_GetCapabilityQuantity(t *testing.T) {
},
},
capability: "",
err: "CapabilityValueParse: failed to parse string 'False' as int64, error: 'strconv.ParseInt: parsing \"False\": invalid syntax'", // nolint:lll
err: "CapabilityValueParse: failed to parse string 'False' as int64, error: 'strconv.ParseInt: parsing \"False\": invalid syntax'", //nolint:lll
},
"foo capability should return successfully with integer": {
sku: compute.ResourceSku{
Expand Down
2 changes: 1 addition & 1 deletion wrap.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package skewer

import "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-12-01/compute" //nolint:staticcheck
import "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-03-01/compute" //nolint:staticcheck

// Wrap takes an array of compute resource skus and wraps them into an
// array of our richer type.
Expand Down

0 comments on commit b30f316

Please sign in to comment.