Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions docs/components/Rootly.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { CardGrid, LinkCard } from "@astrojs/starlight/components";
<CardGrid>
<LinkCard title="Create Event" href="#create-event" description="Add a timeline event to a Rootly incident" />
<LinkCard title="Create Incident" href="#create-incident" description="Create a new incident in Rootly" />
<LinkCard title="Get Incident" href="#get-incident" description="Retrieve a single incident from Rootly by ID" />
<LinkCard title="Update Incident" href="#update-incident" description="Update an existing incident in Rootly" />
</CardGrid>

Expand Down Expand Up @@ -160,6 +161,59 @@ Returns the created incident object including:
}
```

<a id="get-incident"></a>

## Get Incident

The Get Incident component retrieves a single incident from Rootly by its ID.

### Use Cases

- **Incident enrichment**: Fetch current incident details to use in downstream workflow steps
- **Status checks**: Check the current status of an incident before taking action
- **Data retrieval**: Pull incident information for reporting or notifications

### Configuration

- **Incident ID**: The UUID of the incident to retrieve (required, supports expressions)

### Output

Returns the incident object including:
- **id**: Incident UUID
- **sequential_id**: Sequential incident number
- **title**: Incident title
- **slug**: URL-friendly slug
- **summary**: Incident summary
- **status**: Current incident status
- **severity**: Incident severity level
- **started_at**: When the incident started
- **mitigated_at**: When the incident was mitigated
- **resolved_at**: When the incident was resolved
- **updated_at**: Last update timestamp
- **url**: Link to the incident in Rootly

### Example Output

```json
{
"data": {
"id": "abc123-def456",
"sequential_id": 42,
"severity": "sev1",
"slug": "database-connection-issues",
"started_at": "2026-01-19T12:00:00Z",
"status": "started",
"summary": "Users are experiencing slow database queries and connection timeouts.",
"title": "Database connection issues",
"updated_at": "2026-01-19T12:00:00Z",
"url": "https://app.rootly.com/incidents/abc123-def456"
},
"timestamp": "2026-01-19T12:00:00Z",
"type": "rootly.incident"
}
```

<a id="update-incident"></a>

## Update Incident
Expand Down
10 changes: 10 additions & 0 deletions pkg/integrations/rootly/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ var exampleOutputUpdateIncidentBytes []byte
var exampleOutputUpdateIncidentOnce sync.Once
var exampleOutputUpdateIncident map[string]any

//go:embed example_output_get_incident.json
var exampleOutputGetIncidentBytes []byte

var exampleOutputGetIncidentOnce sync.Once
var exampleOutputGetIncident map[string]any

//go:embed example_data_on_incident.json
var exampleDataOnIncidentBytes []byte

Expand All @@ -43,6 +49,10 @@ func (c *UpdateIncident) ExampleOutput() map[string]any {
return utils.UnmarshalEmbeddedJSON(&exampleOutputUpdateIncidentOnce, exampleOutputUpdateIncidentBytes, &exampleOutputUpdateIncident)
}

func (c *GetIncident) ExampleOutput() map[string]any {
return utils.UnmarshalEmbeddedJSON(&exampleOutputGetIncidentOnce, exampleOutputGetIncidentBytes, &exampleOutputGetIncident)
}

func (t *OnIncident) ExampleData() map[string]any {
return utils.UnmarshalEmbeddedJSON(&exampleDataOnIncidentOnce, exampleDataOnIncidentBytes, &exampleDataOnIncident)
}
16 changes: 16 additions & 0 deletions pkg/integrations/rootly/example_output_get_incident.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "rootly.incident",
"data": {
"id": "abc123-def456",
"sequential_id": 42,
"title": "Database connection issues",
"slug": "database-connection-issues",
"summary": "Users are experiencing slow database queries and connection timeouts.",
"status": "started",
"severity": "sev1",
"started_at": "2026-01-19T12:00:00Z",
"updated_at": "2026-01-19T12:00:00Z",
"url": "https://app.rootly.com/incidents/abc123-def456"
},
"timestamp": "2026-01-19T12:00:00Z"
}
147 changes: 147 additions & 0 deletions pkg/integrations/rootly/get_incident.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package rootly

import (
"errors"
"fmt"
"net/http"

"github.com/google/uuid"
"github.com/mitchellh/mapstructure"
"github.com/superplanehq/superplane/pkg/configuration"
"github.com/superplanehq/superplane/pkg/core"
)

type GetIncident struct{}

type GetIncidentSpec struct {
IncidentID string `json:"incidentId"`
}

func (c *GetIncident) Name() string {
return "rootly.getIncident"
}

func (c *GetIncident) Label() string {
return "Get Incident"
}

func (c *GetIncident) Description() string {
return "Retrieve a single incident from Rootly by ID"
}

func (c *GetIncident) Documentation() string {
return `The Get Incident component retrieves a single incident from Rootly by its ID.

