ocm

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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MockModeStubServer    = "stub-server"
	MockModeEmulateServer = "emulate-server"

	ClusterLoggingOperatorAddonID = "cluster-logging-operator"
)
View Source
const (
	// MaxClusterNameLength - defines maximum length of an OSD cluster name
	MaxClusterNameLength = 15
)
View Source
const (
	RHOSAKResourceName string = "rhosak"
)
View Source
const TERMS_EVENTCODE_ONLINE_SERVICE = "onlineService"
View Source
const TERMS_EVENTCODE_REGISTER = "register"
View Source
const TERMS_SITECODE = "OCM"

Variables

This section is empty.

Functions

func NewOCMConnection

func NewOCMConnection(ocmConfig *OCMConfig, BaseUrl string) (*sdkClient.Connection, func(), error)

Types

type AMSClient

type AMSClient Client

type AMSRelatedResourceBillingModel

type AMSRelatedResourceBillingModel string
const (
	AMSRelatedResourceBillingModelMarketplace AMSRelatedResourceBillingModel = "marketplace"
	AMSRelatedResourceBillingModelStandard    AMSRelatedResourceBillingModel = "standard"
)

func (AMSRelatedResourceBillingModel) String

type Client

type Client interface {
	CreateCluster(cluster *clustersmgmtv1.Cluster) (*clustersmgmtv1.Cluster, error)
	GetClusterIngresses(clusterID string) (*clustersmgmtv1.IngressesListResponse, error)
	GetCluster(clusterID string) (*clustersmgmtv1.Cluster, error)
	GetClusterStatus(id string) (*clustersmgmtv1.ClusterStatus, error)
	GetCloudProviders() (*clustersmgmtv1.CloudProviderList, error)
	GetRegions(provider *clustersmgmtv1.CloudProvider) (*clustersmgmtv1.CloudRegionList, error)
	GetAddon(clusterId string, addonId string) (*clustersmgmtv1.AddOnInstallation, error)
	CreateAddonWithParams(clusterId string, addonId string, parameters []Parameter) (*clustersmgmtv1.AddOnInstallation, error)
	CreateAddon(clusterId string, addonId string) (*clustersmgmtv1.AddOnInstallation, error)
	UpdateAddonParameters(clusterId string, addonId string, parameters []Parameter) (*clustersmgmtv1.AddOnInstallation, error)
	GetClusterDNS(clusterID string) (string, error)
	CreateSyncSet(clusterID string, syncset *clustersmgmtv1.Syncset) (*clustersmgmtv1.Syncset, error)
	UpdateSyncSet(clusterID string, syncSetID string, syncset *clustersmgmtv1.Syncset) (*clustersmgmtv1.Syncset, error)
	GetSyncSet(clusterID string, syncSetID string) (*clustersmgmtv1.Syncset, error)
	DeleteSyncSet(clusterID string, syncsetID string) (int, error)
	CreateIdentityProvider(clusterID string, identityProvider *clustersmgmtv1.IdentityProvider) (*clustersmgmtv1.IdentityProvider, error)
	GetIdentityProviderList(clusterID string) (*clustersmgmtv1.IdentityProviderList, error)
	DeleteCluster(clusterID string) (int, error)
	ClusterAuthorization(cb *amsv1.ClusterAuthorizationRequest) (*amsv1.ClusterAuthorizationResponse, error)
	DeleteSubscription(id string) (int, error)
	FindSubscriptions(query string) ([]*amsv1.Subscription, error)
	GetSubscriptionByID(subscriptionID string) (*amsv1.Subscription, bool, error)
	GetRequiresTermsAcceptance(username string) (termsRequired bool, redirectUrl string, err error)
	GetOrganisationIdFromExternalId(externalId string) (string, error)
	Connection() *sdkClient.Connection
	GetMachinePool(clusterID string, machinePoolID string) (*clustersmgmtv1.MachinePool, error)
	CreateMachinePool(clusterID string, machinePool *clustersmgmtv1.MachinePool) (*clustersmgmtv1.MachinePool, error)
	// GetQuotaCosts returns a list of quota cost for the given organizationID.
	// Each quota cost contains information on the usage and max allowed ocm resources quota given to the specified oganization.
	//
	// relatedResourceFilters will only be applied when fetchRelatedResources is set to true.
	GetQuotaCosts(organizationID string, fetchRelatedResources, fetchCloudAccounts bool, filters ...QuotaCostRelatedResourceFilter) ([]*amsv1.QuotaCost, error)
	GetQuotaCostsForProduct(organizationID, resourceName, product string) ([]*amsv1.QuotaCost, error)
	// GetCurrentAccount returns the account information of the current authenticated user
	GetCurrentAccount() (*amsv1.Account, error)
}

