threescale

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 35 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewThreeScaleClient

func NewThreeScaleClient(httpc *http.Client, wildCardDomain string) *threeScaleClient

Types

type AuthProvider

type AuthProvider struct {
	ProviderDetails AuthProviderDetails `json:"authentication_provider"`
}

type AuthProviderDetails

type AuthProviderDetails struct {
	Id                             int    `json:"id"`
	Kind                           string `json:"kind"`
	AccountType                    string `json:"account_type"`
	Name                           string `json:"name"`
	SystemName                     string `json:"system_name"`
	ClientId                       string `json:"client_id"`
	ClientSecret                   string `json:"client_secret"`
	Site                           string `json:"site"`
	AuthorizeURL                   string `json:"authorize_url"`
	SkipSSLCertificateVerification bool   `json:"skip_ssl_certificate_verification"`
	AutomaticallyApproveAccounts   bool   `json:"automatically_approve_accounts"`
	AccountId                      int    `json:"account_id"`
	UsernameKey                    string `json:"username_key"`
	IdentifierKey                  string `json:"identifier_key"`
	TrustEmail                     bool   `json:"trust_email"`
	Published                      bool   `json:"published"`
	CreatedAt                      string `json:"created_at"`
	UpdatedAt                      string `json:"updated_at"`
	CallbackUrl                    string `json:"callback_url"`
}

type AuthProviders

type AuthProviders struct {
	AuthProviders []*AuthProvider `json:"authentication_providers"`
}

type Reconciler

type Reconciler struct {
	ConfigManager config.ConfigReadWriter
	Config        *config.ThreeScale

	*resources.Reconciler
	// contains filtered or unexported fields
}

func (*Reconciler) GetAdminNameAndPassFromSecret

func (r *Reconciler) GetAdminNameAndPassFromSecret(ctx context.Context, serverClient k8sclient.Client) (*string, *string, error)

func (*Reconciler) GetAdminToken

func (r *Reconciler) GetAdminToken(ctx context.Context, serverClient k8sclient.Client) (*string, error)

func (*Reconciler) GetPreflightObject

func (r *Reconciler) GetPreflightObject(ns string) runtime.Object

func (*Reconciler) Reconcile

func (*Reconciler) RolloutDeployment

func (r *Reconciler) RolloutDeployment(name string) error

func (*Reconciler) SetAdminDetailsOnSecret

func (r *Reconciler) SetAdminDetailsOnSecret(ctx context.Context, serverClient k8sclient.Client, username string, email string) error

type ThreeScaleInterface

type ThreeScaleInterface interface {
	SetNamespace(ns string)
	AddAuthenticationProvider(data map[string]string, accessToken string) (*http.Response, error)
	GetAuthenticationProviders(accessToken string) (*AuthProviders, error)
	GetAuthenticationProviderByName(name string, accessToken string) (*AuthProvider, error)
	GetUser(username, accessToken string) (*User, error)
	GetUsers(accessToken string) (*Users, error)
	AddUser(username string, email string, password string, accessToken string) (*http.Response, error)
	DeleteUser(userID int, accessToken string) (*http.Response, error)
	SetUserAsAdmin(userID int, accessToken string) (*http.Response, error)
	SetUserAsMember(userID int, accessToken string) (*http.Response, error)
	UpdateUser(userID int, username string, email string, accessToken string) (*http.Response, error)
}

type ThreeScaleInterfaceMock

type ThreeScaleInterfaceMock struct {
	// AddAuthenticationProviderFunc mocks the AddAuthenticationProvider method.
	AddAuthenticationProviderFunc func(data map[string]string, accessToken string) (*http.Response, error)

	// AddUserFunc mocks the AddUser method.
	AddUserFunc func(username string, email string, password string, accessToken string) (*http.Response, error)

	// DeleteUserFunc mocks the DeleteUser method.
	DeleteUserFunc func(userID int, accessToken string) (*http.Response, error)

	// GetAuthenticationProviderByNameFunc mocks the GetAuthenticationProviderByName method.
	GetAuthenticationProviderByNameFunc func(name string, accessToken string) (*AuthProvider, error)

	// GetAuthenticationProvidersFunc mocks the GetAuthenticationProviders method.
	GetAuthenticationProvidersFunc func(accessToken string) (*AuthProviders, error)

	// GetUserFunc mocks the GetUser method.
	GetUserFunc func(username string, accessToken string) (*User, error)

	// GetUsersFunc mocks the GetUsers method.
	GetUsersFunc func(accessToken string) (*Users, error)

	// SetNamespaceFunc mocks the SetNamespace method.
	SetNamespaceFunc func(ns string)

	// SetUserAsAdminFunc mocks the SetUserAsAdmin method.
	SetUserAsAdminFunc func(userID int, accessToken string) (*http.Response, error)

	// SetUserAsMemberFunc mocks the SetUserAsMember method.
	SetUserAsMemberFunc func(userID int, accessToken string) (*http.Response, error)

	// UpdateUserFunc mocks the UpdateUser method.
	UpdateUserFunc func(userID int, username string, email string, accessToken string) (*http.Response, error)
	// contains filtered or unexported fields
}

