sso

package
v0.0.0-...-9b598c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceAccountLimitExceeded = "service_account_limit_exceeded"
	ServiceAccountNotFound      = "service_account_not_found"
	ServiceAccountUserNotFound  = "service_account_user_not_found"
	ServiceAccountAccessInvalid = "service_account_access_invalid"
)
View Source
const (
	UserServiceAccountPrefix = "srvc-acct-"
)

Variables

This section is empty.

Functions

func NewUUID

func NewUUID() string

Types

type CompleteServiceAccountRequest

type CompleteServiceAccountRequest struct {
	Owner          string
	OwnerAccountId string
	OrgId          string
	ClientId       string
	Name           string
	Description    string
}

type KFMKeycloakServiceBuilderConfigurator

type KFMKeycloakServiceBuilderConfigurator interface {
	WithConfiguration(config *keycloak.KeycloakConfig) KeycloakServiceBuilder
}

type KafkaKeycloakService

type KafkaKeycloakService KeycloakService

type KeycloakService

type KeycloakService interface {
	GetConfig() *keycloak.KeycloakConfig
	GetRealmConfig() *keycloak.KeycloakRealmConfig
	IsKafkaClientExist(clientId string) *errors.ServiceError
	CreateServiceAccount(serviceAccountRequest *api.ServiceAccountRequest, ctx context.Context) (*api.ServiceAccount, *errors.ServiceError)
	DeleteServiceAccount(ctx context.Context, clientId string) *errors.ServiceError
	ResetServiceAccountCredentials(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)
	ListServiceAcc(ctx context.Context, first int, max int) ([]api.ServiceAccount, *errors.ServiceError)
	RegisterKasFleetshardOperatorServiceAccount(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)
	DeRegisterKasFleetshardOperatorServiceAccount(agentClusterId string) *errors.ServiceError
	GetServiceAccountById(ctx context.Context, id string) (*api.ServiceAccount, *errors.ServiceError)
	GetServiceAccountByClientId(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)
	RegisterConnectorFleetshardOperatorServiceAccount(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)
	DeRegisterConnectorFleetshardOperatorServiceAccount(agentClusterId string) *errors.ServiceError
	GetKafkaClientSecret(clientId string) (string, *errors.ServiceError)
	CreateServiceAccountInternal(request CompleteServiceAccountRequest) (*api.ServiceAccount, *errors.ServiceError)
	DeleteServiceAccountInternal(clientId string) *errors.ServiceError
}

type KeycloakServiceBuilder

type KeycloakServiceBuilder interface {
	WithRealmConfig(realmConfig *keycloak.KeycloakRealmConfig) KeycloakServiceBuilder
	Build() KeycloakService
}

type KeycloakServiceBuilderSelector

type KeycloakServiceBuilderSelector interface {
	ForOSD() OSDKeycloakServiceBuilderConfigurator
	ForKFM() KFMKeycloakServiceBuilderConfigurator
}

func NewKeycloakServiceBuilder

func NewKeycloakServiceBuilder() KeycloakServiceBuilderSelector

type KeycloakServiceMock

type KeycloakServiceMock struct {
	// CreateServiceAccountFunc mocks the CreateServiceAccount method.
	CreateServiceAccountFunc func(serviceAccountRequest *api.ServiceAccountRequest, ctx context.Context) (*api.ServiceAccount, *errors.ServiceError)

	// CreateServiceAccountInternalFunc mocks the CreateServiceAccountInternal method.
	CreateServiceAccountInternalFunc func(request CompleteServiceAccountRequest) (*api.ServiceAccount, *errors.ServiceError)

	// DeRegisterConnectorFleetshardOperatorServiceAccountFunc mocks the DeRegisterConnectorFleetshardOperatorServiceAccount method.
	DeRegisterConnectorFleetshardOperatorServiceAccountFunc func(agentClusterId string) *errors.ServiceError

	// DeRegisterKasFleetshardOperatorServiceAccountFunc mocks the DeRegisterKasFleetshardOperatorServiceAccount method.
	DeRegisterKasFleetshardOperatorServiceAccountFunc func(agentClusterId string) *errors.ServiceError

	// DeleteServiceAccountFunc mocks the DeleteServiceAccount method.
	DeleteServiceAccountFunc func(ctx context.Context, clientId string) *errors.ServiceError

	// DeleteServiceAccountInternalFunc mocks the DeleteServiceAccountInternal method.
	DeleteServiceAccountInternalFunc func(clientId string) *errors.ServiceError

	// GetConfigFunc mocks the GetConfig method.
	GetConfigFunc func() *keycloak.KeycloakConfig

	// GetKafkaClientSecretFunc mocks the GetKafkaClientSecret method.
	GetKafkaClientSecretFunc func(clientId string) (string, *errors.ServiceError)

	// GetRealmConfigFunc mocks the GetRealmConfig method.
	GetRealmConfigFunc func() *keycloak.KeycloakRealmConfig

	// GetServiceAccountByClientIdFunc mocks the GetServiceAccountByClientId method.
	GetServiceAccountByClientIdFunc func(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)

	// GetServiceAccountByIdFunc mocks the GetServiceAccountById method.
	GetServiceAccountByIdFunc func(ctx context.Context, id string) (*api.ServiceAccount, *errors.ServiceError)

	// IsKafkaClientExistFunc mocks the IsKafkaClientExist method.
	IsKafkaClientExistFunc func(clientId string) *errors.ServiceError

	// ListServiceAccFunc mocks the ListServiceAcc method.
	ListServiceAccFunc func(ctx context.Context, first int, max int) ([]api.ServiceAccount, *errors.ServiceError)

	// RegisterConnectorFleetshardOperatorServiceAccountFunc mocks the RegisterConnectorFleetshardOperatorServiceAccount method.
	RegisterConnectorFleetshardOperatorServiceAccountFunc func(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)

	// RegisterKasFleetshardOperatorServiceAccountFunc mocks the RegisterKasFleetshardOperatorServiceAccount method.
	RegisterKasFleetshardOperatorServiceAccountFunc func(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)

	// ResetServiceAccountCredentialsFunc mocks the ResetServiceAccountCredentials method.
	ResetServiceAccountCredentialsFunc func(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)
	// contains filtered or unexported fields
}