func NewClient

func NewClient(connection *sdkClient.Connection) Client

type ClientMock

type ClientMock struct {
	// ClusterAuthorizationFunc mocks the ClusterAuthorization method.
	ClusterAuthorizationFunc func(cb *amsv1.ClusterAuthorizationRequest) (*amsv1.ClusterAuthorizationResponse, error)

	// ConnectionFunc mocks the Connection method.
	ConnectionFunc func() *sdkClient.Connection

	// CreateAddonFunc mocks the CreateAddon method.
	CreateAddonFunc func(clusterId string, addonId string) (*clustersmgmtv1.AddOnInstallation, error)

	// CreateAddonWithParamsFunc mocks the CreateAddonWithParams method.
	CreateAddonWithParamsFunc func(clusterId string, addonId string, parameters []Parameter) (*clustersmgmtv1.AddOnInstallation, error)

	// CreateClusterFunc mocks the CreateCluster method.
	CreateClusterFunc func(cluster *clustersmgmtv1.Cluster) (*clustersmgmtv1.Cluster, error)

	// CreateIdentityProviderFunc mocks the CreateIdentityProvider method.
	CreateIdentityProviderFunc func(clusterID string, identityProvider *clustersmgmtv1.IdentityProvider) (*clustersmgmtv1.IdentityProvider, error)

	// CreateMachinePoolFunc mocks the CreateMachinePool method.
	CreateMachinePoolFunc func(clusterID string, machinePool *clustersmgmtv1.MachinePool) (*clustersmgmtv1.MachinePool, error)

	// CreateSyncSetFunc mocks the CreateSyncSet method.
	CreateSyncSetFunc func(clusterID string, syncset *clustersmgmtv1.Syncset) (*clustersmgmtv1.Syncset, error)

	// DeleteClusterFunc mocks the DeleteCluster method.
	DeleteClusterFunc func(clusterID string) (int, error)

	// DeleteSubscriptionFunc mocks the DeleteSubscription method.
	DeleteSubscriptionFunc func(id string) (int, error)

	// DeleteSyncSetFunc mocks the DeleteSyncSet method.
	DeleteSyncSetFunc func(clusterID string, syncsetID string) (int, error)

	// FindSubscriptionsFunc mocks the FindSubscriptions method.
	FindSubscriptionsFunc func(query string) ([]*amsv1.Subscription, error)

	// GetAddonFunc mocks the GetAddon method.
	GetAddonFunc func(clusterId string, addonId string) (*clustersmgmtv1.AddOnInstallation, error)

	// GetCloudProvidersFunc mocks the GetCloudProviders method.
	GetCloudProvidersFunc func() (*clustersmgmtv1.CloudProviderList, error)

	// GetClusterFunc mocks the GetCluster method.
	GetClusterFunc func(clusterID string) (*clustersmgmtv1.Cluster, error)

	// GetClusterDNSFunc mocks the GetClusterDNS method.
	GetClusterDNSFunc func(clusterID string) (string, error)

	// GetClusterIngressesFunc mocks the GetClusterIngresses method.
	GetClusterIngressesFunc func(clusterID string) (*clustersmgmtv1.IngressesListResponse, error)

	// GetClusterStatusFunc mocks the GetClusterStatus method.
	GetClusterStatusFunc func(id string) (*clustersmgmtv1.ClusterStatus, error)

	// GetCurrentAccountFunc mocks the GetCurrentAccount method.
	GetCurrentAccountFunc func() (*amsv1.Account, error)

	// GetIdentityProviderListFunc mocks the GetIdentityProviderList method.
	GetIdentityProviderListFunc func(clusterID string) (*clustersmgmtv1.IdentityProviderList, error)

	// GetMachinePoolFunc mocks the GetMachinePool method.
	GetMachinePoolFunc func(clusterID string, machinePoolID string) (*clustersmgmtv1.MachinePool, error)

	// GetOrganisationIdFromExternalIdFunc mocks the GetOrganisationIdFromExternalId method.
	GetOrganisationIdFromExternalIdFunc func(externalId string) (string, error)

	// GetQuotaCostsFunc mocks the GetQuotaCosts method.
	GetQuotaCostsFunc func(organizationID string, fetchRelatedResources bool, fetchCloudAccounts bool, filters ...QuotaCostRelatedResourceFilter) ([]*amsv1.QuotaCost, error)

	// GetQuotaCostsForProductFunc mocks the GetQuotaCostsForProduct method.
	GetQuotaCostsForProductFunc func(organizationID string, resourceName string, product string) ([]*amsv1.QuotaCost, error)

	// GetRegionsFunc mocks the GetRegions method.
	GetRegionsFunc func(provider *clustersmgmtv1.CloudProvider) (*clustersmgmtv1.CloudRegionList, error)

	// GetRequiresTermsAcceptanceFunc mocks the GetRequiresTermsAcceptance method.
	GetRequiresTermsAcceptanceFunc func(username string) (bool, string, error)

	// GetSubscriptionByIDFunc mocks the GetSubscriptionByID method.
	GetSubscriptionByIDFunc func(subscriptionID string) (*amsv1.Subscription, bool, error)

	// GetSyncSetFunc mocks the GetSyncSet method.
	GetSyncSetFunc func(clusterID string, syncSetID string) (*clustersmgmtv1.Syncset, error)

	// UpdateAddonParametersFunc mocks the UpdateAddonParameters method.
	UpdateAddonParametersFunc func(clusterId string, addonId string, parameters []Parameter) (*clustersmgmtv1.AddOnInstallation, error)

	// UpdateSyncSetFunc mocks the UpdateSyncSet method.
	UpdateSyncSetFunc func(clusterID string, syncSetID string, syncset *clustersmgmtv1.Syncset) (*clustersmgmtv1.Syncset, error)
	// contains filtered or unexported fields
}

