requestgen

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRequestObject added in v1.0.5

func GenerateRequestObject(forProvider v1alpha2.RequestParameters, response v1alpha2.Response) map[string]interface{}

GenerateRequestObject creates a JSON-compatible map from the specified Request's ForProvider and Response fields. It merges the two maps, converts JSON strings to nested maps, and returns the resulting map.

func IsRequestValid

func IsRequestValid(requestDetails RequestDetails) bool

IsRequestValid checks if the request details are valid.

Types

type RequestDetails

type RequestDetails struct {
	Url     string
	Body    httpClient.Data
	Headers httpClient.Data
}

func GenerateRequestDetails

func GenerateRequestDetails(ctx context.Context, localKube client.Client, methodMapping v1alpha2.Mapping, forProvider v1alpha2.RequestParameters, response v1alpha2.Response, logger logging.Logger) (RequestDetails, error, bool)

GenerateRequestDetails generates request details.

func GenerateValidRequestDetails added in v1.0.6

func GenerateValidRequestDetails(ctx context.Context, cr *v1alpha2.Request, mapping *v1alpha2.Mapping, localKube client.Client, logger logging.Logger) (RequestDetails, error)

GenerateValidRequestDetails generates valid request details based on the given Request resource and Mapping configuration. It first attempts to generate request details using the HTTP response stored in the Request's status. If the generated details are valid, the function returns them. If not, it falls back to using the cached response in the Request's status and attempts to generate request details again. The function returns the generated request details or an error if the generation process fails.

Jump to

Keyboard shortcuts

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