Skip to content

Commit 7516e48

Browse files
committed
Add escalations support
1 parent 2026aa2 commit 7516e48

17 files changed

+4161
-1821
lines changed

client/client.gen.go

Lines changed: 1518 additions & 854 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/openapi3.json

Lines changed: 2118 additions & 923 deletions
Large diffs are not rendered by default.

cmd/tap-incident/cmd/app.go

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,27 +151,52 @@ func loadConfigOrError(ctx context.Context, configFile string) (cfg *config.Conf
151151
return
152152
}
153153
if configFile == "" {
154-
OUT("No config file (--config) was provided, but is required.\n")
154+
OUT("No config file (--config) was provided.\n")
155155
} else {
156156
OUT("Failed to load config file!\n")
157157
}
158158

159-
OUT(`We expect a config file in JSON format that looks like:
160-
{
161-
"api_key": "<your-api-key>",
162-
}
159+
OUT(`You can provide configuration via:
160+
161+
1. Environment variables:
162+
export INCIDENT_API_KEY="<your-api-key>"
163+
export INCIDENT_ENDPOINT="https://api.incident.io" (optional)
164+
165+
2. Config file in JSON format:
166+
{
167+
"api_key": "<your-api-key>",
168+
"endpoint": "<api-endpoint>" (optional)
169+
}
163170
`)
164171
}()
165172

166-
if configFile == "" {
167-
return nil, errors.New("No config file set! (--config)")
173+
// Try to load from environment variables first
174+
cfg = &config.Config{
175+
APIKey: os.Getenv("INCIDENT_API_KEY"),
176+
Endpoint: os.Getenv("INCIDENT_ENDPOINT"),
168177
}
169178

170-
cfg, err = config.LoadAndParse(configFile, config.Config{})
171-
if err != nil {
172-
return nil, errors.Wrap(err, "loading config")
179+
// If a config file is provided, load it and merge with env vars
180+
if configFile != "" {
181+
fileCfg, err := config.LoadAndParse(configFile, config.Config{})
182+
if err != nil {
183+
return nil, errors.Wrap(err, "loading config")
184+
}
185+
186+
// File config takes precedence over env vars
187+
if fileCfg.APIKey != "" {
188+
cfg.APIKey = fileCfg.APIKey
189+
}
190+
if fileCfg.Endpoint != "" {
191+
cfg.Endpoint = fileCfg.Endpoint
192+
}
173193
}
194+
195+
// Validate the final config
174196
if err := cfg.Validate(); err != nil {
197+
if configFile == "" && cfg.APIKey == "" {
198+
return nil, errors.New("No API key provided. Set INCIDENT_API_KEY environment variable or use --config flag")
199+
}
175200
data, _ := json.MarshalIndent(err, "", " ")
176201

177202
// Print the validation error in JSON. Needs improving.

development.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,51 @@ go test ./...
99
```
1010

1111
To build the binary, run `make`: this will place a built version of the tool in
12-
the `bin` directory. If you work for incident.io and have a local instance of
13-
the app running, then you can point it to your local environment using the
14-
`--api-key` flag, or an environment variable:
12+
the `bin` directory.
1513

16-
```
14+
## Using Environment Variables
15+
16+
You can provide configuration via environment variables instead of a config file:
17+
18+
```bash
19+
# Required: Set your API key
20+
export INCIDENT_API_KEY="your-api-key"
21+
22+
# Optional: Set a custom endpoint (defaults to https://api.incident.io)
1723
export INCIDENT_ENDPOINT="http://localhost:3001/api/public"
24+
25+
# Run discovery mode
26+
./bin/tap-incident --discover
27+
28+
# Extract data
29+
./bin/tap-incident
1830
```
1931

32+
Note: If you provide both environment variables and a config file, the config file values take precedence.
33+
2034
[go]: https://go.dev/doc/install
2135

36+
## Updating the API client
37+
38+
When the incident.io API changes, you need to refresh the client code:
39+
40+
1. **Update the OpenAPI specification**:
41+
```
42+
make client/openapi3.json
43+
```
44+
This fetches the latest API spec from https://api.incident.io/v1/openapiV3.json
45+
46+
2. **Regenerate the client code**:
47+
```
48+
make client/client.gen.go
49+
```
50+
This uses `oapi-codegen` to generate Go types and client methods from the OpenAPI spec
51+
52+
3. **Update dependencies** (if needed):
53+
```
54+
go mod tidy
55+
```
56+
2257
## Adding new streams
2358

2459
Each table the tap imports is implemented as a `Stream`. If you want to export a new table then you can just add a new `stream_<tablename>` and implement the stream interface. See the tap folder for more examples.

docs/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,11 @@ You can adjust which columns within a stream you wish to export similarly, by ad
193193
- Primary key column(s): id, custom_field_id
194194
- Replication: full table
195195
- API documentation: [Users V2](https://api-docs.incident.io/tag/Users-V2)
196+
197+
### Escalations
198+
199+
- Table name: escalations
200+
- Description: Escalations track the lifecycle of pages sent through escalation paths or directly to users, including who was notified, when they acknowledged, and the current status.
201+
- Primary key column(s): id
202+
- Replication: full table
203+
- API documentation: [Escalations V2](https://api-docs.incident.io/tag/Escalations-V2)

go.mod

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/google/go-cmp v0.5.9
1212
github.com/hashicorp/go-cleanhttp v0.5.2
1313
github.com/hashicorp/go-retryablehttp v0.7.7
14+
github.com/oapi-codegen/runtime v1.1.1
1415
github.com/onsi/ginkgo/v2 v2.13.0
1516
github.com/onsi/gomega v1.28.0
1617
github.com/pkg/errors v0.9.1
@@ -28,24 +29,24 @@ require (
2829
github.com/go-openapi/swag v0.21.1 // indirect
2930
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
3031
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
31-
github.com/google/uuid v1.3.0 // indirect
32+
github.com/google/uuid v1.5.0 // indirect
3233
github.com/invopop/yaml v0.1.0 // indirect
3334
github.com/josharian/intern v1.0.0 // indirect
34-
github.com/labstack/echo/v4 v4.9.1 // indirect
35-
github.com/labstack/gommon v0.4.0 // indirect
35+
github.com/labstack/echo/v4 v4.11.4 // indirect
36+
github.com/labstack/gommon v0.4.2 // indirect
3637
github.com/mailru/easyjson v0.7.7 // indirect
3738
github.com/mattn/go-colorable v0.1.13 // indirect
3839
github.com/mattn/go-isatty v0.0.20 // indirect
3940
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
4041
github.com/valyala/bytebufferpool v1.0.0 // indirect
4142
github.com/valyala/fasttemplate v1.2.2 // indirect
4243
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
43-
golang.org/x/crypto v0.12.0 // indirect
44+
golang.org/x/crypto v0.17.0 // indirect
4445
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
4546
golang.org/x/mod v0.12.0 // indirect
46-
golang.org/x/net v0.14.0 // indirect
47+
golang.org/x/net v0.19.0 // indirect
4748
golang.org/x/sys v0.20.0 // indirect
48-
golang.org/x/text v0.12.0 // indirect
49+
golang.org/x/text v0.14.0 // indirect
4950
golang.org/x/tools v0.12.0 // indirect
5051
gopkg.in/yaml.v2 v2.4.0 // indirect
5152
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
4646
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
4747
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
4848
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
49-
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
50-
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
49+
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
50+
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
5151
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
5252
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
5353
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
@@ -66,26 +66,26 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
6666
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
6767
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
6868
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
69-
github.com/labstack/echo/v4 v4.9.1 h1:GliPYSpzGKlyOhqIbG8nmHBo3i1saKWFOgh41AN3b+Y=
70-
github.com/labstack/echo/v4 v4.9.1/go.mod h1:Pop5HLc+xoc4qhTZ1ip6C0RtP7Z+4VzRLWZZFKqbbjo=
71-
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
72-
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
69+
github.com/labstack/echo/v4 v4.11.4 h1:vDZmA+qNeh1pd/cCkEicDMrjtrnMGQ1QFI9gWN1zGq8=
70+
github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8=
71+
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
72+
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
7373
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
7474
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
7575
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
7676
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
7777
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
78-
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
7978
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
8079
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
81-
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
8280
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
8381
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
8482
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
8583
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
8684
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
8785
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
8886
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
87+
github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro=
88+
github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg=
8989
github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4=
9090
github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
9191
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
@@ -102,38 +102,33 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
102102
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
103103
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
104104
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
105-
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
106-
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
107-
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
105+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
106+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
108107
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
109108
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
110-
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
111109
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
112110
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
113111
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
114112
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
115-
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
116-
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
113+
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
114+
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
117115
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM=
118116
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
119117
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
120118
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
121-
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
122-
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
119+
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
120+
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
123121
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
124-
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
125-
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
126-
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
127122
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
128123
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
129124
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
130125
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
131-
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
132-
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
126+
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
127+
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
133128
golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
134129
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
135-
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
136-
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
130+
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
131+
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
137132
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
138133
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
139134
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
@@ -143,7 +138,6 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
143138
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
144139
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
145140
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
146-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
147141
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
148142
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
149143
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

model/alert_actor_v2.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package model
2+
3+
import "github.com/incident-io/singer-tap/client"
4+
5+
type alertActorV2 struct{}
6+
7+
var AlertActorV2 alertActorV2
8+
9+
func (alertActorV2) Schema() Property {
10+
return Property{
11+
Types: []string{"object"},
12+
Properties: map[string]Property{
13+
"id": {
14+
Types: []string{"string"},
15+
},
16+
"title": {
17+
Types: []string{"string"},
18+
},
19+
},
20+
}
21+
}
22+
23+
func (alertActorV2) Serialize(input client.AlertActorV2) map[string]any {
24+
return map[string]any{
25+
"id": input.Id,
26+
"title": input.Title,
27+
}
28+
}

model/alert_slim_v2.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package model
2+
3+
import "github.com/incident-io/singer-tap/client"
4+
5+
type alertSlimV2 struct{}
6+
7+
var AlertSlimV2 alertSlimV2
8+
9+
func (alertSlimV2) Schema() Property {
10+
return Property{
11+
Types: []string{"object"},
12+
Properties: map[string]Property{
13+
"id": {
14+
Types: []string{"string"},
15+
},
16+
"title": {
17+
Types: []string{"string"},
18+
},
19+
},
20+
}
21+
}
22+
23+
func (alertSlimV2) Serialize(input client.AlertSlimV2) map[string]any {
24+
return map[string]any{
25+
"id": input.Id,
26+
"title": input.Title,
27+
}
28+
}

model/chat_channel_slim_v2.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package model
2+
3+
import "github.com/incident-io/singer-tap/client"
4+
5+
type chatChannelSlimV2 struct{}
6+
7+
var ChatChannelSlimV2 chatChannelSlimV2
8+
9+
func (chatChannelSlimV2) Schema() Property {
10+
return Property{
11+
Types: []string{"object"},
12+
Properties: map[string]Property{
13+
"slack_channel_id": Optional(Property{
14+
Types: []string{"string"},
15+
}),
16+
"slack_team_id": Optional(Property{
17+
Types: []string{"string"},
18+
}),
19+
"microsoft_teams_channel_id": Optional(Property{
20+
Types: []string{"string"},
21+
}),
22+
"microsoft_teams_team_id": Optional(Property{
23+
Types: []string{"string"},
24+
}),
25+
},
26+
}
27+
}
28+
29+
func (chatChannelSlimV2) Serialize(input client.ChatChannelSlimV2) map[string]any {
30+
result := make(map[string]any)
31+
32+
if input.SlackChannelId != nil {
33+
result["slack_channel_id"] = *input.SlackChannelId
34+
}
35+
if input.SlackTeamId != nil {
36+
result["slack_team_id"] = *input.SlackTeamId
37+
}
38+
if input.MicrosoftTeamsChannelId != nil {
39+
result["microsoft_teams_channel_id"] = *input.MicrosoftTeamsChannelId
40+
}
41+
if input.MicrosoftTeamsTeamId != nil {
42+
result["microsoft_teams_team_id"] = *input.MicrosoftTeamsTeamId
43+
}
44+
45+
return result
46+
}

0 commit comments

Comments
 (0)