YAML refracting exercise.

Change-Id: I0437cc9c7eedd2f30e1b10425ce0c3a269bedde2
This commit is contained in:
Manoj Alva 2020-05-16 07:10:41 -05:00 committed by Manoj Alva
parent 924b41cc22
commit 9e1ac26470
4 changed files with 1680 additions and 485 deletions

View File

@ -3,10 +3,10 @@
package mocks package mocks
import ( import (
client "opendev.org/airship/go-redfish/client"
context "context" context "context"
client "opendev.org/airship/go-redfish/client"
http "net/http" http "net/http"
mock "github.com/stretchr/testify/mock" mock "github.com/stretchr/testify/mock"
@ -17,6 +17,59 @@ type RedfishAPI struct {
mock.Mock mock.Mock
} }
// CreateVirtualDisk provides a mock function with given fields: _a0, _a1, _a2, _a3
func (_m *RedfishAPI) CreateVirtualDisk(_a0 context.Context, _a1 string, _a2 string, _a3 client.CreateVirtualDiskRequestBody) (client.RedfishError, *http.Response, error) {
ret := _m.Called(_a0, _a1, _a2, _a3)
var r0 client.RedfishError
if rf, ok := ret.Get(0).(func(context.Context, string, string, client.CreateVirtualDiskRequestBody) client.RedfishError); ok {
r0 = rf(_a0, _a1, _a2, _a3)
} else {
r0 = ret.Get(0).(client.RedfishError)
}
var r1 *http.Response
if rf, ok := ret.Get(1).(func(context.Context, string, string, client.CreateVirtualDiskRequestBody) *http.Response); ok {
r1 = rf(_a0, _a1, _a2, _a3)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*http.Response)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, string, string, client.CreateVirtualDiskRequestBody) error); ok {
r2 = rf(_a0, _a1, _a2, _a3)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// DeleteVirtualdisk provides a mock function with given fields: _a0, _a1, _a2
func (_m *RedfishAPI) DeleteVirtualdisk(_a0 context.Context, _a1 string, _a2 string) (*http.Response, error) {
ret := _m.Called(_a0, _a1, _a2)
var r0 *http.Response
if rf, ok := ret.Get(0).(func(context.Context, string, string) *http.Response); ok {
r0 = rf(_a0, _a1, _a2)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*http.Response)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(_a0, _a1, _a2)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// EjectVirtualMedia provides a mock function with given fields: _a0, _a1, _a2, _a3 // EjectVirtualMedia provides a mock function with given fields: _a0, _a1, _a2, _a3
func (_m *RedfishAPI) EjectVirtualMedia(_a0 context.Context, _a1 string, _a2 string, _a3 map[string]interface{}) (client.RedfishError, *http.Response, error) { func (_m *RedfishAPI) EjectVirtualMedia(_a0 context.Context, _a1 string, _a2 string, _a3 map[string]interface{}) (client.RedfishError, *http.Response, error) {
ret := _m.Called(_a0, _a1, _a2, _a3) ret := _m.Called(_a0, _a1, _a2, _a3)
@ -47,6 +100,66 @@ func (_m *RedfishAPI) EjectVirtualMedia(_a0 context.Context, _a1 string, _a2 str
return r0, r1, r2 return r0, r1, r2
} }
// FirmwareInventory provides a mock function with given fields: _a0
func (_m *RedfishAPI) FirmwareInventory(_a0 context.Context) (client.Collection, *http.Response, error) {
ret := _m.Called(_a0)
var r0 client.Collection
if rf, ok := ret.Get(0).(func(context.Context) client.Collection); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(client.Collection)
}
var r1 *http.Response
if rf, ok := ret.Get(1).(func(context.Context) *http.Response); ok {
r1 = rf(_a0)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*http.Response)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context) error); ok {
r2 = rf(_a0)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// FirmwareInventoryDownloadImage provides a mock function with given fields: _a0, _a1
func (_m *RedfishAPI) FirmwareInventoryDownloadImage(_a0 context.Context, _a1 *client.FirmwareInventoryDownloadImageOpts) (client.RedfishError, *http.Response, error) {
ret := _m.Called(_a0, _a1)
var r0 client.RedfishError
if rf, ok := ret.Get(0).(func(context.Context, *client.FirmwareInventoryDownloadImageOpts) client.RedfishError); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Get(0).(client.RedfishError)
}
var r1 *http.Response
if rf, ok := ret.Get(1).(func(context.Context, *client.FirmwareInventoryDownloadImageOpts) *http.Response); ok {
r1 = rf(_a0, _a1)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*http.Response)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, *client.FirmwareInventoryDownloadImageOpts) error); ok {
r2 = rf(_a0, _a1)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// GetManager provides a mock function with given fields: _a0, _a1 // GetManager provides a mock function with given fields: _a0, _a1
func (_m *RedfishAPI) GetManager(_a0 context.Context, _a1 string) (client.Manager, *http.Response, error) { func (_m *RedfishAPI) GetManager(_a0 context.Context, _a1 string) (client.Manager, *http.Response, error) {
ret := _m.Called(_a0, _a1) ret := _m.Called(_a0, _a1)
@ -167,6 +280,66 @@ func (_m *RedfishAPI) GetSystem(_a0 context.Context, _a1 string) (client.Compute
return r0, r1, r2 return r0, r1, r2
} }
// GetTask provides a mock function with given fields: _a0, _a1
func (_m *RedfishAPI) GetTask(_a0 context.Context, _a1 string) (client.Task, *http.Response, error) {
ret := _m.Called(_a0, _a1)
var r0 client.Task
if rf, ok := ret.Get(0).(func(context.Context, string) client.Task); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Get(0).(client.Task)
}
var r1 *http.Response
if rf, ok := ret.Get(1).(func(context.Context, string) *http.Response); ok {
r1 = rf(_a0, _a1)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*http.Response)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, string) error); ok {
r2 = rf(_a0, _a1)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// GetVolumes provides a mock function with given fields: _a0, _a1, _a2
func (_m *RedfishAPI) GetVolumes(_a0 context.Context, _a1 string, _a2 string) (client.Collection, *http.Response, error) {
ret := _m.Called(_a0, _a1, _a2)
var r0 client.Collection
if rf, ok := ret.Get(0).(func(context.Context, string, string) client.Collection); ok {
r0 = rf(_a0, _a1, _a2)
} else {
r0 = ret.Get(0).(client.Collection)
}
var r1 *http.Response
if rf, ok := ret.Get(1).(func(context.Context, string, string) *http.Response); ok {
r1 = rf(_a0, _a1, _a2)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*http.Response)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok {
r2 = rf(_a0, _a1, _a2)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// InsertVirtualMedia provides a mock function with given fields: _a0, _a1, _a2, _a3 // InsertVirtualMedia provides a mock function with given fields: _a0, _a1, _a2, _a3
func (_m *RedfishAPI) InsertVirtualMedia(_a0 context.Context, _a1 string, _a2 string, _a3 client.InsertMediaRequestBody) (client.RedfishError, *http.Response, error) { func (_m *RedfishAPI) InsertVirtualMedia(_a0 context.Context, _a1 string, _a2 string, _a3 client.InsertMediaRequestBody) (client.RedfishError, *http.Response, error) {
ret := _m.Called(_a0, _a1, _a2, _a3) ret := _m.Called(_a0, _a1, _a2, _a3)
@ -346,3 +519,63 @@ func (_m *RedfishAPI) SetSystem(_a0 context.Context, _a1 string, _a2 client.Comp
return r0, r1, r2 return r0, r1, r2
} }
// UpdateService provides a mock function with given fields: _a0
func (_m *RedfishAPI) UpdateService(_a0 context.Context) (client.UpdateService, *http.Response, error) {
ret := _m.Called(_a0)
var r0 client.UpdateService
if rf, ok := ret.Get(0).(func(context.Context) client.UpdateService); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(client.UpdateService)
}
var r1 *http.Response
if rf, ok := ret.Get(1).(func(context.Context) *http.Response); ok {
r1 = rf(_a0)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*http.Response)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context) error); ok {
r2 = rf(_a0)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// UpdateServiceSimpleUpdate provides a mock function with given fields: _a0, _a1
func (_m *RedfishAPI) UpdateServiceSimpleUpdate(_a0 context.Context, _a1 client.SimpleUpdateRequestBody) (client.RedfishError, *http.Response, error) {
ret := _m.Called(_a0, _a1)
var r0 client.RedfishError
if rf, ok := ret.Get(0).(func(context.Context, client.SimpleUpdateRequestBody) client.RedfishError); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Get(0).(client.RedfishError)
}
var r1 *http.Response
if rf, ok := ret.Get(1).(func(context.Context, client.SimpleUpdateRequestBody) *http.Response); ok {
r1 = rf(_a0, _a1)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*http.Response)
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, client.SimpleUpdateRequestBody) error); ok {
r2 = rf(_a0, _a1)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}

View File

@ -9,6 +9,22 @@ import (
//go:generate mockery -name=RedfishAPI -output ./mocks //go:generate mockery -name=RedfishAPI -output ./mocks
type RedfishAPI interface { type RedfishAPI interface {
CreateVirtualDisk(context.Context,
string,
string,
client.CreateVirtualDiskRequestBody,
) (client.RedfishError,
*http.Response,
error,
)
DeleteVirtualdisk(context.Context,
string,
string,
) (*http.Response,
error,
)
EjectVirtualMedia(context.Context, EjectVirtualMedia(context.Context,
string, string,
string, string,
@ -18,6 +34,19 @@ type RedfishAPI interface {
error, error,
) )
FirmwareInventory(context.Context,
) (client.Collection,
*http.Response,
error,
)
FirmwareInventoryDownloadImage(context.Context,
*client.FirmwareInventoryDownloadImageOpts,
) (client.RedfishError,
*http.Response,
error,
)
GetManager(context.Context, GetManager(context.Context,
string, string,
) (client.Manager, ) (client.Manager,
@ -46,6 +75,21 @@ type RedfishAPI interface {
error, error,
) )
GetTask(context.Context,
string,
) (client.Task,
*http.Response,
error,
)
GetVolumes(context.Context,
string,
string,
) (client.Collection,
*http.Response,
error,
)
InsertVirtualMedia(context.Context, InsertVirtualMedia(context.Context,
string, string,
string, string,
@ -89,4 +133,17 @@ type RedfishAPI interface {
*http.Response, *http.Response,
error, error,
) )
UpdateService(context.Context,
) (client.UpdateService,
*http.Response,
error,
)
UpdateServiceSimpleUpdate(context.Context,
client.SimpleUpdateRequestBody,
) (client.RedfishError,
*http.Response,
error,
)
} }

View File

@ -1693,12 +1693,6 @@ components:
- Name - Name
- VolumeType - VolumeType
type: object type: object
inline_object:
properties:
softwareImage:
format: binary
type: string
type: object
RedfishError_error: RedfishError_error:
example: example:
'@Message.ExtendedInfo': '@Message.ExtendedInfo':
@ -1779,3 +1773,9 @@ components:
$ref: '#/components/schemas/VirtualMedia_Actions__VirtualMedia_EjectMedia' $ref: '#/components/schemas/VirtualMedia_Actions__VirtualMedia_EjectMedia'
'#UpdateService.StartUpdate': '#UpdateService.StartUpdate':
$ref: '#/components/schemas/VirtualMedia_Actions__VirtualMedia_EjectMedia' $ref: '#/components/schemas/VirtualMedia_Actions__VirtualMedia_EjectMedia'
inline_object:
properties:
softwareImage:
format: binary
type: string
type: object

File diff suppressed because it is too large Load Diff