updoc

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package updoc package implements updoc, the tool for publishing official provider docs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketIndex

type BucketIndex struct {
	Items []Item            `json:"tableOfContents"`
	Meta  map[string]string `json:"metadata"`
}

BucketIndex represents an index file in the storage bucket.

type Indexer

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

Indexer indexes docs.

func NewIndexer

func NewIndexer(root string, opts ...IndexerOpt) *Indexer

NewIndexer constructs an indexer at the specified root.

func (*Indexer) Run

func (i *Indexer) Run() error

Run runs the indexer.

type IndexerOpt

type IndexerOpt func(i *Indexer)

IndexerOpt is an indexer option.

func WithFs

func WithFs(fs afero.Fs) IndexerOpt

WithFs sets the Indexer file system.

type Item

type Item struct {
	DisplayName string `json:"name"`
	Location    string `json:"location"`
}

Item represents an item that will ultimately be represented in the uploaded table of contents.

type Option

type Option func(u *UploadManager)

Option is an option that modifies a UploadManager

func WithUpload

func WithUpload(up func(ctx context.Context, bucket *storage.BucketHandle, name string, r io.Reader) error) Option

WithUpload sets the `upload` function to be used by the UploadManager.

type Options

type Options struct {
	Generate struct {
		DocsDir string `name:"docs-dir" required:"" help:"Root directory to crawl for documents."`
	} `kong:"cmd"`
	Upload UploadOptions `kong:"cmd"`
}

Options represents the available subcommands of updoc: "generate" and "upload".

type Section

type Section struct {
	Section string `yaml:"section"`
	Weight  int    `yaml:"weight"`
	Items   []Sortable
}

Section is the section in a document.

type Sortable

type Sortable interface {
	// contains filtered or unexported methods
}

Sortable represents a sortable document section, like the title or a section of a document.

type Title

type Title struct {
	Title        string `yaml:"title"`
	Weight       int    `yaml:"weight"`
	FileLocation string
}

Title is the title of a document.

type UploadManager

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

UploadManager represents a document uploader capable of uploading contents of the specified io.Reader under the specified name.

func New

func New(opts ...Option) *UploadManager

New constructs a new UploadManager

func (*UploadManager) ProcessIndex

func (u *UploadManager) ProcessIndex(opts UploadOptions, afs afero.Fs) error

ProcessIndex processes the index documents and uploads them to the storage.

type UploadOptions

type UploadOptions struct {
	DocsDir    string `name:"docs-dir" required:"" help:"Root directory to crawl for documents."`
	Name       string `name:"name" required:"" help:"The name of the provider being processed."`
	Version    string `name:"version" required:"" help:"The major and minor version number of the provider branch."`
	BucketName string `name:"bucket-name" required:"" help:"Bucket to put documentation in."`
	CDNDomain  string `name:"cdn-domain" required:"" help:"CDN name to prefix processed urls with."`
}

UploadOptions represents the options for the upload subcommand

Jump to

Keyboard shortcuts

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