https://github.com/bhanurp/status-page
go http wrapper for atlassian Status Page
https://github.com/bhanurp/status-page
atlassian client go http-client page status status-page status-pages statuspage
Last synced: 14 days ago
JSON representation
go http wrapper for atlassian Status Page
- Host: GitHub
- URL: https://github.com/bhanurp/status-page
- Owner: bhanurp
- Created: 2024-04-06T10:54:11.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T16:14:12.000Z (over 1 year ago)
- Last Synced: 2025-02-27T03:49:46.879Z (over 1 year ago)
- Topics: atlassian, client, go, http-client, page, status, status-page, status-pages, statuspage
- Language: Go
- Homepage:
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Status Page


This repository contains the code for the status page http go client, which allows for the creation, updating, and deletion of incidents.
## Overview
The `status-page` provides an API for managing incidents on a status page. It includes functionality for
- creating incidents
- updating incidents
- deleting incidents
- fetching all incidents
## Setup
### Prerequisites
- Go 1.23 or higher
- Environment variables:
- `STATUS_PAGE_BEARER_TOKEN`: Your API key for authentication
- `STATUS_PAGE_ID`: The ID of your status page
- `STATUS_PAGE_COMPONENT_ID`: The ID of your status page component
### Installation
1. Clone the repository:
```sh
git clone https://github.com/bhanurp/status-page.git
cd status-page
```
2. Install Dependencies
```sh
go mod tidy
```
3. Running Tests
To run the tests, ensure that the necessary environment variables are set and use the following command:
```sh
go test -v ./...
```
### Usage
#### Creating an Incident
To create an incident, use the CreateIncident function from the incident package. Here is an example:
```go
package main
import (
"log"
"os"
"github.com/bhanurp/status-page/incident"
)
func main() {
apiKey := os.Getenv("STATUS_PAGE_BEARER_TOKEN")
statusPageID := os.Getenv("STATUS_PAGE_ID")
statusPageComponentID := os.Getenv("STATUS_PAGE_COMPONENT_ID")
client := incident.NewClient(apiKey, statusPageComponentID, statusPageID)
incident := incident.Incident{
Name: "Test Incident",
Status: "investigating",
}
createdIncident, err := client.CreateIncident(incident)
if err != nil {
log.Fatalf("Failed to create incident: %v", err)
}
log.Printf("Created incident: %v", createdIncident)
}
```
#### Updating an Incident
To update an incident, use the UpdateIncident function from the incident package. Here is an example:
```go
package main
import (
"log"
"os"
"github.com/bhanurp/status-page/incident"
)
func main() {
apiKey := os.Getenv("STATUS_PAGE_BEARER_TOKEN")
statusPageID := os.Getenv("STATUS_PAGE_ID")
statusPageComponentID := os.Getenv("STATUS_PAGE_COMPONENT_ID")
client := incident.NewClient(apiKey, statusPageComponentID, statusPageID)
incidentID := "incident_id_here"
updatedIncident := incident.Incident{
ID: incidentID,
Name: "Updated Test Incident",
Status: "resolved",
}
err := client.UpdateIncident(incidentID, updatedIncident)
if err != nil {
log.Fatalf("Failed to update incident: %v", err)
}
log.Printf("Updated incident: %v", updatedIncident)
}
```
#### Deleting an Incident
To delete an incident, use the DeleteIncident function from the incident package. Here is an example:
```go
package main
import (
"log"
"os"
"github.com/bhanurp/status-page/incident"
)
func main() {
apiKey := os.Getenv("STATUS_PAGE_BEARER_TOKEN")
statusPageID := os.Getenv("STATUS_PAGE_ID")
statusPageComponentID := os.Getenv("STATUS_PAGE_COMPONENT_ID")
client := incident.NewClient(apiKey, statusPageComponentID, statusPageID)
incidentID := "incident_id_here"
err := client.DeleteIncident(incidentID)
if err != nil {
log.Fatalf("Failed to delete incident: %v", err)
}
log.Println("Deleted incident successfully")
}
```
### Contributing
We welcome contributions! Please see CONTRIBUTING.md for details on how to contribute to this project.
### License
This project is licensed under the MIT License - see the LICENSE file for details.