bundleformat

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Overview

Package bundleformat provides helper functions related with bundle formatting for plugins implementing the BundlePublisher interface. BundlePublisher plugins should use this package as a way to have a standarized name for bundle formats in their configuration, and avoid the re-implementation of bundle parsing logic of formats supported in this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBundle

func FormatBundle(bundle *types.Bundle, format Format) ([]byte, error)

FormatBundle returns the bundle in the form of a slice of bytes in the chosen format.

Types

type Format

type Format int

Format represents the bundle formats that are supported by the Formatter.

const (
	FormatUnset Format = iota
	SPIFFE
	PEM
	JWKS
)

func FromString

func FromString(s string) (Format, error)

FromString returns the Format corresponding to the provided string.

func (Format) String

func (bundleFormat Format) String() string

String returns the string name for the bundle format.

type Formatter

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

Formatter formats a bundle in different formats.

func NewFormatter

func NewFormatter(pluginBundle *types.Bundle) *Formatter

NewFormatter return a new *Formatter with the *types.Bundle provided. Use the Bytes() function to get a slice of bytes with the bundle formatted in the format specified.

func (*Formatter) Format

func (b *Formatter) Format(format Format) ([]byte, error)

Format returns the bundle in the form of a slice of bytes in the chosen format.

Jump to

Keyboard shortcuts

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