mocks

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

Documentation

Index

Constants

View Source
const (
	// EndpointPathClusters ocm clusters management service clusters endpoint
	EndpointPathClusters = "/api/clusters_mgmt/v1/clusters"
	// EndpointPathCluster ocm clusters management service clusters endpoint
	EndpointPathCluster = "/api/clusters_mgmt/v1/clusters/{id}"

	// EndpointPathClusterIdentityProviders ocm clusters management service clusters identity provider create endpoint
	EndpointPathClusterIdentityProviders = "/api/clusters_mgmt/v1/clusters/{id}/identity_providers"
	// EndpointPathClusterIdentityProvider ocm clusters management service clusters identity provider update endpoint
	EndpointPathClusterIdentityProvider = "/api/clusters_mgmt/v1/clusters/{id}/identity_providers/{idp_id}"

	// EndpointPathSyncsets ocm clusters management service syncset endpoint
	EndpointPathSyncsets = "/api/clusters_mgmt/v1/clusters/{id}/external_configuration/syncsets"
	// EndpointPathSyncset ocm clusters management service syncset endpoint
	EndpointPathSyncset = "/api/clusters_mgmt/v1/clusters/{id}/external_configuration/syncsets/{syncsetID}"
	// EndpointPathIngresses ocm cluster management ingress endpoint
	EndpointPathIngresses = "/api/clusters_mgmt/v1/clusters/{id}/ingresses"
	// EndpointPathCloudProviders ocm cluster management cloud providers endpoint
	EndpointPathCloudProviders = "/api/clusters_mgmt/v1/cloud_providers"
	// EndpointPathCloudProvider ocm cluster management cloud provider endpoint
	EndpointPathCloudProvider = "/api/clusters_mgmt/v1/cloud_providers/{id}"
	// EndpointPathCloudProviderRegions ocm cluster management cloud provider regions endpoint
	EndpointPathCloudProviderRegions = "/api/clusters_mgmt/v1/cloud_providers/{id}/regions"
	// EndpointPathCloudProviderRegion ocm cluster management cloud provider region endpoint
	EndpointPathCloudProviderRegion = "/api/clusters_mgmt/v1/cloud_providers/{providerID}/regions/{regionID}"
	// EndpointPathClusterStatus ocm cluster management cluster status endpoint
	EndpointPathClusterStatus = "/api/clusters_mgmt/v1/clusters/{id}/status"
	// EndpointPathClusterAddons ocm cluster management cluster addons endpoint
	EndpointPathClusterAddons = "/api/clusters_mgmt/v1/clusters/{id}/addons"
	// EndpointPathMachinePools ocm cluster management machine pools endpoint
	EndpointPathMachinePools = "/api/clusters_mgmt/v1/clusters/{id}/machine_pools"
	// EndpointPathMachinePool ocm cluster management machine pool endpoint
	EndpointPathMachinePool = "/api/clusters_mgmt/v1/clusters/{id}/machine_pools/{machinePoolId}"
	// EndpointPathAddonInstallations ocm cluster addon installations endpoint
	EndpointPathAddonInstallations = "/api/clusters_mgmt/v1/clusters/{id}/addons"
	// EndpointPathAddonInstallation ocm cluster addon installation endpoint
	EndpointPathAddonInstallation = "/api/clusters_mgmt/v1/clusters/{id}/addons/{addoninstallationId}"
	// EndpointPathKasFleetshardOperatorAddonInstallation ocm cluster kas-fleetshard-operator-qe addon installation endpoint
	EndpointPathKasFleetshardOperatorAddonInstallation = "/api/clusters_mgmt/v1/clusters/{id}/addons/kas-fleetshard-operator-qe"
	// EndpointPathClusterLoggingOperatorAddonInstallation ocm cluster cluster-logging-operator addon installation endpoint
	EndpointPathClusterLoggingOperatorAddonInstallation = "/api/clusters_mgmt/v1/clusters/{id}/addons/cluster-logging-operator"

	EndpointPathClusterAuthorization  = "/api/accounts_mgmt/v1/cluster_authorizations"
	EndpointPathSubscription          = "/api/accounts_mgmt/v1/subscriptions/{id}"
	EndpointPathSubscriptionSearch    = "/api/accounts_mgmt/v1/subscriptions"
	EndpointPathServiceAccount        = "/api/accounts_mgmt/v1/current_account"
	EndpointPathOrganisationQuotaCost = "/api/accounts_mgmt/v1/organizations/{orgId}/quota_cost"
	EndpointPathOrganisationList      = "/api/accounts_mgmt/v1/organizations"

	EndpointPathTermsReview = "/api/authorizations/v1/terms_review"

	// MockClusterID default mock cluster id used in the mock ocm server
	MockClusterID = "2aad9fc1-c40e-471f-8d57-fdaecc7d3686"
	// MockCloudProviderID default mock provider ID
	MockCloudProviderID = "aws"
	// MockClusterExternalID default mock cluster external ID
	MockClusterExternalID = "2aad9fc1-c40e-471f-8d57-fdaecc7d3686"
	// MockClusterState default mock cluster state
	MockClusterState = clustersmgmtv1.ClusterStateReady
	// MockCloudProviderDisplayName default mock provider display name
	MockCloudProviderDisplayName = "AWS"
	// MockCloudRegionID default mock cluster region
	MockCloudRegionID = "us-east-1"
	// MockCloudRegionDisplayName default mock cloud region display name
	MockCloudRegionDisplayName = "US East, N. Virginia"
	// MockSyncsetID default mock syncset id used in the mock ocm server
	MockSyncsetID = "ext-8a41f783-b5e4-4692-a7cd-c0b9c8eeede9"
	// MockIngressID default mock ingress id used in the mock ocm server
	MockIngressID = "s1h5"
	// MockIngressDNS default mock ingress dns used in the mock ocm server
	MockIngressDNS = "apps.mk-btq2d1h8d3b1.b3k3.s1.devshift.org"
	// MockIngressHref default mock ingress HREF used in the mock ocm server
	MockIngressHref = "/api/clusters_mgmt/v1/clusters/000/ingresses/i8y1"
	// MockIngressListening default mock ingress listening used in the mock ocm server
	MockIngressListening = clustersmgmtv1.ListeningMethodExternal
	// MockClusterAddonID default mock cluster addon ID
	MockClusterAddonID = "managed-kafka-qe"
	// MockKasFleetshardAddonID default mock ID for the KAS Fleetshard Operator
	MockKasFleetshardAddonID = "kas-fleetshard-operator-qe"
	// MockClusterLoggingOperatorAddonID default mock ID for the Cluster Logging Operator
	MockClusterLoggingOperatorAddonID = "cluster-logging-operator"
	// MockClusterAddonState default mock cluster addon state
	MockClusterAddonState = clustersmgmtv1.AddOnInstallationStateReady
	// MockClusterAddonDescription default mock cluster addon description
	MockClusterAddonDescription = "InstallWaiting"
	// MockMachinePoolID default machine pool ID
	MockMachinePoolID = "managed"
	// MockMachinePoolReplicas default number of machine pool replicas
	MockMachinePoolReplicas = 3
	// MockOpenshiftVersion default cluster openshift version
	MockOpenshiftVersion = "openshift-v4.6.1"
	//MockMultiAZ default value
	MockMultiAZ = true
	//MockClusterComputeNodes default nodes
	MockClusterComputeNodes = 3
	// MockIdentityProviderID default identity provider ID
	MockIdentityProviderID = "identity-provider-id"
	//
	MockSubID = "pphCb6sIQPqtjMtL0GQaX6i4bP"
	// MockQuotaConsumed default quota consumed value returned by the get quota costs by organisation endpoint
	MockQuotaConsumed = 1
	// MockQuotaMaxAllowed default quota max allowed value returned by the get quota costs by organisation endpoint
	MockQuotaMaxAllowed = 10
	// MockQuotaId default quota id value returned by the get quota costs by organisation endpoint
	MockQuotaId = "quota-id"
)
View Source
const (
	Unlimited = -1
)

