Add snapshot and gallery clients
This commit is contained in:
parent
cfe37057bd
commit
a3d8bf27e1
|
@ -15,7 +15,12 @@ type AzureClientSet interface {
|
|||
MetadataClient() MetadataClientAPI
|
||||
|
||||
DisksClient() computeapi.DisksClientAPI
|
||||
SnapshotsClient() computeapi.SnapshotsClientAPI
|
||||
ImagesClient() computeapi.ImagesClientAPI
|
||||
|
||||
GalleryImagesClient() computeapi.GalleryImagesClientAPI
|
||||
GalleryImageVersionsClient() computeapi.GalleryImageVersionsClientAPI
|
||||
|
||||
VirtualMachinesClient() computeapi.VirtualMachinesClientAPI
|
||||
VirtualMachineImagesClient() VirtualMachineImagesClientAPI
|
||||
|
||||
|
@ -77,6 +82,13 @@ func (s azureClientSet) DisksClient() computeapi.DisksClientAPI {
|
|||
return c
|
||||
}
|
||||
|
||||
func (s azureClientSet) SnapshotsClient() computeapi.SnapshotsClientAPI {
|
||||
c := compute.NewSnapshotsClient(s.subscriptionID)
|
||||
s.configureAutorestClient(&c.Client)
|
||||
c.PollingDelay = s.PollingDelay
|
||||
return c
|
||||
}
|
||||
|
||||
func (s azureClientSet) ImagesClient() computeapi.ImagesClientAPI {
|
||||
c := compute.NewImagesClient(s.subscriptionID)
|
||||
s.configureAutorestClient(&c.Client)
|
||||
|
@ -98,6 +110,20 @@ func (s azureClientSet) VirtualMachineImagesClient() VirtualMachineImagesClientA
|
|||
return VirtualMachineImagesClient{c}
|
||||
}
|
||||
|
||||
func (s azureClientSet) GalleryImagesClient() computeapi.GalleryImagesClientAPI {
|
||||
c := compute.NewGalleryImagesClient(s.subscriptionID)
|
||||
s.configureAutorestClient(&c.Client)
|
||||
c.PollingDelay = s.PollingDelay
|
||||
return c
|
||||
}
|
||||
|
||||
func (s azureClientSet) GalleryImageVersionsClient() computeapi.GalleryImageVersionsClientAPI {
|
||||
c := compute.NewGalleryImageVersionsClient(s.subscriptionID)
|
||||
s.configureAutorestClient(&c.Client)
|
||||
c.PollingDelay = s.PollingDelay
|
||||
return c
|
||||
}
|
||||
|
||||
func (s azureClientSet) PollClient() autorest.Client {
|
||||
c := autorest.NewClientWithUserAgent("Packer-Azure-ClientSet")
|
||||
s.configureAutorestClient(&c)
|
||||
|
|
|
@ -10,9 +10,12 @@ var _ AzureClientSet = &AzureClientSetMock{}
|
|||
// AzureClientSetMock provides a generic mock for AzureClientSet
|
||||
type AzureClientSetMock struct {
|
||||
DisksClientMock computeapi.DisksClientAPI
|
||||
SnapshotsClientMock computeapi.SnapshotsClientAPI
|
||||
ImagesClientMock computeapi.ImagesClientAPI
|
||||
VirtualMachineImagesClientMock VirtualMachineImagesClientAPI
|
||||
VirtualMachinesClientMock computeapi.VirtualMachinesClientAPI
|
||||
GalleryImagesClientMock computeapi.GalleryImagesClientAPI
|
||||
GalleryImageVersionsClientMock computeapi.GalleryImageVersionsClientAPI
|
||||
PollClientMock autorest.Client
|
||||
MetadataClientMock MetadataClientAPI
|
||||
SubscriptionIDMock string
|
||||
|
@ -23,6 +26,11 @@ func (m *AzureClientSetMock) DisksClient() computeapi.DisksClientAPI {
|
|||
return m.DisksClientMock
|
||||
}
|
||||
|
||||
// SnapshotsClient returns a SnapshotsClientAPI
|
||||
func (m *AzureClientSetMock) SnapshotsClient() computeapi.SnapshotsClientAPI {
|
||||
return m.SnapshotsClientMock
|
||||
}
|
||||
|
||||
// ImagesClient returns a ImagesClientAPI
|
||||
func (m *AzureClientSetMock) ImagesClient() computeapi.ImagesClientAPI {
|
||||
return m.ImagesClientMock
|
||||
|
@ -38,6 +46,16 @@ func (m *AzureClientSetMock) VirtualMachinesClient() computeapi.VirtualMachinesC
|
|||
return m.VirtualMachinesClientMock
|
||||
}
|
||||
|
||||
// GalleryImagesClient returns a GalleryImagesClientAPI
|
||||
func (m *AzureClientSetMock) GalleryImagesClient() computeapi.GalleryImagesClientAPI {
|
||||
return m.GalleryImagesClientMock
|
||||
}
|
||||
|
||||
// GalleryImageVersionsClient returns a GalleryImageVersionsClientAPI
|
||||
func (m *AzureClientSetMock) GalleryImageVersionsClient() computeapi.GalleryImageVersionsClientAPI {
|
||||
return m.GalleryImageVersionsClientMock
|
||||
}
|
||||
|
||||
// PollClient returns an autorest Client that can be used for polling async requests
|
||||
func (m *AzureClientSetMock) PollClient() autorest.Client {
|
||||
return m.PollClientMock
|
||||
|
|
Loading…
Reference in New Issue