Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: notifications #513

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions fastly/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ var ErrInvalidMethod = NewFieldError("Method").Message("invalid")
// was set.
var ErrMissingCertificateMTLS = NewFieldError("Certificate, MutualAuthentication").Message("at least one of the available optional fields is required")

// ErrMissingIntegrationID is an error that is returned when an input struct
// requires a "IntegrationID" key, but one was not set.
var ErrMissingIntegrationID = NewFieldError("IntegrationID")

// Ensure HTTPError is, in fact, an error.
var _ error = (*HTTPError)(nil)

Expand Down
48 changes: 48 additions & 0 deletions fastly/fixtures/notifications/cleanup_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
User-Agent:
- FastlyGo/9.2.1 (+github.com/fastly/go-fastly; go1.22.0)
url: https://api.fastly.com/notifications/integrations/3CrNzH0A2XrdLyLPqjybvW
method: DELETE
response:
body: |
{"status":404,"title":"could not delete integration","detail":"could not delete integration","errors":null}
headers:
Accept-Ranges:
- bytes
Cache-Control:
- no-store
Content-Length:
- "108"
Content-Type:
- application/problem+json
Date:
- Tue, 09 Apr 2024 21:52:34 GMT
Pragma:
- no-cache
Server:
- control-gateway
Status:
- 404 Not Found
Strict-Transport-Security:
- max-age=31536000
Vary:
- Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
X-Cache-Hits:
- "0"
X-Served-By:
- cache-pao-kpao1770049-PAO
X-Timer:
- S1712699554.335740,VS0,VE89
status: 404 Not Found
code: 404
duration: ""
53 changes: 53 additions & 0 deletions fastly/fixtures/notifications/create_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
version: 1
interactions:
- request:
body: '{"Config":{"address":"[email protected]"},"Description":"test description","Name":"test
name","Type":"mailinglist"}'
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
User-Agent:
- FastlyGo/9.2.1 (+github.com/fastly/go-fastly; go1.22.0)
url: https://api.fastly.com/notifications/integrations
method: POST
response:
body: |
{"integration_id":"3CrNzH0A2XrdLyLPqjybvW"}
headers:
Accept-Ranges:
- bytes
Cache-Control:
- no-store
Content-Length:
- "44"
Content-Type:
- application/json
Date:
- Tue, 09 Apr 2024 21:52:31 GMT
Pragma:
- no-cache
Server:
- control-gateway
Status:
- 200 OK
Strict-Transport-Security:
- max-age=31536000
Vary:
- Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
X-Cache-Hits:
- "0"
X-Served-By:
- cache-pao-kpao1770049-PAO
X-Timer:
- S1712699550.457828,VS0,VE600
status: 200 OK
code: 200
duration: ""
49 changes: 49 additions & 0 deletions fastly/fixtures/notifications/create_mailinglist_confirmation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
version: 1
interactions:
- request:
body: '{"Email":"[email protected]"}'
form: {}
headers:
Accept:
- application/json
Content-Type:
- application/json
User-Agent:
- FastlyGo/9.2.1 (+github.com/fastly/go-fastly; go1.22.0)
url: https://api.fastly.com/notifications/mailinglist-confirmations
method: POST
response:
body: ""
headers:
Accept-Ranges:
- bytes
Cache-Control:
- no-store
Content-Type:
- application/json
Date:
- Tue, 09 Apr 2024 21:52:32 GMT
Pragma:
- no-cache
Server:
- control-gateway
Status:
- 204 No Content
Strict-Transport-Security:
- max-age=31536000
Vary:
- Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
X-Cache-Hits:
- "0"
X-Served-By:
- cache-pao-kpao1770049-PAO
X-Timer:
- S1712699552.814909,VS0,VE413
status: 204 No Content
code: 204
duration: ""
45 changes: 45 additions & 0 deletions fastly/fixtures/notifications/delete_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
User-Agent:
- FastlyGo/9.2.1 (+github.com/fastly/go-fastly; go1.22.0)
url: https://api.fastly.com/notifications/integrations/3CrNzH0A2XrdLyLPqjybvW
method: DELETE
response:
body: ""
headers:
Accept-Ranges:
- bytes
Cache-Control:
- no-store
Content-Type:
- application/json
Date:
- Tue, 09 Apr 2024 21:52:34 GMT
Pragma:
- no-cache
Server:
- control-gateway
Status:
- 204 No Content
Strict-Transport-Security:
- max-age=31536000
Vary:
- Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
X-Cache-Hits:
- "0"
X-Served-By:
- cache-pao-kpao1770049-PAO
X-Timer:
- S1712699554.925946,VS0,VE284
status: 204 No Content
code: 204
duration: ""
48 changes: 48 additions & 0 deletions fastly/fixtures/notifications/get_integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
User-Agent:
- FastlyGo/9.2.1 (+github.com/fastly/go-fastly; go1.22.0)
url: https://api.fastly.com/notifications/integrations/3CrNzH0A2XrdLyLPqjybvW
method: GET
response:
body: |
{"id":"3CrNzH0A2XrdLyLPqjybvW","name":"test name","description":"test description","type":"mailinglist","created_at":"2024-04-09T21:52:31Z","updated_at":"2024-04-09T21:52:31Z","status":"confirmation_pending","config":{"address":"[email protected]"}}
headers:
Accept-Ranges:
- bytes
Cache-Control:
- no-store
Content-Length:
- "251"
Content-Type:
- application/json
Date:
- Tue, 09 Apr 2024 21:52:31 GMT
Pragma:
- no-cache
Server:
- control-gateway
Status:
- 200 OK
Strict-Transport-Security:
- max-age=31536000
Vary:
- Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
X-Cache-Hits:
- "0"
X-Served-By:
- cache-pao-kpao1770049-PAO
X-Timer:
- S1712699552.674125,VS0,VE116
status: 200 OK
code: 200
duration: ""
48 changes: 48 additions & 0 deletions fastly/fixtures/notifications/get_integration_types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
User-Agent:
- FastlyGo/9.2.1 (+github.com/fastly/go-fastly; go1.22.0)
url: https://api.fastly.com/notifications/integration-types
method: GET
response:
body: |
[{"type":"mailinglist","display_name":"Mailing List","custom_fields":[{"name":"address","display_name":"Address","format":"email"}]},{"type":"microsoftteams","display_name":"Microsoft Teams","custom_fields":[{"name":"webhook","display_name":"Webhook URL","format":"url"}]},{"type":"newrelic","display_name":"New Relic","custom_fields":[{"name":"key","display_name":"Key","format":""},{"name":"account","display_name":"Account","format":""}]},{"type":"pagerduty","display_name":"PagerDuty","custom_fields":[{"name":"key","display_name":"Key","format":""}]},{"type":"slack","display_name":"Slack Webhook","custom_fields":[{"name":"webhook","display_name":"Webhook URL","format":"url"}]},{"type":"webhook","display_name":"Generic Webhook","custom_fields":[{"name":"webhook","display_name":"Webhook URL","format":"url"}]}]
headers:
Accept-Ranges:
- bytes
Cache-Control:
- no-store
Content-Length:
- "819"
Content-Type:
- application/json
Date:
- Tue, 09 Apr 2024 21:52:30 GMT
Pragma:
- no-cache
Server:
- control-gateway
Status:
- 200 OK
Strict-Transport-Security:
- max-age=31536000
Vary:
- Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
X-Cache-Hits:
- "0"
X-Served-By:
- cache-pao-kpao1770049-PAO
X-Timer:
- S1712699550.938310,VS0,VE484
status: 200 OK
code: 200
duration: ""
48 changes: 48 additions & 0 deletions fastly/fixtures/notifications/get_webhook_signing_key.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
User-Agent:
- FastlyGo/9.2.1 (+github.com/fastly/go-fastly; go1.22.0)
url: https://api.fastly.com/notifications/integrations/3CrNzH0A2XrdLyLPqjybvW/signingKey
method: GET
response:
body: |
{"signingKey":"9e4a0f5a-9d81-4503-b848-d9c81065f618"}
headers:
Accept-Ranges:
- bytes
Cache-Control:
- no-store
Content-Length:
- "54"
Content-Type:
- application/json
Date:
- Tue, 09 Apr 2024 21:52:33 GMT
Pragma:
- no-cache
Server:
- control-gateway
Status:
- 200 OK
Strict-Transport-Security:
- max-age=31536000
Vary:
- Accept-Encoding
Via:
- 1.1 varnish
X-Cache:
- MISS
X-Cache-Hits:
- "0"
X-Served-By:
- cache-pao-kpao1770049-PAO
X-Timer:
- S1712699554.519608,VS0,VE355
status: 200 OK
code: 200
duration: ""
Loading
Loading