Variables

View Source
var (
	EndpointClusterGet                                   = Endpoint{EndpointPathCluster, http.MethodGet}
	EndpointClusterPatch                                 = Endpoint{EndpointPathCluster, http.MethodPatch}
	EndpointKafkaDelete                                  = Endpoint{EndpointPathSyncset, http.MethodDelete}
	EndpointClustersGet                                  = Endpoint{EndpointPathClusters, http.MethodGet}
	EndpointClustersPost                                 = Endpoint{EndpointPathClusters, http.MethodPost}
	EndpointClusterDelete                                = Endpoint{EndpointPathCluster, http.MethodDelete}
	EndpointClusterSyncsetsPost                          = Endpoint{EndpointPathSyncsets, http.MethodPost}
	EndpointClusterSyncsetGet                            = Endpoint{EndpointPathSyncset, http.MethodGet}
	EndpointClusterSyncsetPatch                          = Endpoint{EndpointPathSyncset, http.MethodPatch}
	EndpointClusterIngressGet                            = Endpoint{EndpointPathIngresses, http.MethodGet}
	EndpointCloudProvidersGet                            = Endpoint{EndpointPathCloudProviders, http.MethodGet}
	EndpointCloudProviderGet                             = Endpoint{EndpointPathCloudProvider, http.MethodGet}
	EndpointCloudProviderRegionsGet                      = Endpoint{EndpointPathCloudProviderRegions, http.MethodGet}
	EndpointCloudProviderRegionGet                       = Endpoint{EndpointPathCloudProviderRegion, http.MethodGet}
	EndpointClusterStatusGet                             = Endpoint{EndpointPathClusterStatus, http.MethodGet}
	EndpointClusterAddonsGet                             = Endpoint{EndpointPathClusterAddons, http.MethodGet}
	EndpointClusterAddonPost                             = Endpoint{EndpointPathClusterAddons, http.MethodPost}
	EndpointMachinePoolsGet                              = Endpoint{EndpointPathMachinePools, http.MethodGet}
	EndpointMachinePoolPost                              = Endpoint{EndpointPathMachinePools, http.MethodPost}
	EndpointMachinePoolPatch                             = Endpoint{EndpointPathMachinePool, http.MethodPatch}
	EndpointMachinePoolGet                               = Endpoint{EndpointPathMachinePool, http.MethodGet}
	EndpointServiceAccountGet                            = Endpoint{EndpointPathServiceAccount, http.MethodGet}
	EndpointOrganizationQuotaCostGet                     = Endpoint{EndpointPathOrganisationQuotaCost, http.MethodGet}
	EndpointOrganizationList                             = Endpoint{EndpointPathOrganisationList, http.MethodGet}
	EndpointIdentityProviderPost                         = Endpoint{EndpointPathClusterIdentityProviders, http.MethodPost}
	EndpointIdentityProviderPatch                        = Endpoint{EndpointPathClusterIdentityProvider, http.MethodPatch}
	EndpointAddonInstallationsPost                       = Endpoint{EndpointPathAddonInstallations, http.MethodPost}
	EndpointAddonInstallationGet                         = Endpoint{EndpointPathAddonInstallation, http.MethodGet}
	EndpointAddonInstallationPatch                       = Endpoint{EndpointPathAddonInstallation, http.MethodPatch}
	EndpointKasFleetshardOperatorAddonInstallationGet    = Endpoint{EndpointPathKasFleetshardOperatorAddonInstallation, http.MethodGet}
	EndpointKasFleetshardOperatorAddonInstallationPatch  = Endpoint{EndpointPathKasFleetshardOperatorAddonInstallation, http.MethodPatch}
	EndpointKasFleetshardOperatorAddonInstallationPost   = Endpoint{EndpointPathKasFleetshardOperatorAddonInstallation, http.MethodPost}
	EndpointClusterLoggingOperatorAddonInstallationGet   = Endpoint{EndpointPathClusterLoggingOperatorAddonInstallation, http.MethodGet}
	EndpointClusterLoggingOperatorAddonInstallationPatch = Endpoint{EndpointPathClusterLoggingOperatorAddonInstallation, http.MethodPatch}
	EndpointClusterLoggingOperatorAddonInstallationPost  = Endpoint{EndpointPathClusterLoggingOperatorAddonInstallation, http.MethodPost}
	EndpointClusterAuthorizationPost                     = Endpoint{EndpointPathClusterAuthorization, http.MethodPost}
	EndpointSubscriptionDelete                           = Endpoint{EndpointPathSubscription, http.MethodDelete}
	EndpointSubscriptionSearch                           = Endpoint{EndpointPathSubscriptionSearch, http.MethodGet}
	EndpointTermsReviewPost                              = Endpoint{EndpointPathTermsReview, http.MethodPost}
)

