common

package
v0.0.0-...-37aa375 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package common provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type APIFinding

type APIFinding struct {
	// AdditionalInfo Could be any opaque JSON object
	AdditionalInfo *map[string]interface{} `json:"additional_info,omitempty"`

	// Description Human readable description of the finding
	Description string `json:"description"`

	// Name Human readable name of the finding
	Name string `json:"name"`

	// ProvidedSpecLocation JSON pointer to the location of the finding in the specification. See https://datatracker.ietf.org/doc/html/rfc6901. If at the time of creation of the finding, there is no specification, then this field is an empty string.
	ProvidedSpecLocation *string `json:"provided_spec_location,omitempty"`

	// ReconstructedSpecLocation JSON pointer to the location of the finding in the specification. See https://datatracker.ietf.org/doc/html/rfc6901. If at the time of creation of the finding, there is no specification, then this field is an empty string.
	ReconstructedSpecLocation *string `json:"reconstructed_spec_location,omitempty"`

	// Severity Severity of a finding
	Severity Severity `json:"severity"`

	// Source Name of the module which created this finding
	Source string `json:"source"`

	// Type Type of the finding
	Type string `json:"type"`
}

APIFinding An API Finding

type APIFindings

type APIFindings struct {
	// Items A list of findings
	Items *[]APIFinding `json:"items,omitempty"`
}

APIFindings A group of findings

type AlertSeverityEnum

type AlertSeverityEnum string

AlertSeverityEnum defines model for AlertSeverityEnum.

const (
	ALERTCRITICAL AlertSeverityEnum = "ALERT_CRITICAL"
	ALERTINFO     AlertSeverityEnum = "ALERT_INFO"
	ALERTWARN     AlertSeverityEnum = "ALERT_WARN"
)

Defines values for AlertSeverityEnum.

type ApiCount

type ApiCount struct {
	ApiHostName *string `json:"apiHostName,omitempty"`

	// ApiInfoId hold the relevant api info id
	ApiInfoId *uint32      `json:"apiInfoId,omitempty"`
	ApiPort   *int         `json:"apiPort,omitempty"`
	ApiType   *ApiTypeEnum `json:"apiType,omitempty"`
	NumCalls  *int         `json:"numCalls,omitempty"`
}

ApiCount defines model for ApiCount.

type ApiEvent

type ApiEvent struct {
	Alerts *[]ModuleAlert `json:"alerts,omitempty"`

	// ApiInfoId hold the relevant api spec info id
	ApiInfoId                *uint32      `json:"apiInfoId,omitempty"`
	ApiType                  *ApiTypeEnum `json:"apiType,omitempty"`
	DestinationIP            *string      `json:"destinationIP,omitempty"`
	DestinationPort          *int         `json:"destinationPort,omitempty"`
	HasProvidedSpecDiff      *bool        `json:"hasProvidedSpecDiff,omitempty"`
	HasReconstructedSpecDiff *bool        `json:"hasReconstructedSpecDiff,omitempty"`
	HostSpecName             *string      `json:"hostSpecName,omitempty"`
	Id                       *uint32      `json:"id,omitempty"`
	Method                   *HttpMethod  `json:"method,omitempty"`
	Path                     *string      `json:"path,omitempty"`
	Query                    *string      `json:"query,omitempty"`
	RequestTime              *time.Time   `json:"requestTime,omitempty"`
	SourceIP                 *string      `json:"sourceIP,omitempty"`
	SpecDiffType             *DiffType    `json:"specDiffType,omitempty"`
	StatusCode               *int         `json:"statusCode,omitempty"`
	Time                     *time.Time   `json:"time,omitempty"`
}

ApiEvent defines model for ApiEvent.

type ApiEventPathAndMethods

type ApiEventPathAndMethods struct {
	Methods *[]HttpMethod `json:"methods,omitempty"`
	Path    *string       `json:"path,omitempty"`
}

ApiEventPathAndMethods defines model for ApiEventPathAndMethods.

type ApiEventSortKey

type ApiEventSortKey string

ApiEventSortKey defines model for ApiEventSortKey.

const (
	ApiType         ApiEventSortKey = "apiType"
	DestinationIP   ApiEventSortKey = "destinationIP"
	DestinationPort ApiEventSortKey = "destinationPort"
	HostSpecName    ApiEventSortKey = "hostSpecName"
	Method          ApiEventSortKey = "method"
	Path            ApiEventSortKey = "path"
	SourceIP        ApiEventSortKey = "sourceIP"
	SpecDiffType    ApiEventSortKey = "specDiffType"
	StatusCode      ApiEventSortKey = "statusCode"
	Time            ApiEventSortKey = "time"
)

Defines values for ApiEventSortKey.

type ApiEventSpecDiff

type ApiEventSpecDiff struct {
	DiffType *DiffType `json:"diffType,omitempty"`

	// NewSpec New spec json string
	NewSpec string `json:"newSpec"`

	// OldSpec Old spec json string
	OldSpec string `json:"oldSpec"`
}

ApiEventSpecDiff defines model for ApiEventSpecDiff.

type ApiFindingsNotification

type ApiFindingsNotification struct {
	// Items A list of findings
	Items            *[]APIFinding `json:"items,omitempty"`
	NotificationType string        `json:"notificationType"`
}

ApiFindingsNotification defines model for ApiFindingsNotification.

type ApiID

type ApiID = int64

ApiID defines model for ApiID.

type ApiInfo

type ApiInfo struct {
	DestinationNamespace *string `json:"destinationNamespace,omitempty"`
	HasProvidedSpec      *bool   `json:"hasProvidedSpec,omitempty"`
	HasReconstructedSpec *bool   `json:"hasReconstructedSpec,omitempty"`
	Id                   *uint32 `json:"id,omitempty"`

	// Name API name
	Name *string `json:"name,omitempty"`
	Port *int    `json:"port,omitempty"`

	// TraceSourceId Trace Source ID which created this API. Null UUID 0 means it has been created by APIClarity (from the UI for example)
	TraceSourceId *openapi_types.UUID `json:"traceSourceId,omitempty"`
}

ApiInfo defines model for ApiInfo.

type ApiInfoWithType

type ApiInfoWithType struct {
	ApiType              *ApiTypeEnum `json:"apiType,omitempty"`
	DestinationNamespace *string      `json:"destinationNamespace,omitempty"`
	HasProvidedSpec      *bool        `json:"hasProvidedSpec,omitempty"`
	HasReconstructedSpec *bool        `json:"hasReconstructedSpec,omitempty"`
	Id                   *uint32      `json:"id,omitempty"`

	// Name API name
	Name *string `json:"name,omitempty"`
	Port *int    `json:"port,omitempty"`

	// TraceSourceId Trace Source ID which created this API. Null UUID 0 means it has been created by APIClarity (from the UI for example)
	TraceSourceId *openapi_types.UUID `json:"traceSourceId,omitempty"`
}

ApiInfoWithType defines model for ApiInfoWithType.

type ApiInventorySortKey

type ApiInventorySortKey string

ApiInventorySortKey defines model for ApiInventorySortKey.

const (
	HasProvidedSpec      ApiInventorySortKey = "hasProvidedSpec"
	HasReconstructedSpec ApiInventorySortKey = "hasReconstructedSpec"
	Name                 ApiInventorySortKey = "name"
	Port                 ApiInventorySortKey = "port"
)

Defines values for ApiInventorySortKey.

type ApiResponse

type ApiResponse struct {
	Message string `json:"message"`
}

ApiResponse An object that is returned in all cases of failures

type ApiTypeEnum

type ApiTypeEnum string

ApiTypeEnum defines model for ApiTypeEnum.

const (
	EXTERNAL ApiTypeEnum = "EXTERNAL"
	INTERNAL ApiTypeEnum = "INTERNAL"
)

Defines values for ApiTypeEnum.

type ApiUsage

type ApiUsage struct {
	NumOfCalls *int       `json:"numOfCalls"`
	Time       *time.Time `json:"time,omitempty"`
}

ApiUsage defines model for ApiUsage.

type ApiUsages

type ApiUsages struct {
	ApisWithDiff *[]ApiUsage `json:"apisWithDiff,omitempty"`
	ExistingApis *[]ApiUsage `json:"existingApis,omitempty"`
	NewApis      *[]ApiUsage `json:"newApis,omitempty"`
}

ApiUsages defines model for ApiUsages.

type ApprovedReview

type ApprovedReview struct {
	ReviewPathItems *[]ReviewPathItem `json:"reviewPathItems,omitempty"`
}

ApprovedReview defines model for ApprovedReview.

type BaseNotification

type BaseNotification struct {
	NotificationType string `json:"notificationType"`
}

BaseNotification Base Notification all APIClarity notifications must extend

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type DiffType

type DiffType string

DiffType defines model for DiffType.

const (
	GENERALDIFF DiffType = "GENERAL_DIFF"
	NODIFF      DiffType = "NO_DIFF"
	SHADOWDIFF  DiffType = "SHADOW_DIFF"
	ZOMBIEDIFF  DiffType = "ZOMBIE_DIFF"
)

Defines values for DiffType.

type HitCount

type HitCount struct {
	Count *int64     `json:"count"`
	Time  *time.Time `json:"time,omitempty"`
}

HitCount defines model for HitCount.

type HttpMethod

type HttpMethod string

HttpMethod defines model for HttpMethod.

const (
	CONNECT HttpMethod = "CONNECT"
	DELETE  HttpMethod = "DELETE"
	GET     HttpMethod = "GET"
	HEAD    HttpMethod = "HEAD"
	OPTIONS HttpMethod = "OPTIONS"
	PATCH   HttpMethod = "PATCH"
	POST    HttpMethod = "POST"
	PUT     HttpMethod = "PUT"
	TRACE   HttpMethod = "TRACE"
)

Defines values for HttpMethod.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MethodAndPath

type MethodAndPath struct {
	Method *HttpMethod         `json:"method,omitempty"`
	Path   *string             `json:"path,omitempty"`
	PathId *openapi_types.UUID `json:"pathId,omitempty"`
}

MethodAndPath defines model for MethodAndPath.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type ModuleAlert

type ModuleAlert struct {
	Alert *AlertSeverityEnum `json:"alert,omitempty"`

	// ModuleName Name of the module which created this alert
	ModuleName *string `json:"moduleName,omitempty"`

	// Reason Optional description of reason of the alert
	Reason *string `json:"reason,omitempty"`
}

ModuleAlert defines model for ModuleAlert.

type ModuleVersion

type ModuleVersion struct {
	Version string `json:"version"`
}

ModuleVersion defines model for ModuleVersion.

type NewDiscoveredAPINotification

type NewDiscoveredAPINotification struct {
	DestinationNamespace *string `json:"destinationNamespace,omitempty"`
	HasProvidedSpec      *bool   `json:"hasProvidedSpec,omitempty"`
	HasReconstructedSpec *bool   `json:"hasReconstructedSpec,omitempty"`
	Id                   *uint32 `json:"id,omitempty"`

	// Name API name
	Name             *string `json:"name,omitempty"`
	NotificationType string  `json:"notificationType"`
	Port             *int    `json:"port,omitempty"`

	// TraceSourceId Trace Source ID which created this API. Null UUID 0 means it has been created by APIClarity (from the UI for example)
	TraceSourceId *openapi_types.UUID `json:"traceSourceId,omitempty"`
}

NewDiscoveredAPINotification defines model for NewDiscoveredAPINotification.

type OpenApiSpecs

type OpenApiSpecs struct {
	// ProvidedSpec An object containing info about a spec
	ProvidedSpec *SpecInfo `json:"providedSpec,omitempty"`

	// ReconstructedSpec An object containing info about a spec
	ReconstructedSpec *SpecInfo `json:"reconstructedSpec,omitempty"`
}

OpenApiSpecs An object representing the provided and reconstructed API specs

type RawSpec

type RawSpec struct {
	// RawSpec spec in json or yaml format
	RawSpec *string `json:"rawSpec,omitempty"`
}

RawSpec spec in json or yaml format

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ReviewPathItem

type ReviewPathItem struct {
	// ApiEventsPaths Group of api event paths (original) that suggestedPath is representing
	ApiEventsPaths *[]ApiEventPathAndMethods `json:"apiEventsPaths,omitempty"`

	// SuggestedPath Represents the parameterized path suggested by the engine
	SuggestedPath *string `json:"suggestedPath,omitempty"`
}

ReviewPathItem defines model for ReviewPathItem.

type Sensitive

type Sensitive = bool

Sensitive defines model for Sensitive.

type ServerInterface

type ServerInterface interface {
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

type Severity

type Severity string

Severity Severity of a finding

const (
	CRITICAL Severity = "CRITICAL"
	HIGH     Severity = "HIGH"
	INFO     Severity = "INFO"
	LOW      Severity = "LOW"
	MEDIUM   Severity = "MEDIUM"
)

Defines values for Severity.

type SpecDiffTime

type SpecDiffTime struct {
	ApiEventId  *uint32    `json:"apiEventId,omitempty"`
	ApiHostName *string    `json:"apiHostName,omitempty"`
	DiffType    *DiffType  `json:"diffType,omitempty"`
	Time        *time.Time `json:"time,omitempty"`
}

SpecDiffTime defines model for SpecDiffTime.

type SpecInfo

type SpecInfo struct {
	Tags *[]SpecTag `json:"tags,omitempty"`
}

SpecInfo An object containing info about a spec

type SpecTag

type SpecTag struct {
	Description       *string          `json:"description,omitempty"`
	MethodAndPathList *[]MethodAndPath `json:"methodAndPathList,omitempty"`
	Name              *string          `json:"name,omitempty"`
}

SpecTag defines model for SpecTag.

type SpecType

type SpecType string

SpecType defines model for SpecType.

const (
	NONE          SpecType = "NONE"
	PROVIDED      SpecType = "PROVIDED"
	RECONSTRUCTED SpecType = "RECONSTRUCTED"
)

Defines values for SpecType.

type SuccessResponse

type SuccessResponse struct {
	Message *string `json:"message,omitempty"`
}

SuccessResponse An object that is return in cases of success that return nothing.

type SuggestedReview

type SuggestedReview struct {
	Id              *uint32           `json:"id,omitempty"`
	ReviewPathItems *[]ReviewPathItem `json:"reviewPathItems,omitempty"`
}

SuggestedReview defines model for SuggestedReview.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshallingParamError

type UnmarshallingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshallingParamError) Error

func (e *UnmarshallingParamError) Error() string

func (*UnmarshallingParamError) Unwrap

func (e *UnmarshallingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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