KeycloakServiceMock is a mock implementation of KeycloakService.

func TestSomethingThatUsesKeycloakService(t *testing.T) {

	// make and configure a mocked KeycloakService
	mockedKeycloakService := &KeycloakServiceMock{
		CreateServiceAccountFunc: func(serviceAccountRequest *api.ServiceAccountRequest, ctx context.Context) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the CreateServiceAccount method")
		},
		CreateServiceAccountInternalFunc: func(request CompleteServiceAccountRequest) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the CreateServiceAccountInternal method")
		},
		DeRegisterConnectorFleetshardOperatorServiceAccountFunc: func(agentClusterId string) *errors.ServiceError {
			panic("mock out the DeRegisterConnectorFleetshardOperatorServiceAccount method")
		},
		DeRegisterKasFleetshardOperatorServiceAccountFunc: func(agentClusterId string) *errors.ServiceError {
			panic("mock out the DeRegisterKasFleetshardOperatorServiceAccount method")
		},
		DeleteServiceAccountFunc: func(ctx context.Context, clientId string) *errors.ServiceError {
			panic("mock out the DeleteServiceAccount method")
		},
		DeleteServiceAccountInternalFunc: func(clientId string) *errors.ServiceError {
			panic("mock out the DeleteServiceAccountInternal method")
		},
		GetConfigFunc: func() *keycloak.KeycloakConfig {
			panic("mock out the GetConfig method")
		},
		GetKafkaClientSecretFunc: func(clientId string) (string, *errors.ServiceError) {
			panic("mock out the GetKafkaClientSecret method")
		},
		GetRealmConfigFunc: func() *keycloak.KeycloakRealmConfig {
			panic("mock out the GetRealmConfig method")
		},
		GetServiceAccountByClientIdFunc: func(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the GetServiceAccountByClientId method")
		},
		GetServiceAccountByIdFunc: func(ctx context.Context, id string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the GetServiceAccountById method")
		},
		IsKafkaClientExistFunc: func(clientId string) *errors.ServiceError {
			panic("mock out the IsKafkaClientExist method")
		},
		ListServiceAccFunc: func(ctx context.Context, first int, max int) ([]api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the ListServiceAcc method")
		},
		RegisterConnectorFleetshardOperatorServiceAccountFunc: func(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the RegisterConnectorFleetshardOperatorServiceAccount method")
		},
		RegisterKasFleetshardOperatorServiceAccountFunc: func(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the RegisterKasFleetshardOperatorServiceAccount method")
		},
		ResetServiceAccountCredentialsFunc: func(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the ResetServiceAccountCredentials method")
		},
	}

	// use mockedKeycloakService in code that requires KeycloakService
	// and then make assertions.

}

func (*KeycloakServiceMock) CreateServiceAccount

func (mock *KeycloakServiceMock) CreateServiceAccount(serviceAccountRequest *api.ServiceAccountRequest, ctx context.Context) (*api.ServiceAccount, *errors.ServiceError)

CreateServiceAccount calls CreateServiceAccountFunc.

func (*KeycloakServiceMock) CreateServiceAccountCalls

func (mock *KeycloakServiceMock) CreateServiceAccountCalls() []struct {
	ServiceAccountRequest *api.ServiceAccountRequest
	Ctx                   context.Context
}

CreateServiceAccountCalls gets all the calls that were made to CreateServiceAccount. Check the length with:

len(mockedKeycloakService.CreateServiceAccountCalls())

func (*KeycloakServiceMock) CreateServiceAccountInternal

func (mock *KeycloakServiceMock) CreateServiceAccountInternal(request CompleteServiceAccountRequest) (*api.ServiceAccount, *errors.ServiceError)

CreateServiceAccountInternal calls CreateServiceAccountInternalFunc.

func (*KeycloakServiceMock) CreateServiceAccountInternalCalls

func (mock *KeycloakServiceMock) CreateServiceAccountInternalCalls() []struct {
	Request CompleteServiceAccountRequest
}

