(Changeevents)
- CreateChangeEvent - Create an event
Create an event
package main
import(
"os"
swosdkgo "github.com/solarwinds/swo-sdk-go"
"github.com/solarwinds/swo-sdk-go/models/components"
"context"
"log"
)
func main() {
s := swosdkgo.New(
swosdkgo.WithSecurity(os.Getenv("SWO_API_TOKEN")),
)
ctx := context.Background()
res, err := s.Changeevents.CreateChangeEvent(ctx, components.ChangeEvent{
ID: swosdkgo.Int64(1731676626),
Name: "app-deploys",
Title: "deployed v45",
Timestamp: swosdkgo.Int64(1731676626),
Source: swosdkgo.String("foo3.example.com"),
Tags: map[string]string{
"app": "foo",
"environment": "production",
},
Links: []components.CommonLink{
components.CommonLink{
Rel: "self",
Href: "https://example.com",
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.ChangeEvent | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateChangeEventResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.APIError | 4XX, 5XX | */* |