ThreeScaleInterfaceMock is a mock implementation of ThreeScaleInterface.

    func TestSomethingThatUsesThreeScaleInterface(t *testing.T) {

        // make and configure a mocked ThreeScaleInterface
        mockedThreeScaleInterface := &ThreeScaleInterfaceMock{
            AddAuthenticationProviderFunc: func(data map[string]string, accessToken string) (*http.Response, error) {
	               panic("mock out the AddAuthenticationProvider method")
            },
            AddUserFunc: func(username string, email string, password string, accessToken string) (*http.Response, error) {
	               panic("mock out the AddUser method")
            },
            DeleteUserFunc: func(userID int, accessToken string) (*http.Response, error) {
	               panic("mock out the DeleteUser method")
            },
            GetAuthenticationProviderByNameFunc: func(name string, accessToken string) (*AuthProvider, error) {
	               panic("mock out the GetAuthenticationProviderByName method")
            },
            GetAuthenticationProvidersFunc: func(accessToken string) (*AuthProviders, error) {
	               panic("mock out the GetAuthenticationProviders method")
            },
            GetUserFunc: func(username string, accessToken string) (*User, error) {
	               panic("mock out the GetUser method")
            },
            GetUsersFunc: func(accessToken string) (*Users, error) {
	               panic("mock out the GetUsers method")
            },
            SetNamespaceFunc: func(ns string)  {
	               panic("mock out the SetNamespace method")
            },
            SetUserAsAdminFunc: func(userID int, accessToken string) (*http.Response, error) {
	               panic("mock out the SetUserAsAdmin method")
            },
            SetUserAsMemberFunc: func(userID int, accessToken string) (*http.Response, error) {
	               panic("mock out the SetUserAsMember method")
            },
            UpdateUserFunc: func(userID int, username string, email string, accessToken string) (*http.Response, error) {
	               panic("mock out the UpdateUser method")
            },
        }

        // use mockedThreeScaleInterface in code that requires ThreeScaleInterface
        // and then make assertions.

    }

func (*ThreeScaleInterfaceMock) AddAuthenticationProvider

func (mock *ThreeScaleInterfaceMock) AddAuthenticationProvider(data map[string]string, accessToken string) (*http.Response, error)

AddAuthenticationProvider calls AddAuthenticationProviderFunc.

func (*ThreeScaleInterfaceMock) AddAuthenticationProviderCalls

func (mock *ThreeScaleInterfaceMock) AddAuthenticationProviderCalls() []struct {
	Data        map[string]string
	AccessToken string
}

AddAuthenticationProviderCalls gets all the calls that were made to AddAuthenticationProvider. Check the length with:

len(mockedThreeScaleInterface.AddAuthenticationProviderCalls())

func (*ThreeScaleInterfaceMock) AddUser

func (mock *ThreeScaleInterfaceMock) AddUser(username string, email string, password string, accessToken string) (*http.Response, error)

AddUser calls AddUserFunc.

func (*ThreeScaleInterfaceMock) AddUserCalls

func (mock *ThreeScaleInterfaceMock) AddUserCalls() []struct {
	Username    string
	Email       string
	Password    string
	AccessToken string
}

AddUserCalls gets all the calls that were made to AddUser. Check the length with:

len(mockedThreeScaleInterface.AddUserCalls())

func (*ThreeScaleInterfaceMock) DeleteUser

func (mock *ThreeScaleInterfaceMock) DeleteUser(userID int, accessToken string) (*http.Response, error)

DeleteUser calls DeleteUserFunc.

func (*ThreeScaleInterfaceMock) DeleteUserCalls

func (mock *ThreeScaleInterfaceMock) DeleteUserCalls() []struct {
	UserID      int
	AccessToken string
}

DeleteUserCalls gets all the calls that were made to DeleteUser. Check the length with:

len(mockedThreeScaleInterface.DeleteUserCalls())

func (*ThreeScaleInterfaceMock) GetAuthenticationProviderByName

func (mock *ThreeScaleInterfaceMock) GetAuthenticationProviderByName(name string, accessToken string) (*AuthProvider, error)

GetAuthenticationProviderByName calls GetAuthenticationProviderByNameFunc.

func (*ThreeScaleInterfaceMock) GetAuthenticationProviderByNameCalls

func (mock *ThreeScaleInterfaceMock) GetAuthenticationProviderByNameCalls() []struct {
	Name        string
	AccessToken string
}

