3 Star 0 Fork 0

mirrors_medikoo / serverless-manifest-plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Serverless Manifest Plugin

Generate a list of API endpoints, function information & stack outputs to a service manifest file.

The manifest data can be quite useful for:

After serverless deploy finishes, a .serverless/manifest.json file, is created.

Usage

Add to plugins array in serverless.yml

service: my-example-service

plugins:
 - serverless-manifest-plugin

Then run serverless manifest --help to see all options.

Options

You can set options via CLI flags or via the custom field in serverless.yml

# Custom settings for manifest plugin
custom:
  manifest:
    # Custom manifest output path. Default ./.serverless/manifest.json
    output: ./serverless.manifest.json
    # set to true to disable manifest file from being created
    disableOutput: false
    # Path to custom file with JS function for additional post processing
    postProcess: ./my-file-to-process-manifest-data.js
    # Set plugin log output to silent. Default false
    silent: false
    # Path to the function code. Default serverless.yml location (process.cwd())
    srcPath: ./dist

plugins:
 - serverless-manifest-plugin

Programatic usage

Using the json flag will pipe the service manifest to stdout. You can use this with a tool like jq to do something programatic with the data.

serverless manifest --json

Example:

serverless manifest --json | jq '.dev.functions'
# Outputs service function info

Generating a manifest file

The plugin will automatically create the manifest when you run serverless deploy

You can also manually generate the manifest at anytime with

serverless manifest

Additionally sls deploy --noDeploy will also generate a manifest file.

Example

Outputs urls, functions, outputs etc.

.serverless/manifest.json

{
  "dev": {
    "urls": {
      "apiGateway": "https://abc1234.execute-api.us-east-1.amazonaws.com/dev",
      "apiGatewayBaseURL": "https://abc1234.execute-api.us-east-1.amazonaws.com/dev",
      "httpApi": "https://qwertyxyz.execute-api.us-east-1.amazonaws.com",
      "httpApiBaseURL": "https://qwertyxyz.execute-api.us-east-1.amazonaws.com",
      "byPath": {
        "/user/profile": {
          "url": "https://qwertyxyz.execute-api.us-east-1.amazonaws.com/user/profile",
          "methods": [
            "POST",
            "GET"
          ]
        },
        "/tester": {
          "url": "https://abc1234.execute-api.us-east-1.amazonaws.com/dev/tester",
          "methods": [
            "POST"
          ]
        },
        "/wow-cool": {
          "url": "https://abc1234.execute-api.us-east-1.amazonaws.com/dev/wow-cool",
          "methods": [
            "POST"
          ]
        }
      },
      "byFunction": {
        "getProfileInfo": {
          "url": "https://qwertyxyz.execute-api.us-east-1.amazonaws.com/user/profile",
          "methods": [
            "GET"
          ]
        },
        "createProfileInfo": {
          "url": "https://qwertyxyz.execute-api.us-east-1.amazonaws.com/user/profile",
          "methods": [
            "POST"
          ]
        },
        "other": {
          "url": "https://abc1234.execute-api.us-east-1.amazonaws.com/dev/tester",
          "methods": [
            "POST"
          ]
        },
        "forth": {
          "url": "https://abc1234.execute-api.us-east-1.amazonaws.com/dev/wow-cool",
          "methods": [
            "POST"
          ]
        }
      },
      "byMethod": {
        "GET": [
          "https://qwertyxyz.execute-api.us-east-1.amazonaws.com/user/profile"
        ],
        "POST": [
          "https://qwertyxyz.execute-api.us-east-1.amazonaws.com/user/profile",
          "https://abc1234.execute-api.us-east-1.amazonaws.com/dev/tester",
          "https://abc1234.execute-api.us-east-1.amazonaws.com/dev/wow-cool"
        ]
      }
    },
    "functions": {
      "getProfileInfo": {
        "name": "http-api-node-dev-getProfileInfo",
        "arn": "arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:http-api-node-dev-getProfileInfo:4",
        "runtime": "nodejs12.x",
        "triggers": [
          "httpApi"
        ],
        "dependancies": {
          "direct": [
            "faker@^4.1.0",
            "analytics@^0.3.4"
          ],
          "nested": [
            "analytics-utils@^0.2.0",
            "dlv@^1.1.3",
            "@analytics/storage-utils@^0.2.3",
            "@analytics/cookie-utils@^0.2.3"
          ]
        }
      },
      "createProfileInfo": {
        "name": "http-api-node-dev-createProfileInfo",
        "arn": "arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:http-api-node-dev-createProfileInfo:4",
        "runtime": "nodejs12.x",
        "triggers": [
          "httpApi"
        ],
        "dependancies": {
          "direct": [
            "faker@^4.1.0",
            "analytics@^0.3.4"
          ],
          "nested": [
            "analytics-utils@^0.2.0",
            "dlv@^1.1.3",
            "@analytics/storage-utils@^0.2.3",
            "@analytics/cookie-utils@^0.2.3"
          ]
        }
      },
      "other": {
        "name": "http-api-node-dev-other",
        "arn": "arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:http-api-node-dev-other:3",
        "runtime": "nodejs12.x",
        "triggers": [
          "http"
        ],
        "dependancies": {
          "direct": [
            "faker@^4.1.0"
          ],
          "nested": []
        }
      },
      "forth": {
        "name": "http-api-node-dev-forth",
        "arn": "arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:http-api-node-dev-forth:2",
        "runtime": "nodejs12.x",
        "triggers": [
          "http"
        ],
        "dependancies": {
          "direct": [
            "lodash@4.17.15"
          ],
          "nested": []
        }
      }
    },
    "outputs": [
      {
        "OutputKey": "OtherLambdaFunctionQualifiedArn",
        "OutputValue": "arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:http-api-node-dev-other:3",
        "Description": "Current Lambda function version"
      },
      {
        "OutputKey": "GetProfileInfoLambdaFunctionQualifiedArn",
        "OutputValue": "arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:http-api-node-dev-getProfileInfo:4",
        "Description": "Current Lambda function version"
      },
      {
        "OutputKey": "ForthLambdaFunctionQualifiedArn",
        "OutputValue": "arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:http-api-node-dev-forth:2",
        "Description": "Current Lambda function version"
      },
      {
        "OutputKey": "ServiceEndpoint",
        "OutputValue": "https://abc1234.execute-api.us-east-1.amazonaws.com/dev",
        "Description": "URL of the service endpoint"
      },
      {
        "OutputKey": "ServerlessDeploymentBucketName",
        "OutputValue": "http-api-node-dev-serverlessdeploymentbucket-12eu0mj9zoo0s"
      },
      {
        "OutputKey": "CreateProfileInfoLambdaFunctionQualifiedArn",
        "OutputValue": "arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:http-api-node-dev-createProfileInfo:4",
        "Description": "Current Lambda function version"
      },
      {
        "OutputKey": "HttpApiUrl",
        "OutputValue": "https://qwertyxyz.execute-api.us-east-1.amazonaws.com",
        "Description": "URL of the HTTP API"
      }
    ]
  }
}
MIT License Copyright (c) 2020 David Wells Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/mirrors_medikoo/serverless-manifest-plugin.git
git@gitee.com:mirrors_medikoo/serverless-manifest-plugin.git
mirrors_medikoo
serverless-manifest-plugin
serverless-manifest-plugin
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891