ClientMock is a mock implementation of Client.

func TestSomethingThatUsesClient(t *testing.T) {

	// make and configure a mocked Client
	mockedClient := &ClientMock{
		ClusterAuthorizationFunc: func(cb *amsv1.ClusterAuthorizationRequest) (*amsv1.ClusterAuthorizationResponse, error) {
			panic("mock out the ClusterAuthorization method")
		},
		ConnectionFunc: func() *sdkClient.Connection {
			panic("mock out the Connection method")
		},
		CreateAddonFunc: func(clusterId string, addonId string) (*clustersmgmtv1.AddOnInstallation, error) {
			panic("mock out the CreateAddon method")
		},
		CreateAddonWithParamsFunc: func(clusterId string, addonId string, parameters []Parameter) (*clustersmgmtv1.AddOnInstallation, error) {
			panic("mock out the CreateAddonWithParams method")
		},
		CreateClusterFunc: func(cluster *clustersmgmtv1.Cluster) (*clustersmgmtv1.Cluster, error) {
			panic("mock out the CreateCluster method")
		},
		CreateIdentityProviderFunc: func(clusterID string, identityProvider *clustersmgmtv1.IdentityProvider) (*clustersmgmtv1.IdentityProvider, error) {
			panic("mock out the CreateIdentityProvider method")
		},
		CreateMachinePoolFunc: func(clusterID string, machinePool *clustersmgmtv1.MachinePool) (*clustersmgmtv1.MachinePool, error) {
			panic("mock out the CreateMachinePool method")
		},
		CreateSyncSetFunc: func(clusterID string, syncset *clustersmgmtv1.Syncset) (*clustersmgmtv1.Syncset, error) {
			panic("mock out the CreateSyncSet method")
		},
		DeleteClusterFunc: func(clusterID string) (int, error) {
			panic("mock out the DeleteCluster method")
		},
		DeleteSubscriptionFunc: func(id string) (int, error) {
			panic("mock out the DeleteSubscription method")
		},
		DeleteSyncSetFunc: func(clusterID string, syncsetID string) (int, error) {
			panic("mock out the DeleteSyncSet method")
		},
		FindSubscriptionsFunc: func(query string) ([]*amsv1.Subscription, error) {
			panic("mock out the FindSubscriptions method")
		},
		GetAddonFunc: func(clusterId string, addonId string) (*clustersmgmtv1.AddOnInstallation, error) {
			panic("mock out the GetAddon method")
		},
		GetCloudProvidersFunc: func() (*clustersmgmtv1.CloudProviderList, error) {
			panic("mock out the GetCloudProviders method")
		},
		GetClusterFunc: func(clusterID string) (*clustersmgmtv1.Cluster, error) {
			panic("mock out the GetCluster method")
		},
		GetClusterDNSFunc: func(clusterID string) (string, error) {
			panic("mock out the GetClusterDNS method")
		},
		GetClusterIngressesFunc: func(clusterID string) (*clustersmgmtv1.IngressesListResponse, error) {
			panic("mock out the GetClusterIngresses method")
		},
		GetClusterStatusFunc: func(id string) (*clustersmgmtv1.ClusterStatus, error) {
			panic("mock out the GetClusterStatus method")
		},
		GetCurrentAccountFunc: func() (*amsv1.Account, error) {
			panic("mock out the GetCurrentAccount method")
		},
		GetIdentityProviderListFunc: func(clusterID string) (*clustersmgmtv1.IdentityProviderList, error) {
			panic("mock out the GetIdentityProviderList method")
		},
		GetMachinePoolFunc: func(clusterID string, machinePoolID string) (*clustersmgmtv1.MachinePool, error) {
			panic("mock out the GetMachinePool method")
		},
		GetOrganisationIdFromExternalIdFunc: func(externalId string) (string, error) {
			panic("mock out the GetOrganisationIdFromExternalId method")
		},
		GetQuotaCostsFunc: func(organizationID string, fetchRelatedResources bool, fetchCloudAccounts bool, filters ...QuotaCostRelatedResourceFilter) ([]*amsv1.QuotaCost, error) {
			panic("mock out the GetQuotaCosts method")
		},
		GetQuotaCostsForProductFunc: func(organizationID string, resourceName string, product string) ([]*amsv1.QuotaCost, error) {
			panic("mock out the GetQuotaCostsForProduct method")
		},
		GetRegionsFunc: func(provider *clustersmgmtv1.CloudProvider) (*clustersmgmtv1.CloudRegionList, error) {
			panic("mock out the GetRegions method")
		},
		GetRequiresTermsAcceptanceFunc: func(username string) (bool, string, error) {
			panic("mock out the GetRequiresTermsAcceptance method")
		},
		GetSubscriptionByIDFunc: func(subscriptionID string) (*amsv1.Subscription, bool, error) {
			panic("mock out the GetSubscriptionByID method")
		},
		GetSyncSetFunc: func(clusterID string, syncSetID string) (*clustersmgmtv1.Syncset, error) {
			panic("mock out the GetSyncSet method")
		},
		UpdateAddonParametersFunc: func(clusterId string, addonId string, parameters []Parameter) (*clustersmgmtv1.AddOnInstallation, error) {
			panic("mock out the UpdateAddonParameters method")
		},
		UpdateSyncSetFunc: func(clusterID string, syncSetID string, syncset *clustersmgmtv1.Syncset) (*clustersmgmtv1.Syncset, error) {
			panic("mock out the UpdateSyncSet method")
		},
	}

	// use mockedClient in code that requires Client
	// and then make assertions.

}