CreateServiceAccountInternalCalls gets all the calls that were made to CreateServiceAccountInternal. Check the length with:

len(mockedKeycloakService.CreateServiceAccountInternalCalls())

func (*KeycloakServiceMock) DeRegisterConnectorFleetshardOperatorServiceAccount

func (mock *KeycloakServiceMock) DeRegisterConnectorFleetshardOperatorServiceAccount(agentClusterId string) *errors.ServiceError

DeRegisterConnectorFleetshardOperatorServiceAccount calls DeRegisterConnectorFleetshardOperatorServiceAccountFunc.

func (*KeycloakServiceMock) DeRegisterConnectorFleetshardOperatorServiceAccountCalls

func (mock *KeycloakServiceMock) DeRegisterConnectorFleetshardOperatorServiceAccountCalls() []struct {
	AgentClusterId string
}

DeRegisterConnectorFleetshardOperatorServiceAccountCalls gets all the calls that were made to DeRegisterConnectorFleetshardOperatorServiceAccount. Check the length with:

len(mockedKeycloakService.DeRegisterConnectorFleetshardOperatorServiceAccountCalls())

func (*KeycloakServiceMock) DeRegisterKasFleetshardOperatorServiceAccount

func (mock *KeycloakServiceMock) DeRegisterKasFleetshardOperatorServiceAccount(agentClusterId string) *errors.ServiceError

DeRegisterKasFleetshardOperatorServiceAccount calls DeRegisterKasFleetshardOperatorServiceAccountFunc.

func (*KeycloakServiceMock) DeRegisterKasFleetshardOperatorServiceAccountCalls

func (mock *KeycloakServiceMock) DeRegisterKasFleetshardOperatorServiceAccountCalls() []struct {
	AgentClusterId string
}

DeRegisterKasFleetshardOperatorServiceAccountCalls gets all the calls that were made to DeRegisterKasFleetshardOperatorServiceAccount. Check the length with:

len(mockedKeycloakService.DeRegisterKasFleetshardOperatorServiceAccountCalls())

func (*KeycloakServiceMock) DeleteServiceAccount

func (mock *KeycloakServiceMock) DeleteServiceAccount(ctx context.Context, clientId string) *errors.ServiceError

DeleteServiceAccount calls DeleteServiceAccountFunc.

func (*KeycloakServiceMock) DeleteServiceAccountCalls

func (mock *KeycloakServiceMock) DeleteServiceAccountCalls() []struct {
	Ctx      context.Context
	ClientId string
}

DeleteServiceAccountCalls gets all the calls that were made to DeleteServiceAccount. Check the length with:

len(mockedKeycloakService.DeleteServiceAccountCalls())

func (*KeycloakServiceMock) DeleteServiceAccountInternal

func (mock *KeycloakServiceMock) DeleteServiceAccountInternal(clientId string) *errors.ServiceError

DeleteServiceAccountInternal calls DeleteServiceAccountInternalFunc.

func (*KeycloakServiceMock) DeleteServiceAccountInternalCalls

func (mock *KeycloakServiceMock) DeleteServiceAccountInternalCalls() []struct {
	ClientId string
}

DeleteServiceAccountInternalCalls gets all the calls that were made to DeleteServiceAccountInternal. Check the length with:

len(mockedKeycloakService.DeleteServiceAccountInternalCalls())

func (*KeycloakServiceMock) GetConfig

func (mock *KeycloakServiceMock) GetConfig() *keycloak.KeycloakConfig

GetConfig calls GetConfigFunc.

func (*KeycloakServiceMock) GetConfigCalls

func (mock *KeycloakServiceMock) GetConfigCalls() []struct {
}

GetConfigCalls gets all the calls that were made to GetConfig. Check the length with:

len(mockedKeycloakService.GetConfigCalls())

func (*KeycloakServiceMock) GetKafkaClientSecret

func (mock *KeycloakServiceMock) GetKafkaClientSecret(clientId string) (string, *errors.ServiceError)

GetKafkaClientSecret calls GetKafkaClientSecretFunc.

func (*KeycloakServiceMock) GetKafkaClientSecretCalls

func (mock *KeycloakServiceMock) GetKafkaClientSecretCalls() []struct {
	ClientId string
}

GetKafkaClientSecretCalls gets all the calls that were made to GetKafkaClientSecret. Check the length with:

len(mockedKeycloakService.GetKafkaClientSecretCalls())

func (*KeycloakServiceMock) GetRealmConfig

func (mock *KeycloakServiceMock) GetRealmConfig() *keycloak.KeycloakRealmConfig

GetRealmConfig calls GetRealmConfigFunc.

func (*KeycloakServiceMock) GetRealmConfigCalls

func (mock *KeycloakServiceMock) GetRealmConfigCalls() []struct {
}

GetRealmConfigCalls gets all the calls that were made to GetRealmConfig. Check the length with:

len(mockedKeycloakService.GetRealmConfigCalls())

func (*KeycloakServiceMock) GetServiceAccountByClientId

func (mock *KeycloakServiceMock) GetServiceAccountByClientId(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)

