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)
|
c := compute.NewVirtualMachineImagesClient(s.subscriptionID)
|
||||||
s.configureAutorestClient(&c.Client)
|
s.configureAutorestClient(&c.Client)
|
||||||
c.PollingDelay = s.PollingDelay
|
c.PollingDelay = s.PollingDelay
|
||||||
return virtualMachineImagesClientAPI{c}
|
return VirtualMachineImagesClient{c}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s azureClientSet) PollClient() autorest.Client {
|
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)
|
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
|
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
|
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")
|
result, err := c.List(ctx, location, publisher, offer, sku, "", to.Int32Ptr(1), "name desc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue