func (t *Template) GetAWSLambdaPermissionWithName(name string) (AWSLambdaPermission, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case AWSLambdaPermission:
			return resource, nil
		case map[string]interface{}:
			if resType, ok := resource["Type"]; ok {
				if resType == "AWS::Lambda::Permission" {
					if b, err := json.Marshal(resource); err == nil {
						var result AWSLambdaPermission
						if err := json.Unmarshal(b, &result); err == nil {
							return result, nil
						}
					}
				}
			}
		}
	}
	return AWSLambdaPermission{}, errors.New("resource not found")
}
GetAWSLambdaPermissionWithName retrieves all AWSLambdaPermission items from an AWS CloudFormation template
whose logical ID matches the provided name. Returns an error if not found.
package cloudformation
import (
	"encoding/json"
	"errors"
	"fmt"
)
type AWSLambdaPermission struct {
	Action string `json:"Action,omitempty"`
	EventSourceToken string `json:"EventSourceToken,omitempty"`
	FunctionName string `json:"FunctionName,omitempty"`
	Principal string `json:"Principal,omitempty"`
	SourceAccount string `json:"SourceAccount,omitempty"`
	SourceArn string `json:"SourceArn,omitempty"`
}
func (r *AWSLambdaPermission) AWSCloudFormationType() string {
	return "AWS::Lambda::Permission"
}
func (r *AWSLambdaPermission) MarshalJSON() ([]byte, error) {
	type Properties AWSLambdaPermission
	return json.Marshal(&struct {
		Type       string
		Properties Properties
	}{
		Type:       r.AWSCloudFormationType(),
		Properties: (Properties)(*r),
	})
}
func (r *AWSLambdaPermission) UnmarshalJSON(b []byte) error {
	type Properties AWSLambdaPermission
	res := &struct {
		Type       string
		Properties *Properties
	}{}
	if err := json.Unmarshal(b, &res); err != nil {
		fmt.Printf("ERROR: %s\n", err)
		return err
	}
	if res.Properties != nil {
		*r = AWSLambdaPermission(*res.Properties)
	}
	return nil
}
func (t *Template) GetAllAWSLambdaPermissionResources() map[string]AWSLambdaPermission {
	results := map[string]AWSLambdaPermission{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case AWSLambdaPermission:
			results[name] = resource
		case map[string]interface{}:
			if resType, ok := resource["Type"]; ok {
				if resType == "AWS::Lambda::Permission" {
					if b, err := json.Marshal(resource); err == nil {
						var result AWSLambdaPermission
						if err := json.Unmarshal(b, &result); err == nil {
							results[name] = result
						}
					}
				}
			}
		}
	}
	return results
}