apihawk/microcell

MicroCell 是一个用于编写 AppCell 插件的工具包。

安装: 9

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 3

分支: 0

类型:项目

1.1.1 2020-06-19 08:28 UTC

README

MicroCell 是一个用于编写 AppCell 插件的工具包。

AppCell 是一个集成了插件架构的协调软件。它允许一个软件与多个其他软件进行通信,而无需耦合、修改主软件源代码或硬编码插件。这样,各种软件的集成以及服务之间的迁移将变得更快、更安全、更容易实现。

文档

要获取完整文档,请访问 apihawk.com/help

安装

microcell 可在 composer 上使用。要安装它,输入

通过 ApiHawk 安装器

composer global require "apihawk/installer"

请确保将 composer 的系统级 vendor bin 目录添加到您的 $PATH 中,以便您的系统可以找到 ApiHawk 可执行文件。此目录的位置因操作系统而异。在 macOS 和 GNU/Linux 发行版中,它是 $HOME/.composer/vendor/bin。

安装完成后,运行 apihawk new-cell 命令将在您指定的目录中创建一个新的 MicroCell 安装。例如,运行 apihawk new-cell YourVendorName 将创建一个名为 YourVendorNameCell 的目录,其中包含带有所有 MicroCell 依赖项的新鲜 MicroCell 安装

apihawk new-cell YourVendorName

通过 Composer Create-Project

composer create-project --prefer-dist apihawk/microcell YourVendorName

安装框架后,运行 "app renaming" 命令以获得包含所有必需安装文件的全新框架。

APPCELL 安装文件

./application app:rename
Renaming the application...

 What is your application name?:
 > ApiHawk

 What is your website? e.g. https://apihawk.com. The website should be reachable:
 > https://apihawk.com

Generate folder structure. (./appcell): ✔
Fetch website metadata: ✔
Writing AppCell.json: ✔
Please select what functionalities, your service will have (defaults to renewable, suspendable). Multiple choice support. E.g. 0,1,2,3
  [0] Renewable
  [1] Suspendable
  [2] Availability Check
  [3] SSO (single-sign-on)
 > 0,1,2,3
You have just selected: Renewable, Suspendable, Availability Check, SSO (single-sign-on)
Generate plugins.json: ✔
Generate resources.json: ✔
Generate settings.json: ✔
Generate action files: loading... 
 created successfully.
 created successfully.
 created successfully.
 created successfully.
 created successfully.
 created successfully.
 created successfully.
 created successfully.
 created successfully.
 created successfully.
Generate action files: ✔

重命名完成后,您将在 ./appcell./app/Actions 目录中获得新文件。要开始构建应用程序,需要创建格式为 .env 的文件

AH_AMQP_HOST=
AH_AMQP_PORT=
AH_AMQP_USER=
AH_AMQP_PASS=
AH_AMQP_VHOST=/
AH_AMQP_HEARTBEAT=15

AH_ETCD_HOST=
AH_ETCD_PORT=
AH_ETCD_USER=
AH_ETCD_PASS=

联系 ApiHawk 以获取访问所需服务的权限。 ApiHawk 联系方式

生成的文件

appcell.json

{
    "name": "applicationCell",
    "description": "AppCell Application Cell - Software Development for Service Providers. Cloud Billing & Automation Solutions, Software development, Know-How, API Consulting",
    "license": "BSD-3-Clause",
    "minimum-stability": "dev",
    "type": "plugin",
    "support": {
        "email": "thehawks@apihawk.com"
    },
    "homepage": "https://apihawk.com",
    "prefer-stable": true,
    "config": [],
    "require": {
        "appcell": ">=1",
        "etcd": ">=3.0",
        "scope": [
            "customer_product",
            "catalog_product_field",
            "customer",
            "company",
            "email"
        ]
    }
}

plugins.json

{
    "plugin": {
        "application": {
            "implements": [
                "https://repository.appcell.io/core/interface/service.schema.json",
                "https://repository.appcell.io/core/interface/renewable.schema.json",
                "https://repository.appcell.io/core/interface/suspendable.schema.json",
                "https://repository.appcell.io/core/interface/availability.schema.json",
                "https://repository.appcell.io/core/interface/impersonate.schema.json"
            ],
            "actions": {
                "create": {
                    "resource": "default",
                    "action": "create",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/create.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/create.result.json"
                },
                "fetch": {
                    "resource": "default",
                    "action": "fetch",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/fetch.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/fetch.result.json"
                },
                "update": {
                    "resource": "default",
                    "action": "update",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/update.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/update.result.json"
                },
                "delete": {
                    "resource": "default",
                    "action": "delete",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/delete.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/delete.result.json"
                },
                "renew": {
                    "resource": "default",
                    "action": "renew",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/renew.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/renew.result.json"
                },
                "suspend": {
                    "resource": "default",
                    "action": "suspend",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/suspend.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/suspend.result.json"
                },
                "unsuspend": {
                    "resource": "default",
                    "action": "unsuspend",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/unsuspend.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/unsuspend.result.json"
                },
                "checkAvailability": {
                    "resource": "default",
                    "action": "checkAvailability",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/checkAvailability.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/checkAvailability.result.json"
                },
                "impersonate": {
                    "resource": "default",
                    "action": "impersonate",
                    "$payload": "https://repository.appcell.io/applicationcell/schema/default/impersonate.payload.json",
                    "$result": "https://repository.appcell.io/applicationcell/schema/default/impersonate.result.json"
                }
            }
        }
    }
}

resources.json

{
    "resources": {
        "default": {
            "identifier": "domain",
            "rest": [
                "create",
                "fetch",
                "fetchAll",
                "update",
                "delete"
            ],
            "actions": {
                "renew": [],
                "suspend": [],
                "unsuspend": [],
                "checkAvailability": [],
                "impersonate": []
            }
        }
    }
}

settings.json

{
    "fields": [
        {
            "name": "Account Plan",
            "field_key": "plan",
            "value": "basic"
        }
    ],
    "options": [
        {
            "name": "Domain",
            "key": "domain",
            "type": "text",
            "value_type": "text",
            "required": true,
            "provider": "user"
        }
    ]
}