destinationsvc

package
v0.0.0-...-be3a137 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CertChain = "e2e-test-destination-cert-mock-cert-chain"
)

Variables

View Source
var (
	UniqueEntityNameIdentifier = "name_%s_subacc_%s_instance_%s"
	NameIdentifier             = "name_%s"
)
View Source
var FindAPIBasicDestResponseTemplate = `` /* 525-byte string literal not displayed */
View Source
var FindAPIClientCertDestResponseTemplate = `` /* 353-byte string literal not displayed */
View Source
var FindAPINoAuthDestResponseTemplate = `` /* 239-byte string literal not displayed */
View Source
var FindAPIOAuth2ClientCredsDestResponseTemplate = `` /* 556-byte string literal not displayed */
View Source
var FindAPIOAuth2mTLSDestResponseTemplate = `` /* 723-byte string literal not displayed */
View Source
var FindAPISAMLAssertionDestResponseTemplate = `` /* 557-byte string literal not displayed */

Functions

func GetDestinationPrefixNameIdentifier

func GetDestinationPrefixNameIdentifier(name string) string

Types

type BaseDestinationRequestBody

type BaseDestinationRequestBody struct {
	Name               string                          `json:"name"`
	URL                string                          `json:"url"`
	Type               destinationcreatorpkg.Type      `json:"type"`
	ProxyType          destinationcreatorpkg.ProxyType `json:"proxyType"`
	AuthenticationType destinationcreatorpkg.AuthType  `json:"authenticationType"`
	XCorrelationID     string                          `json:"x-correlation-id"` // old format
	CorrelationIds     string                          `json:"correlationIds"`   // new format
	XSystemTenantID    string                          `json:"x-system-id"`      // local tenant id
	XSystemTenantName  string                          `json:"x-system-name"`    // random or application name
	XSystemType        string                          `json:"x-system-type"`    // application type
}

BaseDestinationRequestBody contains the base fields needed in the destination request body

func (*BaseDestinationRequestBody) GetDestinationUniqueIdentifier

func (b *BaseDestinationRequestBody) GetDestinationUniqueIdentifier(subaccountID, instanceID string) string

type BasicDestRequestBody

type BasicDestRequestBody struct {
	BaseDestinationRequestBody
	User     string `json:"user"`
	Password string `json:"password"`
}

BasicDestRequestBody contains the necessary fields for the destination request body with authentication type AuthTypeBasic

func (*BasicDestRequestBody) GetDestinationType

func (b *BasicDestRequestBody) GetDestinationType() string

func (*BasicDestRequestBody) ToDestination

func (*BasicDestRequestBody) Validate

func (b *BasicDestRequestBody) Validate() error

Validate validates that the AuthTypeBasic request body contains the required fields, and they are valid

type CertificateAPIConfig

type CertificateAPIConfig struct {
	SubaccountLevelPath  string `envconfig:"APP_DESTINATION_CREATOR_CERTIFICATE_PATH"`
	InstanceLevelPath    string `envconfig:"APP_DESTINATION_CREATOR_CERTIFICATE_INSTANCE_LEVEL_PATH"`
	RegionParam          string `envconfig:"APP_DESTINATION_CREATOR_CERTIFICATE_REGION_PARAMETER"`
	InstanceIDParam      string `envconfig:"APP_DESTINATION_CREATOR_CERTIFICATE_INSTANCE_ID_PARAMETER"`
	SubaccountIDParam    string `envconfig:"APP_DESTINATION_CREATOR_CERTIFICATE_SUBACCOUNT_ID_PARAMETER"`
	CertificateNameParam string `envconfig:"APP_DESTINATION_CREATOR_CERTIFICATE_NAME_PARAMETER"`
}

CertificateAPIConfig holds a test configuration specific for the certificate API of the destination creator service

type CertificateRequestBody

type CertificateRequestBody struct {
	FileName string `json:"fileName"`
}

CertificateRequestBody contains the necessary fields for the destination creator certificate request body

func (*CertificateRequestBody) Validate

func (c *CertificateRequestBody) Validate() error

Validate validates that the SAML assertion certificate request body contains the required fields, and they are valid

type CertificateResponseBody