GetServiceAccountByClientId calls GetServiceAccountByClientIdFunc.

func (*KeycloakServiceMock) GetServiceAccountByClientIdCalls

func (mock *KeycloakServiceMock) GetServiceAccountByClientIdCalls() []struct {
	Ctx      context.Context
	ClientId string
}

GetServiceAccountByClientIdCalls gets all the calls that were made to GetServiceAccountByClientId. Check the length with:

len(mockedKeycloakService.GetServiceAccountByClientIdCalls())

func (*KeycloakServiceMock) GetServiceAccountById

func (mock *KeycloakServiceMock) GetServiceAccountById(ctx context.Context, id string) (*api.ServiceAccount, *errors.ServiceError)

GetServiceAccountById calls GetServiceAccountByIdFunc.

func (*KeycloakServiceMock) GetServiceAccountByIdCalls

func (mock *KeycloakServiceMock) GetServiceAccountByIdCalls() []struct {
	Ctx context.Context
	ID  string
}

GetServiceAccountByIdCalls gets all the calls that were made to GetServiceAccountById. Check the length with:

len(mockedKeycloakService.GetServiceAccountByIdCalls())

func (*KeycloakServiceMock) IsKafkaClientExist

func (mock *KeycloakServiceMock) IsKafkaClientExist(clientId string) *errors.ServiceError

IsKafkaClientExist calls IsKafkaClientExistFunc.

func (*KeycloakServiceMock) IsKafkaClientExistCalls

func (mock *KeycloakServiceMock) IsKafkaClientExistCalls() []struct {
	ClientId string
}

IsKafkaClientExistCalls gets all the calls that were made to IsKafkaClientExist. Check the length with:

len(mockedKeycloakService.IsKafkaClientExistCalls())

func (*KeycloakServiceMock) ListServiceAcc

func (mock *KeycloakServiceMock) ListServiceAcc(ctx context.Context, first int, max int) ([]api.ServiceAccount, *errors.ServiceError)

ListServiceAcc calls ListServiceAccFunc.

func (*KeycloakServiceMock) ListServiceAccCalls

func (mock *KeycloakServiceMock) ListServiceAccCalls() []struct {
	Ctx   context.Context
	First int
	Max   int
}

ListServiceAccCalls gets all the calls that were made to ListServiceAcc. Check the length with:

len(mockedKeycloakService.ListServiceAccCalls())

func (*KeycloakServiceMock) RegisterConnectorFleetshardOperatorServiceAccount

func (mock *KeycloakServiceMock) RegisterConnectorFleetshardOperatorServiceAccount(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)

RegisterConnectorFleetshardOperatorServiceAccount calls RegisterConnectorFleetshardOperatorServiceAccountFunc.

func (*KeycloakServiceMock) RegisterConnectorFleetshardOperatorServiceAccountCalls

func (mock *KeycloakServiceMock) RegisterConnectorFleetshardOperatorServiceAccountCalls() []struct {
	AgentClusterId string
}

RegisterConnectorFleetshardOperatorServiceAccountCalls gets all the calls that were made to RegisterConnectorFleetshardOperatorServiceAccount. Check the length with:

len(mockedKeycloakService.RegisterConnectorFleetshardOperatorServiceAccountCalls())

func (*KeycloakServiceMock) RegisterKasFleetshardOperatorServiceAccount

func (mock *KeycloakServiceMock) RegisterKasFleetshardOperatorServiceAccount(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)

RegisterKasFleetshardOperatorServiceAccount calls RegisterKasFleetshardOperatorServiceAccountFunc.

func (*KeycloakServiceMock) RegisterKasFleetshardOperatorServiceAccountCalls

func (mock *KeycloakServiceMock) RegisterKasFleetshardOperatorServiceAccountCalls() []struct {
	AgentClusterId string
}

RegisterKasFleetshardOperatorServiceAccountCalls gets all the calls that were made to RegisterKasFleetshardOperatorServiceAccount. Check the length with:

len(mockedKeycloakService.RegisterKasFleetshardOperatorServiceAccountCalls())

func (*KeycloakServiceMock) ResetServiceAccountCredentials

func (mock *KeycloakServiceMock) ResetServiceAccountCredentials(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)

ResetServiceAccountCredentials calls ResetServiceAccountCredentialsFunc.

func (*KeycloakServiceMock) ResetServiceAccountCredentialsCalls

func (mock *KeycloakServiceMock) ResetServiceAccountCredentialsCalls() []struct {
	Ctx      context.Context
	ClientId string
}

ResetServiceAccountCredentialsCalls gets all the calls that were made to ResetServiceAccountCredentials. Check the length with:

len(mockedKeycloakService.ResetServiceAccountCredentialsCalls())

type OSDKeycloakService

type OSDKeycloakService interface {
	KeycloakService
	DeRegisterClientInSSO(kafkaNamespace string) *errors.ServiceError
	RegisterClientInSSO(clusterId string, clusterOathCallbackURI string) (string, *errors.ServiceError)
}

type OSDKeycloakServiceBuilder