## Use Cases

- **Incident enrichment**: Fetch current incident details to use in downstream workflow steps
- **Status checks**: Check the current status of an incident before taking action
- **Data retrieval**: Pull incident information for reporting or notifications

## Configuration

- **Incident ID**: The UUID of the incident to retrieve (required, supports expressions)

## Output

Returns the incident object including:
- **id**: Incident UUID
- **sequential_id**: Sequential incident number
- **title**: Incident title
- **slug**: URL-friendly slug
- **summary**: Incident summary
- **status**: Current incident status
- **severity**: Incident severity level
- **started_at**: When the incident started
- **mitigated_at**: When the incident was mitigated
- **resolved_at**: When the incident was resolved
- **updated_at**: Last update timestamp
- **url**: Link to the incident in Rootly`
}

func (c *GetIncident) Icon() string {
return "search"
}

func (c *GetIncident) Color() string {
return "gray"
}

func (c *GetIncident) OutputChannels(configuration any) []core.OutputChannel {
return []core.OutputChannel{core.DefaultOutputChannel}
}

func (c *GetIncident) Configuration() []configuration.Field {
return []configuration.Field{
{
Name: "incidentId",
Label: "Incident ID",
Type: configuration.FieldTypeString,
Required: true,
Placeholder: "e.g., abc123-def456",
Description: "The UUID of the incident to retrieve",
},
}
}

func (c *GetIncident) Setup(ctx core.SetupContext) error {
spec := GetIncidentSpec{}
err := mapstructure.Decode(ctx.Configuration, &spec)
if err != nil {
return fmt.Errorf("error decoding configuration: %v", err)
}

if spec.IncidentID == "" {
return errors.New("incidentId is required")
}

return nil
}

func (c *GetIncident) Execute(ctx core.ExecutionContext) error {
spec := GetIncidentSpec{}
err := mapstructure.Decode(ctx.Configuration, &spec)
if err != nil {
return fmt.Errorf("error decoding configuration: %v", err)
}

client, err := NewClient(ctx.HTTP, ctx.Integration)
if err != nil {
return fmt.Errorf("error creating client: %v", err)
}

incident, err := client.GetIncident(spec.IncidentID)
if err != nil {
return fmt.Errorf("failed to get incident: %v", err)
}

return ctx.ExecutionState.Emit(
core.DefaultOutputChannel.Name,
"rootly.incident",
[]any{incident},
)
}

func (c *GetIncident) Cancel(ctx core.ExecutionContext) error {
return nil
}

func (c *GetIncident) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error) {
return ctx.DefaultProcessing()
}

func (c *GetIncident) Actions() []core.Action {
return []core.Action{}
}

func (c *GetIncident) HandleAction(ctx core.ActionContext) error {
return nil
}

func (c *GetIncident) HandleWebhook(ctx core.WebhookRequestContext) (int, error) {
return http.StatusOK, nil
}

func (c *GetIncident) Cleanup(ctx core.SetupContext) error {
return nil
}
Loading