GetAuthenticationProviderByNameCalls gets all the calls that were made to GetAuthenticationProviderByName. Check the length with:

len(mockedThreeScaleInterface.GetAuthenticationProviderByNameCalls())

func (*ThreeScaleInterfaceMock) GetAuthenticationProviders

func (mock *ThreeScaleInterfaceMock) GetAuthenticationProviders(accessToken string) (*AuthProviders, error)

GetAuthenticationProviders calls GetAuthenticationProvidersFunc.

func (*ThreeScaleInterfaceMock) GetAuthenticationProvidersCalls

func (mock *ThreeScaleInterfaceMock) GetAuthenticationProvidersCalls() []struct {
	AccessToken string
}

GetAuthenticationProvidersCalls gets all the calls that were made to GetAuthenticationProviders. Check the length with:

len(mockedThreeScaleInterface.GetAuthenticationProvidersCalls())

func (*ThreeScaleInterfaceMock) GetUser

func (mock *ThreeScaleInterfaceMock) GetUser(username string, accessToken string) (*User, error)

GetUser calls GetUserFunc.

func (*ThreeScaleInterfaceMock) GetUserCalls

func (mock *ThreeScaleInterfaceMock) GetUserCalls() []struct {
	Username    string
	AccessToken string
}

GetUserCalls gets all the calls that were made to GetUser. Check the length with:

len(mockedThreeScaleInterface.GetUserCalls())

func (*ThreeScaleInterfaceMock) GetUsers

func (mock *ThreeScaleInterfaceMock) GetUsers(accessToken string) (*Users, error)

GetUsers calls GetUsersFunc.

func (*ThreeScaleInterfaceMock) GetUsersCalls

func (mock *ThreeScaleInterfaceMock) GetUsersCalls() []struct {
	AccessToken string
}

GetUsersCalls gets all the calls that were made to GetUsers. Check the length with:

len(mockedThreeScaleInterface.GetUsersCalls())

func (*ThreeScaleInterfaceMock) SetNamespace

func (mock *ThreeScaleInterfaceMock) SetNamespace(ns string)

SetNamespace calls SetNamespaceFunc.

func (*ThreeScaleInterfaceMock) SetNamespaceCalls

func (mock *ThreeScaleInterfaceMock) SetNamespaceCalls() []struct {
	Ns string
}

SetNamespaceCalls gets all the calls that were made to SetNamespace. Check the length with:

len(mockedThreeScaleInterface.SetNamespaceCalls())

func (*ThreeScaleInterfaceMock) SetUserAsAdmin

func (mock *ThreeScaleInterfaceMock) SetUserAsAdmin(userID int, accessToken string) (*http.Response, error)

SetUserAsAdmin calls SetUserAsAdminFunc.

func (*ThreeScaleInterfaceMock) SetUserAsAdminCalls

func (mock *ThreeScaleInterfaceMock) SetUserAsAdminCalls() []struct {
	UserID      int
	AccessToken string
}

SetUserAsAdminCalls gets all the calls that were made to SetUserAsAdmin. Check the length with:

len(mockedThreeScaleInterface.SetUserAsAdminCalls())

func (*ThreeScaleInterfaceMock) SetUserAsMember

func (mock *ThreeScaleInterfaceMock) SetUserAsMember(userID int, accessToken string) (*http.Response, error)

SetUserAsMember calls SetUserAsMemberFunc.

func (*ThreeScaleInterfaceMock) SetUserAsMemberCalls

func (mock *ThreeScaleInterfaceMock) SetUserAsMemberCalls() []struct {
	UserID      int
	AccessToken string
}

SetUserAsMemberCalls gets all the calls that were made to SetUserAsMember. Check the length with:

len(mockedThreeScaleInterface.SetUserAsMemberCalls())

func (*ThreeScaleInterfaceMock) UpdateUser

func (mock *ThreeScaleInterfaceMock) UpdateUser(userID int, username string, email string, accessToken string) (*http.Response, error)

UpdateUser calls UpdateUserFunc.

func (*ThreeScaleInterfaceMock) UpdateUserCalls

func (mock *ThreeScaleInterfaceMock) UpdateUserCalls() []struct {
	UserID      int
	Username    string
	Email       string
	AccessToken string
}

UpdateUserCalls gets all the calls that were made to UpdateUser. Check the length with:

len(mockedThreeScaleInterface.UpdateUserCalls())

type User

type User struct {
	UserDetails UserDetails `json:"user"`
}

type UserDetails

type UserDetails struct {
	Id       int    `json:"id"`
	State    string `json:"state"`
	Role     string `json:"role"`
	Username string `json:"username"`
	Email    string `json:"email"`
}

type Users

type Users struct {
	Users []*User `json:"users"`
}

Jump to

Keyboard shortcuts

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