type CertificateResponseBody struct {
	FileName         string `json:"fileName"`
	CommonName       string `json:"commonName"`
	CertificateChain string `json:"certificateChain"`
}

CertificateResponseBody contains the response data from the destination creator certificate request

type ClientCertificateAuthDestRequestBody

type ClientCertificateAuthDestRequestBody struct {
	BaseDestinationRequestBody
	KeyStoreLocation string `json:"keyStoreLocation"`
}

ClientCertificateAuthDestRequestBody contains the necessary fields for the destination request body with authentication type AuthTypeClientCertificate

func (*ClientCertificateAuthDestRequestBody) GetDestinationType

func (s *ClientCertificateAuthDestRequestBody) GetDestinationType() string

func (*ClientCertificateAuthDestRequestBody) ToDestination

func (*ClientCertificateAuthDestRequestBody) Validate

Validate validates that the AuthTypeClientCertificate request body contains the required fields, and they are valid

type Config

type Config struct {
	CorrelationIDsKey string `envconfig:"APP_DESTINATION_CREATOR_CORRELATION_IDS_KEY"`
	*DestinationAPIConfig
	*CertificateAPIConfig
}

Config holds destination creator service API test configuration

type DeleteResponse

type DeleteResponse struct {
	Count   int
	Summary []DeleteStatus
}

type DeleteStatus

type DeleteStatus struct {
	Name   string `json:"name"`
	Status string `json:"status"`
	Reason string `json:"reason,omitempty"`
}

type DesignTimeDestRequestBody

type DesignTimeDestRequestBody struct {
	BaseDestinationRequestBody
}

DesignTimeDestRequestBody contains the necessary fields for the destination request body with authentication type AuthTypeNoAuth

func (*DesignTimeDestRequestBody) GetDestinationType

func (n *DesignTimeDestRequestBody) GetDestinationType() string

func (*DesignTimeDestRequestBody) ToDestination

func (*DesignTimeDestRequestBody) Validate

func (n *DesignTimeDestRequestBody) Validate() error

Validate validates that the AuthTypeNoAuth request body contains the required fields, and they are valid

type DestinationAPIConfig

type DestinationAPIConfig struct {
	SubaccountLevelPath  string `envconfig:"APP_DESTINATION_CREATOR_DESTINATION_PATH"`
	InstanceLevelPath    string `envconfig:"APP_DESTINATION_CREATOR_DESTINATION_INSTANCE_LEVEL_PATH"`
	RegionParam          string `envconfig:"APP_DESTINATION_CREATOR_DESTINATION_REGION_PARAMETER"`
	InstanceIDParam      string `envconfig:"APP_DESTINATION_CREATOR_DESTINATION_INSTANCE_ID_PARAMETER"`
	SubaccountIDParam    string `envconfig:"APP_DESTINATION_CREATOR_DESTINATION_SUBACCOUNT_ID_PARAMETER"`
	DestinationNameParam string `envconfig:"APP_DESTINATION_CREATOR_DESTINATION_NAME_PARAMETER"`
}

DestinationAPIConfig holds a test configuration specific for the destination API of the destination creator service

type DestinationRequestBody

type DestinationRequestBody interface {
	ToDestination() destinationcreator.Destination
	Validate() error
	GetDestinationType() string
	GetDestinationUniqueIdentifier(subaccountID, instanceID string) string
}

type Handler

type Handler struct {
	Config                     *Config
	DestinationSvcDestinations map[string]destinationcreator.Destination
	DestinationSvcCertificates map[string]json.RawMessage
	DestinationsSensitive      map[string][]byte
}

Handler is responsible to mock and handle any Destination Service requests

func NewHandler

func NewHandler(config *Config) *Handler

NewHandler creates a new Handler

func (*Handler) CleanupDestinationCertificates

func (h *Handler) CleanupDestinationCertificates(writer http.ResponseWriter, r *http.Request)

CleanupDestinationCertificates is "internal/technical" handler for deleting in-memory certificates mappings

func (*Handler) CleanupDestinations

func (h *Handler) CleanupDestinations(writer http.ResponseWriter, r *http.Request)

CleanupDestinations is "internal/technical" handler for deleting in-memory destinations mappings

func (*Handler) CreateCertificate

func (h *Handler) CreateCertificate(writer http.ResponseWriter, r *http.Request)