type OSDKeycloakServiceBuilder interface {
	WithRealmConfig(realmConfig *keycloak.KeycloakRealmConfig) OSDKeycloakServiceBuilder
	Build() OSDKeycloakService
}

type OSDKeycloakServiceBuilderConfigurator

type OSDKeycloakServiceBuilderConfigurator interface {
	WithConfiguration(config *keycloak.KeycloakConfig) OSDKeycloakServiceBuilder
}

type OSDKeycloakServiceMock

type OSDKeycloakServiceMock struct {
	// CreateServiceAccountFunc mocks the CreateServiceAccount method.
	CreateServiceAccountFunc func(serviceAccountRequest *api.ServiceAccountRequest, ctx context.Context) (*api.ServiceAccount, *errors.ServiceError)

	// CreateServiceAccountInternalFunc mocks the CreateServiceAccountInternal method.
	CreateServiceAccountInternalFunc func(request CompleteServiceAccountRequest) (*api.ServiceAccount, *errors.ServiceError)

	// DeRegisterClientInSSOFunc mocks the DeRegisterClientInSSO method.
	DeRegisterClientInSSOFunc func(kafkaNamespace string) *errors.ServiceError

	// DeRegisterConnectorFleetshardOperatorServiceAccountFunc mocks the DeRegisterConnectorFleetshardOperatorServiceAccount method.
	DeRegisterConnectorFleetshardOperatorServiceAccountFunc func(agentClusterId string) *errors.ServiceError

	// DeRegisterKasFleetshardOperatorServiceAccountFunc mocks the DeRegisterKasFleetshardOperatorServiceAccount method.
	DeRegisterKasFleetshardOperatorServiceAccountFunc func(agentClusterId string) *errors.ServiceError

	// DeleteServiceAccountFunc mocks the DeleteServiceAccount method.
	DeleteServiceAccountFunc func(ctx context.Context, clientId string) *errors.ServiceError

	// DeleteServiceAccountInternalFunc mocks the DeleteServiceAccountInternal method.
	DeleteServiceAccountInternalFunc func(clientId string) *errors.ServiceError

	// GetConfigFunc mocks the GetConfig method.
	GetConfigFunc func() *keycloak.KeycloakConfig

	// GetKafkaClientSecretFunc mocks the GetKafkaClientSecret method.
	GetKafkaClientSecretFunc func(clientId string) (string, *errors.ServiceError)

	// GetRealmConfigFunc mocks the GetRealmConfig method.
	GetRealmConfigFunc func() *keycloak.KeycloakRealmConfig

	// GetServiceAccountByClientIdFunc mocks the GetServiceAccountByClientId method.
	GetServiceAccountByClientIdFunc func(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)

	// GetServiceAccountByIdFunc mocks the GetServiceAccountById method.
	GetServiceAccountByIdFunc func(ctx context.Context, id string) (*api.ServiceAccount, *errors.ServiceError)

	// IsKafkaClientExistFunc mocks the IsKafkaClientExist method.
	IsKafkaClientExistFunc func(clientId string) *errors.ServiceError

	// ListServiceAccFunc mocks the ListServiceAcc method.
	ListServiceAccFunc func(ctx context.Context, first int, max int) ([]api.ServiceAccount, *errors.ServiceError)

	// RegisterClientInSSOFunc mocks the RegisterClientInSSO method.
	RegisterClientInSSOFunc func(clusterId string, clusterOathCallbackURI string) (string, *errors.ServiceError)

	// RegisterConnectorFleetshardOperatorServiceAccountFunc mocks the RegisterConnectorFleetshardOperatorServiceAccount method.
	RegisterConnectorFleetshardOperatorServiceAccountFunc func(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)

	// RegisterKasFleetshardOperatorServiceAccountFunc mocks the RegisterKasFleetshardOperatorServiceAccount method.
	RegisterKasFleetshardOperatorServiceAccountFunc func(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)

	// ResetServiceAccountCredentialsFunc mocks the ResetServiceAccountCredentials method.
	ResetServiceAccountCredentialsFunc func(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)
	// contains filtered or unexported fields
}

OSDKeycloakServiceMock is a mock implementation of OSDKeycloakService.

