common

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Inspired from https://github.com/alecthomas/participle/blob/master/_examples/expr/main.go

This file contains the particle base expression parser and evaluator to compute the values of sequences.

Names for some CloudFormation custom resources.

Index

Constants

View Source
const SsmParameterPrefix = "/codesmith-forge"

SSM Parameters

Some of the custom CloudFormation resources create by the forge are implemented as SSM parameters in the parameter store.

Variables

This section is empty.

Functions

func ArnRegion

func ArnRegion(arn string) string

func CogCondPreAuthParameterName

func CogCondPreAuthParameterName(userPoolId string, userPoolClientId string) string

CogCondPreAuth naming

func DnsCertificeSnsMessageIdParameterName

func DnsCertificeSnsMessageIdParameterName(stackArn string, logicalResourceID string) (string, error)

Dns Certificate SNS Message memory

func Eval

func Eval(expr string, x int64) (int64, error)

func EvalExpression

func EvalExpression(e Expression, x int64) int64

func EvalFactor

func EvalFactor(t Factor, x int64) int64

func EvalOp

func EvalOp(v1 int64, op string, v2 int64) int64

func EvalTerm

func EvalTerm(t Term, x int64) int64

func ExtractStackId

func ExtractStackId(stackArn string) (string, error)

func ExtractStackName

func ExtractStackName(stackArn string) (string, error)

func IsCertificateArn

func IsCertificateArn(s string) bool

func IsForgeSsmParameterARN

func IsForgeSsmParameterARN(s string) bool

func IsSameRegion

func IsSameRegion(event cfn.Event, oldRegion, region string) bool

func SequenceParameterName

func SequenceParameterName(sequenceName string) string

Sequence naming

func UnknownRequestType

func UnknownRequestType(event cfn.Event) (string, map[string]interface{}, error)

Types

type Expression

type Expression struct {
	Term    *Term     `@@`
	OpTerms []*OpTerm `(@@)*`
}

type Factor

type Factor struct {
	Number        *int64      `  @Int`
	Variable      *string     `| @"x"`
	Subexpression *Expression `| "(" @@ ")"`
}

type OpTerm

type OpTerm struct {
	Op   string `@("+" | "-")`
	Term *Term  `@@`
}

type OpValue

type OpValue struct {
	Op     string  `@("*" | "/")`
	Factor *Factor `@@`
}

type Term

type Term struct {
	Factor   *Factor    `@@`
	OpFactor []*OpValue `(@@)*`
}

Jump to

Keyboard shortcuts

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