Documentation ¶
Index ¶
- Variables
- type AsyncFAResponseFn
- type Configuration
- type FormationAssignmentRequestBody
- type FormationAssignmentResponseBody
- type FormationAssignmentResponseBodyWithState
- type FormationAssignmentResponseConfig
- type FormationAssignmentState
- type FormationRequestBody
- type FormationResponseFn
- type FormationState
- type Handler
- func (h *Handler) Async(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncDelete(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncDeleteFormation(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncDestinationDelete(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncDestinationPatch(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncFail(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncFailNoError(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncFailOnce(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncFormationFailOnce(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncNoConfig(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncNoConfigWithCreateReady(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncNoConfigWithDeleteReady(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncNoResponse(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncNoResponseAssign(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncNoResponseUnassign(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncOld(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) AsyncPostFormation(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) Cleanup(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) Delete(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteFormation(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteWithDeleteReadyState(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteWithState(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) DestinationDelete(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) FailOnceFormation(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) FailOnceResponse(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) FailResponse(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) GetResponses(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) KymaBasicCredentials(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) KymaEmptyCredentials(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) KymaOauthCredentials(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) Patch(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) PatchWithCreateReadyState(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) PatchWithState(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) PostFormation(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) RedirectNotificationHandler(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) ResetShouldFail(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) RespondWithIncomplete(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) RespondWithIncompleteAndDestinationDetails(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) RespondWithIncompleteAndRedirectDetails(writer http.ResponseWriter, r *http.Request)
- func (h *Handler) RespondWithNoConfig(writer http.ResponseWriter, r *http.Request)
- type KymaMappingsBasicAuthentication
- type KymaMappingsConfiguration
- type KymaMappingsCredentials
- type KymaMappingsOauthAuthentication
- type KymaMappingsOutboundCommunication
- type KymaMappingsResponseBody
- type Operation
- type ProviderDestinationConfig
- type Response
- type SyncFAResponseFn
Constants ¶
This section is empty.
Variables ¶
var ( TenantIDParam = "tenantId" ApplicationIDParam = "applicationId" )
var AsyncNoopFAResponseFn = func(client *http.Client, correlationID, traceID, spanID, parentSpanID, formationID, formationAssignmentID, config string) {
}
AsyncNoopFAResponseFn is an empty implementation of the AsyncFAResponseFn function
var NoopFormationResponseFn = func(client *http.Client, correlationID, traceID, spanID, parentSpanID, formationError, formationID string) {
}
NoopFormationResponseFn is an empty implementation of the FormationResponseFn function
Functions ¶
This section is empty.
Types ¶
type AsyncFAResponseFn ¶
type AsyncFAResponseFn func(client *http.Client, correlationID, traceID, spanID, parentSpanID, formationID, formationAssignmentID, config string)
AsyncFAResponseFn is a function type that represents the formation assignment response function signature
type Configuration ¶
type Configuration struct { ExternalClientCertTestSecretName string `envconfig:"EXTERNAL_CLIENT_CERT_TEST_SECRET_NAME"` ExternalClientCertTestSecretNamespace string `envconfig:"EXTERNAL_CLIENT_CERT_TEST_SECRET_NAMESPACE"` ExternalClientCertCertKey string `envconfig:"APP_EXTERNAL_CLIENT_CERT_KEY"` ExternalClientCertKeyKey string `envconfig:"APP_EXTERNAL_CLIENT_KEY_KEY"` DirectorExternalCertFAAsyncStatusURL string `envconfig:"APP_DIRECTOR_EXTERNAL_CERT_FORMATION_ASSIGNMENT_ASYNC_STATUS_URL"` DirectorExternalCertFormationAsyncStatusURL string `envconfig:"APP_DIRECTOR_EXTERNAL_CERT_FORMATION_ASYNC_STATUS_URL"` TenantMappingAsyncResponseDelay int64 `envconfig:"APP_TENANT_MAPPING_ASYNC_RESPONSE_DELAY"` TestDestinationInstanceID string `envconfig:"APP_TEST_DESTINATION_INSTANCE_ID"` TestProviderSubaccountID string `envconfig:"APP_TEST_PROVIDER_SUBACCOUNT_ID"` }
type FormationAssignmentRequestBody ¶
type FormationAssignmentRequestBody struct { State FormationAssignmentState `json:"state,omitempty"` Configuration json.RawMessage `json:"configuration,omitempty"` Error string `json:"error,omitempty"` }
FormationAssignmentRequestBody contains the request input of the formation assignment async status request
type FormationAssignmentResponseBody ¶
type FormationAssignmentResponseBody struct { Config *FormationAssignmentResponseConfig `json:"config,omitempty"` Error string `json:"error,omitempty"` }
FormationAssignmentResponseBody contains the synchronous formation assignment notification response body
type FormationAssignmentResponseBodyWithState ¶
type FormationAssignmentResponseBodyWithState struct { Config *FormationAssignmentResponseConfig `json:"config,omitempty"` Error string `json:"error,omitempty"` State FormationAssignmentState `json:"state"` }
FormationAssignmentResponseBodyWithState contains the synchronous formation assignment notification response body with state in it
type FormationAssignmentResponseConfig ¶
type FormationAssignmentResponseConfig struct { Key string `json:"key"` Key2 struct { Key string `json:"key"` } `json:"key2"` }
FormationAssignmentResponseConfig contains the configuration of the formation response body
type FormationAssignmentState ¶
type FormationAssignmentState string
FormationAssignmentState is a type that represents formation assignments state
const ConfigPendingAssignmentState FormationAssignmentState = "CONFIG_PENDING"
ConfigPendingAssignmentState indicates that the config is either missing or not finalized in the formation assignment
const CreateErrorAssignmentState FormationAssignmentState = "CREATE_ERROR"
CreateErrorAssignmentState indicates that an error occurred during the creation of the formation assignment
const CreateReadyAssignmentState FormationAssignmentState = "CREATE_READY"
CreateReadyAssignmentState indicates that the formation assignment is in a ready state
const DeleteErrorAssignmentState FormationAssignmentState = "DELETE_ERROR"
DeleteErrorAssignmentState indicates that an error occurred during the deletion of the formation assignment
const DeleteReadyAssignmentState FormationAssignmentState = "DELETE_READY"
DeleteReadyAssignmentState indicates that the formation assignment is in a ready state
const InitialAssignmentState FormationAssignmentState = "INITIAL"
InitialAssignmentState indicates that nothing has been done with the formation assignment
const ReadyAssignmentState FormationAssignmentState = "READY"
ReadyAssignmentState indicates that the formation assignment is in a ready state
type FormationRequestBody ¶
type FormationRequestBody struct { State FormationState `json:"state"` Error string `json:"error,omitempty"` }
FormationRequestBody contains the request input of the formation async status request
type FormationResponseFn ¶
type FormationResponseFn func(client *http.Client, correlationID, traceID, spanID, parentSpanID, formationError, formationID string)
FormationResponseFn is a function type that represents the formation response function signature
type FormationState ¶
type FormationState string
FormationState is a type that represents formation state
const CreateErrorFormationState FormationState = "CREATE_ERROR"
CreateErrorFormationState indicates that an error occurred during the creation of the formation
const DeleteErrorFormationState FormationState = "DELETE_ERROR"
DeleteErrorFormationState indicates that an error occurred during the deletion of the formation
const ReadyFormationState FormationState = "READY"
ReadyFormationState indicates that the formation is in a ready state
type Handler ¶
type Handler struct { // Mappings is a map of string to Response, where the string value currently can be `formationID` or `tenantID` // mapped to a particular Response that later will be validated in the E2E tests Mappings map[string][]Response ShouldReturnError bool // contains filtered or unexported fields }
Handler is responsible to mock and handle any formation and formation assignment notification requests
func NewHandler ¶
func NewHandler(notificationConfiguration Configuration, providerDestinationConfig ProviderDestinationConfig, tokenServiceURL, oauth2mTLSClientID string) *Handler
NewHandler creates a new Handler
func (*Handler) Async ¶
func (h *Handler) Async(writer http.ResponseWriter, r *http.Request)
Async handles asynchronous formation assignment notification requests for Assign operation using the new receiverTenant/assignedTenant request body format
func (*Handler) AsyncDelete ¶
func (h *Handler) AsyncDelete(writer http.ResponseWriter, r *http.Request)
AsyncDelete handles asynchronous formation assignment notification requests for Unassign operation
func (*Handler) AsyncDeleteFormation ¶
func (h *Handler) AsyncDeleteFormation(writer http.ResponseWriter, r *http.Request)
AsyncDeleteFormation handles asynchronous formation notification requests for DeleteFormation operation
func (*Handler) AsyncDestinationDelete ¶
func (h *Handler) AsyncDestinationDelete(writer http.ResponseWriter, r *http.Request)
AsyncDestinationDelete handles asynchronous formation assignment notification requests for destination deletion during Unassign operation
func (*Handler) AsyncDestinationPatch ¶
func (h *Handler) AsyncDestinationPatch(writer http.ResponseWriter, r *http.Request)
AsyncDestinationPatch handles asynchronous formation assignment notification requests for destination creation during Assign operation
func (*Handler) AsyncFail ¶
func (h *Handler) AsyncFail(writer http.ResponseWriter, r *http.Request)
AsyncFail handles asynchronous formation assignment notification requests for both Assign and Unassign operations by failing and setting error states.
func (*Handler) AsyncFailNoError ¶
func (h *Handler) AsyncFailNoError(writer http.ResponseWriter, r *http.Request)
AsyncFailNoError handles asynchronous formation assignment notification requests for both Assign and Unassign operations by failing and setting error states.
func (*Handler) AsyncFailOnce ¶
func (h *Handler) AsyncFailOnce(writer http.ResponseWriter, r *http.Request)
AsyncFailOnce handles asynchronous formation assignment notification requests for both Assign and Unassign operations by first failing and setting error states. Afterwards the operation succeeds
func (*Handler) AsyncFormationFailOnce ¶
func (h *Handler) AsyncFormationFailOnce(writer http.ResponseWriter, r *http.Request)
AsyncFormationFailOnce handles asynchronous formation notification requests for both Create and Delete operations by first failing and setting error states. Afterwards the operation succeeds
func (*Handler) AsyncNoConfig ¶
func (h *Handler) AsyncNoConfig(writer http.ResponseWriter, r *http.Request)
AsyncNoConfig handles asynchronous formation assignment notification requests for Assign. Sends request without configuration in the body
func (*Handler) AsyncNoConfigWithCreateReady ¶
func (h *Handler) AsyncNoConfigWithCreateReady(writer http.ResponseWriter, r *http.Request)
AsyncNoConfigWithCreateReady handles asynchronous formation assignment notification requests for Assign. Sends request without configuration in the body
func (*Handler) AsyncNoConfigWithDeleteReady ¶
func (h *Handler) AsyncNoConfigWithDeleteReady(writer http.ResponseWriter, r *http.Request)
AsyncNoConfigWithDeleteReady handles asynchronous formation assignment notification requests for Assign. Sends request without configuration in the body
func (*Handler) AsyncNoResponse ¶
func (h *Handler) AsyncNoResponse(writer http.ResponseWriter, r *http.Request)
AsyncNoResponse handles asynchronous formation notification requests that do not send any request to the formation status API
func (*Handler) AsyncNoResponseAssign ¶
func (h *Handler) AsyncNoResponseAssign(writer http.ResponseWriter, r *http.Request)
AsyncNoResponseAssign handles asynchronous formation assignment notification requests for Assign operation that do not send any request to the formation assignment status API
func (*Handler) AsyncNoResponseUnassign ¶
func (h *Handler) AsyncNoResponseUnassign(writer http.ResponseWriter, r *http.Request)
AsyncNoResponseUnassign handles asynchronous formation assignment notification requests for Unassign operation that do not send any request to the formation assignment status API
func (*Handler) AsyncOld ¶
func (h *Handler) AsyncOld(writer http.ResponseWriter, r *http.Request)
AsyncOld handles asynchronous formation assignment notification requests for Assign operation using old request body format Should minimize/restrict the usage of this one and migrate to the new handler and request body format
func (*Handler) AsyncPostFormation ¶
func (h *Handler) AsyncPostFormation(writer http.ResponseWriter, r *http.Request)
AsyncPostFormation handles asynchronous formation notification requests for CreateFormation operation.
func (*Handler) Cleanup ¶
func (h *Handler) Cleanup(writer http.ResponseWriter, r *http.Request)
Cleanup deletes/cleanup the notification data saved in the Mappings
func (*Handler) Delete ¶
func (h *Handler) Delete(writer http.ResponseWriter, r *http.Request)
Delete handles synchronous formation assignment notification requests for Unassign operation
func (*Handler) DeleteFormation ¶
func (h *Handler) DeleteFormation(writer http.ResponseWriter, r *http.Request)
DeleteFormation handles synchronous formation notification requests for DeleteFormation operation
func (*Handler) DeleteWithDeleteReadyState ¶
func (h *Handler) DeleteWithDeleteReadyState(writer http.ResponseWriter, r *http.Request)
DeleteWithDeleteReadyState handles synchronous formation assignment notification requests for Unassign operation and returns DELETE_READY state in the response body
func (*Handler) DeleteWithState ¶
func (h *Handler) DeleteWithState(writer http.ResponseWriter, r *http.Request)
DeleteWithState handles synchronous formation assignment notification requests for Unassign operation and returns state in the response body
func (*Handler) DestinationDelete ¶
func (h *Handler) DestinationDelete(writer http.ResponseWriter, r *http.Request)
DestinationDelete handles synchronous formation assignment notification requests for destination deletion during Unassign operation
func (*Handler) FailOnceFormation ¶
func (h *Handler) FailOnceFormation(writer http.ResponseWriter, r *http.Request)
FailOnceFormation handles synchronous formation notification requests for both Create and Delete operations by first failing and setting error states. Afterwards the operation succeeds
func (*Handler) FailOnceResponse ¶
func (h *Handler) FailOnceResponse(writer http.ResponseWriter, r *http.Request)
FailOnceResponse handles synchronous formation assignment notification requests for both Assign and Unassign operations by first failing and setting error states. Afterwards the operation succeeds
func (*Handler) FailResponse ¶
func (h *Handler) FailResponse(writer http.ResponseWriter, r *http.Request)
FailResponse handles synchronous formation assignment notification requests by failing and setting error states.
func (*Handler) GetResponses ¶
func (h *Handler) GetResponses(writer http.ResponseWriter, r *http.Request)
GetResponses returns the notification data saved in the Mappings
func (*Handler) KymaBasicCredentials ¶
func (h *Handler) KymaBasicCredentials(writer http.ResponseWriter, r *http.Request)
func (*Handler) KymaEmptyCredentials ¶
func (h *Handler) KymaEmptyCredentials(writer http.ResponseWriter, r *http.Request)
func (*Handler) KymaOauthCredentials ¶
func (h *Handler) KymaOauthCredentials(writer http.ResponseWriter, r *http.Request)
func (*Handler) Patch ¶
func (h *Handler) Patch(writer http.ResponseWriter, r *http.Request)
Patch handles synchronous formation assignment notification requests for Assign operation
func (*Handler) PatchWithCreateReadyState ¶
func (h *Handler) PatchWithCreateReadyState(writer http.ResponseWriter, r *http.Request)
PatchWithCreateReadyState handles synchronous formation assignment notification requests for Assign operation and returns CREATE_READY state in the response body
func (*Handler) PatchWithState ¶
func (h *Handler) PatchWithState(writer http.ResponseWriter, r *http.Request)
PatchWithState handles synchronous formation assignment notification requests for Assign operation and returns state in the response body
func (*Handler) PostFormation ¶
func (h *Handler) PostFormation(writer http.ResponseWriter, r *http.Request)
PostFormation handles synchronous formation notification requests for CreateFormation operation
func (*Handler) RedirectNotificationHandler ¶
func (h *Handler) RedirectNotificationHandler(writer http.ResponseWriter, r *http.Request)
RedirectNotificationHandler handle the requests in case of a redirect operator is invoked and return only READY state with no configuration
func (*Handler) ResetShouldFail ¶
func (h *Handler) ResetShouldFail(writer http.ResponseWriter, r *http.Request)
ResetShouldFail toggles whether an error should be returned
func (*Handler) RespondWithIncomplete ¶
func (h *Handler) RespondWithIncomplete(writer http.ResponseWriter, r *http.Request)
RespondWithIncomplete handles synchronous formation assignment notification requests for Assign operation that based on the provided config in the request body we return either so called "incomplete" status coe(204) without config in case the config is not provided or if the config is provided we just return it with "success" status code(200)
func (*Handler) RespondWithIncompleteAndDestinationDetails ¶
func (h *Handler) RespondWithIncompleteAndDestinationDetails(writer http.ResponseWriter, r *http.Request)
RespondWithIncompleteAndDestinationDetails handles synchronous formation assignment notification requests for Assign operation that returns destination details if the config in the request body is NOT provided, and if the config is provided returns READY state without configuration
func (*Handler) RespondWithIncompleteAndRedirectDetails ¶
func (h *Handler) RespondWithIncompleteAndRedirectDetails(writer http.ResponseWriter, r *http.Request)
RespondWithIncompleteAndRedirectDetails handles synchronous formation assignment notification requests for Assign and Unassign operation that returns a random configuration later which will be used to redirect the notification based on some property of it in case of Assign request. And in case of Unassign operation, we only return ready state
func (*Handler) RespondWithNoConfig ¶
func (h *Handler) RespondWithNoConfig(writer http.ResponseWriter, r *http.Request)
RespondWithNoConfig handles synchronous formation assignment notification requests for Assign operation It always returns no configuration
type KymaMappingsBasicAuthentication ¶
type KymaMappingsBasicAuthentication struct { Username string `json:"username"` Password string `json:"password"` }
KymaMappingsBasicAuthentication contains the basic credentials used in the KymaMappingsOutboundCommunication
type KymaMappingsConfiguration ¶
type KymaMappingsConfiguration struct {
Credentials KymaMappingsCredentials `json:"credentials"`
}
KymaMappingsConfiguration contains the configuration used in KymaMappingsResponseBody
type KymaMappingsCredentials ¶
type KymaMappingsCredentials struct {
OutboundCommunication KymaMappingsOutboundCommunication `json:"outboundCommunication"`
}
KymaMappingsCredentials contains the credentials used in the KymaMappingsConfiguration
type KymaMappingsOauthAuthentication ¶
type KymaMappingsOauthAuthentication struct { TokenServiceUrl string `json:"tokenServiceUrl"` ClientId string `json:"clientId"` ClientSecret string `json:"clientSecret"` }
KymaMappingsOauthAuthentication contains the oauth credentials used in the KymaMappingsOutboundCommunication
type KymaMappingsOutboundCommunication ¶
type KymaMappingsOutboundCommunication struct { BasicAuthentication KymaMappingsBasicAuthentication `json:"basicAuthentication,omitempty"` OauthAuthentication KymaMappingsOauthAuthentication `json:"oauth2ClientCredentials,omitempty"` }
KymaMappingsOutboundCommunication contains the outbound communication used in the KymaMappingsCredentials
type KymaMappingsResponseBody ¶
type KymaMappingsResponseBody struct { State string `json:"state"` Configuration KymaMappingsConfiguration `json:"configuration"` }
KymaMappingsResponseBody contains the state and configuration for the Kyma Tenant Mapping flow
type Operation ¶
type Operation string
const ( // Assign represents the assign operation done on a given formation Assign Operation = "assign" // Unassign represents the unassign operation done on a given formation Unassign Operation = "unassign" // CreateFormation represents the create operation on a given formation CreateFormation Operation = "createFormation" // DeleteFormation represents the delete operation on a given formation DeleteFormation Operation = "deleteFormation" )
type ProviderDestinationConfig ¶
type ProviderDestinationConfig struct { ClientID string `envconfig:"APP_PROVIDER_DESTINATION_CLIENT_ID"` ClientSecret string `envconfig:"APP_PROVIDER_DESTINATION_CLIENT_SECRET"` TokenURL string `envconfig:"APP_PROVIDER_DESTINATION_TOKEN_URL"` TokenPath string `envconfig:"APP_PROVIDER_DESTINATION_TOKEN_PATH"` ServiceURL string `envconfig:"APP_PROVIDER_DESTINATION_SERVICE_URL"` Dependency string `envconfig:"APP_PROVIDER_DESTINATION_DEPENDENCY"` }
ProviderDestinationConfig holds a provider's destination service configuration
type Response ¶
type Response struct { Operation Operation ApplicationID *string RequestBody json.RawMessage RequestPath string }
Response is used to model the response for a given formation or formation assignment notification request. It has a metadata fields like Operation and also the request body of the notification request later used for validation in the E2E tests.
type SyncFAResponseFn ¶
type SyncFAResponseFn func(bodyBytes []byte)
SyncFAResponseFn is a function type that represents the synchronous formation assignment response function signature