variables for endpoints

View Source
var (
	MockIdentityProvider                           *clustersmgmtv1.IdentityProvider
	MockSyncset                                    *clustersmgmtv1.Syncset
	MockIngressList                                *clustersmgmtv1.IngressList
	MockCloudProvider                              *clustersmgmtv1.CloudProvider
	MockCloudProviderList                          *clustersmgmtv1.CloudProviderList
	MockCloudProviderRegion                        *clustersmgmtv1.CloudRegion
	MockCloudProviderRegionList                    *clustersmgmtv1.CloudRegionList
	MockClusterStatus                              *clustersmgmtv1.ClusterStatus
	MockClusterAddonInstallation                   *clustersmgmtv1.AddOnInstallation
	MockClusterAddonInstallationList               *clustersmgmtv1.AddOnInstallationList
	MockKasFleetshardOperatorAddonInstallation     *clustersmgmtv1.AddOnInstallation
	MockKasClusterLoggingOperatorAddonInstallation *clustersmgmtv1.AddOnInstallation
	MockMachinePoolList                            *clustersmgmtv1.MachinePoolList
	MockMachinePool                                *clustersmgmtv1.MachinePool
	MockCluster                                    *clustersmgmtv1.Cluster
	MockClusterAuthorization                       *amsv1.ClusterAuthorizationResponse
	MockSubscription                               *amsv1.Subscription
	MockOrganizationQuotaCost                      *amsv1.QuotaCostList
	MockServiceAccount                             *amsv1.Account
	MockSubscriptionSearch                         []*amsv1.Subscription
	MockTermsReview                                *authorizationsv1.TermsReviewResponse
)

