github.com/cloudfoundry-incubator/stembuild@v0.0.0-20211223202937-5b61d62226c6/iaas_cli/iaas_clients/vcenter_manager/vcenter_managerfakes/fake_govmomi_client.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package vcenter_managerfakes
     3  
     4  import (
     5  	"context"
     6  	"net/url"
     7  	"sync"
     8  
     9  	"github.com/cloudfoundry-incubator/stembuild/iaas_cli/iaas_clients/vcenter_manager"
    10  )
    11  
    12  type FakeGovmomiClient struct {
    13  	LoginStub        func(context.Context, *url.Userinfo) error
    14  	loginMutex       sync.RWMutex
    15  	loginArgsForCall []struct {
    16  		arg1 context.Context
    17  		arg2 *url.Userinfo
    18  	}
    19  	loginReturns struct {
    20  		result1 error
    21  	}
    22  	loginReturnsOnCall map[int]struct {
    23  		result1 error
    24  	}
    25  	invocations      map[string][][]interface{}
    26  	invocationsMutex sync.RWMutex
    27  }
    28  
    29  func (fake *FakeGovmomiClient) Login(arg1 context.Context, arg2 *url.Userinfo) error {
    30  	fake.loginMutex.Lock()
    31  	ret, specificReturn := fake.loginReturnsOnCall[len(fake.loginArgsForCall)]
    32  	fake.loginArgsForCall = append(fake.loginArgsForCall, struct {
    33  		arg1 context.Context
    34  		arg2 *url.Userinfo
    35  	}{arg1, arg2})
    36  	fake.recordInvocation("Login", []interface{}{arg1, arg2})
    37  	fake.loginMutex.Unlock()
    38  	if fake.LoginStub != nil {
    39  		return fake.LoginStub(arg1, arg2)
    40  	}
    41  	if specificReturn {
    42  		return ret.result1
    43  	}
    44  	fakeReturns := fake.loginReturns
    45  	return fakeReturns.result1
    46  }
    47  
    48  func (fake *FakeGovmomiClient) LoginCallCount() int {
    49  	fake.loginMutex.RLock()
    50  	defer fake.loginMutex.RUnlock()
    51  	return len(fake.loginArgsForCall)
    52  }
    53  
    54  func (fake *FakeGovmomiClient) LoginCalls(stub func(context.Context, *url.Userinfo) error) {
    55  	fake.loginMutex.Lock()
    56  	defer fake.loginMutex.Unlock()
    57  	fake.LoginStub = stub
    58  }
    59  
    60  func (fake *FakeGovmomiClient) LoginArgsForCall(i int) (context.Context, *url.Userinfo) {
    61  	fake.loginMutex.RLock()
    62  	defer fake.loginMutex.RUnlock()
    63  	argsForCall := fake.loginArgsForCall[i]
    64  	return argsForCall.arg1, argsForCall.arg2
    65  }
    66  
    67  func (fake *FakeGovmomiClient) LoginReturns(result1 error) {
    68  	fake.loginMutex.Lock()
    69  	defer fake.loginMutex.Unlock()
    70  	fake.LoginStub = nil
    71  	fake.loginReturns = struct {
    72  		result1 error
    73  	}{result1}
    74  }
    75  
    76  func (fake *FakeGovmomiClient) LoginReturnsOnCall(i int, result1 error) {
    77  	fake.loginMutex.Lock()
    78  	defer fake.loginMutex.Unlock()
    79  	fake.LoginStub = nil
    80  	if fake.loginReturnsOnCall == nil {
    81  		fake.loginReturnsOnCall = make(map[int]struct {
    82  			result1 error
    83  		})
    84  	}
    85  	fake.loginReturnsOnCall[i] = struct {
    86  		result1 error
    87  	}{result1}
    88  }
    89  
    90  func (fake *FakeGovmomiClient) Invocations() map[string][][]interface{} {
    91  	fake.invocationsMutex.RLock()
    92  	defer fake.invocationsMutex.RUnlock()
    93  	fake.loginMutex.RLock()
    94  	defer fake.loginMutex.RUnlock()
    95  	copiedInvocations := map[string][][]interface{}{}
    96  	for key, value := range fake.invocations {
    97  		copiedInvocations[key] = value
    98  	}
    99  	return copiedInvocations
   100  }
   101  
   102  func (fake *FakeGovmomiClient) recordInvocation(key string, args []interface{}) {
   103  	fake.invocationsMutex.Lock()
   104  	defer fake.invocationsMutex.Unlock()
   105  	if fake.invocations == nil {
   106  		fake.invocations = map[string][][]interface{}{}
   107  	}
   108  	if fake.invocations[key] == nil {
   109  		fake.invocations[key] = [][]interface{}{}
   110  	}
   111  	fake.invocations[key] = append(fake.invocations[key], args)
   112  }
   113  
   114  var _ vcenter_manager.GovmomiClient = new(FakeGovmomiClient)