From 3f0bdc0abbfcc74b5816f074373e3e9cc756399e Mon Sep 17 00:00:00 2001 From: Alex Luong Date: Fri, 11 Oct 2024 22:59:51 +0700 Subject: [PATCH] feat: Implement codegen for source verification providers (#100) * refactor: Implement interface for source verification provider * chore: Use generated code * refactor: Move generated code into its own package * feat: Source verification codegen * chore: Generate source verifications * chore: Resolve lint errors * chore: Use `/latest` OpenAPI spec route Co-authored-by: Phil Leggetter * chore: Update Go SDK v0.5.0 and generate all supported verification * feat: Add support for JSON verification for backward compatibility * chore: Fix lint issue * build: Separate TF docs & source verification codegen generate commands (#99) * chore(deps): bump goreleaser/goreleaser-action from 5.1.0 to 6.0.0 (#69) Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5.1.0 to 6.0.0. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](https://github.com/goreleaser/goreleaser-action/compare/5742e2a039330cbb23ebf35f046f814d4c6ff811...286f3b13b1b49da4ac219696163fb8c1c93e1200) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * ci: Separate codegen & tfdocs generate commands * chore: add pre-commit git hook for docs generation * fix: linting (#105) * chore: add pre-commit git hook for docs generation (#103) * chore(deps): bump goreleaser/goreleaser-action from 5.1.0 to 6.0.0 (#69) Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5.1.0 to 6.0.0. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](https://github.com/goreleaser/goreleaser-action/compare/5742e2a039330cbb23ebf35f046f814d4c6ff811...286f3b13b1b49da4ac219696163fb8c1c93e1200) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: add pre-commit git hook for docs generation * chore: fix lint * fix: linting (#105) --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat: Upgrade SDK v0.6.0 and support SDK max attempts option (#110) * chore: Upgrade SDK v0.6.0 * feat: Support SDK max retries * docs: generate * chore(docs): update API ref link --------- Co-authored-by: Phil Leggetter * chore: generate --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Phil Leggetter --------- Signed-off-by: dependabot[bot] Co-authored-by: Phil Leggetter Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .gitconfig | 2 + .githooks/pre-commit | 3 + GNUmakefile | 13 ++ README.md | 8 + cmd/codegen/main.go | 17 +++ cmd/tfdocs/main.go | 15 ++ docs/resources/source_verification.md | 66 +++++++-- examples/full/main.tf | 73 ++++++++- go.mod | 13 +- go.sum | 47 ++++-- internal/codegen/codegen.go | 69 +++++++++ internal/codegen/generate.go | 89 +++++++++++ internal/codegen/parse.go | 140 ++++++++++++++++++ internal/codegen/templates/model.go.tmpl | 43 ++++++ .../codegen/templates/verification.go.tmpl | 69 +++++++++ internal/codegen/transform.go | 52 +++++++ internal/codegen/transform_test.go | 56 +++++++ .../sourceverification/generated/model.go | 101 +++++++++++++ .../generated/verification_adyen.go | 50 +++++++ .../generated/verification_akeneo.go | 50 +++++++ .../generated/verification_apikey.go | 57 +++++++ .../generated/verification_awssns.go | 40 +++++ .../generated/verification_basicauth.go | 57 +++++++ .../generated/verification_bondsmith.go | 50 +++++++ .../generated/verification_cloudsignal.go | 50 +++++++ .../generated/verification_commercelayer.go | 50 +++++++ .../generated/verification_courier.go | 50 +++++++ .../generated/verification_discord.go | 50 +++++++ .../{ => generated}/verification_ebay.go | 55 +++++-- .../generated/verification_enode.go | 50 +++++++ .../generated/verification_favro.go | 50 +++++++ .../generated/verification_fiserv.go | 50 +++++++ .../generated/verification_frontapp.go | 50 +++++++ .../generated/verification_github.go | 50 +++++++ .../generated/verification_gitlab.go | 50 +++++++ .../generated/verification_hmac.go | 73 +++++++++ .../generated/verification_hubspot.go | 50 +++++++ .../generated/verification_linear.go | 50 +++++++ .../generated/verification_mailchimp.go | 50 +++++++ .../generated/verification_mailgun.go | 50 +++++++ .../generated/verification_nmi.go | 50 +++++++ .../generated/verification_orb.go | 50 +++++++ .../generated/verification_oura.go | 50 +++++++ .../generated/verification_paddle.go | 50 +++++++ .../generated/verification_paypal.go | 50 +++++++ .../generated/verification_persona.go | 50 +++++++ .../generated/verification_pipedrive.go | 57 +++++++ .../generated/verification_postmark.go | 57 +++++++ .../generated/verification_propertyfinder.go | 50 +++++++ .../generated/verification_pylon.go | 50 +++++++ .../generated/verification_razorpay.go | 50 +++++++ .../generated/verification_recharge.go | 50 +++++++ .../generated/verification_repay.go | 50 +++++++ .../generated/verification_sanity.go | 50 +++++++ .../generated/verification_sendgrid.go | 50 +++++++ .../generated/verification_shopify.go | 50 +++++++ .../generated/verification_shopline.go | 50 +++++++ .../generated/verification_slack.go | 50 +++++++ .../generated/verification_solidgate.go | 50 +++++++ .../generated/verification_square.go | 50 +++++++ .../generated/verification_stripe.go | 50 +++++++ .../generated/verification_svix.go | 50 +++++++ .../generated/verification_synctera.go | 50 +++++++ .../generated/verification_tebex.go | 50 +++++++ .../generated/verification_telnyx.go | 50 +++++++ .../generated/verification_threedeye.go | 50 +++++++ .../generated/verification_tokenio.go | 50 +++++++ .../generated/verification_trello.go | 50 +++++++ .../generated/verification_twilio.go | 50 +++++++ .../generated/verification_twitch.go | 50 +++++++ .../generated/verification_twitter.go | 50 +++++++ .../generated/verification_typeform.go | 50 +++++++ .../generated/verification_vercel.go | 50 +++++++ .../generated/verification_vercellogdrains.go | 57 +++++++ .../generated/verification_wix.go | 50 +++++++ .../generated/verification_woocommerce.go | 50 +++++++ .../generated/verification_workos.go | 50 +++++++ .../generated/verification_xero.go | 50 +++++++ .../generated/verification_zoom.go | 50 +++++++ internal/provider/sourceverification/model.go | 72 +-------- .../provider/sourceverification/schema.go | 65 +------- internal/provider/sourceverification/sdk.go | 136 +++-------------- .../sourceverification/verification_adyen.go | 31 ---- .../sourceverification/verification_akeneo.go | 31 ---- .../sourceverification/verification_apikey.go | 36 ----- .../sourceverification/verification_awssns.go | 22 --- .../verification_basicauth.go | 36 ----- .../verification_bondsmith.go | 31 ---- .../verification_cloudsignal.go | 31 ---- .../verification_commercelayer.go | 31 ---- .../verification_courier.go | 31 ---- .../verification_discord.go | 31 ---- .../sourceverification/verification_enode.go | 31 ---- .../sourceverification/verification_favro.go | 31 ---- .../sourceverification/verification_fiserv.go | 31 ---- .../verification_frontapp.go | 31 ---- .../sourceverification/verification_github.go | 31 ---- .../sourceverification/verification_gitlab.go | 31 ---- .../sourceverification/verification_hmac.go | 50 ------- .../sourceverification/verification_json.go | 25 ---- .../sourceverification/verification_linear.go | 31 ---- .../verification_mailgun.go | 31 ---- .../sourceverification/verification_nmi.go | 31 ---- .../sourceverification/verification_orb.go | 31 ---- .../sourceverification/verification_oura.go | 31 ---- .../verification_persona.go | 31 ---- .../verification_pipedrive.go | 36 ----- .../verification_postmark.go | 33 ----- .../verification_propertyfinder.go | 31 ---- .../sourceverification/verification_pylon.go | 31 ---- .../verification_razorpay.go | 31 ---- .../verification_recharge.go | 31 ---- .../sourceverification/verification_repay.go | 31 ---- .../sourceverification/verification_sanity.go | 31 ---- .../verification_sendgrid.go | 31 ---- .../verification_shopify.go | 31 ---- .../verification_shopline.go | 31 ---- .../sourceverification/verification_slack.go | 31 ---- .../verification_solidgate.go | 31 ---- .../sourceverification/verification_square.go | 31 ---- .../sourceverification/verification_stripe.go | 31 ---- .../sourceverification/verification_svix.go | 31 ---- .../verification_synctera.go | 31 ---- .../sourceverification/verification_tebex.go | 31 ---- .../sourceverification/verification_telnyx.go | 31 ---- .../verification_threedeye.go | 31 ---- .../verification_tokenio.go | 31 ---- .../sourceverification/verification_trello.go | 31 ---- .../sourceverification/verification_twitch.go | 31 ---- .../verification_twitter.go | 31 ---- .../verification_typeform.go | 31 ---- .../sourceverification/verification_vercel.go | 31 ---- .../verification_vercellogdrain.go | 37 ----- .../sourceverification/verification_wix.go | 31 ---- .../verification_woocommerce.go | 31 ---- .../sourceverification/verification_workos.go | 31 ---- .../sourceverification/verification_xero.go | 31 ---- .../sourceverification/verification_zoom.go | 31 ---- main.go | 10 -- 139 files changed, 3960 insertions(+), 2065 deletions(-) create mode 100644 .gitconfig create mode 100644 .githooks/pre-commit create mode 100644 cmd/codegen/main.go create mode 100644 cmd/tfdocs/main.go create mode 100644 internal/codegen/codegen.go create mode 100644 internal/codegen/generate.go create mode 100644 internal/codegen/parse.go create mode 100644 internal/codegen/templates/model.go.tmpl create mode 100644 internal/codegen/templates/verification.go.tmpl create mode 100644 internal/codegen/transform.go create mode 100644 internal/codegen/transform_test.go create mode 100644 internal/provider/sourceverification/generated/model.go create mode 100644 internal/provider/sourceverification/generated/verification_adyen.go create mode 100644 internal/provider/sourceverification/generated/verification_akeneo.go create mode 100644 internal/provider/sourceverification/generated/verification_apikey.go create mode 100644 internal/provider/sourceverification/generated/verification_awssns.go create mode 100644 internal/provider/sourceverification/generated/verification_basicauth.go create mode 100644 internal/provider/sourceverification/generated/verification_bondsmith.go create mode 100644 internal/provider/sourceverification/generated/verification_cloudsignal.go create mode 100644 internal/provider/sourceverification/generated/verification_commercelayer.go create mode 100644 internal/provider/sourceverification/generated/verification_courier.go create mode 100644 internal/provider/sourceverification/generated/verification_discord.go rename internal/provider/sourceverification/{ => generated}/verification_ebay.go (51%) create mode 100644 internal/provider/sourceverification/generated/verification_enode.go create mode 100644 internal/provider/sourceverification/generated/verification_favro.go create mode 100644 internal/provider/sourceverification/generated/verification_fiserv.go create mode 100644 internal/provider/sourceverification/generated/verification_frontapp.go create mode 100644 internal/provider/sourceverification/generated/verification_github.go create mode 100644 internal/provider/sourceverification/generated/verification_gitlab.go create mode 100644 internal/provider/sourceverification/generated/verification_hmac.go create mode 100644 internal/provider/sourceverification/generated/verification_hubspot.go create mode 100644 internal/provider/sourceverification/generated/verification_linear.go create mode 100644 internal/provider/sourceverification/generated/verification_mailchimp.go create mode 100644 internal/provider/sourceverification/generated/verification_mailgun.go create mode 100644 internal/provider/sourceverification/generated/verification_nmi.go create mode 100644 internal/provider/sourceverification/generated/verification_orb.go create mode 100644 internal/provider/sourceverification/generated/verification_oura.go create mode 100644 internal/provider/sourceverification/generated/verification_paddle.go create mode 100644 internal/provider/sourceverification/generated/verification_paypal.go create mode 100644 internal/provider/sourceverification/generated/verification_persona.go create mode 100644 internal/provider/sourceverification/generated/verification_pipedrive.go create mode 100644 internal/provider/sourceverification/generated/verification_postmark.go create mode 100644 internal/provider/sourceverification/generated/verification_propertyfinder.go create mode 100644 internal/provider/sourceverification/generated/verification_pylon.go create mode 100644 internal/provider/sourceverification/generated/verification_razorpay.go create mode 100644 internal/provider/sourceverification/generated/verification_recharge.go create mode 100644 internal/provider/sourceverification/generated/verification_repay.go create mode 100644 internal/provider/sourceverification/generated/verification_sanity.go create mode 100644 internal/provider/sourceverification/generated/verification_sendgrid.go create mode 100644 internal/provider/sourceverification/generated/verification_shopify.go create mode 100644 internal/provider/sourceverification/generated/verification_shopline.go create mode 100644 internal/provider/sourceverification/generated/verification_slack.go create mode 100644 internal/provider/sourceverification/generated/verification_solidgate.go create mode 100644 internal/provider/sourceverification/generated/verification_square.go create mode 100644 internal/provider/sourceverification/generated/verification_stripe.go create mode 100644 internal/provider/sourceverification/generated/verification_svix.go create mode 100644 internal/provider/sourceverification/generated/verification_synctera.go create mode 100644 internal/provider/sourceverification/generated/verification_tebex.go create mode 100644 internal/provider/sourceverification/generated/verification_telnyx.go create mode 100644 internal/provider/sourceverification/generated/verification_threedeye.go create mode 100644 internal/provider/sourceverification/generated/verification_tokenio.go create mode 100644 internal/provider/sourceverification/generated/verification_trello.go create mode 100644 internal/provider/sourceverification/generated/verification_twilio.go create mode 100644 internal/provider/sourceverification/generated/verification_twitch.go create mode 100644 internal/provider/sourceverification/generated/verification_twitter.go create mode 100644 internal/provider/sourceverification/generated/verification_typeform.go create mode 100644 internal/provider/sourceverification/generated/verification_vercel.go create mode 100644 internal/provider/sourceverification/generated/verification_vercellogdrains.go create mode 100644 internal/provider/sourceverification/generated/verification_wix.go create mode 100644 internal/provider/sourceverification/generated/verification_woocommerce.go create mode 100644 internal/provider/sourceverification/generated/verification_workos.go create mode 100644 internal/provider/sourceverification/generated/verification_xero.go create mode 100644 internal/provider/sourceverification/generated/verification_zoom.go delete mode 100644 internal/provider/sourceverification/verification_adyen.go delete mode 100644 internal/provider/sourceverification/verification_akeneo.go delete mode 100644 internal/provider/sourceverification/verification_apikey.go delete mode 100644 internal/provider/sourceverification/verification_awssns.go delete mode 100644 internal/provider/sourceverification/verification_basicauth.go delete mode 100644 internal/provider/sourceverification/verification_bondsmith.go delete mode 100644 internal/provider/sourceverification/verification_cloudsignal.go delete mode 100644 internal/provider/sourceverification/verification_commercelayer.go delete mode 100644 internal/provider/sourceverification/verification_courier.go delete mode 100644 internal/provider/sourceverification/verification_discord.go delete mode 100644 internal/provider/sourceverification/verification_enode.go delete mode 100644 internal/provider/sourceverification/verification_favro.go delete mode 100644 internal/provider/sourceverification/verification_fiserv.go delete mode 100644 internal/provider/sourceverification/verification_frontapp.go delete mode 100644 internal/provider/sourceverification/verification_github.go delete mode 100644 internal/provider/sourceverification/verification_gitlab.go delete mode 100644 internal/provider/sourceverification/verification_hmac.go delete mode 100644 internal/provider/sourceverification/verification_json.go delete mode 100644 internal/provider/sourceverification/verification_linear.go delete mode 100644 internal/provider/sourceverification/verification_mailgun.go delete mode 100644 internal/provider/sourceverification/verification_nmi.go delete mode 100644 internal/provider/sourceverification/verification_orb.go delete mode 100644 internal/provider/sourceverification/verification_oura.go delete mode 100644 internal/provider/sourceverification/verification_persona.go delete mode 100644 internal/provider/sourceverification/verification_pipedrive.go delete mode 100644 internal/provider/sourceverification/verification_postmark.go delete mode 100644 internal/provider/sourceverification/verification_propertyfinder.go delete mode 100644 internal/provider/sourceverification/verification_pylon.go delete mode 100644 internal/provider/sourceverification/verification_razorpay.go delete mode 100644 internal/provider/sourceverification/verification_recharge.go delete mode 100644 internal/provider/sourceverification/verification_repay.go delete mode 100644 internal/provider/sourceverification/verification_sanity.go delete mode 100644 internal/provider/sourceverification/verification_sendgrid.go delete mode 100644 internal/provider/sourceverification/verification_shopify.go delete mode 100644 internal/provider/sourceverification/verification_shopline.go delete mode 100644 internal/provider/sourceverification/verification_slack.go delete mode 100644 internal/provider/sourceverification/verification_solidgate.go delete mode 100644 internal/provider/sourceverification/verification_square.go delete mode 100644 internal/provider/sourceverification/verification_stripe.go delete mode 100644 internal/provider/sourceverification/verification_svix.go delete mode 100644 internal/provider/sourceverification/verification_synctera.go delete mode 100644 internal/provider/sourceverification/verification_tebex.go delete mode 100644 internal/provider/sourceverification/verification_telnyx.go delete mode 100644 internal/provider/sourceverification/verification_threedeye.go delete mode 100644 internal/provider/sourceverification/verification_tokenio.go delete mode 100644 internal/provider/sourceverification/verification_trello.go delete mode 100644 internal/provider/sourceverification/verification_twitch.go delete mode 100644 internal/provider/sourceverification/verification_twitter.go delete mode 100644 internal/provider/sourceverification/verification_typeform.go delete mode 100644 internal/provider/sourceverification/verification_vercel.go delete mode 100644 internal/provider/sourceverification/verification_vercellogdrain.go delete mode 100644 internal/provider/sourceverification/verification_wix.go delete mode 100644 internal/provider/sourceverification/verification_woocommerce.go delete mode 100644 internal/provider/sourceverification/verification_workos.go delete mode 100644 internal/provider/sourceverification/verification_xero.go delete mode 100644 internal/provider/sourceverification/verification_zoom.go diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..1c8d4a7 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,2 @@ +[core] + hooksPath = .githooks diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100644 index 0000000..6f28030 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,3 @@ +#!/bin/sh + +make generate-tfdocs \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile index 7771cd6..11ccb76 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -4,3 +4,16 @@ default: testacc .PHONY: testacc testacc: TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m + +generate: + go generate ./... + +generate-codegen: + go generate ./cmd/codegen/... + +generate-tfdocs: + go generate ./cmd/tfdocs/... + +enable-git-hooks: + git config --local include.path ../.gitconfig + $(warning REMEMBER, YOU MUST HAVE REVIEWED THE CUSTOM HOOKS!) diff --git a/README.md b/README.md index 0b87e58..6a0c1eb 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,11 @@ resource "hookdeck_connection" "my_connection" { ## Dependencies This provider uses [Hookdeck API](https://hookdeck.com/docs/api) and [Hookdeck Go SDK](https://github.com/hookdeck/hookdeck-go-sdk) under the hood. + +## Development + +Enable pre-commit Git hooks to ensure any code changes are reflected in the documentation: + +```sh +make enable-git-hooks +``` diff --git a/cmd/codegen/main.go b/cmd/codegen/main.go new file mode 100644 index 0000000..15023b7 --- /dev/null +++ b/cmd/codegen/main.go @@ -0,0 +1,17 @@ +package main + +import ( + "log" + "terraform-provider-hookdeck/internal/codegen" +) + +func main() { + if err := codegen.RunCodeGen(); err != nil { + log.Panicln(err) + } +} + +// Run "go generate" to generate Hookdeck source verification codes + +//go:generate go run . +//go:generate gofmt -w ../../internal/provider/sourceverification/generated diff --git a/cmd/tfdocs/main.go b/cmd/tfdocs/main.go new file mode 100644 index 0000000..7a6c1d9 --- /dev/null +++ b/cmd/tfdocs/main.go @@ -0,0 +1,15 @@ +package main + +// Run "go generate" to format example terraform files and generate the docs for the registry/website + +// If you do not have terraform installed, you can remove the formatting command, but its suggested to +// ensure the documentation is formatted properly. +//go:generate terraform fmt -recursive ../../examples/ + +// Run the docs generation tool, check its repository for more information on how it works and how docs +// can be customized. +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir ../../ + +func main() { + // noop +} diff --git a/docs/resources/source_verification.md b/docs/resources/source_verification.md index 32522ac..77efedd 100644 --- a/docs/resources/source_verification.md +++ b/docs/resources/source_verification.md @@ -54,12 +54,16 @@ Optional: - `github` (Attributes) (see [below for nested schema](#nestedatt--verification--github)) - `gitlab` (Attributes) (see [below for nested schema](#nestedatt--verification--gitlab)) - `hmac` (Attributes) (see [below for nested schema](#nestedatt--verification--hmac)) +- `hubspot` (Attributes) (see [below for nested schema](#nestedatt--verification--hubspot)) - `json` (String, Sensitive) - `linear` (Attributes) (see [below for nested schema](#nestedatt--verification--linear)) +- `mailchimp` (Attributes) (see [below for nested schema](#nestedatt--verification--mailchimp)) - `mailgun` (Attributes) (see [below for nested schema](#nestedatt--verification--mailgun)) - `nmi` (Attributes) (see [below for nested schema](#nestedatt--verification--nmi)) - `orb` (Attributes) (see [below for nested schema](#nestedatt--verification--orb)) - `oura` (Attributes) (see [below for nested schema](#nestedatt--verification--oura)) +- `paddle` (Attributes) (see [below for nested schema](#nestedatt--verification--paddle)) +- `paypal` (Attributes) (see [below for nested schema](#nestedatt--verification--paypal)) - `persona` (Attributes) (see [below for nested schema](#nestedatt--verification--persona)) - `pipedrive` (Attributes) (see [below for nested schema](#nestedatt--verification--pipedrive)) - `postmark` (Attributes) (see [below for nested schema](#nestedatt--verification--postmark)) @@ -80,9 +84,10 @@ Optional: - `synctera` (Attributes) (see [below for nested schema](#nestedatt--verification--synctera)) - `tebex` (Attributes) (see [below for nested schema](#nestedatt--verification--tebex)) - `telnyx` (Attributes) (see [below for nested schema](#nestedatt--verification--telnyx)) -- `threedeye` (Attributes) (see [below for nested schema](#nestedatt--verification--threedeye)) +- `three_d_eye` (Attributes) (see [below for nested schema](#nestedatt--verification--three_d_eye)) - `tokenio` (Attributes) (see [below for nested schema](#nestedatt--verification--tokenio)) - `trello` (Attributes) (see [below for nested schema](#nestedatt--verification--trello)) +- `twilio` (Attributes) (see [below for nested schema](#nestedatt--verification--twilio)) - `twitch` (Attributes) (see [below for nested schema](#nestedatt--verification--twitch)) - `twitter` (Attributes) (see [below for nested schema](#nestedatt--verification--twitter)) - `typeform` (Attributes) (see [below for nested schema](#nestedatt--verification--typeform)) @@ -116,7 +121,7 @@ Required: Required: - `api_key` (String, Sensitive) -- `header_key` (String) +- `header_key` (String, Sensitive) @@ -129,7 +134,7 @@ Required: Required: - `password` (String, Sensitive) -- `username` (String) +- `username` (String, Sensitive) @@ -237,9 +242,17 @@ Required: Required: -- `algorithm` (String) -- `encoding` (String) -- `header_key` (String) +- `algorithm` (String, Sensitive) +- `encoding` (String, Sensitive) +- `header_key` (String, Sensitive) +- `webhook_secret_key` (String, Sensitive) + + + +### Nested Schema for `verification.hubspot` + +Required: + - `webhook_secret_key` (String, Sensitive) @@ -251,6 +264,14 @@ Required: - `webhook_secret_key` (String, Sensitive) + +### Nested Schema for `verification.mailchimp` + +Required: + +- `webhook_secret_key` (String, Sensitive) + + ### Nested Schema for `verification.mailgun` @@ -283,6 +304,22 @@ Required: - `webhook_secret_key` (String, Sensitive) + +### Nested Schema for `verification.paddle` + +Required: + +- `webhook_secret_key` (String, Sensitive) + + + +### Nested Schema for `verification.paypal` + +Required: + +- `webhook_id` (String, Sensitive) + + ### Nested Schema for `verification.persona` @@ -296,8 +333,8 @@ Required: Required: -- `name` (String) - `password` (String, Sensitive) +- `username` (String, Sensitive) @@ -305,7 +342,8 @@ Required: Required: -- `webhook_secret_key` (String, Sensitive) +- `password` (String, Sensitive) +- `username` (String, Sensitive) @@ -444,8 +482,8 @@ Required: - `public_key` (String, Sensitive) - -### Nested Schema for `verification.threedeye` + +### Nested Schema for `verification.three_d_eye` Required: @@ -468,6 +506,14 @@ Required: - `webhook_secret_key` (String, Sensitive) + +### Nested Schema for `verification.twilio` + +Required: + +- `webhook_secret_key` (String, Sensitive) + + ### Nested Schema for `verification.twitch` diff --git a/examples/full/main.tf b/examples/full/main.tf index bf001c5..46ac978 100644 --- a/examples/full/main.tf +++ b/examples/full/main.tf @@ -18,12 +18,16 @@ provider "hookdeck" { api_key = var.HOOKDECK_API_KEY } -resource "hookdeck_source" "my_source" { +resource "hookdeck_source" "first_source" { + name = "first_source" +} + +resource "hookdeck_source" "second_source" { name = "my_source" } -resource "hookdeck_source_verification" "my_authenticated_source" { - source_id = hookdeck_source.my_source.id +resource "hookdeck_source_verification" "named_basic_auth_verification" { + source_id = hookdeck_source.first_source.id verification = { basic_auth = { username = "example-username" @@ -32,14 +36,38 @@ resource "hookdeck_source_verification" "my_authenticated_source" { } } -resource "hookdeck_destination" "my_destination" { - name = "my_destination" +resource "hookdeck_source_verification" "json_basic_auth_verification" { + source_id = hookdeck_source.second_source.id + verification = { + json = jsonencode({ + type = "basic_auth" + configs = { + username = "some-username" + password = "blah-blah-blah" + } + }) + } +} + +resource "hookdeck_destination" "first_destination" { + name = "first_destination" url = "https://mock.hookdeck.com" } -resource "hookdeck_connection" "my_connection" { - source_id = hookdeck_source.my_source.id - destination_id = hookdeck_destination.my_destination.id +resource "hookdeck_destination" "second_destination" { + name = "second_destination" + url = "https://mock.hookdeck.com" + auth_method = { + basic_auth = { + username = "some-username" + password = "blah-blah-blah" + } + } +} + +resource "hookdeck_connection" "first_connection" { + source_id = hookdeck_source.first_source.id + destination_id = hookdeck_destination.first_destination.id rules = [ { filter_rule = { @@ -51,4 +79,33 @@ resource "hookdeck_connection" "my_connection" { } } ] +} + +resource "hookdeck_connection" "second_connection" { + source_id = hookdeck_source.second_source.id + destination_id = hookdeck_destination.first_destination.id +} + +data "hookdeck_source" "manually_created_source" { + id = "src_112rkwa855tb0z" +} + +data "hookdeck_destination" "manually_created_destination" { + id = "des_tsrZIbyk0JBB" +} + +data "hookdeck_connection" "manually_created_connection" { + id = "web_xDRnu9yq9GMl" +} + +resource "hookdeck_connection" "first_connection_using_data_sources" { + name = "first_connection_using_data_sources" + source_id = data.hookdeck_source.manually_created_source.id + destination_id = data.hookdeck_destination.manually_created_destination.id +} + +resource "hookdeck_connection" "second_connection_using_data_sources" { + name = "second_connection_using_data_sources" + source_id = data.hookdeck_connection.manually_created_connection.source_id + destination_id = data.hookdeck_connection.manually_created_connection.destination_id } \ No newline at end of file diff --git a/go.mod b/go.mod index 67b7c66..eeedcd4 100644 --- a/go.mod +++ b/go.mod @@ -5,11 +5,14 @@ go 1.21 toolchain go1.21.9 require ( + github.com/getkin/kin-openapi v0.127.0 github.com/hashicorp/terraform-plugin-docs v0.19.2 github.com/hashicorp/terraform-plugin-framework v1.11.0 github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hookdeck/hookdeck-go-sdk v0.6.0 + github.com/iancoleman/strcase v0.3.0 + golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa golang.org/x/sys v0.24.0 ) @@ -26,6 +29,8 @@ require ( github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/fatih/color v1.16.0 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/cli v1.1.6 // indirect @@ -46,13 +51,18 @@ require ( github.com/hashicorp/yamux v0.1.1 // indirect github.com/huandu/xstrings v1.3.3 // indirect github.com/imdario/mergo v0.3.15 // indirect + github.com/invopop/yaml v0.3.1 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/oklog/run v1.1.0 // indirect + github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/posener/complete v1.2.3 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect @@ -63,8 +73,7 @@ require ( github.com/zclconf/go-cty v1.14.4 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect golang.org/x/crypto v0.21.0 // indirect - golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect - golang.org/x/mod v0.16.0 // indirect + golang.org/x/mod v0.20.0 // indirect golang.org/x/net v0.23.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect diff --git a/go.sum b/go.sum index c302a7d..b2bdd08 100644 --- a/go.sum +++ b/go.sum @@ -38,12 +38,20 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/getkin/kin-openapi v0.127.0 h1:Mghqi3Dhryf3F8vR370nN67pAERW+3a95vomb3MAREY= +github.com/getkin/kin-openapi v0.127.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= @@ -101,19 +109,27 @@ github.com/hookdeck/hookdeck-go-sdk v0.6.0 h1:OEtw5cRV7ShDMfus8BjYKqi9wGHQ8/y4R5 github.com/hookdeck/hookdeck-go-sdk v0.6.0/go.mod h1:fewtdP5f8hnU+x35l2s8F3SSiE94cGz+Q3bR4sI8zlk= github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso= +github.com/invopop/yaml v0.3.1/go.mod h1:PMOp3nn4/12yEZUFfmOuNHJsZToEEOwoWsT+D81KkeA= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -133,8 +149,12 @@ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= +github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -158,8 +178,10 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= @@ -180,11 +202,11 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= +golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -193,6 +215,8 @@ golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -220,8 +244,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= @@ -229,8 +253,9 @@ google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/codegen/codegen.go b/internal/codegen/codegen.go new file mode 100644 index 0000000..30f71ea --- /dev/null +++ b/internal/codegen/codegen.go @@ -0,0 +1,69 @@ +package codegen + +import ( + "errors" + "fmt" + "net/url" + "sort" + "strings" + + "github.com/getkin/kin-openapi/openapi3" +) + +const hookdeckOpenAPISchemaURI = "https://api.hookdeck.com/latest/openapi" + +func RunCodeGen() error { + fmt.Println("generating Hookdeck source verifications") + + // Load OpenAPI schema + loader := openapi3.NewLoader() + u, err := url.Parse(hookdeckOpenAPISchemaURI) + if err != nil { + return err + } + fmt.Println("getting Hookdeck OpenAPI schema") + doc, err := loader.LoadFromURI(u) + if err != nil { + return err + } + + // Get list of source verification providers + verificationListAny, err := doc.Components.Schemas.JSONLookup("VerificationConfig") + if err != nil { + return err + } + verificationList, ok := verificationListAny.(*openapi3.Schema) + if !ok { + return errors.New("type assertion failed") + } + + // Construct verification data + verifications := []Verification{} + for _, schemaRef := range verificationList.OneOf { + verification, err := parseVerification(doc, getSchemaNameFromRef(schemaRef.Ref)) + if err != nil { + return err + } + verifications = append(verifications, *verification) + } + + sort.Slice(verifications, func(i, j int) bool { + return verifications[i].NamePascal < verifications[j].NamePascal + }) + + // Generate code using template + if err := generateModel(verifications); err != nil { + return err + } + if err := generateVerifications(verifications); err != nil { + return err + } + + return nil +} + +func getSchemaNameFromRef(ref string) string { + // Split the string by '/' and take the last element + parts := strings.Split(ref, "/") + return parts[len(parts)-1] +} diff --git a/internal/codegen/generate.go b/internal/codegen/generate.go new file mode 100644 index 0000000..15173c5 --- /dev/null +++ b/internal/codegen/generate.go @@ -0,0 +1,89 @@ +package codegen + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "runtime" + "strings" + "text/template" +) + +func generateVerifications(verifications []Verification) error { + tmpl, err := template.ParseFiles(getRelativePath("templates/verification.go.tmpl")) + if err != nil { + return err + } + + for _, verification := range verifications { + fmt.Printf("generating source verification \"%s\"\n", verification.NameSnake) + + var buf bytes.Buffer + // Execute the template and write the output to the buffer + err = tmpl.Execute(&buf, verification) + if err != nil { + fmt.Printf("Failed to execute template: %v\n", err) + return err + } + writeFile("verification_"+strings.ReplaceAll(verification.NameSnake, "_", "")+".go", buf.String()) + } + + return nil +} + +func generateModel(verifications []Verification) error { + fmt.Println("generating \"model.go\" file") + + tmpl, err := template.ParseFiles(getRelativePath("templates/model.go.tmpl")) + if err != nil { + return err + } + + var buf bytes.Buffer + // Execute the template and write the output to the buffer + err = tmpl.Execute(&buf, verifications) + if err != nil { + fmt.Printf("Failed to execute template: %v\n", err) + return err + } + writeFile("model.go", buf.String()) + + return nil +} + +func writeFile(fileName string, content string) { + // Define the directory and file name + dir := getRelativePath("../provider/sourceverification/generated") + + // Create the "generated" directory if it doesn't exist + err := os.MkdirAll(dir, os.ModePerm) + if err != nil { + fmt.Printf("Failed to create directory: %v\n", err) + return + } + + // Define the full path to the file + filePath := filepath.Join(dir, fileName) + + // Open the file for writing, create it if it doesn't exist + file, err := os.Create(filePath) + if err != nil { + fmt.Printf("Failed to create file: %v\n", err) + return + } + defer file.Close() + + _, err = file.WriteString(content) + if err != nil { + fmt.Printf("Failed to write to file: %v\n", err) + return + } +} + +// getRelativePath returns the absolute path relative to the current file. +func getRelativePath(relativePath string) string { + _, filename, _, _ := runtime.Caller(1) + dir := filepath.Dir(filename) + return filepath.Join(dir, relativePath) +} diff --git a/internal/codegen/parse.go b/internal/codegen/parse.go new file mode 100644 index 0000000..b65b521 --- /dev/null +++ b/internal/codegen/parse.go @@ -0,0 +1,140 @@ +package codegen + +import ( + "errors" + "sort" + "strings" + + "golang.org/x/exp/slices" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/iancoleman/strcase" +) + +type VerificationProperty struct { + NameSnake string + NameCamel string + NamePascal string + Optional bool + Required bool + Sensitive bool + PointerString string // either empty string or "Pointer" if property is optional + TypeString string // "String" | "Float" ... + IsEnum bool + EnumNameString string +} + +type Verification struct { + Ref string + ConfigRef string + NameSnake string + NameCamel string + NamePascal string + NameConfig string // similar to NamePascal but for ThreeDEye it's 3DEye and other casing diff + Properties []VerificationProperty +} + +func parseVerification(doc *openapi3.T, refName string) (*Verification, error) { + // Get verification data + verificationSchemaAny, err := doc.Components.Schemas.JSONLookup(refName) + if err != nil { + return nil, err + } + verificationSchema, ok := verificationSchemaAny.(*openapi3.Schema) + if !ok { + return nil, errors.New("type assertion failed") + } + verificationName, ok := verificationSchema.Properties["type"].Value.Enum[0].(string) + if !ok { + return nil, errors.New("type assertion failed") + } + verificationName = strings.ReplaceAll(verificationName, "-", "_") + docsType, ok := verificationSchema.Extensions["x-docs-type"].(string) + if !ok { + return nil, errors.New("type assertion failed") + } + + // Get verification config data + verificationConfigSchemaRef := verificationSchema.Properties["configs"].Ref + verificationConfigSchemaRefName := getSchemaNameFromRef(verificationConfigSchemaRef) + + verificationConfigSchemaAny, err := doc.Components.Schemas.JSONLookup(verificationConfigSchemaRefName) + if err != nil { + return nil, err + } + verificationConfigSchema, ok := verificationConfigSchemaAny.(*openapi3.Schema) + if !ok { + return nil, errors.New("type assertion failed") + } + + // Constructing Verification struct + + properties := []VerificationProperty{} + + for _, key := range getProperties(verificationName, verificationConfigSchema) { + property := verificationConfigSchema.Properties[key] + required := slices.Contains(verificationConfigSchema.Required, key) + pointerString := "" + if !required { + pointerString = "Pointer" + } + typeString := "" + if property.Value.Type.Is("string") { + typeString = "String" + } else if property.Value.Type.Is("number") && property.Value.Format == "float" { + typeString = "Float64" + } + isEnum := false + enumNameString := "" + if len(property.Value.Enum) > 0 { + isEnum = true + if property.Ref == "" { + enumNameString = "New" + toConfigCase(verificationConfigSchemaRefName) + toConfigCase(key) + "From" + typeString + } else { + enumNameString = "New" + toConfigCase(getSchemaNameFromRef(property.Ref)) + "From" + typeString + } + } + + properties = append(properties, VerificationProperty{ + NameSnake: key, + NameCamel: strcase.ToLowerCamel(key), + NamePascal: strcase.ToCamel(key), + Optional: !required, + Required: required, + Sensitive: true, + PointerString: pointerString, + TypeString: typeString, + IsEnum: isEnum, + EnumNameString: enumNameString, + }) + } + + verification := &Verification{ + Ref: refName, + ConfigRef: verificationConfigSchemaRefName, + NameSnake: verificationName, + NameCamel: strcase.ToLowerCamel(verificationName), + NamePascal: strcase.ToCamel(verificationName), + NameConfig: toConfigCase(docsType), + Properties: properties, + } + + return verification, nil +} + +func getProperties(verificationName string, schema *openapi3.Schema) []string { + if verificationName == "shopify" { + // edge case: for Shopify we only care about "webhook_secret_key" + return []string{"webhook_secret_key"} + } + + properties := []string{} + + for key := range schema.Properties { + properties = append(properties, key) + } + + sort.Strings(properties) + + return properties +} diff --git a/internal/codegen/templates/model.go.tmpl b/internal/codegen/templates/model.go.tmpl new file mode 100644 index 0000000..3a87e3c --- /dev/null +++ b/internal/codegen/templates/model.go.tmpl @@ -0,0 +1,43 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type SourceVerification struct { + JSON types.String `tfsdk:"json"` + + // Providers +{{- range $verification := . }} + {{$verification.NamePascal}} *{{$verification.NameCamel}}SourceVerification `tfsdk:"{{$verification.NameSnake}}"` +{{- end }} +} + +type sourceVerificationProvider interface { + getSchemaName() string + getSchemaValue() schema.SingleNestedAttribute + ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig +} + +var Providers []sourceVerificationProvider + +func GetSourceVerificationSchemaAttributes() map[string]schema.Attribute { + attributes := map[string]schema.Attribute{} + + attributes["json"] = schema.StringAttribute{ + Optional: true, + Sensitive: true, + } + + for _, provider := range Providers { + attributes[provider.getSchemaName()] = provider.getSchemaValue() + } + + return attributes +} diff --git a/internal/codegen/templates/verification.go.tmpl b/internal/codegen/templates/verification.go.tmpl new file mode 100644 index 0000000..6bb3b28 --- /dev/null +++ b/internal/codegen/templates/verification.go.tmpl @@ -0,0 +1,69 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" +{{- if gt (len .Properties) 0 }} + "github.com/hashicorp/terraform-plugin-framework/types" +{{- end }} + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type {{.NameCamel}}SourceVerification struct { +{{- range $property := .Properties }} + {{$property.NamePascal}} types.{{$property.TypeString}} `tfsdk:"{{$property.NameSnake}}"` +{{- end }} +} + +type {{.NameCamel}}SourceVerificationProvider struct { +} + +func (p *{{.NameCamel}}SourceVerificationProvider) getSchemaName() string { + return "{{.NameSnake}}" +} + +func (p *{{.NameCamel}}SourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ +{{- range $property := .Properties }} + "{{$property.NameSnake}}": schema.{{$property.TypeString}}Attribute{ + Required: {{$property.Required}}, + Optional: {{$property.Optional}}, + Sensitive: {{$property.Sensitive}}, + }, +{{- end }} + }, + } +} + +func (p *{{.NameCamel}}SourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.{{.NamePascal}} == nil { + return nil + } +{{- range $property := .Properties }} +{{- if $property.IsEnum}} + {{$property.NameCamel}}, _ := hookdeck.{{$property.EnumNameString}}(sourceVerification.{{$.NamePascal}}.{{$property.NamePascal}}.Value{{$property.TypeString}}{{$property.PointerString}}()); +{{- end}} +{{- end }} + return hookdeck.NewVerificationConfigFrom{{.NamePascal}}(&hookdeck.Verification{{.NameConfig}}{ + Configs: &hookdeck.Verification{{.NameConfig}}Configs{ +{{- range $property := .Properties }} +{{- if and $property.IsEnum $property.Required }} + {{$property.NamePascal}}: {{$property.NameCamel}}, +{{- else if $property.IsEnum }} + {{$property.NamePascal}}: &{{$property.NameCamel}}, +{{- else}} + {{$property.NamePascal}}: sourceVerification.{{$.NamePascal}}.{{$property.NamePascal}}.Value{{$property.TypeString}}{{$property.PointerString}}(), +{{- end}} +{{- end }} + }, + }) +} + +func init() { + Providers = append(Providers, &{{.NameCamel}}SourceVerificationProvider{}) +} diff --git a/internal/codegen/transform.go b/internal/codegen/transform.go new file mode 100644 index 0000000..0ede5af --- /dev/null +++ b/internal/codegen/transform.go @@ -0,0 +1,52 @@ +package codegen + +import ( + "strings" + "unicode" +) + +func toConfigCase(input string) string { + if input == "AWS SNS" { + return "Awssns" + } else if input == "3dEye" { + return "3DEye" + } + + words := splitWords(input) + var result strings.Builder + + for _, word := range words { + word = strings.ToUpper(string(word[0])) + strings.ToLower(word[1:]) + result.WriteString(word) + } + + return result.String() +} + +// splitWords splits a string into words based on uppercase letters or spaces. +func splitWords(s string) []string { + var words []string + var currentWord strings.Builder + + for i, r := range s { + if i > 0 && (unicode.IsUpper(r) && !unicode.IsUpper(rune(s[i-1]))) { + // Split at uppercase letters following lowercase letters or after spaces + words = append(words, currentWord.String()) + currentWord.Reset() + } + if currentWord.Len() > 0 && i < len(s)-1 && (unicode.IsUpper(r) && unicode.IsLower(rune(s[i+1]))) { + // Split at uppercase letters where the next letter is lower case + words = append(words, currentWord.String()) + currentWord.Reset() + } + if !unicode.IsSpace(r) { + currentWord.WriteRune(r) + } + } + + if currentWord.Len() > 0 { + words = append(words, currentWord.String()) + } + + return words +} diff --git a/internal/codegen/transform_test.go b/internal/codegen/transform_test.go new file mode 100644 index 0000000..d6e20da --- /dev/null +++ b/internal/codegen/transform_test.go @@ -0,0 +1,56 @@ +package codegen + +import ( + "strings" + "testing" +) + +func TestToConfigCase(t *testing.T) { + testCases := []struct { + input string + expected string + }{ + {"GitHub", "GitHub"}, + {"HMACAlgorithms", "HmacAlgorithms"}, + {"Shopify", "Shopify"}, + {"TokenIO", "TokenIo"}, + {"AWS SNS", "Awssns"}, + {"3dEye", "3DEye"}, + {"NMI Payment Gateway", "NmiPaymentGateway"}, + {"VerificationHMACConfigs", "VerificationHmacConfigs"}, + } + + for _, tc := range testCases { + t.Run(tc.input, func(t *testing.T) { + output := toConfigCase(tc.input) + + if output != tc.expected { + t.Errorf("toConfig(\"%s\") = \"%s\", expected '%s'", tc.input, output, tc.expected) + } + }) + } +} + +func TestSplitWords(t *testing.T) { + testCases := []struct { + input string + expected string + }{ + {"GitHub", "Git Hub"}, + {"HMACAlgorithms", "HMAC Algorithms"}, + {"Shopify", "Shopify"}, + {"TokenIO", "Token IO"}, + {"AWS SNS", "AWS SNS"}, + {"NMI Payment Gateway", "NMI Payment Gateway"}, + } + + for _, tc := range testCases { + t.Run(tc.input, func(t *testing.T) { + output := splitWords(tc.input) + + if strings.Join(output, " ") != tc.expected { + t.Errorf("splitWords(\"%s\") = \"%s\", expected '%s'", tc.input, strings.Join(output, " "), tc.expected) + } + }) + } +} diff --git a/internal/provider/sourceverification/generated/model.go b/internal/provider/sourceverification/generated/model.go new file mode 100644 index 0000000..7eb3044 --- /dev/null +++ b/internal/provider/sourceverification/generated/model.go @@ -0,0 +1,101 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type SourceVerification struct { + JSON types.String `tfsdk:"json"` + + // Providers + Adyen *adyenSourceVerification `tfsdk:"adyen"` + Akeneo *akeneoSourceVerification `tfsdk:"akeneo"` + ApiKey *apiKeySourceVerification `tfsdk:"api_key"` + AwsSns *awsSnsSourceVerification `tfsdk:"aws_sns"` + BasicAuth *basicAuthSourceVerification `tfsdk:"basic_auth"` + Bondsmith *bondsmithSourceVerification `tfsdk:"bondsmith"` + Cloudsignal *cloudsignalSourceVerification `tfsdk:"cloudsignal"` + Commercelayer *commercelayerSourceVerification `tfsdk:"commercelayer"` + Courier *courierSourceVerification `tfsdk:"courier"` + Discord *discordSourceVerification `tfsdk:"discord"` + Ebay *ebaySourceVerification `tfsdk:"ebay"` + Enode *enodeSourceVerification `tfsdk:"enode"` + Favro *favroSourceVerification `tfsdk:"favro"` + Fiserv *fiservSourceVerification `tfsdk:"fiserv"` + Frontapp *frontappSourceVerification `tfsdk:"frontapp"` + Github *githubSourceVerification `tfsdk:"github"` + Gitlab *gitlabSourceVerification `tfsdk:"gitlab"` + Hmac *hmacSourceVerification `tfsdk:"hmac"` + Hubspot *hubspotSourceVerification `tfsdk:"hubspot"` + Linear *linearSourceVerification `tfsdk:"linear"` + Mailchimp *mailchimpSourceVerification `tfsdk:"mailchimp"` + Mailgun *mailgunSourceVerification `tfsdk:"mailgun"` + Nmi *nmiSourceVerification `tfsdk:"nmi"` + Orb *orbSourceVerification `tfsdk:"orb"` + Oura *ouraSourceVerification `tfsdk:"oura"` + Paddle *paddleSourceVerification `tfsdk:"paddle"` + Paypal *paypalSourceVerification `tfsdk:"paypal"` + Persona *personaSourceVerification `tfsdk:"persona"` + Pipedrive *pipedriveSourceVerification `tfsdk:"pipedrive"` + Postmark *postmarkSourceVerification `tfsdk:"postmark"` + PropertyFinder *propertyFinderSourceVerification `tfsdk:"property_finder"` + Pylon *pylonSourceVerification `tfsdk:"pylon"` + Razorpay *razorpaySourceVerification `tfsdk:"razorpay"` + Recharge *rechargeSourceVerification `tfsdk:"recharge"` + Repay *repaySourceVerification `tfsdk:"repay"` + Sanity *sanitySourceVerification `tfsdk:"sanity"` + Sendgrid *sendgridSourceVerification `tfsdk:"sendgrid"` + Shopify *shopifySourceVerification `tfsdk:"shopify"` + Shopline *shoplineSourceVerification `tfsdk:"shopline"` + Slack *slackSourceVerification `tfsdk:"slack"` + Solidgate *solidgateSourceVerification `tfsdk:"solidgate"` + Square *squareSourceVerification `tfsdk:"square"` + Stripe *stripeSourceVerification `tfsdk:"stripe"` + Svix *svixSourceVerification `tfsdk:"svix"` + Synctera *syncteraSourceVerification `tfsdk:"synctera"` + Tebex *tebexSourceVerification `tfsdk:"tebex"` + Telnyx *telnyxSourceVerification `tfsdk:"telnyx"` + ThreeDEye *threeDEyeSourceVerification `tfsdk:"three_d_eye"` + Tokenio *tokenioSourceVerification `tfsdk:"tokenio"` + Trello *trelloSourceVerification `tfsdk:"trello"` + Twilio *twilioSourceVerification `tfsdk:"twilio"` + Twitch *twitchSourceVerification `tfsdk:"twitch"` + Twitter *twitterSourceVerification `tfsdk:"twitter"` + Typeform *typeformSourceVerification `tfsdk:"typeform"` + Vercel *vercelSourceVerification `tfsdk:"vercel"` + VercelLogDrains *vercelLogDrainsSourceVerification `tfsdk:"vercel_log_drains"` + Wix *wixSourceVerification `tfsdk:"wix"` + Woocommerce *woocommerceSourceVerification `tfsdk:"woocommerce"` + Workos *workosSourceVerification `tfsdk:"workos"` + Xero *xeroSourceVerification `tfsdk:"xero"` + Zoom *zoomSourceVerification `tfsdk:"zoom"` +} + +type sourceVerificationProvider interface { + getSchemaName() string + getSchemaValue() schema.SingleNestedAttribute + ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig +} + +var Providers []sourceVerificationProvider + +func GetSourceVerificationSchemaAttributes() map[string]schema.Attribute { + attributes := map[string]schema.Attribute{} + + attributes["json"] = schema.StringAttribute{ + Optional: true, + Sensitive: true, + } + + for _, provider := range Providers { + attributes[provider.getSchemaName()] = provider.getSchemaValue() + } + + return attributes +} diff --git a/internal/provider/sourceverification/generated/verification_adyen.go b/internal/provider/sourceverification/generated/verification_adyen.go new file mode 100644 index 0000000..bed1279 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_adyen.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type adyenSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type adyenSourceVerificationProvider struct { +} + +func (p *adyenSourceVerificationProvider) getSchemaName() string { + return "adyen" +} + +func (p *adyenSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *adyenSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Adyen == nil { + return nil + } + return hookdeck.NewVerificationConfigFromAdyen(&hookdeck.VerificationAdyen{ + Configs: &hookdeck.VerificationAdyenConfigs{ + WebhookSecretKey: sourceVerification.Adyen.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &adyenSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_akeneo.go b/internal/provider/sourceverification/generated/verification_akeneo.go new file mode 100644 index 0000000..762c0b2 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_akeneo.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type akeneoSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type akeneoSourceVerificationProvider struct { +} + +func (p *akeneoSourceVerificationProvider) getSchemaName() string { + return "akeneo" +} + +func (p *akeneoSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *akeneoSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Akeneo == nil { + return nil + } + return hookdeck.NewVerificationConfigFromAkeneo(&hookdeck.VerificationAkeneo{ + Configs: &hookdeck.VerificationAkeneoConfigs{ + WebhookSecretKey: sourceVerification.Akeneo.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &akeneoSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_apikey.go b/internal/provider/sourceverification/generated/verification_apikey.go new file mode 100644 index 0000000..c725cb1 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_apikey.go @@ -0,0 +1,57 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type apiKeySourceVerification struct { + ApiKey types.String `tfsdk:"api_key"` + HeaderKey types.String `tfsdk:"header_key"` +} + +type apiKeySourceVerificationProvider struct { +} + +func (p *apiKeySourceVerificationProvider) getSchemaName() string { + return "api_key" +} + +func (p *apiKeySourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "api_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + "header_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *apiKeySourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.ApiKey == nil { + return nil + } + return hookdeck.NewVerificationConfigFromApiKey(&hookdeck.VerificationApiKey{ + Configs: &hookdeck.VerificationApiKeyConfigs{ + ApiKey: sourceVerification.ApiKey.ApiKey.ValueString(), + HeaderKey: sourceVerification.ApiKey.HeaderKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &apiKeySourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_awssns.go b/internal/provider/sourceverification/generated/verification_awssns.go new file mode 100644 index 0000000..d8bb6e6 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_awssns.go @@ -0,0 +1,40 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type awsSnsSourceVerification struct { +} + +type awsSnsSourceVerificationProvider struct { +} + +func (p *awsSnsSourceVerificationProvider) getSchemaName() string { + return "aws_sns" +} + +func (p *awsSnsSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{}, + } +} + +func (p *awsSnsSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.AwsSns == nil { + return nil + } + return hookdeck.NewVerificationConfigFromAwsSns(&hookdeck.VerificationAwssns{ + Configs: &hookdeck.VerificationAwssnsConfigs{}, + }) +} + +func init() { + Providers = append(Providers, &awsSnsSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_basicauth.go b/internal/provider/sourceverification/generated/verification_basicauth.go new file mode 100644 index 0000000..171c9b7 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_basicauth.go @@ -0,0 +1,57 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type basicAuthSourceVerification struct { + Password types.String `tfsdk:"password"` + Username types.String `tfsdk:"username"` +} + +type basicAuthSourceVerificationProvider struct { +} + +func (p *basicAuthSourceVerificationProvider) getSchemaName() string { + return "basic_auth" +} + +func (p *basicAuthSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "password": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + "username": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *basicAuthSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.BasicAuth == nil { + return nil + } + return hookdeck.NewVerificationConfigFromBasicAuth(&hookdeck.VerificationBasicAuth{ + Configs: &hookdeck.VerificationBasicAuthConfigs{ + Password: sourceVerification.BasicAuth.Password.ValueString(), + Username: sourceVerification.BasicAuth.Username.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &basicAuthSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_bondsmith.go b/internal/provider/sourceverification/generated/verification_bondsmith.go new file mode 100644 index 0000000..9e4dd19 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_bondsmith.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type bondsmithSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type bondsmithSourceVerificationProvider struct { +} + +func (p *bondsmithSourceVerificationProvider) getSchemaName() string { + return "bondsmith" +} + +func (p *bondsmithSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *bondsmithSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Bondsmith == nil { + return nil + } + return hookdeck.NewVerificationConfigFromBondsmith(&hookdeck.VerificationBondsmith{ + Configs: &hookdeck.VerificationBondsmithConfigs{ + WebhookSecretKey: sourceVerification.Bondsmith.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &bondsmithSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_cloudsignal.go b/internal/provider/sourceverification/generated/verification_cloudsignal.go new file mode 100644 index 0000000..0cb2518 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_cloudsignal.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type cloudsignalSourceVerification struct { + ApiKey types.String `tfsdk:"api_key"` +} + +type cloudsignalSourceVerificationProvider struct { +} + +func (p *cloudsignalSourceVerificationProvider) getSchemaName() string { + return "cloudsignal" +} + +func (p *cloudsignalSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "api_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *cloudsignalSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Cloudsignal == nil { + return nil + } + return hookdeck.NewVerificationConfigFromCloudsignal(&hookdeck.VerificationCloudSignal{ + Configs: &hookdeck.VerificationCloudSignalConfigs{ + ApiKey: sourceVerification.Cloudsignal.ApiKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &cloudsignalSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_commercelayer.go b/internal/provider/sourceverification/generated/verification_commercelayer.go new file mode 100644 index 0000000..dcb194c --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_commercelayer.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type commercelayerSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type commercelayerSourceVerificationProvider struct { +} + +func (p *commercelayerSourceVerificationProvider) getSchemaName() string { + return "commercelayer" +} + +func (p *commercelayerSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *commercelayerSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Commercelayer == nil { + return nil + } + return hookdeck.NewVerificationConfigFromCommercelayer(&hookdeck.VerificationCommercelayer{ + Configs: &hookdeck.VerificationCommercelayerConfigs{ + WebhookSecretKey: sourceVerification.Commercelayer.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &commercelayerSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_courier.go b/internal/provider/sourceverification/generated/verification_courier.go new file mode 100644 index 0000000..8252fc1 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_courier.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type courierSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type courierSourceVerificationProvider struct { +} + +func (p *courierSourceVerificationProvider) getSchemaName() string { + return "courier" +} + +func (p *courierSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *courierSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Courier == nil { + return nil + } + return hookdeck.NewVerificationConfigFromCourier(&hookdeck.VerificationCourier{ + Configs: &hookdeck.VerificationCourierConfigs{ + WebhookSecretKey: sourceVerification.Courier.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &courierSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_discord.go b/internal/provider/sourceverification/generated/verification_discord.go new file mode 100644 index 0000000..6e691d4 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_discord.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type discordSourceVerification struct { + PublicKey types.String `tfsdk:"public_key"` +} + +type discordSourceVerificationProvider struct { +} + +func (p *discordSourceVerificationProvider) getSchemaName() string { + return "discord" +} + +func (p *discordSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "public_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *discordSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Discord == nil { + return nil + } + return hookdeck.NewVerificationConfigFromDiscord(&hookdeck.VerificationDiscord{ + Configs: &hookdeck.VerificationDiscordConfigs{ + PublicKey: sourceVerification.Discord.PublicKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &discordSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/verification_ebay.go b/internal/provider/sourceverification/generated/verification_ebay.go similarity index 51% rename from internal/provider/sourceverification/verification_ebay.go rename to internal/provider/sourceverification/generated/verification_ebay.go index 3b2fcb3..2c0e55d 100644 --- a/internal/provider/sourceverification/verification_ebay.go +++ b/internal/provider/sourceverification/generated/verification_ebay.go @@ -1,4 +1,8 @@ -package sourceverification +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -6,50 +10,69 @@ import ( hookdeck "github.com/hookdeck/hookdeck-go-sdk" ) -func ebayConfigSchema() schema.SingleNestedAttribute { +type ebaySourceVerification struct { + ClientId types.String `tfsdk:"client_id"` + ClientSecret types.String `tfsdk:"client_secret"` + DevId types.String `tfsdk:"dev_id"` + Environment types.String `tfsdk:"environment"` + VerificationToken types.String `tfsdk:"verification_token"` +} + +type ebaySourceVerificationProvider struct { +} + +func (p *ebaySourceVerificationProvider) getSchemaName() string { + return "ebay" +} + +func (p *ebaySourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { return schema.SingleNestedAttribute{ Optional: true, Attributes: map[string]schema.Attribute{ "client_id": schema.StringAttribute{ Required: true, + Optional: false, Sensitive: true, }, "client_secret": schema.StringAttribute{ Required: true, + Optional: false, Sensitive: true, }, "dev_id": schema.StringAttribute{ Required: true, + Optional: false, Sensitive: true, }, "environment": schema.StringAttribute{ Required: true, + Optional: false, Sensitive: true, }, "verification_token": schema.StringAttribute{ Required: true, + Optional: false, Sensitive: true, }, }, } } -type ebaySourceVerification struct { - ClientId types.String `tfsdk:"client_id"` - ClientSecret types.String `tfsdk:"client_secret"` - DevId types.String `tfsdk:"dev_id"` - Environment types.String `tfsdk:"environment"` - VerificationToken types.String `tfsdk:"verification_token"` -} - -func (m *ebaySourceVerification) toPayload() *hookdeck.VerificationConfig { +func (p *ebaySourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Ebay == nil { + return nil + } return hookdeck.NewVerificationConfigFromEbay(&hookdeck.VerificationEbay{ Configs: &hookdeck.VerificationEbayConfigs{ - ClientId: m.ClientId.ValueString(), - ClientSecret: m.ClientSecret.ValueString(), - DevId: m.DevId.ValueString(), - Environment: m.Environment.ValueString(), - VerificationToken: m.VerificationToken.ValueString(), + ClientId: sourceVerification.Ebay.ClientId.ValueString(), + ClientSecret: sourceVerification.Ebay.ClientSecret.ValueString(), + DevId: sourceVerification.Ebay.DevId.ValueString(), + Environment: sourceVerification.Ebay.Environment.ValueString(), + VerificationToken: sourceVerification.Ebay.VerificationToken.ValueString(), }, }) } + +func init() { + Providers = append(Providers, &ebaySourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_enode.go b/internal/provider/sourceverification/generated/verification_enode.go new file mode 100644 index 0000000..a5027ab --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_enode.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type enodeSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type enodeSourceVerificationProvider struct { +} + +func (p *enodeSourceVerificationProvider) getSchemaName() string { + return "enode" +} + +func (p *enodeSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *enodeSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Enode == nil { + return nil + } + return hookdeck.NewVerificationConfigFromEnode(&hookdeck.VerificationEnode{ + Configs: &hookdeck.VerificationEnodeConfigs{ + WebhookSecretKey: sourceVerification.Enode.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &enodeSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_favro.go b/internal/provider/sourceverification/generated/verification_favro.go new file mode 100644 index 0000000..6b6feea --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_favro.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type favroSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type favroSourceVerificationProvider struct { +} + +func (p *favroSourceVerificationProvider) getSchemaName() string { + return "favro" +} + +func (p *favroSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *favroSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Favro == nil { + return nil + } + return hookdeck.NewVerificationConfigFromFavro(&hookdeck.VerificationFavro{ + Configs: &hookdeck.VerificationFavroConfigs{ + WebhookSecretKey: sourceVerification.Favro.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &favroSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_fiserv.go b/internal/provider/sourceverification/generated/verification_fiserv.go new file mode 100644 index 0000000..3cfc2ed --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_fiserv.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type fiservSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type fiservSourceVerificationProvider struct { +} + +func (p *fiservSourceVerificationProvider) getSchemaName() string { + return "fiserv" +} + +func (p *fiservSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *fiservSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Fiserv == nil { + return nil + } + return hookdeck.NewVerificationConfigFromFiserv(&hookdeck.VerificationFiserv{ + Configs: &hookdeck.VerificationFiservConfigs{ + WebhookSecretKey: sourceVerification.Fiserv.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &fiservSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_frontapp.go b/internal/provider/sourceverification/generated/verification_frontapp.go new file mode 100644 index 0000000..b91cebf --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_frontapp.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type frontappSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type frontappSourceVerificationProvider struct { +} + +func (p *frontappSourceVerificationProvider) getSchemaName() string { + return "frontapp" +} + +func (p *frontappSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *frontappSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Frontapp == nil { + return nil + } + return hookdeck.NewVerificationConfigFromFrontapp(&hookdeck.VerificationFrontApp{ + Configs: &hookdeck.VerificationFrontAppConfigs{ + WebhookSecretKey: sourceVerification.Frontapp.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &frontappSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_github.go b/internal/provider/sourceverification/generated/verification_github.go new file mode 100644 index 0000000..0eb1ef1 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_github.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type githubSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type githubSourceVerificationProvider struct { +} + +func (p *githubSourceVerificationProvider) getSchemaName() string { + return "github" +} + +func (p *githubSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *githubSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Github == nil { + return nil + } + return hookdeck.NewVerificationConfigFromGithub(&hookdeck.VerificationGitHub{ + Configs: &hookdeck.VerificationGitHubConfigs{ + WebhookSecretKey: sourceVerification.Github.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &githubSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_gitlab.go b/internal/provider/sourceverification/generated/verification_gitlab.go new file mode 100644 index 0000000..24c3d7e --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_gitlab.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type gitlabSourceVerification struct { + ApiKey types.String `tfsdk:"api_key"` +} + +type gitlabSourceVerificationProvider struct { +} + +func (p *gitlabSourceVerificationProvider) getSchemaName() string { + return "gitlab" +} + +func (p *gitlabSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "api_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *gitlabSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Gitlab == nil { + return nil + } + return hookdeck.NewVerificationConfigFromGitlab(&hookdeck.VerificationGitLab{ + Configs: &hookdeck.VerificationGitLabConfigs{ + ApiKey: sourceVerification.Gitlab.ApiKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &gitlabSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_hmac.go b/internal/provider/sourceverification/generated/verification_hmac.go new file mode 100644 index 0000000..ce5af64 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_hmac.go @@ -0,0 +1,73 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type hmacSourceVerification struct { + Algorithm types.String `tfsdk:"algorithm"` + Encoding types.String `tfsdk:"encoding"` + HeaderKey types.String `tfsdk:"header_key"` + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type hmacSourceVerificationProvider struct { +} + +func (p *hmacSourceVerificationProvider) getSchemaName() string { + return "hmac" +} + +func (p *hmacSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "algorithm": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + "encoding": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + "header_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *hmacSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Hmac == nil { + return nil + } + algorithm, _ := hookdeck.NewHmacAlgorithmsFromString(sourceVerification.Hmac.Algorithm.ValueString()) + encoding, _ := hookdeck.NewVerificationHmacConfigsEncodingFromString(sourceVerification.Hmac.Encoding.ValueString()) + return hookdeck.NewVerificationConfigFromHmac(&hookdeck.VerificationHmac{ + Configs: &hookdeck.VerificationHmacConfigs{ + Algorithm: algorithm, + Encoding: encoding, + HeaderKey: sourceVerification.Hmac.HeaderKey.ValueString(), + WebhookSecretKey: sourceVerification.Hmac.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &hmacSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_hubspot.go b/internal/provider/sourceverification/generated/verification_hubspot.go new file mode 100644 index 0000000..8ebdae3 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_hubspot.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type hubspotSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type hubspotSourceVerificationProvider struct { +} + +func (p *hubspotSourceVerificationProvider) getSchemaName() string { + return "hubspot" +} + +func (p *hubspotSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *hubspotSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Hubspot == nil { + return nil + } + return hookdeck.NewVerificationConfigFromHubspot(&hookdeck.VerificationHubspot{ + Configs: &hookdeck.VerificationHubspotConfigs{ + WebhookSecretKey: sourceVerification.Hubspot.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &hubspotSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_linear.go b/internal/provider/sourceverification/generated/verification_linear.go new file mode 100644 index 0000000..6ef44d7 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_linear.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type linearSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type linearSourceVerificationProvider struct { +} + +func (p *linearSourceVerificationProvider) getSchemaName() string { + return "linear" +} + +func (p *linearSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *linearSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Linear == nil { + return nil + } + return hookdeck.NewVerificationConfigFromLinear(&hookdeck.VerificationLinear{ + Configs: &hookdeck.VerificationLinearConfigs{ + WebhookSecretKey: sourceVerification.Linear.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &linearSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_mailchimp.go b/internal/provider/sourceverification/generated/verification_mailchimp.go new file mode 100644 index 0000000..199cc22 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_mailchimp.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type mailchimpSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type mailchimpSourceVerificationProvider struct { +} + +func (p *mailchimpSourceVerificationProvider) getSchemaName() string { + return "mailchimp" +} + +func (p *mailchimpSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *mailchimpSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Mailchimp == nil { + return nil + } + return hookdeck.NewVerificationConfigFromMailchimp(&hookdeck.VerificationMailchimp{ + Configs: &hookdeck.VerificationMailchimpConfigs{ + WebhookSecretKey: sourceVerification.Mailchimp.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &mailchimpSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_mailgun.go b/internal/provider/sourceverification/generated/verification_mailgun.go new file mode 100644 index 0000000..974f877 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_mailgun.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type mailgunSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type mailgunSourceVerificationProvider struct { +} + +func (p *mailgunSourceVerificationProvider) getSchemaName() string { + return "mailgun" +} + +func (p *mailgunSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *mailgunSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Mailgun == nil { + return nil + } + return hookdeck.NewVerificationConfigFromMailgun(&hookdeck.VerificationMailgun{ + Configs: &hookdeck.VerificationMailgunConfigs{ + WebhookSecretKey: sourceVerification.Mailgun.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &mailgunSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_nmi.go b/internal/provider/sourceverification/generated/verification_nmi.go new file mode 100644 index 0000000..f9fb40e --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_nmi.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type nmiSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type nmiSourceVerificationProvider struct { +} + +func (p *nmiSourceVerificationProvider) getSchemaName() string { + return "nmi" +} + +func (p *nmiSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *nmiSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Nmi == nil { + return nil + } + return hookdeck.NewVerificationConfigFromNmi(&hookdeck.VerificationNmiPaymentGateway{ + Configs: &hookdeck.VerificationNmiPaymentGatewayConfigs{ + WebhookSecretKey: sourceVerification.Nmi.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &nmiSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_orb.go b/internal/provider/sourceverification/generated/verification_orb.go new file mode 100644 index 0000000..700ddc2 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_orb.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type orbSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type orbSourceVerificationProvider struct { +} + +func (p *orbSourceVerificationProvider) getSchemaName() string { + return "orb" +} + +func (p *orbSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *orbSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Orb == nil { + return nil + } + return hookdeck.NewVerificationConfigFromOrb(&hookdeck.VerificationOrb{ + Configs: &hookdeck.VerificationOrbConfigs{ + WebhookSecretKey: sourceVerification.Orb.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &orbSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_oura.go b/internal/provider/sourceverification/generated/verification_oura.go new file mode 100644 index 0000000..09723fd --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_oura.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type ouraSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type ouraSourceVerificationProvider struct { +} + +func (p *ouraSourceVerificationProvider) getSchemaName() string { + return "oura" +} + +func (p *ouraSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *ouraSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Oura == nil { + return nil + } + return hookdeck.NewVerificationConfigFromOura(&hookdeck.VerificationOura{ + Configs: &hookdeck.VerificationOuraConfigs{ + WebhookSecretKey: sourceVerification.Oura.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &ouraSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_paddle.go b/internal/provider/sourceverification/generated/verification_paddle.go new file mode 100644 index 0000000..f8cab18 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_paddle.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type paddleSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type paddleSourceVerificationProvider struct { +} + +func (p *paddleSourceVerificationProvider) getSchemaName() string { + return "paddle" +} + +func (p *paddleSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *paddleSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Paddle == nil { + return nil + } + return hookdeck.NewVerificationConfigFromPaddle(&hookdeck.VerificationPaddle{ + Configs: &hookdeck.VerificationPaddleConfigs{ + WebhookSecretKey: sourceVerification.Paddle.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &paddleSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_paypal.go b/internal/provider/sourceverification/generated/verification_paypal.go new file mode 100644 index 0000000..307ecc9 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_paypal.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type paypalSourceVerification struct { + WebhookId types.String `tfsdk:"webhook_id"` +} + +type paypalSourceVerificationProvider struct { +} + +func (p *paypalSourceVerificationProvider) getSchemaName() string { + return "paypal" +} + +func (p *paypalSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_id": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *paypalSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Paypal == nil { + return nil + } + return hookdeck.NewVerificationConfigFromPaypal(&hookdeck.VerificationPaypal{ + Configs: &hookdeck.VerificationPaypalConfigs{ + WebhookId: sourceVerification.Paypal.WebhookId.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &paypalSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_persona.go b/internal/provider/sourceverification/generated/verification_persona.go new file mode 100644 index 0000000..35ee1e8 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_persona.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type personaSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type personaSourceVerificationProvider struct { +} + +func (p *personaSourceVerificationProvider) getSchemaName() string { + return "persona" +} + +func (p *personaSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *personaSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Persona == nil { + return nil + } + return hookdeck.NewVerificationConfigFromPersona(&hookdeck.VerificationPersona{ + Configs: &hookdeck.VerificationPersonaConfigs{ + WebhookSecretKey: sourceVerification.Persona.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &personaSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_pipedrive.go b/internal/provider/sourceverification/generated/verification_pipedrive.go new file mode 100644 index 0000000..65fff0e --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_pipedrive.go @@ -0,0 +1,57 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type pipedriveSourceVerification struct { + Password types.String `tfsdk:"password"` + Username types.String `tfsdk:"username"` +} + +type pipedriveSourceVerificationProvider struct { +} + +func (p *pipedriveSourceVerificationProvider) getSchemaName() string { + return "pipedrive" +} + +func (p *pipedriveSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "password": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + "username": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *pipedriveSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Pipedrive == nil { + return nil + } + return hookdeck.NewVerificationConfigFromPipedrive(&hookdeck.VerificationPipedrive{ + Configs: &hookdeck.VerificationPipedriveConfigs{ + Password: sourceVerification.Pipedrive.Password.ValueString(), + Username: sourceVerification.Pipedrive.Username.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &pipedriveSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_postmark.go b/internal/provider/sourceverification/generated/verification_postmark.go new file mode 100644 index 0000000..1b4eef8 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_postmark.go @@ -0,0 +1,57 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type postmarkSourceVerification struct { + Password types.String `tfsdk:"password"` + Username types.String `tfsdk:"username"` +} + +type postmarkSourceVerificationProvider struct { +} + +func (p *postmarkSourceVerificationProvider) getSchemaName() string { + return "postmark" +} + +func (p *postmarkSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "password": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + "username": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *postmarkSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Postmark == nil { + return nil + } + return hookdeck.NewVerificationConfigFromPostmark(&hookdeck.VerificationPostmark{ + Configs: &hookdeck.VerificationPostmarkConfigs{ + Password: sourceVerification.Postmark.Password.ValueString(), + Username: sourceVerification.Postmark.Username.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &postmarkSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_propertyfinder.go b/internal/provider/sourceverification/generated/verification_propertyfinder.go new file mode 100644 index 0000000..ff18261 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_propertyfinder.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type propertyFinderSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type propertyFinderSourceVerificationProvider struct { +} + +func (p *propertyFinderSourceVerificationProvider) getSchemaName() string { + return "property_finder" +} + +func (p *propertyFinderSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *propertyFinderSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.PropertyFinder == nil { + return nil + } + return hookdeck.NewVerificationConfigFromPropertyFinder(&hookdeck.VerificationPropertyFinder{ + Configs: &hookdeck.VerificationPropertyFinderConfigs{ + WebhookSecretKey: sourceVerification.PropertyFinder.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &propertyFinderSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_pylon.go b/internal/provider/sourceverification/generated/verification_pylon.go new file mode 100644 index 0000000..5bdc13d --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_pylon.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type pylonSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type pylonSourceVerificationProvider struct { +} + +func (p *pylonSourceVerificationProvider) getSchemaName() string { + return "pylon" +} + +func (p *pylonSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *pylonSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Pylon == nil { + return nil + } + return hookdeck.NewVerificationConfigFromPylon(&hookdeck.VerificationPylon{ + Configs: &hookdeck.VerificationPylonConfigs{ + WebhookSecretKey: sourceVerification.Pylon.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &pylonSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_razorpay.go b/internal/provider/sourceverification/generated/verification_razorpay.go new file mode 100644 index 0000000..47ed044 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_razorpay.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type razorpaySourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type razorpaySourceVerificationProvider struct { +} + +func (p *razorpaySourceVerificationProvider) getSchemaName() string { + return "razorpay" +} + +func (p *razorpaySourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *razorpaySourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Razorpay == nil { + return nil + } + return hookdeck.NewVerificationConfigFromRazorpay(&hookdeck.VerificationRazorpay{ + Configs: &hookdeck.VerificationRazorpayConfigs{ + WebhookSecretKey: sourceVerification.Razorpay.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &razorpaySourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_recharge.go b/internal/provider/sourceverification/generated/verification_recharge.go new file mode 100644 index 0000000..6353db4 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_recharge.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type rechargeSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type rechargeSourceVerificationProvider struct { +} + +func (p *rechargeSourceVerificationProvider) getSchemaName() string { + return "recharge" +} + +func (p *rechargeSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *rechargeSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Recharge == nil { + return nil + } + return hookdeck.NewVerificationConfigFromRecharge(&hookdeck.VerificationRecharge{ + Configs: &hookdeck.VerificationRechargeConfigs{ + WebhookSecretKey: sourceVerification.Recharge.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &rechargeSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_repay.go b/internal/provider/sourceverification/generated/verification_repay.go new file mode 100644 index 0000000..315f5bf --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_repay.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type repaySourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type repaySourceVerificationProvider struct { +} + +func (p *repaySourceVerificationProvider) getSchemaName() string { + return "repay" +} + +func (p *repaySourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *repaySourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Repay == nil { + return nil + } + return hookdeck.NewVerificationConfigFromRepay(&hookdeck.VerificationRepay{ + Configs: &hookdeck.VerificationRepayConfigs{ + WebhookSecretKey: sourceVerification.Repay.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &repaySourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_sanity.go b/internal/provider/sourceverification/generated/verification_sanity.go new file mode 100644 index 0000000..db62a7a --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_sanity.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type sanitySourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type sanitySourceVerificationProvider struct { +} + +func (p *sanitySourceVerificationProvider) getSchemaName() string { + return "sanity" +} + +func (p *sanitySourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *sanitySourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Sanity == nil { + return nil + } + return hookdeck.NewVerificationConfigFromSanity(&hookdeck.VerificationSanity{ + Configs: &hookdeck.VerificationSanityConfigs{ + WebhookSecretKey: sourceVerification.Sanity.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &sanitySourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_sendgrid.go b/internal/provider/sourceverification/generated/verification_sendgrid.go new file mode 100644 index 0000000..fc6853d --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_sendgrid.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type sendgridSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type sendgridSourceVerificationProvider struct { +} + +func (p *sendgridSourceVerificationProvider) getSchemaName() string { + return "sendgrid" +} + +func (p *sendgridSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *sendgridSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Sendgrid == nil { + return nil + } + return hookdeck.NewVerificationConfigFromSendgrid(&hookdeck.VerificationSendGrid{ + Configs: &hookdeck.VerificationSendGridConfigs{ + WebhookSecretKey: sourceVerification.Sendgrid.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &sendgridSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_shopify.go b/internal/provider/sourceverification/generated/verification_shopify.go new file mode 100644 index 0000000..cfaddaa --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_shopify.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type shopifySourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type shopifySourceVerificationProvider struct { +} + +func (p *shopifySourceVerificationProvider) getSchemaName() string { + return "shopify" +} + +func (p *shopifySourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *shopifySourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Shopify == nil { + return nil + } + return hookdeck.NewVerificationConfigFromShopify(&hookdeck.VerificationShopify{ + Configs: &hookdeck.VerificationShopifyConfigs{ + WebhookSecretKey: sourceVerification.Shopify.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &shopifySourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_shopline.go b/internal/provider/sourceverification/generated/verification_shopline.go new file mode 100644 index 0000000..ef0a8c3 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_shopline.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type shoplineSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type shoplineSourceVerificationProvider struct { +} + +func (p *shoplineSourceVerificationProvider) getSchemaName() string { + return "shopline" +} + +func (p *shoplineSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *shoplineSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Shopline == nil { + return nil + } + return hookdeck.NewVerificationConfigFromShopline(&hookdeck.VerificationShopline{ + Configs: &hookdeck.VerificationShoplineConfigs{ + WebhookSecretKey: sourceVerification.Shopline.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &shoplineSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_slack.go b/internal/provider/sourceverification/generated/verification_slack.go new file mode 100644 index 0000000..f9904da --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_slack.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type slackSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type slackSourceVerificationProvider struct { +} + +func (p *slackSourceVerificationProvider) getSchemaName() string { + return "slack" +} + +func (p *slackSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *slackSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Slack == nil { + return nil + } + return hookdeck.NewVerificationConfigFromSlack(&hookdeck.VerificationSlack{ + Configs: &hookdeck.VerificationSlackConfigs{ + WebhookSecretKey: sourceVerification.Slack.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &slackSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_solidgate.go b/internal/provider/sourceverification/generated/verification_solidgate.go new file mode 100644 index 0000000..36c5338 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_solidgate.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type solidgateSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type solidgateSourceVerificationProvider struct { +} + +func (p *solidgateSourceVerificationProvider) getSchemaName() string { + return "solidgate" +} + +func (p *solidgateSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *solidgateSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Solidgate == nil { + return nil + } + return hookdeck.NewVerificationConfigFromSolidgate(&hookdeck.VerificationSolidGate{ + Configs: &hookdeck.VerificationSolidGateConfigs{ + WebhookSecretKey: sourceVerification.Solidgate.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &solidgateSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_square.go b/internal/provider/sourceverification/generated/verification_square.go new file mode 100644 index 0000000..a9b8f84 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_square.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type squareSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type squareSourceVerificationProvider struct { +} + +func (p *squareSourceVerificationProvider) getSchemaName() string { + return "square" +} + +func (p *squareSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *squareSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Square == nil { + return nil + } + return hookdeck.NewVerificationConfigFromSquare(&hookdeck.VerificationSquare{ + Configs: &hookdeck.VerificationSquareConfigs{ + WebhookSecretKey: sourceVerification.Square.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &squareSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_stripe.go b/internal/provider/sourceverification/generated/verification_stripe.go new file mode 100644 index 0000000..7ada0bd --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_stripe.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type stripeSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type stripeSourceVerificationProvider struct { +} + +func (p *stripeSourceVerificationProvider) getSchemaName() string { + return "stripe" +} + +func (p *stripeSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *stripeSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Stripe == nil { + return nil + } + return hookdeck.NewVerificationConfigFromStripe(&hookdeck.VerificationStripe{ + Configs: &hookdeck.VerificationStripeConfigs{ + WebhookSecretKey: sourceVerification.Stripe.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &stripeSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_svix.go b/internal/provider/sourceverification/generated/verification_svix.go new file mode 100644 index 0000000..1bd584d --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_svix.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type svixSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type svixSourceVerificationProvider struct { +} + +func (p *svixSourceVerificationProvider) getSchemaName() string { + return "svix" +} + +func (p *svixSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *svixSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Svix == nil { + return nil + } + return hookdeck.NewVerificationConfigFromSvix(&hookdeck.VerificationSvix{ + Configs: &hookdeck.VerificationSvixConfigs{ + WebhookSecretKey: sourceVerification.Svix.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &svixSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_synctera.go b/internal/provider/sourceverification/generated/verification_synctera.go new file mode 100644 index 0000000..8031478 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_synctera.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type syncteraSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type syncteraSourceVerificationProvider struct { +} + +func (p *syncteraSourceVerificationProvider) getSchemaName() string { + return "synctera" +} + +func (p *syncteraSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *syncteraSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Synctera == nil { + return nil + } + return hookdeck.NewVerificationConfigFromSynctera(&hookdeck.VerificationSynctera{ + Configs: &hookdeck.VerificationSyncteraConfigs{ + WebhookSecretKey: sourceVerification.Synctera.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &syncteraSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_tebex.go b/internal/provider/sourceverification/generated/verification_tebex.go new file mode 100644 index 0000000..3c90a6d --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_tebex.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type tebexSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type tebexSourceVerificationProvider struct { +} + +func (p *tebexSourceVerificationProvider) getSchemaName() string { + return "tebex" +} + +func (p *tebexSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *tebexSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Tebex == nil { + return nil + } + return hookdeck.NewVerificationConfigFromTebex(&hookdeck.VerificationTebex{ + Configs: &hookdeck.VerificationTebexConfigs{ + WebhookSecretKey: sourceVerification.Tebex.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &tebexSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_telnyx.go b/internal/provider/sourceverification/generated/verification_telnyx.go new file mode 100644 index 0000000..6859250 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_telnyx.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type telnyxSourceVerification struct { + PublicKey types.String `tfsdk:"public_key"` +} + +type telnyxSourceVerificationProvider struct { +} + +func (p *telnyxSourceVerificationProvider) getSchemaName() string { + return "telnyx" +} + +func (p *telnyxSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "public_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *telnyxSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Telnyx == nil { + return nil + } + return hookdeck.NewVerificationConfigFromTelnyx(&hookdeck.VerificationTelnyx{ + Configs: &hookdeck.VerificationTelnyxConfigs{ + PublicKey: sourceVerification.Telnyx.PublicKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &telnyxSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_threedeye.go b/internal/provider/sourceverification/generated/verification_threedeye.go new file mode 100644 index 0000000..d16302c --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_threedeye.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type threeDEyeSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type threeDEyeSourceVerificationProvider struct { +} + +func (p *threeDEyeSourceVerificationProvider) getSchemaName() string { + return "three_d_eye" +} + +func (p *threeDEyeSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *threeDEyeSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.ThreeDEye == nil { + return nil + } + return hookdeck.NewVerificationConfigFromThreeDEye(&hookdeck.Verification3DEye{ + Configs: &hookdeck.Verification3DEyeConfigs{ + WebhookSecretKey: sourceVerification.ThreeDEye.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &threeDEyeSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_tokenio.go b/internal/provider/sourceverification/generated/verification_tokenio.go new file mode 100644 index 0000000..b0894da --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_tokenio.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type tokenioSourceVerification struct { + PublicKey types.String `tfsdk:"public_key"` +} + +type tokenioSourceVerificationProvider struct { +} + +func (p *tokenioSourceVerificationProvider) getSchemaName() string { + return "tokenio" +} + +func (p *tokenioSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "public_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *tokenioSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Tokenio == nil { + return nil + } + return hookdeck.NewVerificationConfigFromTokenio(&hookdeck.VerificationTokenIo{ + Configs: &hookdeck.VerificationTokenIoConfigs{ + PublicKey: sourceVerification.Tokenio.PublicKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &tokenioSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_trello.go b/internal/provider/sourceverification/generated/verification_trello.go new file mode 100644 index 0000000..1a4a2ca --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_trello.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type trelloSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type trelloSourceVerificationProvider struct { +} + +func (p *trelloSourceVerificationProvider) getSchemaName() string { + return "trello" +} + +func (p *trelloSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *trelloSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Trello == nil { + return nil + } + return hookdeck.NewVerificationConfigFromTrello(&hookdeck.VerificationTrello{ + Configs: &hookdeck.VerificationTrelloConfigs{ + WebhookSecretKey: sourceVerification.Trello.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &trelloSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_twilio.go b/internal/provider/sourceverification/generated/verification_twilio.go new file mode 100644 index 0000000..4409314 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_twilio.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type twilioSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type twilioSourceVerificationProvider struct { +} + +func (p *twilioSourceVerificationProvider) getSchemaName() string { + return "twilio" +} + +func (p *twilioSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *twilioSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Twilio == nil { + return nil + } + return hookdeck.NewVerificationConfigFromTwilio(&hookdeck.VerificationTwilio{ + Configs: &hookdeck.VerificationTwilioConfigs{ + WebhookSecretKey: sourceVerification.Twilio.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &twilioSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_twitch.go b/internal/provider/sourceverification/generated/verification_twitch.go new file mode 100644 index 0000000..ac51c98 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_twitch.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type twitchSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type twitchSourceVerificationProvider struct { +} + +func (p *twitchSourceVerificationProvider) getSchemaName() string { + return "twitch" +} + +func (p *twitchSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *twitchSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Twitch == nil { + return nil + } + return hookdeck.NewVerificationConfigFromTwitch(&hookdeck.VerificationTwitch{ + Configs: &hookdeck.VerificationTwitchConfigs{ + WebhookSecretKey: sourceVerification.Twitch.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &twitchSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_twitter.go b/internal/provider/sourceverification/generated/verification_twitter.go new file mode 100644 index 0000000..dd978af --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_twitter.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type twitterSourceVerification struct { + ApiKey types.String `tfsdk:"api_key"` +} + +type twitterSourceVerificationProvider struct { +} + +func (p *twitterSourceVerificationProvider) getSchemaName() string { + return "twitter" +} + +func (p *twitterSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "api_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *twitterSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Twitter == nil { + return nil + } + return hookdeck.NewVerificationConfigFromTwitter(&hookdeck.VerificationTwitter{ + Configs: &hookdeck.VerificationTwitterConfigs{ + ApiKey: sourceVerification.Twitter.ApiKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &twitterSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_typeform.go b/internal/provider/sourceverification/generated/verification_typeform.go new file mode 100644 index 0000000..d960c18 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_typeform.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type typeformSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type typeformSourceVerificationProvider struct { +} + +func (p *typeformSourceVerificationProvider) getSchemaName() string { + return "typeform" +} + +func (p *typeformSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *typeformSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Typeform == nil { + return nil + } + return hookdeck.NewVerificationConfigFromTypeform(&hookdeck.VerificationTypeform{ + Configs: &hookdeck.VerificationTypeformConfigs{ + WebhookSecretKey: sourceVerification.Typeform.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &typeformSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_vercel.go b/internal/provider/sourceverification/generated/verification_vercel.go new file mode 100644 index 0000000..a36fd6f --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_vercel.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type vercelSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type vercelSourceVerificationProvider struct { +} + +func (p *vercelSourceVerificationProvider) getSchemaName() string { + return "vercel" +} + +func (p *vercelSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *vercelSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Vercel == nil { + return nil + } + return hookdeck.NewVerificationConfigFromVercel(&hookdeck.VerificationVercel{ + Configs: &hookdeck.VerificationVercelConfigs{ + WebhookSecretKey: sourceVerification.Vercel.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &vercelSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_vercellogdrains.go b/internal/provider/sourceverification/generated/verification_vercellogdrains.go new file mode 100644 index 0000000..f6fe020 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_vercellogdrains.go @@ -0,0 +1,57 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type vercelLogDrainsSourceVerification struct { + VercelLogDrainsSecret types.String `tfsdk:"vercel_log_drains_secret"` + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type vercelLogDrainsSourceVerificationProvider struct { +} + +func (p *vercelLogDrainsSourceVerificationProvider) getSchemaName() string { + return "vercel_log_drains" +} + +func (p *vercelLogDrainsSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "vercel_log_drains_secret": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + "webhook_secret_key": schema.StringAttribute{ + Required: false, + Optional: true, + Sensitive: true, + }, + }, + } +} + +func (p *vercelLogDrainsSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.VercelLogDrains == nil { + return nil + } + return hookdeck.NewVerificationConfigFromVercelLogDrains(&hookdeck.VerificationVercelLogDrains{ + Configs: &hookdeck.VerificationVercelLogDrainsConfigs{ + VercelLogDrainsSecret: sourceVerification.VercelLogDrains.VercelLogDrainsSecret.ValueString(), + WebhookSecretKey: sourceVerification.VercelLogDrains.WebhookSecretKey.ValueStringPointer(), + }, + }) +} + +func init() { + Providers = append(Providers, &vercelLogDrainsSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_wix.go b/internal/provider/sourceverification/generated/verification_wix.go new file mode 100644 index 0000000..cd5c059 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_wix.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type wixSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type wixSourceVerificationProvider struct { +} + +func (p *wixSourceVerificationProvider) getSchemaName() string { + return "wix" +} + +func (p *wixSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *wixSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Wix == nil { + return nil + } + return hookdeck.NewVerificationConfigFromWix(&hookdeck.VerificationWix{ + Configs: &hookdeck.VerificationWixConfigs{ + WebhookSecretKey: sourceVerification.Wix.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &wixSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_woocommerce.go b/internal/provider/sourceverification/generated/verification_woocommerce.go new file mode 100644 index 0000000..79b7321 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_woocommerce.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type woocommerceSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type woocommerceSourceVerificationProvider struct { +} + +func (p *woocommerceSourceVerificationProvider) getSchemaName() string { + return "woocommerce" +} + +func (p *woocommerceSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *woocommerceSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Woocommerce == nil { + return nil + } + return hookdeck.NewVerificationConfigFromWoocommerce(&hookdeck.VerificationWooCommerce{ + Configs: &hookdeck.VerificationWooCommerceConfigs{ + WebhookSecretKey: sourceVerification.Woocommerce.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &woocommerceSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_workos.go b/internal/provider/sourceverification/generated/verification_workos.go new file mode 100644 index 0000000..cbdf822 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_workos.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type workosSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type workosSourceVerificationProvider struct { +} + +func (p *workosSourceVerificationProvider) getSchemaName() string { + return "workos" +} + +func (p *workosSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *workosSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Workos == nil { + return nil + } + return hookdeck.NewVerificationConfigFromWorkos(&hookdeck.VerificationWorkOs{ + Configs: &hookdeck.VerificationWorkOsConfigs{ + WebhookSecretKey: sourceVerification.Workos.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &workosSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_xero.go b/internal/provider/sourceverification/generated/verification_xero.go new file mode 100644 index 0000000..a556de1 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_xero.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type xeroSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type xeroSourceVerificationProvider struct { +} + +func (p *xeroSourceVerificationProvider) getSchemaName() string { + return "xero" +} + +func (p *xeroSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *xeroSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Xero == nil { + return nil + } + return hookdeck.NewVerificationConfigFromXero(&hookdeck.VerificationXero{ + Configs: &hookdeck.VerificationXeroConfigs{ + WebhookSecretKey: sourceVerification.Xero.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &xeroSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/generated/verification_zoom.go b/internal/provider/sourceverification/generated/verification_zoom.go new file mode 100644 index 0000000..cfb27a1 --- /dev/null +++ b/internal/provider/sourceverification/generated/verification_zoom.go @@ -0,0 +1,50 @@ +// Code generated by cmd/codegen. DO NOT EDIT. +// This file is automatically generated and any changes will be overwritten. +// To regenerate this file, run `go generate`. + +package generated + +import ( + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" +) + +type zoomSourceVerification struct { + WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` +} + +type zoomSourceVerificationProvider struct { +} + +func (p *zoomSourceVerificationProvider) getSchemaName() string { + return "zoom" +} + +func (p *zoomSourceVerificationProvider) getSchemaValue() schema.SingleNestedAttribute { + return schema.SingleNestedAttribute{ + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook_secret_key": schema.StringAttribute{ + Required: true, + Optional: false, + Sensitive: true, + }, + }, + } +} + +func (p *zoomSourceVerificationProvider) ToPayload(sourceVerification *SourceVerification) *hookdeck.VerificationConfig { + if sourceVerification.Zoom == nil { + return nil + } + return hookdeck.NewVerificationConfigFromZoom(&hookdeck.VerificationZoom{ + Configs: &hookdeck.VerificationZoomConfigs{ + WebhookSecretKey: sourceVerification.Zoom.WebhookSecretKey.ValueString(), + }, + }) +} + +func init() { + Providers = append(Providers, &zoomSourceVerificationProvider{}) +} diff --git a/internal/provider/sourceverification/model.go b/internal/provider/sourceverification/model.go index 307da6f..091f786 100644 --- a/internal/provider/sourceverification/model.go +++ b/internal/provider/sourceverification/model.go @@ -1,70 +1,12 @@ package sourceverification -import "github.com/hashicorp/terraform-plugin-framework/types" +import ( + "terraform-provider-hookdeck/internal/provider/sourceverification/generated" -type sourceVerificationResourceModel struct { - SourceID types.String `tfsdk:"source_id"` - Verification *sourceVerification `tfsdk:"verification"` -} + "github.com/hashicorp/terraform-plugin-framework/types" +) -type sourceVerification struct { - // generic - APIKey *apiKeySourceVerification `tfsdk:"api_key"` - BasicAuth *basicAuthSourceVerification `tfsdk:"basic_auth"` - HMAC *hmacSourceVerification `tfsdk:"hmac"` - JSON types.String `tfsdk:"json"` - // providers - Adyen *adyenSourceVerification `tfsdk:"adyen"` - Akeneo *akeneoSourceVerification `tfsdk:"akeneo"` - AWSSNS *awsSNSSourceVerification `tfsdk:"aws_sns"` - Bondsmith *bondsmithSourceVerification `tfsdk:"bondsmith"` - Cloudsignal *cloudsignalSourceVerification `tfsdk:"cloudsignal"` - Commercelayer *commercelayerSourceVerification `tfsdk:"commercelayer"` - Courier *courierSourceVerification `tfsdk:"courier"` - Discord *discordSourceVerification `tfsdk:"discord"` - Ebay *ebaySourceVerification `tfsdk:"ebay"` - Enode *enodeSourceVerification `tfsdk:"enode"` - Favro *favroSourceVerification `tfsdk:"favro"` - Fiserv *fiservSourceVerification `tfsdk:"fiserv"` - FrontApp *frontAppSourceVerification `tfsdk:"frontapp"` - GitHub *githubSourceVerification `tfsdk:"github"` - GitLab *gitlabSourceVerification `tfsdk:"gitlab"` - Linear *linearSourceVerification `tfsdk:"linear"` - Mailgun *mailgunSourceVerification `tfsdk:"mailgun"` - Nmi *nmiSourceVerification `tfsdk:"nmi"` - Orb *orbSourceVerification `tfsdk:"orb"` - Oura *ouraSourceVerification `tfsdk:"oura"` - Persona *personaSourceVerification `tfsdk:"persona"` - Pipedrive *pipedriveSourceVerification `tfsdk:"pipedrive"` - Postmark *postmarkSourceVerification `tfsdk:"postmark"` - PropertyFinder *propertyFinderSourceVerification `tfsdk:"property_finder"` - Pylon *pylonSourceVerification `tfsdk:"pylon"` - Razorpay *razorpaySourceVerification `tfsdk:"razorpay"` - Recharge *rechargeSourceVerification `tfsdk:"recharge"` - Repay *repaySourceVerification `tfsdk:"repay"` - Sanity *sanitySourceVerification `tfsdk:"sanity"` - SendGrid *sendgridSourceVerification `tfsdk:"sendgrid"` - Shopify *shopifySourceVerification `tfsdk:"shopify"` - Shopline *shoplineSourceVerification `tfsdk:"shopline"` - Slack *slackSourceVerification `tfsdk:"slack"` - Solidgate *solidgateSourceVerification `tfsdk:"solidgate"` - Square *squareSourceVerification `tfsdk:"square"` - Stripe *stripeSourceVerification `tfsdk:"stripe"` - Svix *svixSourceVerification `tfsdk:"svix"` - Synctera *syncteraSourceVerification `tfsdk:"synctera"` - Tebex *tebexSourceVerification `tfsdk:"tebex"` - Telnyx *telnyxSourceVerification `tfsdk:"telnyx"` - ThreeDEye *threeDEyeSourceVerification `tfsdk:"threedeye"` - TokenIo *tokenIoSourceVerification `tfsdk:"tokenio"` - Trello *trelloSourceVerification `tfsdk:"trello"` - Twitch *twitchSourceVerification `tfsdk:"twitch"` - Twitter *twitterSourceVerification `tfsdk:"twitter"` - Typeform *typeformSourceVerification `tfsdk:"typeform"` - Vercel *vercelSourceVerification `tfsdk:"vercel"` - VercelLogDrains *vercelLogDrainsSourceVerification `tfsdk:"vercel_log_drains"` - Wix *wixSourceVerification `tfsdk:"wix"` - WooCommerce *woocommerceSourceVerification `tfsdk:"woocommerce"` - WorkOS *workOSSourceVerification `tfsdk:"workos"` - Xero *xeroSourceVerification `tfsdk:"xero"` - Zoom *zoomSourceVerification `tfsdk:"zoom"` +type sourceVerificationResourceModel struct { + SourceID types.String `tfsdk:"source_id"` + Verification *generated.SourceVerification `tfsdk:"verification"` } diff --git a/internal/provider/sourceverification/schema.go b/internal/provider/sourceverification/schema.go index e8a34ca..46ea3fb 100644 --- a/internal/provider/sourceverification/schema.go +++ b/internal/provider/sourceverification/schema.go @@ -1,6 +1,7 @@ package sourceverification import ( + "terraform-provider-hookdeck/internal/provider/sourceverification/generated" "terraform-provider-hookdeck/internal/validators" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -19,68 +20,8 @@ func schemaAttributes() map[string]schema.Attribute { Description: "ID of the source", }, "verification": schema.SingleNestedAttribute{ - Required: true, - Attributes: map[string]schema.Attribute{ - // generic - "api_key": apiKeyConfigSchema(), - "basic_auth": basicAuthConfigSchema(), - "hmac": hmacConfigSchema(), - "json": jsonConfigSchema(), - // providers - "adyen": adyenConfigSchema(), - "akeneo": akeneoConfigSchema(), - "aws_sns": awsSNSConfigSchema(), - "bondsmith": bondsmithConfigSchema(), - "cloudsignal": cloudsignalConfigSchema(), - "commercelayer": commercelayerConfigSchema(), - "courier": courierConfigSchema(), - "discord": discordConfigSchema(), - "ebay": ebayConfigSchema(), - "enode": enodeConfigSchema(), - "favro": favroConfigSchema(), - "fiserv": fiservConfigSchema(), - "frontapp": frontAppConfigSchema(), - "github": githubConfigSchema(), - "gitlab": gitlabConfigSchema(), - "linear": linearConfigSchema(), - "mailgun": mailgunConfigSchema(), - "nmi": nmiConfigSchema(), - "orb": orbConfigSchema(), - "oura": ouraConfigSchema(), - "persona": personaConfigSchema(), - "pipedrive": pipedriveConfigSchema(), - "postmark": postmarkConfigSchema(), - "property_finder": propertyFinderConfigSchema(), - "pylon": pylonConfigSchema(), - "razorpay": razorpayConfigSchema(), - "recharge": rechargeConfigSchema(), - "repay": repayConfigSchema(), - "sanity": sanityConfigSchema(), - "sendgrid": sendgridConfigSchema(), - "shopify": shopifyConfigSchema(), - "shopline": shoplineConfigSchema(), - "slack": slackConfigSchema(), - "solidgate": solidgateConfigSchema(), - "square": squareConfigSchema(), - "stripe": stripeConfigSchema(), - "svix": svixConfigSchema(), - "synctera": syncteraConfigSchema(), - "tebex": tebexConfigSchema(), - "telnyx": telnyxConfigSchema(), - "threedeye": threeDEyeConfigSchema(), - "tokenio": tokenIoConfigSchema(), - "trello": trelloConfigSchema(), - "twitch": twitchConfigSchema(), - "twitter": twitterConfigSchema(), - "typeform": typeformConfigSchema(), - "vercel": vercelConfigSchema(), - "vercel_log_drains": vercelLogDrainsConfigSchema(), - "wix": wixConfigSchema(), - "woocommerce": woocommerceConfigSchema(), - "workos": workOSConfigSchema(), - "xero": xeroConfigSchema(), - "zoom": zoomConfigSchema(), - }, + Required: true, + Attributes: generated.GetSourceVerificationSchemaAttributes(), Validators: []validator.Object{ validators.ExactlyOneChild(), }, diff --git a/internal/provider/sourceverification/sdk.go b/internal/provider/sourceverification/sdk.go index 28e8291..3986f04 100644 --- a/internal/provider/sourceverification/sdk.go +++ b/internal/provider/sourceverification/sdk.go @@ -1,6 +1,10 @@ package sourceverification import ( + "encoding/json" + "log" + "terraform-provider-hookdeck/internal/provider/sourceverification/generated" + hookdeck "github.com/hookdeck/hookdeck-go-sdk" ) @@ -14,126 +18,13 @@ func (m *sourceVerificationResourceModel) ToCreatePayload() *hookdeck.SourceUpda func (m *sourceVerificationResourceModel) ToUpdatePayload() *hookdeck.SourceUpdateRequest { var verification *hookdeck.VerificationConfig - // generic - if m.Verification.APIKey != nil { - verification = m.Verification.APIKey.toPayload() - } else if m.Verification.BasicAuth != nil { - verification = m.Verification.BasicAuth.toPayload() - } else if m.Verification.HMAC != nil { - verification = m.Verification.HMAC.toPayload() - } else if !m.Verification.JSON.IsUnknown() && !m.Verification.JSON.IsNull() { + if !m.Verification.JSON.IsUnknown() && !m.Verification.JSON.IsNull() { verification = jsonToPayload(m.Verification.JSON.ValueString()) - - // providers - } else if m.Verification.Adyen != nil { - verification = m.Verification.Adyen.toPayload() - } else if m.Verification.Akeneo != nil { - verification = m.Verification.Akeneo.toPayload() - } else if m.Verification.AWSSNS != nil { - verification = m.Verification.AWSSNS.toPayload() - } else if m.Verification.Bondsmith != nil { - verification = m.Verification.Bondsmith.toPayload() - } else if m.Verification.Cloudsignal != nil { - verification = m.Verification.Cloudsignal.toPayload() - } else if m.Verification.Commercelayer != nil { - verification = m.Verification.Commercelayer.toPayload() - } else if m.Verification.Courier != nil { - verification = m.Verification.Courier.toPayload() - } else if m.Verification.Discord != nil { - verification = m.Verification.Discord.toPayload() - } else if m.Verification.Ebay != nil { - verification = m.Verification.Ebay.toPayload() - } else if m.Verification.Enode != nil { - verification = m.Verification.Enode.toPayload() - } else if m.Verification.Favro != nil { - verification = m.Verification.Favro.toPayload() - } else if m.Verification.Fiserv != nil { - verification = m.Verification.Fiserv.toPayload() - } else if m.Verification.FrontApp != nil { - verification = m.Verification.FrontApp.toPayload() - } else if m.Verification.GitHub != nil { - verification = m.Verification.GitHub.toPayload() - } else if m.Verification.GitLab != nil { - verification = m.Verification.GitLab.toPayload() - } else if m.Verification.Linear != nil { - verification = m.Verification.Linear.toPayload() - } else if m.Verification.Mailgun != nil { - verification = m.Verification.Mailgun.toPayload() - } else if m.Verification.Nmi != nil { - verification = m.Verification.Nmi.toPayload() - } else if m.Verification.Orb != nil { - verification = m.Verification.Orb.toPayload() - } else if m.Verification.Oura != nil { - verification = m.Verification.Oura.toPayload() - } else if m.Verification.Persona != nil { - verification = m.Verification.Persona.toPayload() - } else if m.Verification.Pipedrive != nil { - verification = m.Verification.Pipedrive.toPayload() - } else if m.Verification.Postmark != nil { - verification = m.Verification.Postmark.toPayload() - } else if m.Verification.PropertyFinder != nil { - verification = m.Verification.PropertyFinder.toPayload() - } else if m.Verification.Pylon != nil { - verification = m.Verification.Pylon.toPayload() - } else if m.Verification.Razorpay != nil { - verification = m.Verification.Razorpay.toPayload() - } else if m.Verification.Recharge != nil { - verification = m.Verification.Recharge.toPayload() - } else if m.Verification.Repay != nil { - verification = m.Verification.Repay.toPayload() - } else if m.Verification.Sanity != nil { - verification = m.Verification.Sanity.toPayload() - } else if m.Verification.SendGrid != nil { - verification = m.Verification.SendGrid.toPayload() - } else if m.Verification.Shopify != nil { - verification = m.Verification.Shopify.toPayload() - } else if m.Verification.Shopline != nil { - verification = m.Verification.Shopline.toPayload() - } else if m.Verification.Slack != nil { - verification = m.Verification.Slack.toPayload() - } else if m.Verification.Solidgate != nil { - verification = m.Verification.Solidgate.toPayload() - } else if m.Verification.Square != nil { - verification = m.Verification.Square.toPayload() - } else if m.Verification.Stripe != nil { - verification = m.Verification.Stripe.toPayload() - } else if m.Verification.Svix != nil { - verification = m.Verification.Svix.toPayload() - } else if m.Verification.Synctera != nil { - verification = m.Verification.Synctera.toPayload() - } else if m.Verification.Tebex != nil { - verification = m.Verification.Tebex.toPayload() - } else if m.Verification.Telnyx != nil { - verification = m.Verification.Telnyx.toPayload() - } else if m.Verification.ThreeDEye != nil { - verification = m.Verification.ThreeDEye.toPayload() - } else if m.Verification.TokenIo != nil { - verification = m.Verification.TokenIo.toPayload() - } else if m.Verification.Trello != nil { - verification = m.Verification.Trello.toPayload() - } else if m.Verification.Twitch != nil { - verification = m.Verification.Twitch.toPayload() - } else if m.Verification.Twitter != nil { - verification = m.Verification.Twitter.toPayload() - } else if m.Verification.Typeform != nil { - verification = m.Verification.Typeform.toPayload() - } else if m.Verification.Wix != nil { - verification = m.Verification.Wix.toPayload() - } else if m.Verification.Vercel != nil { - verification = m.Verification.Vercel.toPayload() - } else if m.Verification.VercelLogDrains != nil { - verification = m.Verification.VercelLogDrains.toPayload() - } else if m.Verification.WooCommerce != nil { - verification = m.Verification.WooCommerce.toPayload() - } else if m.Verification.WorkOS != nil { - verification = m.Verification.WorkOS.toPayload() - } else if m.Verification.Xero != nil { - verification = m.Verification.Xero.toPayload() - } else if m.Verification.Zoom != nil { - verification = m.Verification.Zoom.toPayload() } else { - return &hookdeck.SourceUpdateRequest{ - Verification: hookdeck.Null[hookdeck.VerificationConfig](), + for _, provider := range generated.Providers { + if verification == nil { + verification = provider.ToPayload(m.Verification) + } } } @@ -147,3 +38,12 @@ func (m *sourceVerificationResourceModel) ToDeletePayload() *hookdeck.SourceUpda Verification: hookdeck.Null[hookdeck.VerificationConfig](), } } + +func jsonToPayload(stringifiedJSON string) *hookdeck.VerificationConfig { + var verification *hookdeck.VerificationConfig + if err := json.Unmarshal([]byte(stringifiedJSON), &verification); err != nil { + // TODO: improve error handling? + log.Fatal("Error unmarshalling JSON source verification payload") + } + return verification +} diff --git a/internal/provider/sourceverification/verification_adyen.go b/internal/provider/sourceverification/verification_adyen.go deleted file mode 100644 index 1c953ea..0000000 --- a/internal/provider/sourceverification/verification_adyen.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func adyenConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type adyenSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *adyenSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromAdyen(&hookdeck.VerificationAdyen{ - Configs: &hookdeck.VerificationAdyenConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_akeneo.go b/internal/provider/sourceverification/verification_akeneo.go deleted file mode 100644 index 437a652..0000000 --- a/internal/provider/sourceverification/verification_akeneo.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func akeneoConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type akeneoSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *akeneoSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromAkeneo(&hookdeck.VerificationAkeneo{ - Configs: &hookdeck.VerificationAkeneoConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_apikey.go b/internal/provider/sourceverification/verification_apikey.go deleted file mode 100644 index 8b645dd..0000000 --- a/internal/provider/sourceverification/verification_apikey.go +++ /dev/null @@ -1,36 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func apiKeyConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "api_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - "header_key": schema.StringAttribute{ - Required: true, - }, - }, - } -} - -type apiKeySourceVerification struct { - APIKey types.String `tfsdk:"api_key"` - HeaderKey types.String `tfsdk:"header_key"` -} - -func (m *apiKeySourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromApiKey(&hookdeck.VerificationApiKey{ - Configs: &hookdeck.VerificationApiKeyConfigs{ - ApiKey: m.APIKey.ValueString(), - HeaderKey: m.HeaderKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_awssns.go b/internal/provider/sourceverification/verification_awssns.go deleted file mode 100644 index d8a781c..0000000 --- a/internal/provider/sourceverification/verification_awssns.go +++ /dev/null @@ -1,22 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func awsSNSConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{}, - } -} - -type awsSNSSourceVerification struct { -} - -func (m *awsSNSSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromAwsSns(&hookdeck.VerificationAwssns{ - Configs: &hookdeck.VerificationAwssnsConfigs{}, - }) -} diff --git a/internal/provider/sourceverification/verification_basicauth.go b/internal/provider/sourceverification/verification_basicauth.go deleted file mode 100644 index 5ef189c..0000000 --- a/internal/provider/sourceverification/verification_basicauth.go +++ /dev/null @@ -1,36 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func basicAuthConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "password": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - "username": schema.StringAttribute{ - Required: true, - }, - }, - } -} - -type basicAuthSourceVerification struct { - Username types.String `tfsdk:"username"` - Password types.String `tfsdk:"password"` -} - -func (m *basicAuthSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromBasicAuth(&hookdeck.VerificationBasicAuth{ - Configs: &hookdeck.VerificationBasicAuthConfigs{ - Username: m.Username.ValueString(), - Password: m.Password.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_bondsmith.go b/internal/provider/sourceverification/verification_bondsmith.go deleted file mode 100644 index 8642d7d..0000000 --- a/internal/provider/sourceverification/verification_bondsmith.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func bondsmithConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type bondsmithSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *bondsmithSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromBondsmith(&hookdeck.VerificationBondsmith{ - Configs: &hookdeck.VerificationBondsmithConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_cloudsignal.go b/internal/provider/sourceverification/verification_cloudsignal.go deleted file mode 100644 index c012c8d..0000000 --- a/internal/provider/sourceverification/verification_cloudsignal.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func cloudsignalConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "api_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type cloudsignalSourceVerification struct { - APIKey types.String `tfsdk:"api_key"` -} - -func (m *cloudsignalSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromCloudsignal(&hookdeck.VerificationCloudSignal{ - Configs: &hookdeck.VerificationCloudSignalConfigs{ - ApiKey: m.APIKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_commercelayer.go b/internal/provider/sourceverification/verification_commercelayer.go deleted file mode 100644 index f0dafe4..0000000 --- a/internal/provider/sourceverification/verification_commercelayer.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func commercelayerConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type commercelayerSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *commercelayerSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromCommercelayer(&hookdeck.VerificationCommercelayer{ - Configs: &hookdeck.VerificationCommercelayerConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_courier.go b/internal/provider/sourceverification/verification_courier.go deleted file mode 100644 index d3b4f93..0000000 --- a/internal/provider/sourceverification/verification_courier.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func courierConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type courierSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *courierSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromCourier(&hookdeck.VerificationCourier{ - Configs: &hookdeck.VerificationCourierConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_discord.go b/internal/provider/sourceverification/verification_discord.go deleted file mode 100644 index 8c72148..0000000 --- a/internal/provider/sourceverification/verification_discord.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func discordConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "public_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type discordSourceVerification struct { - PublicKey types.String `tfsdk:"public_key"` -} - -func (m *discordSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromDiscord(&hookdeck.VerificationDiscord{ - Configs: &hookdeck.VerificationDiscordConfigs{ - PublicKey: m.PublicKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_enode.go b/internal/provider/sourceverification/verification_enode.go deleted file mode 100644 index d5a7b9b..0000000 --- a/internal/provider/sourceverification/verification_enode.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func enodeConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type enodeSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *enodeSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromEnode(&hookdeck.VerificationEnode{ - Configs: &hookdeck.VerificationEnodeConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_favro.go b/internal/provider/sourceverification/verification_favro.go deleted file mode 100644 index fbdd178..0000000 --- a/internal/provider/sourceverification/verification_favro.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func favroConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type favroSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *favroSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromFavro(&hookdeck.VerificationFavro{ - Configs: &hookdeck.VerificationFavroConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_fiserv.go b/internal/provider/sourceverification/verification_fiserv.go deleted file mode 100644 index 9f39a62..0000000 --- a/internal/provider/sourceverification/verification_fiserv.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func fiservConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type fiservSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *fiservSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromFiserv(&hookdeck.VerificationFiserv{ - Configs: &hookdeck.VerificationFiservConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_frontapp.go b/internal/provider/sourceverification/verification_frontapp.go deleted file mode 100644 index 8c900a5..0000000 --- a/internal/provider/sourceverification/verification_frontapp.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func frontAppConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type frontAppSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *frontAppSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromFrontapp(&hookdeck.VerificationFrontApp{ - Configs: &hookdeck.VerificationFrontAppConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_github.go b/internal/provider/sourceverification/verification_github.go deleted file mode 100644 index 62656d6..0000000 --- a/internal/provider/sourceverification/verification_github.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func githubConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type githubSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *githubSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromGithub(&hookdeck.VerificationGitHub{ - Configs: &hookdeck.VerificationGitHubConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_gitlab.go b/internal/provider/sourceverification/verification_gitlab.go deleted file mode 100644 index 8e80a64..0000000 --- a/internal/provider/sourceverification/verification_gitlab.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func gitlabConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "api_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type gitlabSourceVerification struct { - APIKey types.String `tfsdk:"api_key"` -} - -func (m *gitlabSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromGitlab(&hookdeck.VerificationGitLab{ - Configs: &hookdeck.VerificationGitLabConfigs{ - ApiKey: m.APIKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_hmac.go b/internal/provider/sourceverification/verification_hmac.go deleted file mode 100644 index 1d09d01..0000000 --- a/internal/provider/sourceverification/verification_hmac.go +++ /dev/null @@ -1,50 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func hmacConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "algorithm": schema.StringAttribute{ - // TODO: enum "md5, sha1, sha256, sha512" - Required: true, - }, - "encoding": schema.StringAttribute{ - // TODO: enum "base64, hex" - Required: true, - }, - "header_key": schema.StringAttribute{ - Required: true, - }, - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type hmacSourceVerification struct { - Algorithm types.String `tfsdk:"algorithm"` - Encoding types.String `tfsdk:"encoding"` - HeaderKey types.String `tfsdk:"header_key"` - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *hmacSourceVerification) toPayload() *hookdeck.VerificationConfig { - algorithm, _ := hookdeck.NewHmacAlgorithmsFromString(m.Algorithm.ValueString()) - encoding, _ := hookdeck.NewVerificationHmacConfigsEncodingFromString(m.Encoding.ValueString()) - return hookdeck.NewVerificationConfigFromHmac(&hookdeck.VerificationHmac{ - Configs: &hookdeck.VerificationHmacConfigs{ - Algorithm: algorithm, - Encoding: encoding, - HeaderKey: m.HeaderKey.ValueString(), - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_json.go b/internal/provider/sourceverification/verification_json.go deleted file mode 100644 index 593d05e..0000000 --- a/internal/provider/sourceverification/verification_json.go +++ /dev/null @@ -1,25 +0,0 @@ -package sourceverification - -import ( - "encoding/json" - "log" - - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func jsonConfigSchema() schema.StringAttribute { - return schema.StringAttribute{ - Optional: true, - Sensitive: true, - } -} - -func jsonToPayload(stringifiedJSON string) *hookdeck.VerificationConfig { - var verification *hookdeck.VerificationConfig - if err := json.Unmarshal([]byte(stringifiedJSON), &verification); err != nil { - // TODO: improve error handling? - log.Fatal("Error unmarshalling JSON source verification payload") - } - return verification -} diff --git a/internal/provider/sourceverification/verification_linear.go b/internal/provider/sourceverification/verification_linear.go deleted file mode 100644 index 90b0ee1..0000000 --- a/internal/provider/sourceverification/verification_linear.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func linearConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type linearSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *linearSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromLinear(&hookdeck.VerificationLinear{ - Configs: &hookdeck.VerificationLinearConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_mailgun.go b/internal/provider/sourceverification/verification_mailgun.go deleted file mode 100644 index 1579a98..0000000 --- a/internal/provider/sourceverification/verification_mailgun.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func mailgunConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type mailgunSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *mailgunSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromMailgun(&hookdeck.VerificationMailgun{ - Configs: &hookdeck.VerificationMailgunConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_nmi.go b/internal/provider/sourceverification/verification_nmi.go deleted file mode 100644 index 5e3f688..0000000 --- a/internal/provider/sourceverification/verification_nmi.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func nmiConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type nmiSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *nmiSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromNmi(&hookdeck.VerificationNmiPaymentGateway{ - Configs: &hookdeck.VerificationNmiPaymentGatewayConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_orb.go b/internal/provider/sourceverification/verification_orb.go deleted file mode 100644 index b59d211..0000000 --- a/internal/provider/sourceverification/verification_orb.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func orbConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type orbSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *orbSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromOrb(&hookdeck.VerificationOrb{ - Configs: &hookdeck.VerificationOrbConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_oura.go b/internal/provider/sourceverification/verification_oura.go deleted file mode 100644 index 4d78e82..0000000 --- a/internal/provider/sourceverification/verification_oura.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func ouraConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type ouraSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *ouraSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromOura(&hookdeck.VerificationOura{ - Configs: &hookdeck.VerificationOuraConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_persona.go b/internal/provider/sourceverification/verification_persona.go deleted file mode 100644 index 525d1a8..0000000 --- a/internal/provider/sourceverification/verification_persona.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func personaConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type personaSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *personaSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromPersona(&hookdeck.VerificationPersona{ - Configs: &hookdeck.VerificationPersonaConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_pipedrive.go b/internal/provider/sourceverification/verification_pipedrive.go deleted file mode 100644 index 41e2614..0000000 --- a/internal/provider/sourceverification/verification_pipedrive.go +++ /dev/null @@ -1,36 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func pipedriveConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{ - Required: true, - }, - "password": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type pipedriveSourceVerification struct { - Username types.String `tfsdk:"username"` - Password types.String `tfsdk:"password"` -} - -func (m *pipedriveSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromPipedrive(&hookdeck.VerificationPipedrive{ - Configs: &hookdeck.VerificationPipedriveConfigs{ - Username: m.Username.ValueString(), - Password: m.Password.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_postmark.go b/internal/provider/sourceverification/verification_postmark.go deleted file mode 100644 index 7153f33..0000000 --- a/internal/provider/sourceverification/verification_postmark.go +++ /dev/null @@ -1,33 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func postmarkConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type postmarkSourceVerification struct { - Username types.String `tfsdk:"username"` - Password types.String `tfsdk:"password"` -} - -func (m *postmarkSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromPostmark(&hookdeck.VerificationPostmark{ - Configs: &hookdeck.VerificationPostmarkConfigs{ - Username: m.Username.ValueString(), - Password: m.Password.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_propertyfinder.go b/internal/provider/sourceverification/verification_propertyfinder.go deleted file mode 100644 index f1513f1..0000000 --- a/internal/provider/sourceverification/verification_propertyfinder.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func propertyFinderConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type propertyFinderSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *propertyFinderSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromPropertyFinder(&hookdeck.VerificationPropertyFinder{ - Configs: &hookdeck.VerificationPropertyFinderConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_pylon.go b/internal/provider/sourceverification/verification_pylon.go deleted file mode 100644 index ebc5db3..0000000 --- a/internal/provider/sourceverification/verification_pylon.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func pylonConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type pylonSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *pylonSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromPylon(&hookdeck.VerificationPylon{ - Configs: &hookdeck.VerificationPylonConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_razorpay.go b/internal/provider/sourceverification/verification_razorpay.go deleted file mode 100644 index caddbcc..0000000 --- a/internal/provider/sourceverification/verification_razorpay.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func razorpayConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type razorpaySourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *razorpaySourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromRazorpay(&hookdeck.VerificationRazorpay{ - Configs: &hookdeck.VerificationRazorpayConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_recharge.go b/internal/provider/sourceverification/verification_recharge.go deleted file mode 100644 index 19b324a..0000000 --- a/internal/provider/sourceverification/verification_recharge.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func rechargeConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type rechargeSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *rechargeSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromRecharge(&hookdeck.VerificationRecharge{ - Configs: &hookdeck.VerificationRechargeConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_repay.go b/internal/provider/sourceverification/verification_repay.go deleted file mode 100644 index 02e0e08..0000000 --- a/internal/provider/sourceverification/verification_repay.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func repayConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type repaySourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *repaySourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromRepay(&hookdeck.VerificationRepay{ - Configs: &hookdeck.VerificationRepayConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_sanity.go b/internal/provider/sourceverification/verification_sanity.go deleted file mode 100644 index f748804..0000000 --- a/internal/provider/sourceverification/verification_sanity.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func sanityConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type sanitySourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *sanitySourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromSanity(&hookdeck.VerificationSanity{ - Configs: &hookdeck.VerificationSanityConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_sendgrid.go b/internal/provider/sourceverification/verification_sendgrid.go deleted file mode 100644 index 709cf3d..0000000 --- a/internal/provider/sourceverification/verification_sendgrid.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func sendgridConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type sendgridSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *sendgridSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromSendgrid(&hookdeck.VerificationSendGrid{ - Configs: &hookdeck.VerificationSendGridConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_shopify.go b/internal/provider/sourceverification/verification_shopify.go deleted file mode 100644 index c204d85..0000000 --- a/internal/provider/sourceverification/verification_shopify.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func shopifyConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type shopifySourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *shopifySourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromShopify(&hookdeck.VerificationShopify{ - Configs: &hookdeck.VerificationShopifyConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_shopline.go b/internal/provider/sourceverification/verification_shopline.go deleted file mode 100644 index bbe01b9..0000000 --- a/internal/provider/sourceverification/verification_shopline.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func shoplineConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type shoplineSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *shoplineSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromShopline(&hookdeck.VerificationShopline{ - Configs: &hookdeck.VerificationShoplineConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_slack.go b/internal/provider/sourceverification/verification_slack.go deleted file mode 100644 index b9e086f..0000000 --- a/internal/provider/sourceverification/verification_slack.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func slackConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type slackSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *slackSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromSlack(&hookdeck.VerificationSlack{ - Configs: &hookdeck.VerificationSlackConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_solidgate.go b/internal/provider/sourceverification/verification_solidgate.go deleted file mode 100644 index c9fe329..0000000 --- a/internal/provider/sourceverification/verification_solidgate.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func solidgateConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type solidgateSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *solidgateSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromSolidgate(&hookdeck.VerificationSolidGate{ - Configs: &hookdeck.VerificationSolidGateConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_square.go b/internal/provider/sourceverification/verification_square.go deleted file mode 100644 index 249830b..0000000 --- a/internal/provider/sourceverification/verification_square.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func squareConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type squareSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *squareSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromSquare(&hookdeck.VerificationSquare{ - Configs: &hookdeck.VerificationSquareConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_stripe.go b/internal/provider/sourceverification/verification_stripe.go deleted file mode 100644 index 725b34c..0000000 --- a/internal/provider/sourceverification/verification_stripe.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func stripeConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type stripeSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *stripeSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromStripe(&hookdeck.VerificationStripe{ - Configs: &hookdeck.VerificationStripeConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_svix.go b/internal/provider/sourceverification/verification_svix.go deleted file mode 100644 index de24ca4..0000000 --- a/internal/provider/sourceverification/verification_svix.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func svixConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type svixSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *svixSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromSvix(&hookdeck.VerificationSvix{ - Configs: &hookdeck.VerificationSvixConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_synctera.go b/internal/provider/sourceverification/verification_synctera.go deleted file mode 100644 index 24317ba..0000000 --- a/internal/provider/sourceverification/verification_synctera.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func syncteraConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type syncteraSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *syncteraSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromSynctera(&hookdeck.VerificationSynctera{ - Configs: &hookdeck.VerificationSyncteraConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_tebex.go b/internal/provider/sourceverification/verification_tebex.go deleted file mode 100644 index aaddadf..0000000 --- a/internal/provider/sourceverification/verification_tebex.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func tebexConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type tebexSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *tebexSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromTebex(&hookdeck.VerificationTebex{ - Configs: &hookdeck.VerificationTebexConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_telnyx.go b/internal/provider/sourceverification/verification_telnyx.go deleted file mode 100644 index a47286a..0000000 --- a/internal/provider/sourceverification/verification_telnyx.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func telnyxConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "public_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type telnyxSourceVerification struct { - PublicKey types.String `tfsdk:"public_key"` -} - -func (m *telnyxSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromTelnyx(&hookdeck.VerificationTelnyx{ - Configs: &hookdeck.VerificationTelnyxConfigs{ - PublicKey: m.PublicKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_threedeye.go b/internal/provider/sourceverification/verification_threedeye.go deleted file mode 100644 index cc7baa5..0000000 --- a/internal/provider/sourceverification/verification_threedeye.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func threeDEyeConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type threeDEyeSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *threeDEyeSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromThreeDEye(&hookdeck.Verification3DEye{ - Configs: &hookdeck.Verification3DEyeConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_tokenio.go b/internal/provider/sourceverification/verification_tokenio.go deleted file mode 100644 index 166ba78..0000000 --- a/internal/provider/sourceverification/verification_tokenio.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func tokenIoConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "public_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type tokenIoSourceVerification struct { - PublicKey types.String `tfsdk:"public_key"` -} - -func (m *tokenIoSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromTokenio(&hookdeck.VerificationTokenIo{ - Configs: &hookdeck.VerificationTokenIoConfigs{ - PublicKey: m.PublicKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_trello.go b/internal/provider/sourceverification/verification_trello.go deleted file mode 100644 index 3b7cf17..0000000 --- a/internal/provider/sourceverification/verification_trello.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func trelloConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type trelloSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *trelloSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromTrello(&hookdeck.VerificationTrello{ - Configs: &hookdeck.VerificationTrelloConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_twitch.go b/internal/provider/sourceverification/verification_twitch.go deleted file mode 100644 index 30a1c6b..0000000 --- a/internal/provider/sourceverification/verification_twitch.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func twitchConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type twitchSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *twitchSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromTwitch(&hookdeck.VerificationTwitch{ - Configs: &hookdeck.VerificationTwitchConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_twitter.go b/internal/provider/sourceverification/verification_twitter.go deleted file mode 100644 index c334817..0000000 --- a/internal/provider/sourceverification/verification_twitter.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func twitterConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "api_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type twitterSourceVerification struct { - APIKey types.String `tfsdk:"api_key"` -} - -func (m *twitterSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromTwitter(&hookdeck.VerificationTwitter{ - Configs: &hookdeck.VerificationTwitterConfigs{ - ApiKey: m.APIKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_typeform.go b/internal/provider/sourceverification/verification_typeform.go deleted file mode 100644 index 00eaeda..0000000 --- a/internal/provider/sourceverification/verification_typeform.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func typeformConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type typeformSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *typeformSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromTypeform(&hookdeck.VerificationTypeform{ - Configs: &hookdeck.VerificationTypeformConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_vercel.go b/internal/provider/sourceverification/verification_vercel.go deleted file mode 100644 index 6a6cd98..0000000 --- a/internal/provider/sourceverification/verification_vercel.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func vercelConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type vercelSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *vercelSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromVercel(&hookdeck.VerificationVercel{ - Configs: &hookdeck.VerificationVercelConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_vercellogdrain.go b/internal/provider/sourceverification/verification_vercellogdrain.go deleted file mode 100644 index 7b2be81..0000000 --- a/internal/provider/sourceverification/verification_vercellogdrain.go +++ /dev/null @@ -1,37 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func vercelLogDrainsConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Optional: true, - Sensitive: true, - }, - "vercel_log_drains_secret": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type vercelLogDrainsSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` - VercelLogDrainsSecret types.String `tfsdk:"vercel_log_drains_secret"` -} - -func (m *vercelLogDrainsSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromVercelLogDrains(&hookdeck.VerificationVercelLogDrains{ - Configs: &hookdeck.VerificationVercelLogDrainsConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueStringPointer(), - VercelLogDrainsSecret: m.VercelLogDrainsSecret.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_wix.go b/internal/provider/sourceverification/verification_wix.go deleted file mode 100644 index a98f6b0..0000000 --- a/internal/provider/sourceverification/verification_wix.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func wixConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type wixSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *wixSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromWix(&hookdeck.VerificationWix{ - Configs: &hookdeck.VerificationWixConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_woocommerce.go b/internal/provider/sourceverification/verification_woocommerce.go deleted file mode 100644 index 2c6bf57..0000000 --- a/internal/provider/sourceverification/verification_woocommerce.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func woocommerceConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type woocommerceSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *woocommerceSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromWoocommerce(&hookdeck.VerificationWooCommerce{ - Configs: &hookdeck.VerificationWooCommerceConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_workos.go b/internal/provider/sourceverification/verification_workos.go deleted file mode 100644 index 3baaef8..0000000 --- a/internal/provider/sourceverification/verification_workos.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func workOSConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type workOSSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *workOSSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromWorkos(&hookdeck.VerificationWorkOs{ - Configs: &hookdeck.VerificationWorkOsConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_xero.go b/internal/provider/sourceverification/verification_xero.go deleted file mode 100644 index aa946f2..0000000 --- a/internal/provider/sourceverification/verification_xero.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func xeroConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type xeroSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *xeroSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromXero(&hookdeck.VerificationXero{ - Configs: &hookdeck.VerificationXeroConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/internal/provider/sourceverification/verification_zoom.go b/internal/provider/sourceverification/verification_zoom.go deleted file mode 100644 index 0a87c1d..0000000 --- a/internal/provider/sourceverification/verification_zoom.go +++ /dev/null @@ -1,31 +0,0 @@ -package sourceverification - -import ( - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" - hookdeck "github.com/hookdeck/hookdeck-go-sdk" -) - -func zoomConfigSchema() schema.SingleNestedAttribute { - return schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "webhook_secret_key": schema.StringAttribute{ - Required: true, - Sensitive: true, - }, - }, - } -} - -type zoomSourceVerification struct { - WebhookSecretKey types.String `tfsdk:"webhook_secret_key"` -} - -func (m *zoomSourceVerification) toPayload() *hookdeck.VerificationConfig { - return hookdeck.NewVerificationConfigFromZoom(&hookdeck.VerificationZoom{ - Configs: &hookdeck.VerificationZoomConfigs{ - WebhookSecretKey: m.WebhookSecretKey.ValueString(), - }, - }) -} diff --git a/main.go b/main.go index 1368883..db8a4f9 100644 --- a/main.go +++ b/main.go @@ -13,16 +13,6 @@ import ( "terraform-provider-hookdeck/internal/provider" ) -// Run "go generate" to format example terraform files and generate the docs for the registry/website - -// If you do not have terraform installed, you can remove the formatting command, but its suggested to -// ensure the documentation is formatted properly. -//go:generate terraform fmt -recursive ./examples/ - -// Run the docs generation tool, check its repository for more information on how it works and how docs -// can be customized. -//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs - var ( // these will be set by the goreleaser configuration // to appropriate values for the compiled binary.