variables for mocked ocm types

these are the default types that will be returned by the emulated ocm api to override these values, do not set them directly e.g. mocks.MockSyncset = ... instead use the Set*Response functions provided by MockConfigurableServerBuilder e.g. SetClusterGetResponse(...)

Functions

func GetMachinePoolList

func GetMachinePoolList(modifyFn func(*clustersmgmtv1.MachinePoolList, error)) (*clustersmgmtv1.MachinePoolList, error)

GetMachinePoolList for emulated OCM server

func GetMockCloudProvider

func GetMockCloudProvider(modifyFn func(*clustersmgmtv1.CloudProvider, error)) (*clustersmgmtv1.CloudProvider, error)

GetMockCloudProvider for emulated OCM server

func GetMockCloudProviderBuilder

func GetMockCloudProviderBuilder(modifyFn func(builder *clustersmgmtv1.CloudProviderBuilder)) *clustersmgmtv1.CloudProviderBuilder

GetMockCloudProviderBuilder for emulated OCM server

func GetMockCloudProviderList

func GetMockCloudProviderList(modifyFn func(*clustersmgmtv1.CloudProviderList, error)) (*clustersmgmtv1.CloudProviderList, error)

GetMockCloudProviderList for emulated OCM server

func GetMockCloudProviderRegion

func GetMockCloudProviderRegion(modifyFn func(*clustersmgmtv1.CloudRegion, error)) (*clustersmgmtv1.CloudRegion, error)

GetMockCloudProviderRegion for emulated OCM server

func GetMockCloudProviderRegionBuilder

func GetMockCloudProviderRegionBuilder(modifyFn func(*clustersmgmtv1.CloudRegionBuilder)) *clustersmgmtv1.CloudRegionBuilder

GetMockCloudProviderRegionBuilder for emulated OCM server

func GetMockCloudProviderRegionList

func GetMockCloudProviderRegionList(modifyFn func(*clustersmgmtv1.CloudRegionList, error)) (*clustersmgmtv1.CloudRegionList, error)

GetMockCloudProviderRegionList for emulated OCM server

func GetMockCluster

func GetMockCluster(modifyFn func(*clustersmgmtv1.Cluster, error)) (*clustersmgmtv1.Cluster, error)

GetMockCluster for emulated OCM server

func GetMockClusterAddonBuilder

func GetMockClusterAddonBuilder(modifyFn func(*clustersmgmtv1.AddOnBuilder), addonId string) *clustersmgmtv1.AddOnBuilder

GetMockClusterAddonBuilder for emulated OCM server

func GetMockClusterAddonInstallation

func GetMockClusterAddonInstallation(modifyFn func(*clustersmgmtv1.AddOnInstallation, error), addonId string) (*clustersmgmtv1.AddOnInstallation, error)

GetMockClusterAddonInstallation for emulated OCM server

func GetMockClusterAddonInstallationBuilder

func GetMockClusterAddonInstallationBuilder(modifyFn func(*clustersmgmtv1.AddOnInstallationBuilder), addonId string) *clustersmgmtv1.AddOnInstallationBuilder

GetMockClusterAddonInstallationBuilder for emulated OCM server

func GetMockClusterAddonInstallationList

func GetMockClusterAddonInstallationList(modifyFn func(*clustersmgmtv1.AddOnInstallationList, error)) (*clustersmgmtv1.AddOnInstallationList, error)

GetMockClusterAddonInstallationList for emulated OCM server

func GetMockClusterAuthorization

func GetMockClusterAuthorization(modifyFn func(b *amsv1.ClusterAuthorizationResponse)) (*amsv1.ClusterAuthorizationResponse, error)

func GetMockClusterBuilder

func GetMockClusterBuilder(modifyFn func(*clustersmgmtv1.ClusterBuilder)) *clustersmgmtv1.ClusterBuilder

GetMockClusterBuilder for emulated OCM server

func GetMockClusterNodesBuilder

func GetMockClusterNodesBuilder(modifyFn func(*clustersmgmtv1.ClusterNodesBuilder)) *clustersmgmtv1.ClusterNodesBuilder