func (*ClientMock) ClusterAuthorization

ClusterAuthorization calls ClusterAuthorizationFunc.

func (*ClientMock) ClusterAuthorizationCalls

func (mock *ClientMock) ClusterAuthorizationCalls() []struct {
	Cb *amsv1.ClusterAuthorizationRequest
}

ClusterAuthorizationCalls gets all the calls that were made to ClusterAuthorization. Check the length with:

len(mockedClient.ClusterAuthorizationCalls())

func (*ClientMock) Connection

func (mock *ClientMock) Connection() *sdkClient.Connection

Connection calls ConnectionFunc.

func (*ClientMock) ConnectionCalls

func (mock *ClientMock) ConnectionCalls() []struct {
}

ConnectionCalls gets all the calls that were made to Connection. Check the length with:

len(mockedClient.ConnectionCalls())

func (*ClientMock) CreateAddon

func (mock *ClientMock) CreateAddon(clusterId string, addonId string) (*clustersmgmtv1.AddOnInstallation, error)

CreateAddon calls CreateAddonFunc.

func (*ClientMock) CreateAddonCalls

func (mock *ClientMock) CreateAddonCalls() []struct {
	ClusterId string
	AddonId   string
}

CreateAddonCalls gets all the calls that were made to CreateAddon. Check the length with:

len(mockedClient.CreateAddonCalls())

func (*ClientMock) CreateAddonWithParams

func (mock *ClientMock) CreateAddonWithParams(clusterId string, addonId string, parameters []Parameter) (*clustersmgmtv1.AddOnInstallation, error)

CreateAddonWithParams calls CreateAddonWithParamsFunc.

func (*ClientMock) CreateAddonWithParamsCalls

func (mock *ClientMock) CreateAddonWithParamsCalls() []struct {
	ClusterId  string
	AddonId    string
	Parameters []Parameter
}

CreateAddonWithParamsCalls gets all the calls that were made to CreateAddonWithParams. Check the length with:

len(mockedClient.CreateAddonWithParamsCalls())

func (*ClientMock) CreateCluster

func (mock *ClientMock) CreateCluster(cluster *clustersmgmtv1.Cluster) (*clustersmgmtv1.Cluster, error)

CreateCluster calls CreateClusterFunc.

func (*ClientMock) CreateClusterCalls

func (mock *ClientMock) CreateClusterCalls() []struct {
	Cluster *clustersmgmtv1.Cluster
}