func TestSomethingThatUsesOSDKeycloakService(t *testing.T) {

	// make and configure a mocked OSDKeycloakService
	mockedOSDKeycloakService := &OSDKeycloakServiceMock{
		CreateServiceAccountFunc: func(serviceAccountRequest *api.ServiceAccountRequest, ctx context.Context) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the CreateServiceAccount method")
		},
		CreateServiceAccountInternalFunc: func(request CompleteServiceAccountRequest) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the CreateServiceAccountInternal method")
		},
		DeRegisterClientInSSOFunc: func(kafkaNamespace string) *errors.ServiceError {
			panic("mock out the DeRegisterClientInSSO method")
		},
		DeRegisterConnectorFleetshardOperatorServiceAccountFunc: func(agentClusterId string) *errors.ServiceError {
			panic("mock out the DeRegisterConnectorFleetshardOperatorServiceAccount method")
		},
		DeRegisterKasFleetshardOperatorServiceAccountFunc: func(agentClusterId string) *errors.ServiceError {
			panic("mock out the DeRegisterKasFleetshardOperatorServiceAccount method")
		},
		DeleteServiceAccountFunc: func(ctx context.Context, clientId string) *errors.ServiceError {
			panic("mock out the DeleteServiceAccount method")
		},
		DeleteServiceAccountInternalFunc: func(clientId string) *errors.ServiceError {
			panic("mock out the DeleteServiceAccountInternal method")
		},
		GetConfigFunc: func() *keycloak.KeycloakConfig {
			panic("mock out the GetConfig method")
		},
		GetKafkaClientSecretFunc: func(clientId string) (string, *errors.ServiceError) {
			panic("mock out the GetKafkaClientSecret method")
		},
		GetRealmConfigFunc: func() *keycloak.KeycloakRealmConfig {
			panic("mock out the GetRealmConfig method")
		},
		GetServiceAccountByClientIdFunc: func(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the GetServiceAccountByClientId method")
		},
		GetServiceAccountByIdFunc: func(ctx context.Context, id string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the GetServiceAccountById method")
		},
		IsKafkaClientExistFunc: func(clientId string) *errors.ServiceError {
			panic("mock out the IsKafkaClientExist method")
		},
		ListServiceAccFunc: func(ctx context.Context, first int, max int) ([]api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the ListServiceAcc method")
		},
		RegisterClientInSSOFunc: func(clusterId string, clusterOathCallbackURI string) (string, *errors.ServiceError) {
			panic("mock out the RegisterClientInSSO method")
		},
		RegisterConnectorFleetshardOperatorServiceAccountFunc: func(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the RegisterConnectorFleetshardOperatorServiceAccount method")
		},
		RegisterKasFleetshardOperatorServiceAccountFunc: func(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the RegisterKasFleetshardOperatorServiceAccount method")
		},
		ResetServiceAccountCredentialsFunc: func(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError) {
			panic("mock out the ResetServiceAccountCredentials method")
		},
	}

	// use mockedOSDKeycloakService in code that requires OSDKeycloakService
	// and then make assertions.

}

func (*OSDKeycloakServiceMock) CreateServiceAccount

func (mock *OSDKeycloakServiceMock) CreateServiceAccount(serviceAccountRequest *api.ServiceAccountRequest, ctx context.Context) (*api.ServiceAccount, *errors.ServiceError)

CreateServiceAccount calls CreateServiceAccountFunc.

func (*OSDKeycloakServiceMock) CreateServiceAccountCalls

func (mock *OSDKeycloakServiceMock) CreateServiceAccountCalls() []struct {
	ServiceAccountRequest *api.ServiceAccountRequest
	Ctx                   context.Context
}

CreateServiceAccountCalls gets all the calls that were made to CreateServiceAccount. Check the length with:

len(mockedOSDKeycloakService.CreateServiceAccountCalls())

func (*OSDKeycloakServiceMock) CreateServiceAccountInternal

func (mock *OSDKeycloakServiceMock) CreateServiceAccountInternal(request CompleteServiceAccountRequest) (*api.ServiceAccount, *errors.ServiceError)

CreateServiceAccountInternal calls CreateServiceAccountInternalFunc.

func (*OSDKeycloakServiceMock) CreateServiceAccountInternalCalls

func (mock *OSDKeycloakServiceMock) CreateServiceAccountInternalCalls() []struct {
	Request CompleteServiceAccountRequest
}

CreateServiceAccountInternalCalls gets all the calls that were made to CreateServiceAccountInternal. Check the length with:

len(mockedOSDKeycloakService.CreateServiceAccountInternalCalls())

func (*OSDKeycloakServiceMock) DeRegisterClientInSSO

func (mock *OSDKeycloakServiceMock) DeRegisterClientInSSO(kafkaNamespace string) *errors.ServiceError

DeRegisterClientInSSO calls DeRegisterClientInSSOFunc.

func (*OSDKeycloakServiceMock) DeRegisterClientInSSOCalls

func (mock *OSDKeycloakServiceMock) DeRegisterClientInSSOCalls() []struct {
	KafkaNamespace string
}

DeRegisterClientInSSOCalls gets all the calls that were made to DeRegisterClientInSSO. Check the length with:

len(mockedOSDKeycloakService.DeRegisterClientInSSOCalls())

func (*OSDKeycloakServiceMock) DeRegisterConnectorFleetshardOperatorServiceAccount

func (mock *OSDKeycloakServiceMock) DeRegisterConnectorFleetshardOperatorServiceAccount(agentClusterId string) *errors.ServiceError

DeRegisterConnectorFleetshardOperatorServiceAccount calls DeRegisterConnectorFleetshardOperatorServiceAccountFunc.

func (*OSDKeycloakServiceMock) DeRegisterConnectorFleetshardOperatorServiceAccountCalls

func (mock *OSDKeycloakServiceMock) DeRegisterConnectorFleetshardOperatorServiceAccountCalls() []struct {
	AgentClusterId string
}

DeRegisterConnectorFleetshardOperatorServiceAccountCalls gets all the calls that were made to DeRegisterConnectorFleetshardOperatorServiceAccount. Check the length with:

