slareport

package
v4.83.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunQuery

func RunQuery(ctx context.Context, promURL, timeRange, date, mimirOrg string, serviceSla map[string]float64) (map[string][]ServiceInstance, error)

Types

type DocGenPDF

type DocGenPDF struct {
	Asciidoc             string `json:"asciidoc,omitempty"`
	VshnDocgenId         string `json:"vshn_docgen_id,omitempty"`
	VshnTextRoleOfVshnAg string `json:"vshn_text_role_of_vshn_ag,omitempty"`
}

type PDF

type PDF struct {
	Customer string
	Date     time.Time
	PDFData  io.ReadCloser
}

PDF is contains all metainformation to upload a PDF to S3.

type PDFUploader

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

PDFUploader uploads pdfs to the configured S3 endpoint.

func NewPDFUploader

func NewPDFUploader(ctx context.Context, endpoint, bucket, keyID, secretKey string) (PDFUploader, error)

NewPDFUploader initializes an S3 client.

func (*PDFUploader) Upload

func (p *PDFUploader) Upload(ctx context.Context, pdf PDF) error

Upload uploads the given PDF to the logged in S3 enspoint. It will create an object with the pattern `year/month/customer.pdf`.

type Renderer

type Renderer interface {
	RenderAsciidoc() (string, error)
	PrepareJSONPayload() ([]byte, error)
}

type SLARenderer

type SLARenderer struct {
	Customer      string
	ExceptionLink string
	Month         time.Month
	Year          int
	SI            []ServiceInstance
}

func (*SLARenderer) GeneratePDF

func (s *SLARenderer) GeneratePDF() (io.ReadCloser, error)

GeneratePDF sends a request to docgen an returns the rendered PDF.

func (*SLARenderer) PrepareJSONPayload

func (s *SLARenderer) PrepareJSONPayload() ([]byte, error)

PrepareJSONPayload creates a json payload that is ready to be used for docgen api endpoint https://docgen.vshn.net/api/pdf

func (*SLARenderer) RenderAsciidoc

func (s *SLARenderer) RenderAsciidoc() (string, error)

RenderAsciidoc renders the sla go template into an asciidoc template

type ServiceInstance

type ServiceInstance struct {
	Namespace  string
	Instance   string
	TargetSLA  float64
	OutcomeSLA float64
	Cluster    string
	Service    string
	Color      string
}

Jump to

Keyboard shortcuts

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