CreateClusterCalls gets all the calls that were made to CreateCluster. Check the length with:

len(mockedClient.CreateClusterCalls())

func (*ClientMock) CreateIdentityProvider

func (mock *ClientMock) CreateIdentityProvider(clusterID string, identityProvider *clustersmgmtv1.IdentityProvider) (*clustersmgmtv1.IdentityProvider, error)

CreateIdentityProvider calls CreateIdentityProviderFunc.

func (*ClientMock) CreateIdentityProviderCalls

func (mock *ClientMock) CreateIdentityProviderCalls() []struct {
	ClusterID        string
	IdentityProvider *clustersmgmtv1.IdentityProvider
}

CreateIdentityProviderCalls gets all the calls that were made to CreateIdentityProvider. Check the length with:

len(mockedClient.CreateIdentityProviderCalls())

func (*ClientMock) CreateMachinePool

func (mock *ClientMock) CreateMachinePool(clusterID string, machinePool *clustersmgmtv1.MachinePool) (*clustersmgmtv1.MachinePool, error)

CreateMachinePool calls CreateMachinePoolFunc.

func (*ClientMock) CreateMachinePoolCalls

func (mock *ClientMock) CreateMachinePoolCalls() []struct {
	ClusterID   string
	MachinePool *clustersmgmtv1.MachinePool
}

CreateMachinePoolCalls gets all the calls that were made to CreateMachinePool. Check the length with:

len(mockedClient.CreateMachinePoolCalls())

func (*ClientMock) CreateSyncSet

func (mock *ClientMock) CreateSyncSet(clusterID string, syncset *clustersmgmtv1.Syncset) (*clustersmgmtv1.Syncset, error)

CreateSyncSet calls CreateSyncSetFunc.

func (*ClientMock) CreateSyncSetCalls

func (mock *ClientMock) CreateSyncSetCalls() []struct {
	ClusterID string
	Syncset   *clustersmgmtv1.Syncset
}

CreateSyncSetCalls gets all the calls that were made to CreateSyncSet. Check the length with:

len(mockedClient.CreateSyncSetCalls())

func (*ClientMock) DeleteCluster

func (mock *ClientMock) DeleteCluster(clusterID string) (int, error)

DeleteCluster calls DeleteClusterFunc.

func (*ClientMock) DeleteClusterCalls

func (mock *ClientMock) DeleteClusterCalls() []struct {
	ClusterID string
}

DeleteClusterCalls gets all the calls that were made to DeleteCluster. Check the length with:

len(mockedClient.DeleteClusterCalls())

func (*ClientMock) DeleteSubscription

func (mock *ClientMock) DeleteSubscription(id string) (int, error)

DeleteSubscription calls DeleteSubscriptionFunc.

func (*ClientMock) DeleteSubscriptionCalls

func (mock *ClientMock) DeleteSubscriptionCalls() []struct {
	ID string
}

DeleteSubscriptionCalls gets all the calls that were made to DeleteSubscription. Check the length with:

len(mockedClient.DeleteSubscriptionCalls())

func (*ClientMock) DeleteSyncSet

func (mock *ClientMock) DeleteSyncSet(clusterID string, syncsetID string) (int, error)

DeleteSyncSet calls DeleteSyncSetFunc.

func (*ClientMock) DeleteSyncSetCalls

func (mock *ClientMock) DeleteSyncSetCalls() []struct {
	ClusterID string
	SyncsetID string
}

DeleteSyncSetCalls gets all the calls that were made to DeleteSyncSet. Check the length with:

len(mockedClient.DeleteSyncSetCalls())

func (*ClientMock) FindSubscriptions

func (mock *ClientMock) FindSubscriptions(query string) ([]*amsv1.Subscription, error)

FindSubscriptions calls FindSubscriptionsFunc.

func (*ClientMock) FindSubscriptionsCalls

func (mock *ClientMock) FindSubscriptionsCalls() []struct {
	Query string
}

FindSubscriptionsCalls gets all the calls that were made to FindSubscriptions. Check the length with:

len(mockedClient.FindSubscriptionsCalls())

func (*ClientMock) GetAddon

func (mock *ClientMock) GetAddon(clusterId string, addonId string) (*clustersmgmtv1.AddOnInstallation, error)

GetAddon calls GetAddonFunc.

func (*ClientMock) GetAddonCalls

func (mock *ClientMock) GetAddonCalls() []struct {
	ClusterId string
	AddonId   string
}

GetAddonCalls gets all the calls that were made to GetAddon. Check the length with:

len(mockedClient.GetAddonCalls())

func (*ClientMock) GetCloudProviders

