parsing

package
v0.0.0-...-c2fab7e Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Parse content from data sources into models.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDeploymentScript

func CreateDeploymentScript(id string, params []models.AppDeployParameter, ymlfile string) string

Types

type PRParser

type PRParser struct {
	// Ctx is the server context
	Ctx context.Context

	// Gh is a GitHub API client
	GH *github.Client

	// RepoOwner is the owner of the PR's GitHub repository
	RepoOwner string

	// RepoName is the name of the PR's GitHub repository
	RepoName string

	// RepoRef is the Git reference to parse data at
	RepoRef string

	// PRNumber is the pull request's unique user facing number
	PRNumber int
}

PRParser parses a pull request

func (PRParser) GetModifiedAppIDs

func (p PRParser) GetModifiedAppIDs() ([]string, []string, error)

GetModifiedAppIDs returns IDs of applications modified in pull request and IDs of applications deleted in pull request.

type ParseError

type ParseError struct {
	// What indicates the object that failed to be parsed.
	// This field does not have to provide context about what is being parsed. Just
	// what part of the parsing process failed.
	What string

	// Why indicates why the object failed to be parsed
	Why string

	// FixInstructions for the user to remedy this error
	// Leave this field blank if there is nothing the user can do to fix the issue,
	// ex., internal server error
	FixInstructions string

	// InternalError is a non user presentable error which will be logged for
	// debug purposes. Can be nil if error is entirely caused by user's input.
	// If not nil will be treated as if the server messed up in some way and
	// the dev team will be notified.
	InternalError error
}

ParseError provides details about a failure to parse an object. ParseErrors are meant to be presented to users. All string fields will be interpreted with Markdown formatting.

func (ParseError) Error

func (e ParseError) Error() string

Error returns an internal error string which should not be shown to the user

func (ParseError) UserError

func (e ParseError) UserError() string

UserError returns an error string meant to be displayed to the user

type RepoParser

type RepoParser struct {
	// Ctx is the server's context
	Ctx context.Context

	// GH is a GitHub API client
	GH *github.Client

	// GHDevTeamName is the name of the GitHub team to ping when an internal error occurs
	GHDevTeamName string

	// SiteURL is the URL at which the website can be accessed
	SiteURL url.URL

	// RepoOwner is the owner of the repository
	RepoOwner string

	// RepoName is the name of the repository
	RepoName string

	// RepoRef is the Git reference to parse data at
	RepoRef string
}

RepoParser reads GitHub repositories for serverless application information

func (RepoParser) GetApp

func (p RepoParser) GetApp(id string) (*models.App, []ParseError)

GetApp marshals an app from the repository

func (RepoParser) GetAppIDs

func (p RepoParser) GetAppIDs() ([]string, error)

GetAppIDs returns the IDs of all the serverless applications in a repository

func (RepoParser) GetDownloadURLs

func (p RepoParser) GetDownloadURLs(path string) ([]string, error)

GetDownloadURLs returns the download URLs for files in a directory

func (RepoParser) GetFileContent

func (p RepoParser) GetFileContent(f string) (string, error)

GetFileContent retrieves the contents of a file

Jump to

Keyboard shortcuts

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