104 lines
2.7 KiB
Markdown
104 lines
2.7 KiB
Markdown
# StellaOps Plugin Templates
|
|
|
|
This directory contains `dotnet new` templates for creating StellaOps plugins.
|
|
|
|
## Available Templates
|
|
|
|
| Template | Short Name | Description |
|
|
|----------|------------|-------------|
|
|
| StellaOps Connector Plugin | `stellaops-plugin-connector` | Create a data connector plugin (e.g., VEX, advisory feeds) |
|
|
| StellaOps Scheduled Job Plugin | `stellaops-plugin-scheduler` | Create a scheduled job plugin |
|
|
|
|
## Installation
|
|
|
|
### From Local Directory
|
|
|
|
```bash
|
|
dotnet new install ./templates
|
|
```
|
|
|
|
### From NuGet Package
|
|
|
|
```bash
|
|
dotnet new install StellaOps.Templates
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Create a Connector Plugin
|
|
|
|
```bash
|
|
# Create with defaults
|
|
dotnet new stellaops-plugin-connector -n MyCompany.AcmeConnector
|
|
|
|
# Create with custom parameters
|
|
dotnet new stellaops-plugin-connector \
|
|
-n MyCompany.AcmeConnector \
|
|
--connectorName Acme \
|
|
--connectorId acme-vex \
|
|
--namespace MyCompany.Plugins.Acme
|
|
```
|
|
|
|
### Create a Scheduled Job Plugin
|
|
|
|
```bash
|
|
# Create with defaults
|
|
dotnet new stellaops-plugin-scheduler -n MyCompany.CleanupJob
|
|
|
|
# Create with custom parameters
|
|
dotnet new stellaops-plugin-scheduler \
|
|
-n MyCompany.CleanupJob \
|
|
--jobName Cleanup \
|
|
--cronSchedule "0 */6 * * *" \
|
|
--namespace MyCompany.Plugins.Cleanup
|
|
```
|
|
|
|
## Template Parameters
|
|
|
|
### Connector Plugin Parameters
|
|
|
|
| Parameter | Description | Default |
|
|
|-----------|-------------|---------|
|
|
| `--connectorName` | Name of the connector | MyConnector |
|
|
| `--connectorId` | Unique connector identifier | my-connector |
|
|
| `--namespace` | Root namespace | StellaOps.Plugin.MyConnector |
|
|
| `--pluginVersion` | Initial version | 1.0.0 |
|
|
|
|
### Scheduler Plugin Parameters
|
|
|
|
| Parameter | Description | Default |
|
|
|-----------|-------------|---------|
|
|
| `--jobName` | Name of the scheduled job | MyJob |
|
|
| `--cronSchedule` | Default cron schedule | 0 0 * * * |
|
|
| `--namespace` | Root namespace | StellaOps.Plugin.MyJob |
|
|
| `--pluginVersion` | Initial version | 1.0.0 |
|
|
|
|
## Building the Template Pack
|
|
|
|
```bash
|
|
cd templates
|
|
dotnet pack -c Release
|
|
```
|
|
|
|
This creates `StellaOps.Templates.<version>.nupkg` that can be published to NuGet.
|
|
|
|
## Uninstalling Templates
|
|
|
|
```bash
|
|
dotnet new uninstall StellaOps.Templates
|
|
```
|
|
|
|
## Plugin Development Guide
|
|
|
|
After creating a plugin from a template:
|
|
|
|
1. **Update options**: Modify the `*Options.cs` file with your configuration
|
|
2. **Implement logic**: Add your business logic to the main class
|
|
3. **Add validation**: Update the validator for your specific requirements
|
|
4. **Add tests**: Create a test project for your plugin
|
|
5. **Build**: `dotnet build -c Release`
|
|
6. **Sign**: `cosign sign --key $COSIGN_KEY <assembly.dll>`
|
|
7. **Deploy**: Copy to the plugin binaries directory
|
|
|
|
For more details, see `docs/10_PLUGIN_SDK_GUIDE.md`.
|