func (mock *ClientMock) GetCloudProviders() (*clustersmgmtv1.CloudProviderList, error)

GetCloudProviders calls GetCloudProvidersFunc.

func (*ClientMock) GetCloudProvidersCalls

func (mock *ClientMock) GetCloudProvidersCalls() []struct {
}

GetCloudProvidersCalls gets all the calls that were made to GetCloudProviders. Check the length with:

len(mockedClient.GetCloudProvidersCalls())

func (*ClientMock) GetCluster

func (mock *ClientMock) GetCluster(clusterID string) (*clustersmgmtv1.Cluster, error)

GetCluster calls GetClusterFunc.

func (*ClientMock) GetClusterCalls

func (mock *ClientMock) GetClusterCalls() []struct {
	ClusterID string
}

GetClusterCalls gets all the calls that were made to GetCluster. Check the length with:

len(mockedClient.GetClusterCalls())

func (*ClientMock) GetClusterDNS

func (mock *ClientMock) GetClusterDNS(clusterID string) (string, error)

GetClusterDNS calls GetClusterDNSFunc.

func (*ClientMock) GetClusterDNSCalls

func (mock *ClientMock) GetClusterDNSCalls() []struct {
	ClusterID string
}

GetClusterDNSCalls gets all the calls that were made to GetClusterDNS. Check the length with:

len(mockedClient.GetClusterDNSCalls())

func (*ClientMock) GetClusterIngresses

func (mock *ClientMock) GetClusterIngresses(clusterID string) (*clustersmgmtv1.IngressesListResponse, error)

GetClusterIngresses calls GetClusterIngressesFunc.

func (*ClientMock) GetClusterIngressesCalls

func (mock *ClientMock) GetClusterIngressesCalls() []struct {
	ClusterID string
}

GetClusterIngressesCalls gets all the calls that were made to GetClusterIngresses. Check the length with:

len(mockedClient.GetClusterIngressesCalls())

func (*ClientMock) GetClusterStatus

func (mock *ClientMock) GetClusterStatus(id string) (*clustersmgmtv1.ClusterStatus, error)

GetClusterStatus calls GetClusterStatusFunc.

func (*ClientMock) GetClusterStatusCalls

func (mock *ClientMock) GetClusterStatusCalls() []struct {
	ID string
}

GetClusterStatusCalls gets all the calls that were made to GetClusterStatus. Check the length with:

len(mockedClient.GetClusterStatusCalls())

func (*ClientMock) GetCurrentAccount

func (mock *ClientMock) GetCurrentAccount() (*amsv1.Account, error)

GetCurrentAccount calls GetCurrentAccountFunc.

func (*ClientMock) GetCurrentAccountCalls

func (mock *ClientMock) GetCurrentAccountCalls() []struct {
}

GetCurrentAccountCalls gets all the calls that were made to GetCurrentAccount. Check the length with:

len(mockedClient.GetCurrentAccountCalls())

func (*ClientMock) GetIdentityProviderList

func (mock *ClientMock) GetIdentityProviderList(clusterID string) (*clustersmgmtv1.IdentityProviderList, error)

GetIdentityProviderList calls GetIdentityProviderListFunc.

func (*ClientMock) GetIdentityProviderListCalls

func (mock *ClientMock) GetIdentityProviderListCalls() []struct {
	ClusterID string
}

GetIdentityProviderListCalls gets all the calls that were made to GetIdentityProviderList. Check the length with:

len(mockedClient.GetIdentityProviderListCalls())

func (*ClientMock) GetMachinePool

func (mock *ClientMock) GetMachinePool(clusterID string, machinePoolID string) (*clustersmgmtv1.MachinePool, error)

GetMachinePool calls GetMachinePoolFunc.

func (*ClientMock) GetMachinePoolCalls

func (mock *ClientMock) GetMachinePoolCalls() []struct {
	ClusterID     string
	MachinePoolID string
}

GetMachinePoolCalls gets all the calls that were made to GetMachinePool. Check the length with:

len(mockedClient.GetMachinePoolCalls())

func (*ClientMock) GetOrganisationIdFromExternalId

func (mock *ClientMock) GetOrganisationIdFromExternalId(externalId string) (string, error)

GetOrganisationIdFromExternalId calls GetOrganisationIdFromExternalIdFunc.

func (*ClientMock) GetOrganisationIdFromExternalIdCalls

func (mock *ClientMock) GetOrganisationIdFromExternalIdCalls() []struct {
	ExternalId string
}

GetOrganisationIdFromExternalIdCalls gets all the calls that were made to GetOrganisationIdFromExternalId. Check the length with:

len(mockedClient.GetOrganisationIdFromExternalIdCalls())

