INNER CODE UNIT · Go
NewStage
mweagle/Sparta · apigateway.go:793
func NewStage(name string) *Stage {
return &Stage{
name: name,
Variables: make(map[string]string),
}
}
// NewResource associates a URL path value with the LambdaAWSInfo golang lambda. To make
// the Resource available, associate one or more Methods via NewMethod().
func (api *API) NewResource(pathPart string, parentLambda *LambdaAWSInfo) (*Resource, error) {
// The key is the path+resource, since we want to support POLA scoped
// security roles based on HTTP method
resourcesKey := fmt.Sprintf("%s%s", parentLambda.lambdaFunctionName(), pathPart)
_, exists := api.resources[resourcesKey]
if exists {
return nil, fmt.Errorf("path %s already defined for lambda function: %s", pathPart, parentLambda.lambdaFunctionName())
}
resource := &Resource{