GetMockClusterNodesBuilder for emulated OCM server

func GetMockClusterStatus

func GetMockClusterStatus(modifyFn func(*clustersmgmtv1.ClusterStatus, error)) (*clustersmgmtv1.ClusterStatus, error)

GetMockClusterStatus for emulated OCM server

func GetMockClusterStatusBuilder

func GetMockClusterStatusBuilder(modifyFn func(*clustersmgmtv1.ClusterStatusBuilder)) *clustersmgmtv1.ClusterStatusBuilder

GetMockClusterStatusBuilder for emulated OCM server

func GetMockIdentityProvider

func GetMockIdentityProvider(modifyFn func(*clustersmgmtv1.IdentityProvider, error)) (*clustersmgmtv1.IdentityProvider, error)

GetMockIdentityProvider for emulated OCM server

func GetMockIdentityProviderBuilder

func GetMockIdentityProviderBuilder(modifyFn func(*clustersmgmtv1.IdentityProviderBuilder)) *clustersmgmtv1.IdentityProviderBuilder

GetMockIdentityProviderBuilder for emulated OCM server

func GetMockIngressList

func GetMockIngressList(modifyFn func(l *v1.IngressList, err error)) (*clustersmgmtv1.IngressList, error)

GetMockIngressList for emulated OCM server

func GetMockMachineBuilder

func GetMockMachineBuilder(modifyFn func(*clustersmgmtv1.MachinePoolBuilder)) *clustersmgmtv1.MachinePoolBuilder

GetMockMachineBuilder for emulated OCM server

func GetMockMachinePool

func GetMockMachinePool(modifyFn func(*clustersmgmtv1.MachinePool, error)) (*clustersmgmtv1.MachinePool, error)

GetMockMachinePool for emulated OCM server

func GetMockOpenshiftVersionBuilder

func GetMockOpenshiftVersionBuilder(modifyFn func(*clustersmgmtv1.VersionBuilder)) *clustersmgmtv1.VersionBuilder

GetMockOpenshiftVersionBuilder for emulated OCM server

func GetMockOrganizationQuotaCost

func GetMockOrganizationQuotaCost(modifyFn func(*amsv1.QuotaCostList, error)) (*amsv1.QuotaCostList, error)

func GetMockOrganizationQuotaCostBuilder

func GetMockOrganizationQuotaCostBuilder(modifyFn func(*amsv1.QuotaCostListBuilder)) *amsv1.QuotaCostListBuilder

func GetMockServiceAccount

func GetMockServiceAccount(modifyFn func(*amsv1.Account, error)) (*amsv1.Account, error)

func GetMockServiceAccountBuilder

func GetMockServiceAccountBuilder(modifyFn func(*amsv1.AccountBuilder)) *amsv1.AccountBuilder

func GetMockSubscription

func GetMockSubscription(modifyFn func(b *amsv1.Subscription)) (*amsv1.Subscription, error)

func GetMockSyncset

func GetMockSyncset(syncsetBuilder *clustersmgmtv1.SyncsetBuilder) (*clustersmgmtv1.Syncset, error)

GetMockSyncset for emulated OCM server

func GetMockSyncsetBuilder

func GetMockSyncsetBuilder(modifyFn func(b *clustersmgmtv1.SyncsetBuilder)) *clustersmgmtv1.SyncsetBuilder

GetMockSyncsetBuilder for emulated OCM server

func NewJWKCertServerMock

func NewJWKCertServerMock(t *testing.T, pubKey crypto.PublicKey, jwkKID string) (url string, teardown func())

func NewOCMList

func NewOCMList() *ocmList

func NewOrganizationList

func NewOrganizationList() *organizationList

func NewSubscriptionList

func NewSubscriptionList() *subscriptionList

Types

type Endpoint

type Endpoint struct {
	Path   string
	Method string
}

Endpoint is a wrapper around an endpoint and the method used to interact with that endpoint e.g. GET /clusters

type HandlerRegister

type HandlerRegister map[Endpoint]func(w http.ResponseWriter, r *http.Request)

HandlerRegister is a cache that maps Endpoints to their handlers

type MockConfigurableServerBuilder

type MockConfigurableServerBuilder struct {
	// contains filtered or unexported fields
}

MockConfigurableServerBuilder allows mock ocm api servers to be built

func NewMockConfigurableServerBuilder

func NewMockConfigurableServerBuilder() *MockConfigurableServerBuilder

NewMockConfigurableServerBuilder returns a new builder that can be used to define a mock ocm api server

func (*MockConfigurableServerBuilder) Build

Build builds the mock ocm api server using the endpoint handlers that have been set in the builder