func (*ClientMock) GetQuotaCosts

func (mock *ClientMock) GetQuotaCosts(organizationID string, fetchRelatedResources bool, fetchCloudAccounts bool, filters ...QuotaCostRelatedResourceFilter) ([]*amsv1.QuotaCost, error)

GetQuotaCosts calls GetQuotaCostsFunc.

func (*ClientMock) GetQuotaCostsCalls

func (mock *ClientMock) GetQuotaCostsCalls() []struct {
	OrganizationID        string
	FetchRelatedResources bool
	FetchCloudAccounts    bool
	Filters               []QuotaCostRelatedResourceFilter
}

GetQuotaCostsCalls gets all the calls that were made to GetQuotaCosts. Check the length with:

len(mockedClient.GetQuotaCostsCalls())

func (*ClientMock) GetQuotaCostsForProduct

func (mock *ClientMock) GetQuotaCostsForProduct(organizationID string, resourceName string, product string) ([]*amsv1.QuotaCost, error)

GetQuotaCostsForProduct calls GetQuotaCostsForProductFunc.

func (*ClientMock) GetQuotaCostsForProductCalls

func (mock *ClientMock) GetQuotaCostsForProductCalls() []struct {
	OrganizationID string
	ResourceName   string
	Product        string
}

GetQuotaCostsForProductCalls gets all the calls that were made to GetQuotaCostsForProduct. Check the length with:

len(mockedClient.GetQuotaCostsForProductCalls())

func (*ClientMock) GetRegions

GetRegions calls GetRegionsFunc.

func (*ClientMock) GetRegionsCalls

func (mock *ClientMock) GetRegionsCalls() []struct {
	Provider *clustersmgmtv1.CloudProvider
}

GetRegionsCalls gets all the calls that were made to GetRegions. Check the length with:

len(mockedClient.GetRegionsCalls())

func (*ClientMock) GetRequiresTermsAcceptance

func (mock *ClientMock) GetRequiresTermsAcceptance(username string) (bool, string, error)

GetRequiresTermsAcceptance calls GetRequiresTermsAcceptanceFunc.

func (*ClientMock) GetRequiresTermsAcceptanceCalls

func (mock *ClientMock) GetRequiresTermsAcceptanceCalls() []struct {
	Username string
}

GetRequiresTermsAcceptanceCalls gets all the calls that were made to GetRequiresTermsAcceptance. Check the length with:

len(mockedClient.GetRequiresTermsAcceptanceCalls())

func (*ClientMock) GetSubscriptionByID

func (mock *ClientMock) GetSubscriptionByID(subscriptionID string) (*amsv1.Subscription, bool, error)

GetSubscriptionByID calls GetSubscriptionByIDFunc.

func (*ClientMock) GetSubscriptionByIDCalls

func (mock *ClientMock) GetSubscriptionByIDCalls() []struct {
	SubscriptionID string
}

GetSubscriptionByIDCalls gets all the calls that were made to GetSubscriptionByID. Check the length with:

len(mockedClient.GetSubscriptionByIDCalls())

func (*ClientMock) GetSyncSet

func (mock *ClientMock) GetSyncSet(clusterID string, syncSetID string) (*clustersmgmtv1.Syncset, error)

GetSyncSet calls GetSyncSetFunc.

func (*ClientMock) GetSyncSetCalls

func (mock *ClientMock) GetSyncSetCalls() []struct {
	ClusterID string
	SyncSetID string
}

GetSyncSetCalls gets all the calls that were made to GetSyncSet. Check the length with:

len(mockedClient.GetSyncSetCalls())

func (*ClientMock) UpdateAddonParameters

func (mock *ClientMock) UpdateAddonParameters(clusterId string, addonId string, parameters []Parameter) (*clustersmgmtv1.AddOnInstallation, error)

UpdateAddonParameters calls UpdateAddonParametersFunc.

func (*ClientMock) UpdateAddonParametersCalls

func (mock *ClientMock) UpdateAddonParametersCalls() []struct {
	ClusterId  string
	AddonId    string
	Parameters []Parameter
}

UpdateAddonParametersCalls gets all the calls that were made to UpdateAddonParameters. Check the length with:

len(mockedClient.UpdateAddonParametersCalls())

func (*ClientMock) UpdateSyncSet

func (mock *ClientMock) UpdateSyncSet(clusterID string, syncSetID string, syncset *clustersmgmtv1.Syncset) (*clustersmgmtv1.Syncset, error)

UpdateSyncSet calls UpdateSyncSetFunc.

func (*ClientMock) UpdateSyncSetCalls