len(mockedOSDKeycloakService.DeRegisterConnectorFleetshardOperatorServiceAccountCalls())

func (*OSDKeycloakServiceMock) DeRegisterKasFleetshardOperatorServiceAccount

func (mock *OSDKeycloakServiceMock) DeRegisterKasFleetshardOperatorServiceAccount(agentClusterId string) *errors.ServiceError

DeRegisterKasFleetshardOperatorServiceAccount calls DeRegisterKasFleetshardOperatorServiceAccountFunc.

func (*OSDKeycloakServiceMock) DeRegisterKasFleetshardOperatorServiceAccountCalls

func (mock *OSDKeycloakServiceMock) DeRegisterKasFleetshardOperatorServiceAccountCalls() []struct {
	AgentClusterId string
}

DeRegisterKasFleetshardOperatorServiceAccountCalls gets all the calls that were made to DeRegisterKasFleetshardOperatorServiceAccount. Check the length with:

len(mockedOSDKeycloakService.DeRegisterKasFleetshardOperatorServiceAccountCalls())

func (*OSDKeycloakServiceMock) DeleteServiceAccount

func (mock *OSDKeycloakServiceMock) DeleteServiceAccount(ctx context.Context, clientId string) *errors.ServiceError

DeleteServiceAccount calls DeleteServiceAccountFunc.

func (*OSDKeycloakServiceMock) DeleteServiceAccountCalls

func (mock *OSDKeycloakServiceMock) DeleteServiceAccountCalls() []struct {
	Ctx      context.Context
	ClientId string
}

DeleteServiceAccountCalls gets all the calls that were made to DeleteServiceAccount. Check the length with:

len(mockedOSDKeycloakService.DeleteServiceAccountCalls())

func (*OSDKeycloakServiceMock) DeleteServiceAccountInternal

func (mock *OSDKeycloakServiceMock) DeleteServiceAccountInternal(clientId string) *errors.ServiceError

DeleteServiceAccountInternal calls DeleteServiceAccountInternalFunc.

func (*OSDKeycloakServiceMock) DeleteServiceAccountInternalCalls

func (mock *OSDKeycloakServiceMock) DeleteServiceAccountInternalCalls() []struct {
	ClientId string
}

DeleteServiceAccountInternalCalls gets all the calls that were made to DeleteServiceAccountInternal. Check the length with:

len(mockedOSDKeycloakService.DeleteServiceAccountInternalCalls())

func (*OSDKeycloakServiceMock) GetConfig

func (mock *OSDKeycloakServiceMock) GetConfig() *keycloak.KeycloakConfig

GetConfig calls GetConfigFunc.

func (*OSDKeycloakServiceMock) GetConfigCalls

func (mock *OSDKeycloakServiceMock) GetConfigCalls() []struct {
}

GetConfigCalls gets all the calls that were made to GetConfig. Check the length with:

len(mockedOSDKeycloakService.GetConfigCalls())

func (*OSDKeycloakServiceMock) GetKafkaClientSecret

func (mock *OSDKeycloakServiceMock) GetKafkaClientSecret(clientId string) (string, *errors.ServiceError)

GetKafkaClientSecret calls GetKafkaClientSecretFunc.

func (*OSDKeycloakServiceMock) GetKafkaClientSecretCalls

func (mock *OSDKeycloakServiceMock) GetKafkaClientSecretCalls() []struct {
	ClientId string
}

GetKafkaClientSecretCalls gets all the calls that were made to GetKafkaClientSecret. Check the length with:

len(mockedOSDKeycloakService.GetKafkaClientSecretCalls())

func (*OSDKeycloakServiceMock) GetRealmConfig

func (mock *OSDKeycloakServiceMock) GetRealmConfig() *keycloak.KeycloakRealmConfig

GetRealmConfig calls GetRealmConfigFunc.

func (*OSDKeycloakServiceMock) GetRealmConfigCalls

func (mock *OSDKeycloakServiceMock) GetRealmConfigCalls() []struct {
}

GetRealmConfigCalls gets all the calls that were made to GetRealmConfig. Check the length with:

len(mockedOSDKeycloakService.GetRealmConfigCalls())

func (*OSDKeycloakServiceMock) GetServiceAccountByClientId

func (mock *OSDKeycloakServiceMock) GetServiceAccountByClientId(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)

GetServiceAccountByClientId calls GetServiceAccountByClientIdFunc.

func (*OSDKeycloakServiceMock) GetServiceAccountByClientIdCalls

func (mock *OSDKeycloakServiceMock) GetServiceAccountByClientIdCalls() []struct {
	Ctx      context.Context
	ClientId string
}

GetServiceAccountByClientIdCalls gets all the calls that were made to GetServiceAccountByClientId. Check the length with:

len(mockedOSDKeycloakService.GetServiceAccountByClientIdCalls())

func (*OSDKeycloakServiceMock) GetServiceAccountById

func (mock *OSDKeycloakServiceMock) GetServiceAccountById(ctx context.Context, id string) (*api.ServiceAccount, *errors.ServiceError)

GetServiceAccountById calls GetServiceAccountByIdFunc.

