77 "strings"
88 "time"
99
10- azsku "github.com/Azure/azure-sdk-for-go/profiles/2018-03-01/compute/mgmt/compute"
1110 aznetwork "github.com/Azure/azure-sdk-for-go/profiles/2018-03-01/network/mgmt/network"
1211 azres "github.com/Azure/azure-sdk-for-go/profiles/2018-03-01/resources/mgmt/resources"
1312 azsubs "github.com/Azure/azure-sdk-for-go/profiles/2018-03-01/resources/mgmt/subscriptions"
@@ -25,9 +24,9 @@ type API interface {
2524 GetControlPlaneSubnet (ctx context.Context , resourceGroupName , virtualNetwork , subnet string ) (* aznetwork.Subnet , error )
2625 ListLocations (ctx context.Context ) (* []azsubs.Location , error )
2726 GetResourcesProvider (ctx context.Context , resourceProviderNamespace string ) (* azres.Provider , error )
28- GetVirtualMachineSku (ctx context.Context , name , region string ) (* azsku .ResourceSku , error )
27+ GetVirtualMachineSku (ctx context.Context , name , region string ) (* azenc .ResourceSku , error )
2928 GetVirtualMachineFamily (ctx context.Context , name , region string ) (string , error )
30- GetDiskSkus (ctx context.Context , region string ) ([]azsku .ResourceSku , error )
29+ GetDiskSkus (ctx context.Context , region string ) ([]azenc .ResourceSku , error )
3130 GetGroup (ctx context.Context , groupName string ) (* azres.Group , error )
3231 ListResourceIDsByGroup (ctx context.Context , groupName string ) ([]string , error )
3332 GetStorageEndpointSuffix (ctx context.Context ) (string , error )
@@ -170,20 +169,19 @@ func (c *Client) getProvidersClient(ctx context.Context) (azres.ProvidersClient,
170169}
171170
172171// GetDiskSkus returns all the disk SKU pages for a given region.
173- func (c * Client ) GetDiskSkus (ctx context.Context , region string ) ([]azsku .ResourceSku , error ) {
174- client := azsku .NewResourceSkusClientWithBaseURI (c .ssn .Environment .ResourceManagerEndpoint , c .ssn .Credentials .SubscriptionID )
172+ func (c * Client ) GetDiskSkus (ctx context.Context , region string ) ([]azenc .ResourceSku , error ) {
173+ client := azenc .NewResourceSkusClientWithBaseURI (c .ssn .Environment .ResourceManagerEndpoint , c .ssn .Credentials .SubscriptionID )
175174 client .Authorizer = c .ssn .Authorizer
176-
177175 // See https://issues.redhat.com/browse/OCPBUGS-29469 before changing this timeout
178176 ctx , cancel := context .WithTimeout (ctx , 2 * time .Minute )
179177 defer cancel ()
180178
181- var sku []azsku .ResourceSku
182-
179+ var sku []azenc .ResourceSku
180+ filter := fmt . Sprintf ( "location eq '%s'" , region )
183181 // This has to be initialized outside the `for` because we need access to
184182 // `err`. If initialized in the loop and the API call fails right away,
185183 // `page.NotDone()` will return `false` and we'll never check for the error
186- skuPage , err := client .List (ctx )
184+ skuPage , err := client .List (ctx , filter , "false" )
187185 if err != nil {
188186 return nil , fmt .Errorf ("failed to list SKUs: %w" , err )
189187 }
@@ -245,18 +243,19 @@ func (c *Client) ListResourceIDsByGroup(ctx context.Context, groupName string) (
245243}
246244
247245// GetVirtualMachineSku retrieves the resource SKU of a specified virtual machine SKU in the specified region.
248- func (c * Client ) GetVirtualMachineSku (ctx context.Context , name , region string ) (* azsku .ResourceSku , error ) {
249- client := azsku .NewResourceSkusClientWithBaseURI (c .ssn .Environment .ResourceManagerEndpoint , c .ssn .Credentials .SubscriptionID )
246+ func (c * Client ) GetVirtualMachineSku (ctx context.Context , name , region string ) (* azenc .ResourceSku , error ) {
247+ client := azenc .NewResourceSkusClientWithBaseURI (c .ssn .Environment .ResourceManagerEndpoint , c .ssn .Credentials .SubscriptionID )
250248 client .Authorizer = c .ssn .Authorizer
251249
252250 // See https://issues.redhat.com/browse/OCPBUGS-29469 before chaging this timeout
253251 ctx , cancel := context .WithTimeout (ctx , 2 * time .Minute )
254252 defer cancel ()
255253
254+ filter := fmt .Sprintf ("location eq '%s'" , region )
256255 // This has to be initialized outside the `for` because we need access to
257256 // `err`. If initialized in the loop and the API call fails right away,
258257 // `page.NotDone()` will return `false` and we'll never check for the error
259- page , err := client .List (ctx )
258+ page , err := client .List (ctx , filter , "false" )
260259 if err != nil {
261260 return nil , fmt .Errorf ("failed to list SKUs: %w" , err )
262261 }
0 commit comments