func (mock *ClientMock) UpdateSyncSetCalls() []struct {
	ClusterID string
	SyncSetID string
	Syncset   *clustersmgmtv1.Syncset
}

UpdateSyncSetCalls gets all the calls that were made to UpdateSyncSet. Check the length with:

len(mockedClient.UpdateSyncSetCalls())

type ClusterManagementClient

type ClusterManagementClient Client

type IDGenerator

type IDGenerator interface {
	// Generate create a new string ID.
	Generate() string
}

NOTE: the current mock generation exports to a _test file, if in the future this should be made public, consider moving the type into a ocmtest package. IDGenerator interface for string ID generators.

func NewIDGenerator

func NewIDGenerator(prefix string) IDGenerator

NewIDGenerator create a new default implementation of IDGenerator.

type IDGeneratorMock

type IDGeneratorMock struct {
	// GenerateFunc mocks the Generate method.
	GenerateFunc func() string
	// contains filtered or unexported fields
}

IDGeneratorMock is a mock implementation of IDGenerator.

func TestSomethingThatUsesIDGenerator(t *testing.T) {

	// make and configure a mocked IDGenerator
	mockedIDGenerator := &IDGeneratorMock{
		GenerateFunc: func() string {
			panic("mock out the Generate method")
		},
	}

	// use mockedIDGenerator in code that requires IDGenerator
	// and then make assertions.

}

func (*IDGeneratorMock) Generate

func (mock *IDGeneratorMock) Generate() string

Generate calls GenerateFunc.

func (*IDGeneratorMock) GenerateCalls

func (mock *IDGeneratorMock) GenerateCalls() []struct {
}

GenerateCalls gets all the calls that were made to Generate. Check the length with:

len(mockedIDGenerator.GenerateCalls())

type KafkaProduct

type KafkaProduct string
const (
	RHOSAKProduct      KafkaProduct = "RHOSAK"
	RHOSAKTrialProduct KafkaProduct = "RHOSAKTrial"
	RHOSAKEvalProduct  KafkaProduct = "RHOSAKEval"
	RHOSAKCCProduct    KafkaProduct = "RHOSAKCC"
)

type KafkaQuotaType

type KafkaQuotaType string
const (
	DeveloperQuota KafkaQuotaType = "developer"
	StandardQuota  KafkaQuotaType = "standard"
)

type OCMConfig

type OCMConfig struct {
	BaseURL                       string `json:"base_url"`
	AmsUrl                        string `json:"ams_url"`
	ClientID                      string `json:"client-id"`
	ClientIDFile                  string `json:"client-id_file"`
	ClientSecret                  string `json:"client-secret"`
	ClientSecretFile              string `json:"client-secret_file"`
	SelfToken                     string `json:"self_token"`
	SelfTokenFile                 string `json:"self_token_file"`
	TokenURL                      string `json:"token_url"`
	Debug                         bool   `json:"debug"`
	EnableMock                    bool   `json:"enable_mock"`
	MockMode                      string `json:"mock_type"`
	StrimziOperatorAddonID        string `json:"strimzi_operator_addon_id"`
	KasFleetshardAddonID          string `json:"kas_fleetshard_addon_id"`
	ClusterLoggingOperatorAddonID string `json:"cluster_logging_operator_addon_id"`
}

func NewOCMConfig

func NewOCMConfig() *OCMConfig

func (*OCMConfig) AddFlags

func (c *OCMConfig) AddFlags(fs *pflag.FlagSet)

func (*OCMConfig) HasCredentials

func (c *OCMConfig) HasCredentials() bool

func (*OCMConfig) ReadFiles

func (c *OCMConfig) ReadFiles() error

type Parameter

type Parameter struct {
	Id    string
	Value string
}

type QuotaCostRelatedResourceFilter

type QuotaCostRelatedResourceFilter struct {
	ResourceName *string
	ResourceType *string
	Product      *string
	BillingModel *string
}

QuotaCostRelatedResourceFilter represents the properties of the related resource, associated to each quota cost, that can be used to filter the result of the get quota costs request. Any property set to nil will not be applied as a filter.

func (*QuotaCostRelatedResourceFilter) IsMatch

func (qcf *QuotaCostRelatedResourceFilter) IsMatch(relatedResource *amsv1.RelatedResource) bool

IsMatch returns true if all the given properties of the filter matches that of the given related resource. If a filter property was not specified, the check for that property will always return true

Directories

Path Synopsis
Package clusterservicetest provides simple mock helpers for OCM Cluster Service types, to make table driven tests easier to define.
Package clusterservicetest provides simple mock helpers for OCM Cluster Service types, to make table driven tests easier to define.

Jump to

Keyboard shortcuts

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