func (*MockConfigurableServerBuilder) SetAddonInstallationGetResponse

func (b *MockConfigurableServerBuilder) SetAddonInstallationGetResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

SetAddonInstallationGetResponse set a mock response for Get /api/clusters_mgmt/v1/clusters/{id}/addons/{addoninstallationId}

func (*MockConfigurableServerBuilder) SetAddonInstallationPatchResponse

func (b *MockConfigurableServerBuilder) SetAddonInstallationPatchResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

SetAddonInstallationPatchResponse set a mock response for Patch /api/clusters_mgmt/v1/clusters/{id}/addons/{addoninstallationId}

func (*MockConfigurableServerBuilder) SetAddonInstallationsPostResponse

func (b *MockConfigurableServerBuilder) SetAddonInstallationsPostResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

SetAddonInstallationsPostResponse set a mock response for Post /api/clusters_mgmt/v1/clusters/{id}/addons

func (*MockConfigurableServerBuilder) SetCloudProvidersGetResponse

func (b *MockConfigurableServerBuilder) SetCloudProvidersGetResponse(providers *clustersmgmtv1.CloudProviderList, err *ocmErrors.ServiceError)

SetCloudProvidersGetResponse set a mock response provider list or error for GET /api/clusters_mgmt/v1/cloud_providers

func (*MockConfigurableServerBuilder) SetCloudRegionGetResponse

func (b *MockConfigurableServerBuilder) SetCloudRegionGetResponse(region *clustersmgmtv1.CloudRegion, err *ocmErrors.ServiceError)

SetCloudRegionGetResponse set a mock response region or error for GET /api/clusters_mgmt/v1/cloud_providers/{id}/regions/{regionId}

func (*MockConfigurableServerBuilder) SetCloudRegionsGetResponse

func (b *MockConfigurableServerBuilder) SetCloudRegionsGetResponse(regions *clustersmgmtv1.CloudRegionList, err *ocmErrors.ServiceError)

SetCloudRegionsGetResponse set a mock response region list or error for GET /api/clusters_mgmt/v1/cloud_providers/{id}/regions

func (*MockConfigurableServerBuilder) SetClusterAddonPostResponse