func (*OSDKeycloakServiceMock) GetServiceAccountByIdCalls

func (mock *OSDKeycloakServiceMock) GetServiceAccountByIdCalls() []struct {
	Ctx context.Context
	ID  string
}

GetServiceAccountByIdCalls gets all the calls that were made to GetServiceAccountById. Check the length with:

len(mockedOSDKeycloakService.GetServiceAccountByIdCalls())

func (*OSDKeycloakServiceMock) IsKafkaClientExist

func (mock *OSDKeycloakServiceMock) IsKafkaClientExist(clientId string) *errors.ServiceError

IsKafkaClientExist calls IsKafkaClientExistFunc.

func (*OSDKeycloakServiceMock) IsKafkaClientExistCalls

func (mock *OSDKeycloakServiceMock) IsKafkaClientExistCalls() []struct {
	ClientId string
}

IsKafkaClientExistCalls gets all the calls that were made to IsKafkaClientExist. Check the length with:

len(mockedOSDKeycloakService.IsKafkaClientExistCalls())

func (*OSDKeycloakServiceMock) ListServiceAcc

func (mock *OSDKeycloakServiceMock) ListServiceAcc(ctx context.Context, first int, max int) ([]api.ServiceAccount, *errors.ServiceError)

ListServiceAcc calls ListServiceAccFunc.

func (*OSDKeycloakServiceMock) ListServiceAccCalls

func (mock *OSDKeycloakServiceMock) ListServiceAccCalls() []struct {
	Ctx   context.Context
	First int
	Max   int
}

ListServiceAccCalls gets all the calls that were made to ListServiceAcc. Check the length with:

len(mockedOSDKeycloakService.ListServiceAccCalls())

func (*OSDKeycloakServiceMock) RegisterClientInSSO

func (mock *OSDKeycloakServiceMock) RegisterClientInSSO(clusterId string, clusterOathCallbackURI string) (string, *errors.ServiceError)

RegisterClientInSSO calls RegisterClientInSSOFunc.

func (*OSDKeycloakServiceMock) RegisterClientInSSOCalls

func (mock *OSDKeycloakServiceMock) RegisterClientInSSOCalls() []struct {
	ClusterId              string
	ClusterOathCallbackURI string
}

RegisterClientInSSOCalls gets all the calls that were made to RegisterClientInSSO. Check the length with:

len(mockedOSDKeycloakService.RegisterClientInSSOCalls())

func (*OSDKeycloakServiceMock) RegisterConnectorFleetshardOperatorServiceAccount

func (mock *OSDKeycloakServiceMock) RegisterConnectorFleetshardOperatorServiceAccount(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)

RegisterConnectorFleetshardOperatorServiceAccount calls RegisterConnectorFleetshardOperatorServiceAccountFunc.

func (*OSDKeycloakServiceMock) RegisterConnectorFleetshardOperatorServiceAccountCalls

func (mock *OSDKeycloakServiceMock) RegisterConnectorFleetshardOperatorServiceAccountCalls() []struct {
	AgentClusterId string
}

RegisterConnectorFleetshardOperatorServiceAccountCalls gets all the calls that were made to RegisterConnectorFleetshardOperatorServiceAccount. Check the length with:

len(mockedOSDKeycloakService.RegisterConnectorFleetshardOperatorServiceAccountCalls())

func (*OSDKeycloakServiceMock) RegisterKasFleetshardOperatorServiceAccount

func (mock *OSDKeycloakServiceMock) RegisterKasFleetshardOperatorServiceAccount(agentClusterId string) (*api.ServiceAccount, *errors.ServiceError)

RegisterKasFleetshardOperatorServiceAccount calls RegisterKasFleetshardOperatorServiceAccountFunc.

func (*OSDKeycloakServiceMock) RegisterKasFleetshardOperatorServiceAccountCalls

func (mock *OSDKeycloakServiceMock) RegisterKasFleetshardOperatorServiceAccountCalls() []struct {
	AgentClusterId string
}

RegisterKasFleetshardOperatorServiceAccountCalls gets all the calls that were made to RegisterKasFleetshardOperatorServiceAccount. Check the length with:

len(mockedOSDKeycloakService.RegisterKasFleetshardOperatorServiceAccountCalls())

func (*OSDKeycloakServiceMock) ResetServiceAccountCredentials

func (mock *OSDKeycloakServiceMock) ResetServiceAccountCredentials(ctx context.Context, clientId string) (*api.ServiceAccount, *errors.ServiceError)

ResetServiceAccountCredentials calls ResetServiceAccountCredentialsFunc.

func (*OSDKeycloakServiceMock) ResetServiceAccountCredentialsCalls

func (mock *OSDKeycloakServiceMock) ResetServiceAccountCredentialsCalls() []struct {
	Ctx      context.Context
	ClientId string
}

ResetServiceAccountCredentialsCalls gets all the calls that were made to ResetServiceAccountCredentials. Check the length with:

len(mockedOSDKeycloakService.ResetServiceAccountCredentialsCalls())

type OsdKeycloakService

type OsdKeycloakService OSDKeycloakService

type Provider

type Provider string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL