apispec

package
v0.0.0-...-97ed522 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version 2.4.1 DO NOT EDIT.

Index

Constants

View Source
const (
	JWTScopes = "JWT.Scopes"
)

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 NewGetApiV1SettingsRequest

func NewGetApiV1SettingsRequest(server string) (*http.Request, error)

NewGetApiV1SettingsRequest generates requests for GetApiV1Settings

func NewGetConfigRequest

func NewGetConfigRequest(server string) (*http.Request, error)

NewGetConfigRequest generates requests for GetConfig

func NewGetNetPolicyRequest

func NewGetNetPolicyRequest(server string, params *GetNetPolicyParams) (*http.Request, error)

NewGetNetPolicyRequest generates requests for GetNetPolicy

func NewPostApiV1DependenciesEventRequest

func NewPostApiV1DependenciesEventRequest(server string, body PostApiV1DependenciesEventJSONRequestBody) (*http.Request, error)

NewPostApiV1DependenciesEventRequest calls the generic PostApiV1DependenciesEvent builder with application/json body

func NewPostApiV1DependenciesEventRequestWithBody

func NewPostApiV1DependenciesEventRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewPostApiV1DependenciesEventRequestWithBody generates requests for PostApiV1DependenciesEvent with any type of body

func NewPostApiV1DetectionsEventRequest

func NewPostApiV1DetectionsEventRequest(server string, body PostApiV1DetectionsEventJSONRequestBody) (*http.Request, error)

NewPostApiV1DetectionsEventRequest calls the generic PostApiV1DetectionsEvent builder with application/json body

func NewPostApiV1DetectionsEventRequestWithBody

func NewPostApiV1DetectionsEventRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewPostApiV1DetectionsEventRequestWithBody generates requests for PostApiV1DetectionsEvent with any type of body

func NewPostApiV1InformationalEventRequest

func NewPostApiV1InformationalEventRequest(server string, body PostApiV1InformationalEventJSONRequestBody) (*http.Request, error)

NewPostApiV1InformationalEventRequest calls the generic PostApiV1InformationalEvent builder with application/json body

func NewPostApiV1InformationalEventRequestWithBody

func NewPostApiV1InformationalEventRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewPostApiV1InformationalEventRequestWithBody generates requests for PostApiV1InformationalEvent with any type of body

func NewPostApiV1PipelineEventRequest

func NewPostApiV1PipelineEventRequest(server string, body PostApiV1PipelineEventJSONRequestBody) (*http.Request, error)

NewPostApiV1PipelineEventRequest calls the generic PostApiV1PipelineEvent builder with application/json body

func NewPostApiV1PipelineEventRequestWithBody

func NewPostApiV1PipelineEventRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewPostApiV1PipelineEventRequestWithBody generates requests for PostApiV1PipelineEvent with any type of body

func PathToRawSpec

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

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

func RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetApiV1Settings

func (c *Client) GetApiV1Settings(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetNetPolicy

func (c *Client) GetNetPolicy(ctx context.Context, params *GetNetPolicyParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostApiV1DependenciesEvent

func (c *Client) PostApiV1DependenciesEvent(ctx context.Context, body PostApiV1DependenciesEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostApiV1DependenciesEventWithBody

func (c *Client) PostApiV1DependenciesEventWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostApiV1DetectionsEvent

func (c *Client) PostApiV1DetectionsEvent(ctx context.Context, body PostApiV1DetectionsEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostApiV1DetectionsEventWithBody

func (c *Client) PostApiV1DetectionsEventWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostApiV1InformationalEvent

func (c *Client) PostApiV1InformationalEvent(ctx context.Context, body PostApiV1InformationalEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostApiV1InformationalEventWithBody

func (c *Client) PostApiV1InformationalEventWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostApiV1PipelineEvent

func (c *Client) PostApiV1PipelineEvent(ctx context.Context, body PostApiV1PipelineEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostApiV1PipelineEventWithBody

func (c *Client) PostApiV1PipelineEventWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetConfig request
	GetConfig(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PostApiV1DependenciesEventWithBody request with any body
	PostApiV1DependenciesEventWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	PostApiV1DependenciesEvent(ctx context.Context, body PostApiV1DependenciesEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PostApiV1DetectionsEventWithBody request with any body
	PostApiV1DetectionsEventWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	PostApiV1DetectionsEvent(ctx context.Context, body PostApiV1DetectionsEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PostApiV1InformationalEventWithBody request with any body
	PostApiV1InformationalEventWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	PostApiV1InformationalEvent(ctx context.Context, body PostApiV1InformationalEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetNetPolicy request
	GetNetPolicy(ctx context.Context, params *GetNetPolicyParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// PostApiV1PipelineEventWithBody request with any body
	PostApiV1PipelineEventWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	PostApiV1PipelineEvent(ctx context.Context, body PostApiV1PipelineEventJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetApiV1Settings request
	GetApiV1Settings(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetApiV1SettingsWithResponse

func (c *ClientWithResponses) GetApiV1SettingsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV1SettingsResponse, error)

GetApiV1SettingsWithResponse request returning *GetApiV1SettingsResponse

func (*ClientWithResponses) GetConfigWithResponse

func (c *ClientWithResponses) GetConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigResponse, error)

GetConfigWithResponse request returning *GetConfigResponse

func (*ClientWithResponses) GetNetPolicyWithResponse

func (c *ClientWithResponses) GetNetPolicyWithResponse(ctx context.Context, params *GetNetPolicyParams, reqEditors ...RequestEditorFn) (*GetNetPolicyResponse, error)

GetNetPolicyWithResponse request returning *GetNetPolicyResponse

func (*ClientWithResponses) PostApiV1DependenciesEventWithBodyWithResponse

func (c *ClientWithResponses) PostApiV1DependenciesEventWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1DependenciesEventResponse, error)

PostApiV1DependenciesEventWithBodyWithResponse request with arbitrary body returning *PostApiV1DependenciesEventResponse

func (*ClientWithResponses) PostApiV1DependenciesEventWithResponse

func (c *ClientWithResponses) PostApiV1DependenciesEventWithResponse(ctx context.Context, body PostApiV1DependenciesEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1DependenciesEventResponse, error)

func (*ClientWithResponses) PostApiV1DetectionsEventWithBodyWithResponse

func (c *ClientWithResponses) PostApiV1DetectionsEventWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1DetectionsEventResponse, error)

PostApiV1DetectionsEventWithBodyWithResponse request with arbitrary body returning *PostApiV1DetectionsEventResponse

func (*ClientWithResponses) PostApiV1DetectionsEventWithResponse

func (c *ClientWithResponses) PostApiV1DetectionsEventWithResponse(ctx context.Context, body PostApiV1DetectionsEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1DetectionsEventResponse, error)

func (*ClientWithResponses) PostApiV1InformationalEventWithBodyWithResponse

func (c *ClientWithResponses) PostApiV1InformationalEventWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1InformationalEventResponse, error)

PostApiV1InformationalEventWithBodyWithResponse request with arbitrary body returning *PostApiV1InformationalEventResponse

func (*ClientWithResponses) PostApiV1InformationalEventWithResponse

func (c *ClientWithResponses) PostApiV1InformationalEventWithResponse(ctx context.Context, body PostApiV1InformationalEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1InformationalEventResponse, error)

func (*ClientWithResponses) PostApiV1PipelineEventWithBodyWithResponse

func (c *ClientWithResponses) PostApiV1PipelineEventWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1PipelineEventResponse, error)

PostApiV1PipelineEventWithBodyWithResponse request with arbitrary body returning *PostApiV1PipelineEventResponse

func (*ClientWithResponses) PostApiV1PipelineEventWithResponse

func (c *ClientWithResponses) PostApiV1PipelineEventWithResponse(ctx context.Context, body PostApiV1PipelineEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1PipelineEventResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetConfigWithResponse request
	GetConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigResponse, error)

	// PostApiV1DependenciesEventWithBodyWithResponse request with any body
	PostApiV1DependenciesEventWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1DependenciesEventResponse, error)

	PostApiV1DependenciesEventWithResponse(ctx context.Context, body PostApiV1DependenciesEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1DependenciesEventResponse, error)

	// PostApiV1DetectionsEventWithBodyWithResponse request with any body
	PostApiV1DetectionsEventWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1DetectionsEventResponse, error)

	PostApiV1DetectionsEventWithResponse(ctx context.Context, body PostApiV1DetectionsEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1DetectionsEventResponse, error)

	// PostApiV1InformationalEventWithBodyWithResponse request with any body
	PostApiV1InformationalEventWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1InformationalEventResponse, error)

	PostApiV1InformationalEventWithResponse(ctx context.Context, body PostApiV1InformationalEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1InformationalEventResponse, error)

	// GetNetPolicyWithResponse request
	GetNetPolicyWithResponse(ctx context.Context, params *GetNetPolicyParams, reqEditors ...RequestEditorFn) (*GetNetPolicyResponse, error)

	// PostApiV1PipelineEventWithBodyWithResponse request with any body
	PostApiV1PipelineEventWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV1PipelineEventResponse, error)

	PostApiV1PipelineEventWithResponse(ctx context.Context, body PostApiV1PipelineEventJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV1PipelineEventResponse, error)

	// GetApiV1SettingsWithResponse request
	GetApiV1SettingsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetApiV1SettingsResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type DependencyEvent

type DependencyEvent struct {
	GithubContext GitHubDependencyEventContext `json:"github_context"`

	// LockFilePath Identifies the file path of the lock file used to retrieve the dependency this event is about
	LockFilePath *string `json:"lock_file_path,omitempty"`

	// Verdict The verdict of the event
	Verdict models.Verdict `json:"verdict"`
}

DependencyEvent defines model for DependencyEvent.

type DetectionEvent

type DetectionEvent struct {
	Data struct {
		Body interface{} `json:"body"`
		Head interface{} `json:"head"`

		// UniqueId Unique SHA256 identifier
		UniqueId string `json:"unique_id"`
	} `json:"data"`
	GithubContext GitHubDetectionEventContext `json:"github_context"`
	Type          string                      `json:"type"`
}

DetectionEvent defines model for DetectionEvent.

type Error

type Error struct {
	Identifier *string `json:"identifier,omitempty"`
	Message    string  `json:"message"`
}

Error defines model for Error.

type GetApiV1SettingsResponse

type GetApiV1SettingsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Settings
	JSON401      *Error
	JSON500      *Error
}

func ParseGetApiV1SettingsResponse

func ParseGetApiV1SettingsResponse(rsp *http.Response) (*GetApiV1SettingsResponse, error)

ParseGetApiV1SettingsResponse parses an HTTP response from a GetApiV1SettingsWithResponse call

func (GetApiV1SettingsResponse) Status

func (r GetApiV1SettingsResponse) Status() string

Status returns HTTPResponse.Status

func (GetApiV1SettingsResponse) StatusCode

func (r GetApiV1SettingsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetConfigResponse

type GetConfigResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *JibrilConfig
	JSON401      *Error
	JSON500      *Error
}

func ParseGetConfigResponse

func ParseGetConfigResponse(rsp *http.Response) (*GetConfigResponse, error)

ParseGetConfigResponse parses an HTTP response from a GetConfigWithResponse call

func (GetConfigResponse) Status

func (r GetConfigResponse) Status() string

Status returns HTTPResponse.Status

func (GetConfigResponse) StatusCode

func (r GetConfigResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetNetPolicyParams

type GetNetPolicyParams struct {
	// GithubRepository The owner and repository name. For example, octocat/Hello-World.
	GithubRepository string `form:"github_repository" json:"github_repository"`

	// GithubRepositoryId The GitHub repository ID.
	GithubRepositoryId string `form:"github_repository_id" json:"github_repository_id"`
}

GetNetPolicyParams defines parameters for GetNetPolicy.

type GetNetPolicyResponse

type GetNetPolicyResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *NetworkPolicy
	JSON400      *Error
	JSON401      *Error
	JSON500      *Error
}

func ParseGetNetPolicyResponse

func ParseGetNetPolicyResponse(rsp *http.Response) (*GetNetPolicyResponse, error)

ParseGetNetPolicyResponse parses an HTTP response from a GetNetPolicyWithResponse call

func (GetNetPolicyResponse) Status

func (r GetNetPolicyResponse) Status() string

Status returns HTTPResponse.Status

func (GetNetPolicyResponse) StatusCode

func (r GetNetPolicyResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type GitHubDependencyEventContext

type GitHubDependencyEventContext = GitHubEventContext

GitHubDependencyEventContext defines model for GitHubDependencyEventContext.

type GitHubDetectionEventContext

type GitHubDetectionEventContext = GitHubEventContext

GitHubDetectionEventContext defines model for GitHubDetectionEventContext.

type GitHubEventContext

type GitHubEventContext struct {
	Action            string                  `json:"action"`
	ActionPath        *string                 `json:"action_path,omitempty"`
	ActionRepository  *string                 `json:"action_repository,omitempty"`
	Actor             string                  `json:"actor"`
	ActorId           int64string.Int64String `json:"actor_id"`
	EventName         string                  `json:"event_name"`
	Job               string                  `json:"job"`
	Ref               string                  `json:"ref"`
	RefName           string                  `json:"ref_name"`
	RefProtected      bool                    `json:"ref_protected"`
	RefType           string                  `json:"ref_type"`
	Repository        string                  `json:"repository"`
	RepositoryId      int64string.Int64String `json:"repository_id"`
	RepositoryOwner   string                  `json:"repository_owner"`
	RepositoryOwnerId int64string.Int64String `json:"repository_owner_id"`
	RunAttempt        int64string.Int64String `json:"run_attempt"`
	RunId             int64string.Int64String `json:"run_id"`
	RunNumber         int64string.Int64String `json:"run_number"`
	RunnerArch        string                  `json:"runner_arch"`
	RunnerDebug       *bool                   `json:"runner_debug,omitempty"`
	RunnerOs          string                  `json:"runner_os"`
	ServerUrl         string                  `json:"server_url"`
	Sha               string                  `json:"sha"`
	TriggeringActor   string                  `json:"triggering_actor"`
	Workflow          string                  `json:"workflow"`
	WorkflowRef       string                  `json:"workflow_ref"`
	Workspace         string                  `json:"workspace"`
}

GitHubEventContext defines model for GitHubEventContext.

type GitHubPipelineEventContext

type GitHubPipelineEventContext = GitHubEventContext

GitHubPipelineEventContext defines model for GitHubPipelineEventContext.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type InformationalEvent

type InformationalEvent struct {
	Data struct {
		Body interface{} `json:"body"`
		Head interface{} `json:"head"`

		// UniqueId Unique SHA256 identifier
		UniqueId string `json:"unique_id"`
	} `json:"data"`
	GithubContext GitHubDetectionEventContext `json:"github_context"`
	Type          string                      `human:"the informational event type" json:"type" validate:"mandatory,is_informational_event_type=case"`
}

InformationalEvent defines model for InformationalEvent.

type JibrilConfig

type JibrilConfig struct {
	Cardinal  bool                 `json:"cardinal" yaml:"cardinal"`
	ChopLines bool                 `json:"chop-lines" yaml:"chop-lines"`
	Daemon    bool                 `json:"daemon" yaml:"daemon"`
	Event     []string             `json:"event" yaml:"event"`
	Extension []string             `json:"extension" yaml:"extension"`
	LogLevel  JibrilConfigLogLevel `json:"log-level" yaml:"log-level"`
	NoHealth  bool                 `json:"no-health" yaml:"no-health"`
	Notify    bool                 `json:"notify" yaml:"notify"`
	Plugin    []string             `json:"plugin" yaml:"plugin"`
	Printer   []string             `json:"printer" yaml:"printer"`
	Profiler  bool                 `json:"profiler" yaml:"profiler"`
	Stderr    string               `json:"stderr" yaml:"stderr"`
	Stdout    string               `json:"stdout" yaml:"stdout"`
}

JibrilConfig defines model for JibrilConfig.

type JibrilConfigLogLevel

type JibrilConfigLogLevel string

JibrilConfigLogLevel defines model for JibrilConfig.LogLevel.

const (
	JibrilConfigLogLevelDebug JibrilConfigLogLevel = "debug"
	JibrilConfigLogLevelError JibrilConfigLogLevel = "error"
	JibrilConfigLogLevelInfo  JibrilConfigLogLevel = "info"
	JibrilConfigLogLevelWarn  JibrilConfigLogLevel = "warn"
)

Defines values for JibrilConfigLogLevel.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type NetworkPolicy

type NetworkPolicy struct {
	// CidrMode Mode for handling CIDR traffic.
	CidrMode NetworkPolicyCidrMode `json:"cidr_mode" yaml:"cidr_mode"`

	// CidrPolicy Default policy for CIDR traffic.
	CidrPolicy NetworkPolicyCidrPolicy `json:"cidr_policy" yaml:"cidr_policy"`

	// ResolveMode Mode for handling domain resolution.
	ResolveMode NetworkPolicyResolveMode `json:"resolve_mode" yaml:"resolve_mode"`

	// ResolvePolicy Default policy for domain resolution.
	ResolvePolicy NetworkPolicyResolvePolicy `json:"resolve_policy" yaml:"resolve_policy"`

	// Rules List of network policy rules.
	Rules *[]struct {
		// Cidr CIDR range for the rule (if applicable).
		Cidr *string `json:"cidr,omitempty" yaml:"cidr,omitempty"`

		// Domain Domain for the rule (if applicable).
		Domain *string `json:"domain,omitempty" yaml:"domain,omitempty"`

		// Policy Policy for the rule.
		Policy NetworkPolicyRulesPolicy `json:"policy" yaml:"policy"`
	} `json:"rules,omitempty" yaml:"rules"`

	// Tags Tags for easy lookup in db based on repository/workflow/job.
	Tags *map[string]string `json:"tags,omitempty" yaml:"-"`
}

NetworkPolicy defines model for NetworkPolicy.

type NetworkPolicyCidrMode

type NetworkPolicyCidrMode string

NetworkPolicyCidrMode Mode for handling CIDR traffic.

const (
	NetworkPolicyCidrModeAlert   NetworkPolicyCidrMode = "alert"
	NetworkPolicyCidrModeBoth    NetworkPolicyCidrMode = "both"
	NetworkPolicyCidrModeBypass  NetworkPolicyCidrMode = "bypass"
	NetworkPolicyCidrModeEnforce NetworkPolicyCidrMode = "enforce"
	NetworkPolicyCidrModeNone    NetworkPolicyCidrMode = "none"
)

Defines values for NetworkPolicyCidrMode.

type NetworkPolicyCidrPolicy

type NetworkPolicyCidrPolicy string

NetworkPolicyCidrPolicy Default policy for CIDR traffic.

const (
	NetworkPolicyCidrPolicyAllow NetworkPolicyCidrPolicy = "allow"
	NetworkPolicyCidrPolicyDeny  NetworkPolicyCidrPolicy = "deny"
	NetworkPolicyCidrPolicyNone  NetworkPolicyCidrPolicy = "none"
)

Defines values for NetworkPolicyCidrPolicy.

type NetworkPolicyResolveMode

type NetworkPolicyResolveMode string

NetworkPolicyResolveMode Mode for handling domain resolution.

const (
	NetworkPolicyResolveModeAlert   NetworkPolicyResolveMode = "alert"
	NetworkPolicyResolveModeBoth    NetworkPolicyResolveMode = "both"
	NetworkPolicyResolveModeBypass  NetworkPolicyResolveMode = "bypass"
	NetworkPolicyResolveModeEnforce NetworkPolicyResolveMode = "enforce"
	NetworkPolicyResolveModeNone    NetworkPolicyResolveMode = "none"
)

Defines values for NetworkPolicyResolveMode.

type NetworkPolicyResolvePolicy

type NetworkPolicyResolvePolicy string

NetworkPolicyResolvePolicy Default policy for domain resolution.

const (
	NetworkPolicyResolvePolicyAllow NetworkPolicyResolvePolicy = "allow"
	NetworkPolicyResolvePolicyDeny  NetworkPolicyResolvePolicy = "deny"
	NetworkPolicyResolvePolicyNone  NetworkPolicyResolvePolicy = "none"
)

Defines values for NetworkPolicyResolvePolicy.

type NetworkPolicyRulesPolicy

type NetworkPolicyRulesPolicy string

NetworkPolicyRulesPolicy Policy for the rule.

const (
	Allow NetworkPolicyRulesPolicy = "allow"
	Deny  NetworkPolicyRulesPolicy = "deny"
	None  NetworkPolicyRulesPolicy = "none"
)

Defines values for NetworkPolicyRulesPolicy.

type PipelineEvent

type PipelineEvent struct {
	Data          interface{}                `json:"data"`
	GithubContext GitHubPipelineEventContext `json:"github_context"`
	Type          string                     `json:"type"`
}

PipelineEvent defines model for PipelineEvent.

type PostApiV1DependenciesEventJSONRequestBody

type PostApiV1DependenciesEventJSONRequestBody = DependencyEvent

PostApiV1DependenciesEventJSONRequestBody defines body for PostApiV1DependenciesEvent for application/json ContentType.

type PostApiV1DependenciesEventResponse

type PostApiV1DependenciesEventResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *Error
	JSON500      *Error
}

func ParsePostApiV1DependenciesEventResponse

func ParsePostApiV1DependenciesEventResponse(rsp *http.Response) (*PostApiV1DependenciesEventResponse, error)

ParsePostApiV1DependenciesEventResponse parses an HTTP response from a PostApiV1DependenciesEventWithResponse call

func (PostApiV1DependenciesEventResponse) Status

Status returns HTTPResponse.Status

func (PostApiV1DependenciesEventResponse) StatusCode

func (r PostApiV1DependenciesEventResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PostApiV1DetectionsEventJSONRequestBody

type PostApiV1DetectionsEventJSONRequestBody = DetectionEvent

PostApiV1DetectionsEventJSONRequestBody defines body for PostApiV1DetectionsEvent for application/json ContentType.

type PostApiV1DetectionsEventResponse

type PostApiV1DetectionsEventResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *Error
	JSON500      *Error
}

func ParsePostApiV1DetectionsEventResponse

func ParsePostApiV1DetectionsEventResponse(rsp *http.Response) (*PostApiV1DetectionsEventResponse, error)

ParsePostApiV1DetectionsEventResponse parses an HTTP response from a PostApiV1DetectionsEventWithResponse call

func (PostApiV1DetectionsEventResponse) Status

Status returns HTTPResponse.Status

func (PostApiV1DetectionsEventResponse) StatusCode

func (r PostApiV1DetectionsEventResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PostApiV1InformationalEventJSONRequestBody

type PostApiV1InformationalEventJSONRequestBody = InformationalEvent

PostApiV1InformationalEventJSONRequestBody defines body for PostApiV1InformationalEvent for application/json ContentType.

type PostApiV1InformationalEventResponse

type PostApiV1InformationalEventResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *Error
	JSON500      *Error
}

func ParsePostApiV1InformationalEventResponse

func ParsePostApiV1InformationalEventResponse(rsp *http.Response) (*PostApiV1InformationalEventResponse, error)

ParsePostApiV1InformationalEventResponse parses an HTTP response from a PostApiV1InformationalEventWithResponse call

func (PostApiV1InformationalEventResponse) Status

Status returns HTTPResponse.Status

func (PostApiV1InformationalEventResponse) StatusCode

StatusCode returns HTTPResponse.StatusCode

type PostApiV1PipelineEventJSONRequestBody

type PostApiV1PipelineEventJSONRequestBody = PipelineEvent

PostApiV1PipelineEventJSONRequestBody defines body for PostApiV1PipelineEvent for application/json ContentType.

type PostApiV1PipelineEventResponse

type PostApiV1PipelineEventResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *Error
	JSON500      *Error
}

func ParsePostApiV1PipelineEventResponse

func ParsePostApiV1PipelineEventResponse(rsp *http.Response) (*PostApiV1PipelineEventResponse, error)

ParsePostApiV1PipelineEventResponse parses an HTTP response from a PostApiV1PipelineEventWithResponse call

func (PostApiV1PipelineEventResponse) Status

Status returns HTTPResponse.Status

func (PostApiV1PipelineEventResponse) StatusCode

func (r PostApiV1PipelineEventResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type ServerInterface

type ServerInterface interface {
	// Get configuratoin to inject in jibril
	// (GET /api/v1/config)
	GetConfig(c *gin.Context)
	// Create a new dependency event
	// (POST /api/v1/dependencies/event)
	PostApiV1DependenciesEvent(c *gin.Context)
	// Create a new detection event
	// (POST /api/v1/detections/event)
	PostApiV1DetectionsEvent(c *gin.Context)
	// Create a new informational event
	// (POST /api/v1/informational/event)
	PostApiV1InformationalEvent(c *gin.Context)
	// Get the network policy for the current project and github_workflow_ref
	// (GET /api/v1/netpolicy)
	GetNetPolicy(c *gin.Context, params GetNetPolicyParams)
	// Create a new pipeline event
	// (POST /api/v1/pipeline/event)
	PostApiV1PipelineEvent(c *gin.Context)
	// Get the settings for the current project
	// (GET /api/v1/settings)
	GetApiV1Settings(c *gin.Context)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetApiV1Settings

func (siw *ServerInterfaceWrapper) GetApiV1Settings(c *gin.Context)

GetApiV1Settings operation middleware

func (*ServerInterfaceWrapper) GetConfig

func (siw *ServerInterfaceWrapper) GetConfig(c *gin.Context)

GetConfig operation middleware

func (*ServerInterfaceWrapper) GetNetPolicy

func (siw *ServerInterfaceWrapper) GetNetPolicy(c *gin.Context)

GetNetPolicy operation middleware

func (*ServerInterfaceWrapper) PostApiV1DependenciesEvent

func (siw *ServerInterfaceWrapper) PostApiV1DependenciesEvent(c *gin.Context)

PostApiV1DependenciesEvent operation middleware

func (*ServerInterfaceWrapper) PostApiV1DetectionsEvent

func (siw *ServerInterfaceWrapper) PostApiV1DetectionsEvent(c *gin.Context)

PostApiV1DetectionsEvent operation middleware

func (*ServerInterfaceWrapper) PostApiV1InformationalEvent

func (siw *ServerInterfaceWrapper) PostApiV1InformationalEvent(c *gin.Context)

PostApiV1InformationalEvent operation middleware

func (*ServerInterfaceWrapper) PostApiV1PipelineEvent

func (siw *ServerInterfaceWrapper) PostApiV1PipelineEvent(c *gin.Context)

PostApiV1PipelineEvent operation middleware

type Settings

type Settings struct {
	// Policies The policies associated with the settings
	Policies map[string]struct {
		Observe *bool `json:"observe,omitempty"`
	} `bson:"policies" json:"policies"`

	// ProjectId The id of the project that the settings belongs to
	ProjectId string `bson:"project_id" json:"project_id"`

	// Tokens The tokens associated with the settings
	Tokens *map[string]struct {
		Key *string `json:"key,omitempty"`
	} `bson:"tokens" json:"tokens,omitempty"`
}

Settings defines model for Settings.

func (*Settings) TokensMap

func (s *Settings) TokensMap(options ...SettingsOptioner) map[string]string

func (*Settings) TokensSlice

func (s *Settings) TokensSlice(options ...SettingsOptioner) []string

type SettingsOptioner

type SettingsOptioner func(*SettingsOptions)

func WithPrefix

func WithPrefix(prefix string) SettingsOptioner

WithPrefix is an option to set a prefix.

func WithSeparator

func WithSeparator(separator string) SettingsOptioner

WithPrefix is an option to set a separator.

func WithValueDoubleQuotes

func WithValueDoubleQuotes() SettingsOptioner

type SettingsOptions

type SettingsOptions struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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