autorest

package
v51.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChangelogFilename ...
	ChangelogFilename = "CHANGELOG.md"
)

Variables

This section is empty.

Functions

func CollectGenerationMetadata

func CollectGenerationMetadata(root string) (map[string]GenerationMetadata, error)

CollectGenerationMetadata iterates every track 1 go sdk package under root, and collect all the GenerationMetadata into a map using relative path of the package as keys

func FormatPackage

func FormatPackage(dir string) error

FormatPackage formats the given package using gofmt

func GeneratedFrom

func GeneratedFrom(commitHash, readme, tag string) string

GeneratedFrom gives the information of the generation metadata, including the commit hash that this package is generated from, the readme path, and the tag

Types

type ChangelogContext

type ChangelogContext interface {
	SDKRoot() string
	SDKCloneRoot() string
	SpecRoot() string
	SpecCommitHash() string
	CodeGenVersion() string
}

ChangelogContext describes all necessary data that would be needed in the processing of changelogs

type ChangelogProcessError

type ChangelogProcessError struct {
	Errors []error
}

ChangelogProcessError describes the errors during the processing

func (*ChangelogProcessError) Error

func (e *ChangelogProcessError) Error() string

Error ...

type ChangelogProcessor

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

ChangelogProcessor processes the metadata and output changelog with the desired format

func NewChangelogProcessorFromContext

func NewChangelogProcessorFromContext(ctx ChangelogContext) *ChangelogProcessor

NewChangelogProcessorFromContext returns a new ChangelogProcessor

func (*ChangelogProcessor) GenerateChangelog

func (p *ChangelogProcessor) GenerateChangelog(packagePath, tag string) (*ChangelogResult, error)

GenerateChangelog generates a changelog for one package

func (*ChangelogProcessor) Process

func (p *ChangelogProcessor) Process(metadataMap map[string]model.Metadata) ([]ChangelogResult, error)

Process generates the changelogs using the input metadata map. Please ensure the input metadata map does not contain any package that is not under the sdk root, otherwise this might give weird results.

func (*ChangelogProcessor) WithLocation

func (p *ChangelogProcessor) WithLocation(metadataLocation string) *ChangelogProcessor

WithLocation adds the information of the metadata-output-folder

func (*ChangelogProcessor) WithReadme

func (p *ChangelogProcessor) WithReadme(readme string) *ChangelogProcessor

WithReadme adds the information of the path of readme.md file. This path could be relative or absolute.

type ChangelogResult

type ChangelogResult struct {
	PackageName        string
	PackagePath        string
	GenerationMetadata GenerationMetadata
	Changelog          model.Changelog
}

ChangelogResult describes the result of the generated changelog for one package

type GenerateError

type GenerateError struct {
	Arguments []string
	Message   string
}

GenerateError ...

func (*GenerateError) Error

func (e *GenerateError) Error() string

Error ...

type GenerationMetadata

type GenerationMetadata struct {
	CommitHash     string
	Readme         string
	Tag            string
	CodeGenVersion string
}

GenerationMetadata contains all the metadata that has been used when generating a track 1 package

func GetGenerationMetadata

func GetGenerationMetadata(pkg string) (*GenerationMetadata, error)

GetGenerationMetadata gets the GenerationMetadata in one specific package

func Parse

func Parse(reader io.Reader) (*GenerationMetadata, error)

Parse parses the metadata info stored in a changelog with certain format into the GenerationMetadata struct

func (GenerationMetadata) String

func (m GenerationMetadata) String() string

String ...

type Generator

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

Generator collects all the related context of an autorest generation

func NewGeneratorFromOptions

func NewGeneratorFromOptions(o model.Options) *Generator

NewGeneratorFromOptions returns a new Generator with the given model.Options

func (*Generator) Generate

func (g *Generator) Generate() error

Generate executes the autorest generation. The error will be of type *GenerateError

func (*Generator) Run

func (g *Generator) Run() error

Run starts and waits the generation

func (*Generator) Start

func (g *Generator) Start() error

Start starts the generation

func (*Generator) StderrPipe

func (g *Generator) StderrPipe() (io.ReadCloser, error)

StderrPipe returns the stderr pipeline of the command

func (*Generator) StdoutPipe

func (g *Generator) StdoutPipe() (io.ReadCloser, error)

StdoutPipe returns the stdout pipeline of the command

func (*Generator) Wait

func (g *Generator) Wait() error

Wait waits for the generation to complete

func (*Generator) WithMetadataOutput

func (g *Generator) WithMetadataOutput(output string) *Generator

WithMetadataOutput appends a `metadata-output-folder` option to the autorest argument list

func (*Generator) WithMultiAPI

func (g *Generator) WithMultiAPI() *Generator

WithMultiAPI appends a multiapi flag to the autorest argument list

func (*Generator) WithOption

func (g *Generator) WithOption(option model.Option) *Generator

WithOption appends an model.Option to the argument list of the autorest generation

func (*Generator) WithReadme

func (g *Generator) WithReadme(readme string) *Generator

WithReadme appends a readme argument

func (*Generator) WithTag

func (g *Generator) WithTag(tag string) *Generator

WithTag appends a tag option to the autorest argument list

type MetadataProcessError

type MetadataProcessError struct {
	MetadataLocation string
	Errors           []error
}

MetadataProcessError ...

func (*MetadataProcessError) Error

func (e *MetadataProcessError) Error() string

Error ...

type MetadataProcessor

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

MetadataProcessor processes the metadata

func NewMetadataProcessorFromLocation

func NewMetadataProcessorFromLocation(metadataOutput string) *MetadataProcessor

NewMetadataProcessorFromLocation creates a new MetadataProcessor using the metadata output folder location

func (MetadataProcessor) Process

func (p MetadataProcessor) Process() (map[string]model.Metadata, error)

Process returns the metadata result: a map from tag to Metadata, and an error if there is anything that could not be processed. the error returned must be of type *MetadataProcessError

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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