func (b *MockConfigurableServerBuilder) SetClusterAddonPostResponse(addon *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

SetClusterAddonPostResponse set a mock response addon or error for POST /api/clusters_mgmt/v1/clusters/{id}/addons

func (*MockConfigurableServerBuilder) SetClusterAddonsGetResponse

func (b *MockConfigurableServerBuilder) SetClusterAddonsGetResponse(addons *clustersmgmtv1.AddOnInstallationList, err *ocmErrors.ServiceError)

SetClusterAddonsGetResponse set a mock response addon list or error for GET /api/clusters_mgmt/v1/clusters/{id}/addons

func (*MockConfigurableServerBuilder) SetClusterAuthorizationResponse

func (b *MockConfigurableServerBuilder) SetClusterAuthorizationResponse(idp *amsv1.ClusterAuthorizationResponse, err *ocmErrors.ServiceError)

SetClusterAuthorizationResponse set a mock response for Post /api/accounts_mgmt/v1/cluster_authorizations

func (*MockConfigurableServerBuilder) SetClusterDeleteResponse

func (b *MockConfigurableServerBuilder) SetClusterDeleteResponse(cluster *clustersmgmtv1.Cluster, err *ocmErrors.ServiceError)

SetClusterDeleteResponse set a mock response cluster or error for the DELETE /api/clusters_mgmt/v1/clusters/{id} endpoint

func (*MockConfigurableServerBuilder) SetClusterGetResponse

func (b *MockConfigurableServerBuilder) SetClusterGetResponse(cluster *clustersmgmtv1.Cluster, err *ocmErrors.ServiceError)

SetClusterGetResponse set a mock response cluster or error for the POST /api/clusters_mgmt/v1/clusters endpoint

func (*MockConfigurableServerBuilder) SetClusterIngressGetResponse

func (b *MockConfigurableServerBuilder) SetClusterIngressGetResponse(ingress *clustersmgmtv1.Ingress, err *ocmErrors.ServiceError)

SetClusterIngressGetResponse set a mock response ingress or error for the GET /api/clusters_mgmt/v1/clusters/{id}/ingresses endpoint

func (*MockConfigurableServerBuilder) SetClusterLoggingOperatorAddonInstallationGetResponse

func (b *MockConfigurableServerBuilder) SetClusterLoggingOperatorAddonInstallationGetResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

func (*MockConfigurableServerBuilder) SetClusterLoggingOperatorAddonInstallationPatchResponse

func (b *MockConfigurableServerBuilder) SetClusterLoggingOperatorAddonInstallationPatchResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

func (*MockConfigurableServerBuilder) SetClusterLoggingOperatorAddonInstallationPostResponse

func (b *MockConfigurableServerBuilder) SetClusterLoggingOperatorAddonInstallationPostResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

func (*MockConfigurableServerBuilder) SetClusterPatchResponse

func (b *MockConfigurableServerBuilder) SetClusterPatchResponse(cluster *clustersmgmtv1.Cluster, err *ocmErrors.ServiceError)

SetClusterPatchResponse set a mock response cluster or error for the PATCH /api/clusters_mgmt/v1/clusters/{id} endpoint

func (*MockConfigurableServerBuilder) SetClusterStatusGetResponse

func (b *MockConfigurableServerBuilder) SetClusterStatusGetResponse(status *clustersmgmtv1.ClusterStatus, err *ocmErrors.ServiceError)

SetClusterStatusGetResponse set a mock response cluster status or error for GET /api/clusters_mgmt/v1/clusters/{id}/status

func (*MockConfigurableServerBuilder) SetClusterSyncsetGetResponse

func (b *MockConfigurableServerBuilder) SetClusterSyncsetGetResponse(syncset *clustersmgmtv1.Syncset, err *ocmErrors.ServiceError)

SetClusterSyncsetGetResponse set a mock response syncset or error for the GET /api/clusters_mgmt/v1/clusters/{id}/external_configuration/syncsets/{syncsetID}

func (*MockConfigurableServerBuilder) SetClusterSyncsetPatchResponse

func (b *MockConfigurableServerBuilder) SetClusterSyncsetPatchResponse(syncset *clustersmgmtv1.Syncset, err *ocmErrors.ServiceError)

SetClusterSyncsetPatchResponse set a mock response syncset or error for the Patch /api/clusters_mgmt/v1/clusters/{id}/syncsets endpoint

func (*MockConfigurableServerBuilder) SetClusterSyncsetPostRequestHandler

func (b *MockConfigurableServerBuilder) SetClusterSyncsetPostRequestHandler(customMockRequestHandler func() func(w http.ResponseWriter, r *http.Request))

func (*MockConfigurableServerBuilder) SetClusterSyncsetPostResponse

func (b *MockConfigurableServerBuilder) SetClusterSyncsetPostResponse(syncset *clustersmgmtv1.Syncset, err *ocmErrors.ServiceError)

SetClusterSyncsetPostResponse set a mock response syncset or error for the POST /api/clusters_mgmt/v1/clusters/{id}/syncsets endpoint

func (*MockConfigurableServerBuilder) SetClustersGetResponse

func (b *MockConfigurableServerBuilder) SetClustersGetResponse(cluster *clustersmgmtv1.Cluster, err *ocmErrors.ServiceError)

SetClustersGetResponse set a mock response cluster or error for the GET /api/clusters_mgmt/v1/clusters endpoint

func (*MockConfigurableServerBuilder) SetClustersPostResponse

func (b *MockConfigurableServerBuilder) SetClustersPostResponse(cluster *clustersmgmtv1.Cluster, err *ocmErrors.ServiceError)

SetClustersPostResponse set a mock response cluster or error for the POST /api/clusters_mgmt/v1/clusters endpoint

func (*MockConfigurableServerBuilder) SetGetOrganizationQuotaCostResponse

func (b *MockConfigurableServerBuilder) SetGetOrganizationQuotaCostResponse(list *amsv1.QuotaCostList, err *ocmErrors.ServiceError)

SetGetOrganizationQuotaCostResponse set a mock response for GET /api/accounts_mgmt/v1/organizations/{id}/quota_cost

func (*MockConfigurableServerBuilder) SetGetServiceAccountResponse

func (b *MockConfigurableServerBuilder) SetGetServiceAccountResponse(acc *amsv1.Account, err *ocmErrors.ServiceError)

SetGetServiceAccountResponse set a mock response for GET /api/accounts_mgmt/v1/accounts/{id}

func (*MockConfigurableServerBuilder) SetIdentityProviderPatchResponse

func (b *MockConfigurableServerBuilder) SetIdentityProviderPatchResponse(idp *clustersmgmtv1.IdentityProvider, err *ocmErrors.ServiceError)

SetIdentityProviderPatchResponse set a mock response for Patch /api/clusters_mgmt/v1/clusters/{id}/identity_providers/{idp_id}

func (*MockConfigurableServerBuilder) SetIdentityProviderPostResponse

func (b *MockConfigurableServerBuilder) SetIdentityProviderPostResponse(idp *clustersmgmtv1.IdentityProvider, err *ocmErrors.ServiceError)

SetIdentityProviderPostResponse set a mock response for Post /api/clusters_mgmt/v1/clusters/{id}/identity_providers

func (*MockConfigurableServerBuilder) SetKafkaDeleteResponse

func (b *MockConfigurableServerBuilder) SetKafkaDeleteResponse(syncset *clustersmgmtv1.Syncset, err *ocmErrors.ServiceError)

SetKafkaDeleteResponse set a mock response cluster or error for the DELETE /api/clusters_mgmt/v1/clusters/{id}/external_configuration/syncsets/{syncsetID} endpoint

func (*MockConfigurableServerBuilder) SetKasFleetshardOperatorAddonInstallationGetResponse

func (b *MockConfigurableServerBuilder) SetKasFleetshardOperatorAddonInstallationGetResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

func (*MockConfigurableServerBuilder) SetKasFleetshardOperatorAddonInstallationPatchResponse

func (b *MockConfigurableServerBuilder) SetKasFleetshardOperatorAddonInstallationPatchResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

func (*MockConfigurableServerBuilder) SetKasFleetshardOperatorAddonInstallationPostResponse

func (b *MockConfigurableServerBuilder) SetKasFleetshardOperatorAddonInstallationPostResponse(ai *clustersmgmtv1.AddOnInstallation, err *ocmErrors.ServiceError)

func (*MockConfigurableServerBuilder) SetMachinePoolGetResponse

func (b *MockConfigurableServerBuilder) SetMachinePoolGetResponse(mp *clustersmgmtv1.MachinePoolList, err *ocmErrors.ServiceError)

SetMachinePoolGetResponse set a mock response machine pool list or error for Get /api/clusters_mgmt/v1/clusters/{id}/machine_pools/{machinePoolId}

func (*MockConfigurableServerBuilder) SetMachinePoolPatchResponse

func (b *MockConfigurableServerBuilder) SetMachinePoolPatchResponse(mp *clustersmgmtv1.MachinePool, err *ocmErrors.ServiceError)

SetMachinePoolPatchResponse set a mock response for Patch /api/clusters_mgmt/v1/clusters/{id}/machine_pools/{machinePoolId}

func (*MockConfigurableServerBuilder) SetMachinePoolPostResponse

func (b *MockConfigurableServerBuilder) SetMachinePoolPostResponse(mp *clustersmgmtv1.MachinePool, err *ocmErrors.ServiceError)

SetMachinePoolPostResponse set a mock response for Post /api/clusters_mgmt/v1/clusters/{id}/machine_pools

func (*MockConfigurableServerBuilder) SetMachinePoolsGetResponse

func (b *MockConfigurableServerBuilder) SetMachinePoolsGetResponse(mp *clustersmgmtv1.MachinePoolList, err *ocmErrors.ServiceError)

SetMachinePoolsGetResponse set a mock response machine pool or error for Get /api/clusters_mgmt/v1/clusters/{id}/machine_pools

func (*MockConfigurableServerBuilder) SetOrganizationsGetResponse

func (b *MockConfigurableServerBuilder) SetOrganizationsGetResponse(list *amsv1.OrganizationList, err *ocmErrors.ServiceError)

SetOrganizationsGetResponse set a mock response for GET /api/accounts_mgmt/v1/organizations

func (*MockConfigurableServerBuilder) SetSubscriptionPathDeleteResponse

func (b *MockConfigurableServerBuilder) SetSubscriptionPathDeleteResponse(idp *amsv1.Subscription, err *ocmErrors.ServiceError)

func (*MockConfigurableServerBuilder) SetSubscriptionSearchResponse

func (b *MockConfigurableServerBuilder) SetSubscriptionSearchResponse(sl *amsv1.SubscriptionList, err *ocmErrors.ServiceError)

func (*MockConfigurableServerBuilder) SetTermsReviewPostResponse

func (*MockConfigurableServerBuilder) SwapRouterResponse

func (b *MockConfigurableServerBuilder) SwapRouterResponse(path string, method string, successType interface{}, serviceErr *ocmErrors.ServiceError)

SwapRouterResponse and update the router to handle this response

type MockServerOption

type MockServerOption func(mock *redhatSSOMock)

func WithServiceAccountLimit

func WithServiceAccountLimit(limit int) MockServerOption

type RedhatSSOMock

type RedhatSSOMock interface {
	Start()
	Stop()
	BaseURL() string
	GenerateNewAuthToken() string
	SetBearerToken(token string) string
	DeleteAllServiceAccounts()
	ServiceAccountsLimit() int
}

func NewMockServer

func NewMockServer(options ...MockServerOption) RedhatSSOMock

Jump to

Keyboard shortcuts

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