зеркало из https://github.com/Azure/ARO-RP.git
add InterfacesClient methods
This commit is contained in:
Родитель
7720f05a7d
Коммит
1c5b774e38
|
@ -4,6 +4,8 @@ package network
|
|||
// Licensed under the Apache License 2.0.
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
mgmtnetwork "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-07-01/network"
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
|
@ -12,6 +14,7 @@ import (
|
|||
// InterfacesClient is a minimal interface for azure InterfacesClient
|
||||
type InterfacesClient interface {
|
||||
InterfacesClientAddons
|
||||
Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (result mgmtnetwork.Interface, err error)
|
||||
}
|
||||
|
||||
type interfacesClient struct {
|
||||
|
|
|
@ -5,13 +5,25 @@ package network
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
mgmtnetwork "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-07-01/network"
|
||||
)
|
||||
|
||||
// InterfacesClientAddons contains addons for InterfacesClient
|
||||
type InterfacesClientAddons interface {
|
||||
CreateOrUpdateAndWait(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters mgmtnetwork.Interface) (err error)
|
||||
DeleteAndWait(ctx context.Context, resourceGroupName string, networkInterfaceName string) (err error)
|
||||
}
|
||||
|
||||
func (c *interfacesClient) CreateOrUpdateAndWait(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters mgmtnetwork.Interface) error {
|
||||
future, err := c.CreateOrUpdate(ctx, resourceGroupName, networkInterfaceName, parameters)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return future.WaitForCompletionRef(ctx, c.Client)
|
||||
}
|
||||
|
||||
func (c *interfacesClient) DeleteAndWait(ctx context.Context, resourceGroupName string, networkInterfaceName string) error {
|
||||
future, err := c.Delete(ctx, resourceGroupName, networkInterfaceName)
|
||||
if err != nil {
|
||||
|
|
|
@ -35,6 +35,20 @@ func (m *MockInterfacesClient) EXPECT() *MockInterfacesClientMockRecorder {
|
|||
return m.recorder
|
||||
}
|
||||
|
||||
// CreateOrUpdateAndWait mocks base method
|
||||
func (m *MockInterfacesClient) CreateOrUpdateAndWait(arg0 context.Context, arg1, arg2 string, arg3 network.Interface) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CreateOrUpdateAndWait", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// CreateOrUpdateAndWait indicates an expected call of CreateOrUpdateAndWait
|
||||
func (mr *MockInterfacesClientMockRecorder) CreateOrUpdateAndWait(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateOrUpdateAndWait", reflect.TypeOf((*MockInterfacesClient)(nil).CreateOrUpdateAndWait), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// DeleteAndWait mocks base method
|
||||
func (m *MockInterfacesClient) DeleteAndWait(arg0 context.Context, arg1, arg2 string) error {
|
||||
m.ctrl.T.Helper()
|
||||
|
@ -49,6 +63,21 @@ func (mr *MockInterfacesClientMockRecorder) DeleteAndWait(arg0, arg1, arg2 inter
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAndWait", reflect.TypeOf((*MockInterfacesClient)(nil).DeleteAndWait), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// Get mocks base method
|
||||
func (m *MockInterfacesClient) Get(arg0 context.Context, arg1, arg2, arg3 string) (network.Interface, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Get", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(network.Interface)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Get indicates an expected call of Get
|
||||
func (mr *MockInterfacesClientMockRecorder) Get(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterfacesClient)(nil).Get), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// MockLoadBalancersClient is a mock of LoadBalancersClient interface
|
||||
type MockLoadBalancersClient struct {
|
||||
ctrl *gomock.Controller
|
||||
|
|
Загрузка…
Ссылка в новой задаче