CreateCertificate mocks creation of certificate in both Destination Creator Service and Destination Service using the APIs in the Destination Creator component

func (*Handler) CreateDestinations

func (h *Handler) CreateDestinations(writer http.ResponseWriter, r *http.Request)

CreateDestinations mocks creation of all types of destinations in both Destination Creator Service and Destination Service using the APIs in the Destination Creator component

func (*Handler) DeleteCertificate

func (h *Handler) DeleteCertificate(writer http.ResponseWriter, r *http.Request)

DeleteCertificate mocks deletion of certificate from both Destination Creator Service and Destination Service using the APIs in the Destination Creator component

func (*Handler) DeleteDestination

func (h *Handler) DeleteDestination(writer http.ResponseWriter, req *http.Request)

DeleteDestination is an "internal/technical" handler for deleting Destinations from E2E tests

func (*Handler) DeleteDestinations

func (h *Handler) DeleteDestinations(writer http.ResponseWriter, r *http.Request)

DeleteDestinations mocks deletion of destinations from both Destination Creator Service and Destination Service using the APIs in the Destination Creator component

func (*Handler) FindDestinationByNameFromDestinationSvc

func (h *Handler) FindDestinationByNameFromDestinationSvc(writer http.ResponseWriter, r *http.Request)

FindDestinationByNameFromDestinationSvc finds a destination by name

func (*Handler) GetDestinationCertificateByNameFromDestinationSvc

func (h *Handler) GetDestinationCertificateByNameFromDestinationSvc(writer http.ResponseWriter, r *http.Request)

GetDestinationCertificateByNameFromDestinationSvc mocks getting a single certificate by its name from Destination Service

func (*Handler) GetSensitiveData

func (h *Handler) GetSensitiveData(writer http.ResponseWriter, req *http.Request)

GetSensitiveData mocks getting a sensitive data by destination name from Destination Service

func (*Handler) GetSubaccountDestinationsPage

func (h *Handler) GetSubaccountDestinationsPage(writer http.ResponseWriter, req *http.Request)

GetSubaccountDestinationsPage gets a page of destinations

func (*Handler) PostDestination

func (h *Handler) PostDestination(writer http.ResponseWriter, req *http.Request)

PostDestination is an "internal/technical" handler for creating Destinations from E2E tests

type OAuth2ClientCredsDestRequestBody

type OAuth2ClientCredsDestRequestBody struct {
	BaseDestinationRequestBody
	TokenServiceURL     string `json:"tokenServiceURL"`
	TokenServiceURLType string `json:"tokenServiceURLType"`
	ClientID            string `json:"clientId"`
	KeyStoreLocation    string `json:"tokenServiceKeystoreLocation"`
	ClientSecret        string `json:"clientSecret"`
}

OAuth2ClientCredsDestRequestBody contains the necessary fields for the destination request body with authentication type OAuth2ClientCredentials

func (*OAuth2ClientCredsDestRequestBody) GetDestinationType

func (b *OAuth2ClientCredsDestRequestBody) GetDestinationType() string

func (*OAuth2ClientCredsDestRequestBody) ToDestination

func (*OAuth2ClientCredsDestRequestBody) Validate

Validate validates that the AuthTypeBasic request body contains the required fields, and they are valid

type PostResponse

type PostResponse struct {
	Name   string `json:"name"`
	Status int    `json:"status"`
	Cause  string `json:"cause,omitempty"`
}

type SAMLAssertionDestRequestBody

type SAMLAssertionDestRequestBody struct {
	BaseDestinationRequestBody
	Audience         string `json:"audience"`
	KeyStoreLocation string `json:"keyStoreLocation"`
}

SAMLAssertionDestRequestBody contains the necessary fields for the destination request body with authentication type AuthTypeSAMLAssertion

func (*SAMLAssertionDestRequestBody) GetDestinationType

func (s *SAMLAssertionDestRequestBody) GetDestinationType() string

func (*SAMLAssertionDestRequestBody) ToDestination

func (*SAMLAssertionDestRequestBody) Validate

func (s *SAMLAssertionDestRequestBody) Validate() error

Validate validates that the AuthTypeSAMLAssertion request body contains the required fields, and they are valid

Jump to

Keyboard shortcuts

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