You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: resources_test.go
    path of file: ./repos/up/platform/lambda/stack/resources
    
    the code of the file until where you have to start completion: package resources

import (
	"encoding/json"
	"fmt"
	"os"
	"strings"

	"github.com/apex/up"
	"github.com/apex/up/config"
)

// keys returns keys from a map.
func keys(m Map) (v []string) {
	for k := range m {
		v = append(v, k)
	}
	return
}

// getResource returns resource by name.
func getResource(c *Config, name string) Map {
	tmpl := New(c)
	r := tmpl["Resources"].(Map)

	v, ok := r[name].(Map)
	if !ok {
		k := strings.Join(keys(r), "\n  - ")
		panic(fmt.Sprintf("resource %q does not exist in:\n\n  - %s", name, k))
	}

	return v
}

// dump a resource to stdout.
func dump(c *Config, name string) {
	r := getResource(c, name)
	{
		enc := json.NewEncoder(os.Stdout)
		enc.SetIndent("", "  ")
		enc.Encode(r)
	}
}

func Example_api() {
	c := &Config{
		Config: &up.Config{
			Name: "polls",
		},
	}

	dump(c, "Api")
	// Output:
	// {
	//   "Properties": {
	//     "BinaryMediaTypes": [
	//       "*/*"
	//     ],
	//     "Description": "Managed by Up.",
	//     "Name": {
	//       "Ref": "Name"
	//     }
	//   },
	//   "Type": "AWS::ApiGateway::RestApi"
	// }
}

func Example_apiRootMethod() {
	c := &Config{
		Config: &up.Config{
			Name: "polls",
		},
	}

	dump(c, "ApiRootMethod")
	// Output:
	// {
	//   "Properties": {
	//     "AuthorizationType": "NONE",
	//     "HttpMethod": "ANY",
	//     "Integration": {
	//       "IntegrationHttpMethod": "POST",
	//       "Type": "AWS_PROXY",
	//       "Uri": {
	//         "Fn::Join": [
	//           "",
	//           [
	//             "arn:aws:apiga
    
func Example_stagePermission() {
	c := &Config{
		Config: &up.Config{
			Name: "polls",
			Stages: config.Stages{
				"production": &config.Stage{
					Name: "production",
				},
			},
		},
		Versions: Versions{
			"production": "15",
		},
	}

	dump(c, "ApiLambdaPermissionProduction")
	// Output:
	// {
	//   "DependsOn": "ApiFunctionAliasProduction",
	//   "Properties": {
	//     "Action": "lambda:invokeFunction",
	//     "FunctionName": {
	//       "Fn::Join": [
	//         ":",
	//         [
	//           "arn",
	//           "aws",
	//           "lambda",
	//           {
	//             "Ref": "AWS::Region"
	//           },
	//           {
	//             "Ref": "AWS::AccountId"
	//           },
	//           "function",
	//           {
	//             "Fn::Join": [
	//               ":",
	//               [
	//                 {
	//                   "Ref": "FunctionName"
	//                 },
	//                 "production"
	//               ]
	//             ]
	//           }
	//         ]
	//       ]
	//     },
	//     "Principal": "apigateway.amazonaws.com",
	//     "SourceArn": {
	//       "Fn::Join": [
	//         "",
	//         [
	//           "arn:aws:execute-api",
	//           ":",
	//           {
	//             "Ref": "AWS::Region"
	//           },
	//           ":",
	//           {
	//             "Ref": "AWS::AccountId"
	//           },
	//           ":",
	//           {
	//             "Ref": "Api"
	//           },
	//           "/*"
	//         ]
	//       ]
	//     }
	//   },
	//   "Type": "AWS::Lambda::Permission"
	// }
}