Make VirtualMachineImagesClient easier to mock
This commit is contained in:
parent
a3b49cdc08
commit
f0ec912ba6
|
@ -88,7 +88,7 @@ func (s azureClientSet) VirtualMachineImagesClient() VirtualMachineImagesClientA
|
|||
c := compute.NewVirtualMachineImagesClient(s.subscriptionID)
|
||||
s.configureAutorestClient(&c.Client)
|
||||
c.PollingDelay = s.PollingDelay
|
||||
return virtualMachineImagesClientAPI{c}
|
||||
return VirtualMachineImagesClient{c}
|
||||
}
|
||||
|
||||
func (s azureClientSet) PollClient() autorest.Client {
|
||||
|
|
|
@ -19,9 +19,9 @@ type VirtualMachineImagesClientAPI interface {
|
|||
GetLatest(ctx context.Context, publisher, offer, sku, location string) (*compute.VirtualMachineImageResource, error)
|
||||
}
|
||||
|
||||
var _ VirtualMachineImagesClientAPI = virtualMachineImagesClientAPI{}
|
||||
var _ VirtualMachineImagesClientAPI = VirtualMachineImagesClient{}
|
||||
|
||||
type virtualMachineImagesClientAPI struct {
|
||||
type VirtualMachineImagesClient struct {
|
||||
computeapi.VirtualMachineImagesClientAPI
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ func ParsePlatformImageURN(urn string) (image *PlatformImage, err error) {
|
|||
return &PlatformImage{parts[0], parts[1], parts[2], parts[3]}, nil
|
||||
}
|
||||
|
||||
func (c virtualMachineImagesClientAPI) GetLatest(ctx context.Context, publisher, offer, sku, location string) (*compute.VirtualMachineImageResource, error) {
|
||||
func (c VirtualMachineImagesClient) GetLatest(ctx context.Context, publisher, offer, sku, location string) (*compute.VirtualMachineImageResource, error) {
|
||||
result, err := c.List(ctx, location, publisher, offer, sku, "", to.Int32Ptr(1), "name desc")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue