diff --git a/Makefile b/Makefile index 9bc8105..db646a7 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ BIN_OUT_DIR := out BINARY := $(BIN_OUT_DIR)/terraform-provider-cala -version = 0.0.19 +version = 0.0.20 os_arch = $(shell go env GOOS)_$(shell go env GOARCH) provider_path = registry.terraform.io/galoymoney/cala/$(version)/$(os_arch)/ diff --git a/cala/graphql/big-query.graphql b/cala/graphql/big-query.graphql new file mode 100644 index 0000000..66f9fe6 --- /dev/null +++ b/cala/graphql/big-query.graphql @@ -0,0 +1,27 @@ +query bigQueryIntegrationGet($id: UUID!){ + bigQuery { + integration(id: $id) { + integrationId + name + description + gcpProjectId + gcpDatasetId + } + } +} + +mutation bigQueryIntegrationCreate($input: BigQueryIntegrationCreateInput!) { + bigQuery { + integrationCreate( + input: $input + ) { + integration { + integrationId + name + description + gcpProjectId + gcpDatasetId + } + } + } +} diff --git a/docs/resources/account.md b/docs/resources/account.md index 44beb77..624839a 100644 --- a/docs/resources/account.md +++ b/docs/resources/account.md @@ -23,9 +23,9 @@ resource "cala_account" "alice" { resource "random_uuid" "bank" {} resource "cala_account" "bank" { - id = random_uuid.bank.result - name = "Bank cash" - code = "BANK.DEPOSITS.${random_uuid.bank.result}" + id = random_uuid.bank.result + name = "Bank cash" + code = "BANK.DEPOSITS.${random_uuid.bank.result}" normal_balance_type = "DEBIT" } ``` diff --git a/docs/resources/big_query_integration.md b/docs/resources/big_query_integration.md new file mode 100644 index 0000000..abc980e --- /dev/null +++ b/docs/resources/big_query_integration.md @@ -0,0 +1,45 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cala_big_query_integration Resource - terraform-provider-cala" +subcategory: "" +description: |- + Cala BigQuery Integration. +--- + +# cala_big_query_integration (Resource) + +Cala BigQuery Integration. + +## Example Usage + +```terraform +variable "service_account_creds" { + sensitive = true + default = "ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb3VudCIsCiAgInByb2plY3RfaWQiOiAiY2F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kyQUxWQ1Z2MTZabC9TL1V4MTI4R3kxcXllYitsZVNweU1TaXI4SkFvR0FXcXkzdFJlUEpCUzNEU1IvR25QK1xuQ0FaUG5yWFg0RmYrSDMzeW1Sc2t1VGZ6VEs0elRac2todmdGd1pWV2NnSVhHeHVrcnNnR3kxQ0hjdHY0QURPaFxuSmJDeTZOR3JKWFBhQWNEN2RPY0Z2OGJhQVZSakcrTk9naVVWMm5tWHBiczNpR1pKakNSQlArU24vejBiTUs2aVxuZWxGR2N1U2xsOUNIUmdLTHIwdkM5Y1E9XG4tLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tXG4iLAogICJjbGllbnRfZW1haWwiOiAiZ2hhLWNpLWNhbGEtYnEtYWNjZXNzQGNhbGEtZW50ZXJwcmlzZS5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsCiAgImNsaWVudF9pZCI6ICIxMTcyMzIyMjg4NjQ5MDM1MDgyNjEiLAogICJhdXRoX3VyaSI6ICJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20vby9vYXV0aDIvYXV0aCIsCiAgInRva2VuX3VyaSI6ICJodHRwczovL29hdXRoMi5nb29nbGVhcGlzLmNvbS90b2tlbiIsCiAgImF1dGhfcHJvdmlkZXJfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9vYXV0aDIvdjEvY2VydHMiLAogICJjbGllbnRfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9yb2JvdC92MS9tZXRhZGF0YS94NTA5L2doYS1jaS1jYWxhLWJxLWFjY2VzcyU0MGNhbGEtZW50ZXJwcmlzZS5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsCiAgInVuaXZlcnNlX2RvbWFpbiI6ICJnb29nbGVhcGlzLmNvbSIKfQo=" +} + +resource "random_uuid" "integration_id" {} + +resource "cala_big_query_integration" "bq" { + id = random_uuid.integration_id.result + name = "bq-integration" + project_id = "cala-enterprise" + dataset_id = "cala-enterprise-dev" + service_account_creds_base64 = var.service_account_creds +} +``` + + +## Schema + +### Required + +- `dataset_id` (String) Gcp Biq Query Dataset Id +- `id` (String) ID of the integration. +- `name` (String) Name of the integration. +- `project_id` (String) Gcp Project Id +- `service_account_creds_base64` (String, Sensitive) The GCP service account creds + +### Optional + +- `description` (String) Description of the integration. diff --git a/docs/resources/bitfinex_integration.md b/docs/resources/bitfinex_integration.md index 99adda5..b61d5e5 100644 --- a/docs/resources/bitfinex_integration.md +++ b/docs/resources/bitfinex_integration.md @@ -15,12 +15,12 @@ Cala Bitfinex Integration. ```terraform variable "bitfinex_key" { sensitive = true - default = "dummy" + default = "dummy" } variable "bitfinex_secret" { sensitive = true - default = "dummy" + default = "dummy" } resource "random_uuid" "journal_id" {} diff --git a/examples/cala-enterprise-a8f0d425bc44.json b/examples/cala-enterprise-a8f0d425bc44.json new file mode 100644 index 0000000..7adffa5 --- /dev/null +++ b/examples/cala-enterprise-a8f0d425bc44.json @@ -0,0 +1,13 @@ +{ + "type": "service_account", + "project_id": "cala-enterprise", + "private_key_id": "a8f0d425bc441120a16788f6eb89e947b5d0d632", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCjtYXSXfhPNNNl\nWxqwuUpTBWssQtAp/0sQ41RGDBGWDoGAXKKA3hXxeMqQ9gB9gbe/FmMs9RKcNJah\nHCOjJPjzr+VRXcHTebG3KhPIK37rq+ZSN43l192PAR900D9RrvYBOpMaP6uUDidd\nQn5UsRDT6RITaedQVjl6Os5i89KKR7l6h4LYM2jJsWyEkI9VPkMO17m+0XNYLDNl\nwfsCQRLpjlHg7LznRtme2v7Q+nyYK7wZ1yRfasoPbvL1q1cHbhxDr4KjJiZsECur\nCbkUh2bcCNsPl7XgfVstkqfRYGvVrPBWX8kzWeBDozpy6Vpd8yMwe3iAv3hfjlQf\nIrKaEkflAgMBAAECggEAIRo2m8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AoGAWqy3tRePJBS3DSR/GnP+\nCAZPnrXX4Ff+H33ymRskuTfzTK4zTZskhvgFwZVWcgIXGxukrsgGy1CHctv4ADOh\nJbCy6NGrJXPaAcD7dOcFv8baAVRjG+NOgiUV2nmXpbs3iGZJjCRBP+Sn/z0bMK6i\nelFGcuSll9CHRgKLr0vC9cQ=\n-----END PRIVATE KEY-----\n", + "client_email": "gha-ci-cala-bq-access@cala-enterprise.iam.gserviceaccount.com", + "client_id": "117232228864903508261", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gha-ci-cala-bq-access%40cala-enterprise.iam.gserviceaccount.com", + "universe_domain": "googleapis.com" +} diff --git a/examples/main.tf b/examples/main.tf index ef0b7a6..936ace4 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -22,6 +22,10 @@ module "account_set_member_account_set" { source = "./resources/cala_account_set_member_account_set" } +module "big_query_integration" { + source = "./resources/cala_big_query_integration" +} + module "bitfinex_integration" { source = "./resources/cala_bitfinex_integration" } @@ -30,7 +34,7 @@ terraform { required_providers { cala = { source = "registry.terraform.io/galoymoney/cala" - version = "0.0.18" + version = "0.0.20" } } } diff --git a/examples/resources/cala_account/resource.tf b/examples/resources/cala_account/resource.tf index 278c1fe..7f51662 100644 --- a/examples/resources/cala_account/resource.tf +++ b/examples/resources/cala_account/resource.tf @@ -8,8 +8,8 @@ resource "cala_account" "alice" { resource "random_uuid" "bank" {} resource "cala_account" "bank" { - id = random_uuid.bank.result - name = "Bank cash" - code = "BANK.DEPOSITS.${random_uuid.bank.result}" + id = random_uuid.bank.result + name = "Bank cash" + code = "BANK.DEPOSITS.${random_uuid.bank.result}" normal_balance_type = "DEBIT" } diff --git a/examples/resources/cala_big_query_integration/required_providers.tf b/examples/resources/cala_big_query_integration/required_providers.tf new file mode 100644 index 0000000..aca9bd1 --- /dev/null +++ b/examples/resources/cala_big_query_integration/required_providers.tf @@ -0,0 +1,11 @@ +terraform { + required_providers { + cala = { + source = "registry.terraform.io/galoymoney/cala" + } + } +} + +provider "cala" { + endpoint = "http://localhost:2252/graphql" +} diff --git a/examples/resources/cala_big_query_integration/resource.tf b/examples/resources/cala_big_query_integration/resource.tf new file mode 100644 index 0000000..b9ce8cc --- /dev/null +++ b/examples/resources/cala_big_query_integration/resource.tf @@ -0,0 +1,14 @@ +variable "service_account_creds" { + sensitive = true + default = "ewogICJ0eXBlIjogInNlcnZpY2VfYWNjb3VudCIsCiAgInByb2plY3RfaWQiOiAiY2FsYS1lbnRlcnByaXNlIiwKICAicHJpdmF0ZV9rZXlfaWQiOiAiYThmMGQ0MjViYzQ0MTEyMGExNjc4OGY2ZWI4OWU5NDdiNWQwZDYzMiIsCiAgInByaXZhdGVfa2V5IjogIi0tLS0tQkVHSU4gUFJJVkFURSBLRVktLS0tLVxuTUlJRXZRSUJBREFOQmdrcWhraUc5dzBCQVFFRkFBU0NCS2N3Z2dTakFnRUFBb0lCQVFDanRZWFNYZmhQTk5ObFxuV3hxd3VVcFRCV3NzUXRBcC8wc1E0MVJHREJHV0RvR0FYS0tBM2hYeGVNcVE5Z0I5Z2JlL0ZtTXM5UktjTkphaFxuSENPakpQanpyK1ZSWGNIVGViRzNLaFBJSzM3cnErWlNONDNsMTkyUEFSOTAwRDlScnZZQk9wTWFQNnVVRGlkZFxuUW41VXNSRFQ2UklUYWVkUVZqbDZPczVpODlLS1I3bDZoNExZTTJqSnNXeUVrSTlWUGtNTzE3bSswWE5ZTERObFxud2ZzQ1FSTHBqbEhnN0x6blJ0bWUydjdRK255WUs3d1oxeVJmYXNvUGJ2TDFxMWNIYmh4RHI0S2pKaVpzRUN1clxuQ2JrVWgyYmNDTnNQbDdYZ2ZWc3RrcWZSWUd2VnJQQldYOGt6V2VCRG96cHk2VnBkOHlNd2UzaUF2M2hmamxRZlxuSXJLYUVrZmxBZ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GlzLmNvbS9vYXV0aDIvdjEvY2VydHMiLAogICJjbGllbnRfeDUwOV9jZXJ0X3VybCI6ICJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9yb2JvdC92MS9tZXRhZGF0YS94NTA5L2doYS1jaS1jYWxhLWJxLWFjY2VzcyU0MGNhbGEtZW50ZXJwcmlzZS5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsCiAgInVuaXZlcnNlX2RvbWFpbiI6ICJnb29nbGVhcGlzLmNvbSIKfQo=" +} + +resource "random_uuid" "integration_id" {} + +resource "cala_big_query_integration" "bq" { + id = random_uuid.integration_id.result + name = "bq-integration" + project_id = "cala-enterprise" + dataset_id = "cala-enterprise-dev" + service_account_creds_base64 = var.service_account_creds +} diff --git a/examples/resources/cala_bitfinex_integration/resource.tf b/examples/resources/cala_bitfinex_integration/resource.tf index e8ffcb2..5350e3c 100644 --- a/examples/resources/cala_bitfinex_integration/resource.tf +++ b/examples/resources/cala_bitfinex_integration/resource.tf @@ -1,11 +1,11 @@ variable "bitfinex_key" { sensitive = true - default = "dummy" + default = "dummy" } variable "bitfinex_secret" { sensitive = true - default = "dummy" + default = "dummy" } resource "random_uuid" "journal_id" {} diff --git a/provider/generated.go b/provider/generated.go index 5e4bf21..2f6101d 100644 --- a/provider/generated.go +++ b/provider/generated.go @@ -152,6 +152,35 @@ func (v *BfxIntegrationCreateInput) GetKey() string { return v.Key } // GetSecret returns BfxIntegrationCreateInput.Secret, and is useful for accessing the field via an interface. func (v *BfxIntegrationCreateInput) GetSecret() string { return v.Secret } +type BigQueryIntegrationCreateInput struct { + IntegrationId string `json:"integrationId"` + Name string `json:"name"` + Description *string `json:"description"` + GcpProjectId string `json:"gcpProjectId"` + GcpDatasetId string `json:"gcpDatasetId"` + ServiceAccountCredsBase64 string `json:"serviceAccountCredsBase64"` +} + +// GetIntegrationId returns BigQueryIntegrationCreateInput.IntegrationId, and is useful for accessing the field via an interface. +func (v *BigQueryIntegrationCreateInput) GetIntegrationId() string { return v.IntegrationId } + +// GetName returns BigQueryIntegrationCreateInput.Name, and is useful for accessing the field via an interface. +func (v *BigQueryIntegrationCreateInput) GetName() string { return v.Name } + +// GetDescription returns BigQueryIntegrationCreateInput.Description, and is useful for accessing the field via an interface. +func (v *BigQueryIntegrationCreateInput) GetDescription() *string { return v.Description } + +// GetGcpProjectId returns BigQueryIntegrationCreateInput.GcpProjectId, and is useful for accessing the field via an interface. +func (v *BigQueryIntegrationCreateInput) GetGcpProjectId() string { return v.GcpProjectId } + +// GetGcpDatasetId returns BigQueryIntegrationCreateInput.GcpDatasetId, and is useful for accessing the field via an interface. +func (v *BigQueryIntegrationCreateInput) GetGcpDatasetId() string { return v.GcpDatasetId } + +// GetServiceAccountCredsBase64 returns BigQueryIntegrationCreateInput.ServiceAccountCredsBase64, and is useful for accessing the field via an interface. +func (v *BigQueryIntegrationCreateInput) GetServiceAccountCredsBase64() string { + return v.ServiceAccountCredsBase64 +} + type DebitOrCredit string const ( @@ -324,6 +353,22 @@ type __bfxIntegrationGetInput struct { // GetId returns __bfxIntegrationGetInput.Id, and is useful for accessing the field via an interface. func (v *__bfxIntegrationGetInput) GetId() string { return v.Id } +// __bigQueryIntegrationCreateInput is used internally by genqlient +type __bigQueryIntegrationCreateInput struct { + Input BigQueryIntegrationCreateInput `json:"input"` +} + +// GetInput returns __bigQueryIntegrationCreateInput.Input, and is useful for accessing the field via an interface. +func (v *__bigQueryIntegrationCreateInput) GetInput() BigQueryIntegrationCreateInput { return v.Input } + +// __bigQueryIntegrationGetInput is used internally by genqlient +type __bigQueryIntegrationGetInput struct { + Id string `json:"id"` +} + +// GetId returns __bigQueryIntegrationGetInput.Id, and is useful for accessing the field via an interface. +func (v *__bigQueryIntegrationGetInput) GetId() string { return v.Id } + // __journalCreateInput is used internally by genqlient type __journalCreateInput struct { Input JournalCreateInput `json:"input"` @@ -952,6 +997,124 @@ func (v *bfxIntegrationGetResponse) GetBitfinex() bfxIntegrationGetBitfinexBitfi return v.Bitfinex } +// bigQueryIntegrationCreateBigQueryBigQueryMutation includes the requested fields of the GraphQL type BigQueryMutation. +type bigQueryIntegrationCreateBigQueryBigQueryMutation struct { + IntegrationCreate bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayload `json:"integrationCreate"` +} + +// GetIntegrationCreate returns bigQueryIntegrationCreateBigQueryBigQueryMutation.IntegrationCreate, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationCreateBigQueryBigQueryMutation) GetIntegrationCreate() bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayload { + return v.IntegrationCreate +} + +// bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayload includes the requested fields of the GraphQL type BigQueryIntegrationCreatePayload. +type bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayload struct { + Integration bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration `json:"integration"` +} + +// GetIntegration returns bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayload.Integration, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayload) GetIntegration() bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration { + return v.Integration +} + +// bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration includes the requested fields of the GraphQL type BigQueryIntegration. +type bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration struct { + IntegrationId string `json:"integrationId"` + Name string `json:"name"` + Description *string `json:"description"` + GcpProjectId string `json:"gcpProjectId"` + GcpDatasetId string `json:"gcpDatasetId"` +} + +// GetIntegrationId returns bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration.IntegrationId, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration) GetIntegrationId() string { + return v.IntegrationId +} + +// GetName returns bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration.Name, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration) GetName() string { + return v.Name +} + +// GetDescription returns bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration.Description, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration) GetDescription() *string { + return v.Description +} + +// GetGcpProjectId returns bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration.GcpProjectId, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration) GetGcpProjectId() string { + return v.GcpProjectId +} + +// GetGcpDatasetId returns bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration.GcpDatasetId, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationCreateBigQueryBigQueryMutationIntegrationCreateBigQueryIntegrationCreatePayloadIntegrationBigQueryIntegration) GetGcpDatasetId() string { + return v.GcpDatasetId +} + +// bigQueryIntegrationCreateResponse is returned by bigQueryIntegrationCreate on success. +type bigQueryIntegrationCreateResponse struct { + BigQuery bigQueryIntegrationCreateBigQueryBigQueryMutation `json:"bigQuery"` +} + +// GetBigQuery returns bigQueryIntegrationCreateResponse.BigQuery, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationCreateResponse) GetBigQuery() bigQueryIntegrationCreateBigQueryBigQueryMutation { + return v.BigQuery +} + +// bigQueryIntegrationGetBigQueryBigQueryQuery includes the requested fields of the GraphQL type BigQueryQuery. +type bigQueryIntegrationGetBigQueryBigQueryQuery struct { + Integration *bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration `json:"integration"` +} + +// GetIntegration returns bigQueryIntegrationGetBigQueryBigQueryQuery.Integration, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationGetBigQueryBigQueryQuery) GetIntegration() *bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration { + return v.Integration +} + +// bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration includes the requested fields of the GraphQL type BigQueryIntegration. +type bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration struct { + IntegrationId string `json:"integrationId"` + Name string `json:"name"` + Description *string `json:"description"` + GcpProjectId string `json:"gcpProjectId"` + GcpDatasetId string `json:"gcpDatasetId"` +} + +// GetIntegrationId returns bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration.IntegrationId, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration) GetIntegrationId() string { + return v.IntegrationId +} + +// GetName returns bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration.Name, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration) GetName() string { + return v.Name +} + +// GetDescription returns bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration.Description, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration) GetDescription() *string { + return v.Description +} + +// GetGcpProjectId returns bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration.GcpProjectId, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration) GetGcpProjectId() string { + return v.GcpProjectId +} + +// GetGcpDatasetId returns bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration.GcpDatasetId, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationGetBigQueryBigQueryQueryIntegrationBigQueryIntegration) GetGcpDatasetId() string { + return v.GcpDatasetId +} + +// bigQueryIntegrationGetResponse is returned by bigQueryIntegrationGet on success. +type bigQueryIntegrationGetResponse struct { + BigQuery bigQueryIntegrationGetBigQueryBigQueryQuery `json:"bigQuery"` +} + +// GetBigQuery returns bigQueryIntegrationGetResponse.BigQuery, and is useful for accessing the field via an interface. +func (v *bigQueryIntegrationGetResponse) GetBigQuery() bigQueryIntegrationGetBigQueryBigQueryQuery { + return v.BigQuery +} + // journalCreateJournalCreateJournalCreatePayload includes the requested fields of the GraphQL type JournalCreatePayload. type journalCreateJournalCreateJournalCreatePayload struct { Journal journalCreateJournalCreateJournalCreatePayloadJournal `json:"journal"` @@ -1572,6 +1735,90 @@ func bfxIntegrationGet( return &data_, err_ } +// The query or mutation executed by bigQueryIntegrationCreate. +const bigQueryIntegrationCreate_Operation = ` +mutation bigQueryIntegrationCreate ($input: BigQueryIntegrationCreateInput!) { + bigQuery { + integrationCreate(input: $input) { + integration { + integrationId + name + description + gcpProjectId + gcpDatasetId + } + } + } +} +` + +func bigQueryIntegrationCreate( + ctx_ context.Context, + client_ graphql.Client, + input BigQueryIntegrationCreateInput, +) (*bigQueryIntegrationCreateResponse, error) { + req_ := &graphql.Request{ + OpName: "bigQueryIntegrationCreate", + Query: bigQueryIntegrationCreate_Operation, + Variables: &__bigQueryIntegrationCreateInput{ + Input: input, + }, + } + var err_ error + + var data_ bigQueryIntegrationCreateResponse + resp_ := &graphql.Response{Data: &data_} + + err_ = client_.MakeRequest( + ctx_, + req_, + resp_, + ) + + return &data_, err_ +} + +// The query or mutation executed by bigQueryIntegrationGet. +const bigQueryIntegrationGet_Operation = ` +query bigQueryIntegrationGet ($id: UUID!) { + bigQuery { + integration(id: $id) { + integrationId + name + description + gcpProjectId + gcpDatasetId + } + } +} +` + +func bigQueryIntegrationGet( + ctx_ context.Context, + client_ graphql.Client, + id string, +) (*bigQueryIntegrationGetResponse, error) { + req_ := &graphql.Request{ + OpName: "bigQueryIntegrationGet", + Query: bigQueryIntegrationGet_Operation, + Variables: &__bigQueryIntegrationGetInput{ + Id: id, + }, + } + var err_ error + + var data_ bigQueryIntegrationGetResponse + resp_ := &graphql.Response{Data: &data_} + + err_ = client_.MakeRequest( + ctx_, + req_, + resp_, + ) + + return &data_, err_ +} + // The query or mutation executed by journalCreate. const journalCreate_Operation = ` mutation journalCreate ($input: JournalCreateInput!) { diff --git a/provider/provider.go b/provider/provider.go index 6a89988..2705421 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -95,6 +95,7 @@ func (p *CalaProvider) Resources(ctx context.Context) []func() resource.Resource NewAccountSetResource, NewAccountSetMemberAccountResource, NewAccountSetMemberAccountSetResource, + NewBigQueryIntegrationResource, NewBitfinexIntegrationResource, } } diff --git a/provider/resource_bigquery_integration.go b/provider/resource_bigquery_integration.go new file mode 100644 index 0000000..58b4dbd --- /dev/null +++ b/provider/resource_bigquery_integration.go @@ -0,0 +1,162 @@ +package provider + +import ( + "context" + "fmt" + + "github.com/Khan/genqlient/graphql" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +var _ resource.Resource = &BigQueryIntegrationResource{} +var _ resource.ResourceWithImportState = &BigQueryIntegrationResource{} + +func NewBigQueryIntegrationResource() resource.Resource { + return &BigQueryIntegrationResource{} +} + +type BigQueryIntegrationResource struct { + client *graphql.Client +} + +type BigQueryIntegrationResourceModel struct { + BigQueryIntegrationId types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Description types.String `tfsdk:"description"` + ServiceAccountCredsBase64 types.String `tfsdk:"service_account_creds_base64"` + ProjectId types.String `tfsdk:"project_id"` + DatasetId types.String `tfsdk:"dataset_id"` +} + +func (r *BigQueryIntegrationResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_big_query_integration" +} + +func (r *BigQueryIntegrationResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + MarkdownDescription: "Cala BigQuery Integration.", + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + MarkdownDescription: "ID of the integration.", + Required: true, + }, + "name": schema.StringAttribute{ + MarkdownDescription: "Name of the integration.", + Required: true, + }, + "description": schema.StringAttribute{ + MarkdownDescription: "Description of the integration.", + Optional: true, + }, + "project_id": schema.StringAttribute{ + MarkdownDescription: "Gcp Project Id", + Required: true, + }, + "dataset_id": schema.StringAttribute{ + MarkdownDescription: "Gcp Biq Query Dataset Id", + Required: true, + }, + "service_account_creds_base64": schema.StringAttribute{ + MarkdownDescription: "The GCP service account creds", + Required: true, + Sensitive: true, + }, + }, + } +} + +func (r *BigQueryIntegrationResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*graphql.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *graphql.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client +} + +func (r *BigQueryIntegrationResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + var data *BigQueryIntegrationResourceModel + + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + input := BigQueryIntegrationCreateInput{ + IntegrationId: data.BigQueryIntegrationId.ValueString(), + Name: data.Name.ValueString(), + Description: data.Description.ValueStringPointer(), + GcpProjectId: data.ProjectId.ValueString(), + GcpDatasetId: data.DatasetId.ValueString(), + ServiceAccountCredsBase64: data.ServiceAccountCredsBase64.ValueString(), + } + + response, err := bigQueryIntegrationCreate(ctx, *r.client, input) + + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to create integration, got error: %s", err)) + return + } + + tflog.Trace(ctx, "created an integration") + + integration := response.BigQuery.IntegrationCreate.Integration + + data.BigQueryIntegrationId = types.StringValue(integration.IntegrationId) + data.Name = types.StringValue(integration.Name) + data.Description = types.StringPointerValue(integration.Description) + data.ProjectId = types.StringValue(integration.GcpProjectId) + data.DatasetId = types.StringValue(integration.GcpDatasetId) + + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +func (r *BigQueryIntegrationResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var data *BigQueryIntegrationResourceModel + + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + response, err := bigQueryIntegrationGet(ctx, *r.client, data.BigQueryIntegrationId.ValueString()) + + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read integration, got error: %s", err)) + return + } + + integration := response.BigQuery.Integration + + data.BigQueryIntegrationId = types.StringValue(integration.IntegrationId) + data.Name = types.StringValue(integration.Name) + data.Description = types.StringPointerValue(integration.Description) + data.ProjectId = types.StringValue(integration.GcpProjectId) + data.DatasetId = types.StringValue(integration.GcpDatasetId) + + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +func (r *BigQueryIntegrationResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + +} + +func (r *BigQueryIntegrationResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + +} + +func (r *BigQueryIntegrationResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + +} diff --git a/schema/vendor/schema.graphql b/schema/vendor/schema.graphql index 5fbf1cf..55d5b42 100644 --- a/schema/vendor/schema.graphql +++ b/schema/vendor/schema.graphql @@ -12,6 +12,7 @@ type Account { createdAt: Timestamp! modifiedAt: Timestamp! balance(journalId: UUID!, currency: CurrencyCode!): Balance + balanceInRange(journalId: UUID!, currency: CurrencyCode!, from: Timestamp!, until: Timestamp): RangedBalance sets(first: Int!, after: String): AccountSetConnection! } @@ -72,6 +73,7 @@ type AccountSet { createdAt: Timestamp! modifiedAt: Timestamp! balance(currency: CurrencyCode!): Balance + balanceInRange(journalId: UUID!, currency: CurrencyCode!, from: Timestamp!, until: Timestamp): RangedBalance members(first: Int!, after: String): AccountSetMemberConnection! sets(first: Int!, after: String): AccountSetConnection! } @@ -199,6 +201,7 @@ type Balance { pending: BalanceAmount! encumbrance: BalanceAmount! version: Int! + available(layer: Layer!): BalanceAmount! } type BalanceAmount { @@ -208,40 +211,6 @@ type BalanceAmount { entryId: UUID! } -type BalanceSheet { - assets: AccountSet! - liabilities: AccountSet! - equity: AccountSet! - schedule1: AccountSet! - schedule2: AccountSet! - schedule3: AccountSet! - schedule4: AccountSet! - schedule5: AccountSet! - schedule6: AccountSet! - schedule7: AccountSet! - schedule8: AccountSet! - schedule9: AccountSet! - schedule10: AccountSet! - schedule11: AccountSet! - schedule12: AccountSet! -} - -input BalanceSheetCreateInput { - journalId: UUID! -} - -type BalanceSheetCreatePayload { - balanceSheet: BalanceSheet! -} - -type BalanceSheetMutation { - create(input: BalanceSheetCreateInput!): BalanceSheetCreatePayload! -} - -type BalanceSheetQuery { - byJournalId(journalId: UUID!): BalanceSheet -} - type BfxAddressBackedAccount { address: String! account: Account! @@ -319,12 +288,16 @@ enum BfxWithdrawalMethod { TETHER_USX } -type BigQueryExportCreatePayload { - job: Job! +type BigQueryIntegration { + integrationId: UUID! + name: String! + description: String + gcpProjectId: String! + gcpDatasetId: String! } -input BigQueryExportJobCreateInput { - jobId: UUID! +input BigQueryIntegrationCreateInput { + integrationId: UUID! name: String! description: String gcpProjectId: String! @@ -332,8 +305,39 @@ input BigQueryExportJobCreateInput { serviceAccountCredsBase64: String! } +type BigQueryIntegrationCreatePayload { + integration: BigQueryIntegration! +} + type BigQueryMutation { - bqExportJobCreate(input: BigQueryExportJobCreateInput!): BigQueryExportCreatePayload! + integrationCreate(input: BigQueryIntegrationCreateInput!): BigQueryIntegrationCreatePayload! + tableCreate(input: BigQueryTableCreateInput!): BigQueryTableCreatePayload! + rowInsert(input: BigQueryRowInsertInput!): BigQueryRowInsertPayload! +} + +type BigQueryQuery { + integration(id: UUID!): BigQueryIntegration +} + +input BigQueryRowInsertInput { + integrationId: UUID! + tableName: String! + rowData: JSON! +} + +type BigQueryRowInsertPayload { + integration: BigQueryIntegration! +} + +input BigQueryTableCreateInput { + integrationId: UUID! + tableName: String! + tableSchema: JSON! +} + +type BigQueryTableCreatePayload { + tableName: String! + integration: BigQueryIntegration! } type BitfinexMutation { @@ -373,16 +377,6 @@ enum DebitOrCredit { scalar Decimal -type EntryInput { - entryType: Expression! - accountId: Expression! - layer: Expression! - direction: Expression! - units: Expression! - currency: Expression! - description: Expression -} - scalar Expression @@ -458,6 +452,12 @@ type JournalUpdatePayload { journal: Journal! } +enum Layer { + SETTLED + PENDING + ENCUMBRANCE +} + type Money { units: Decimal! currency: CurrencyCode! @@ -467,7 +467,6 @@ type Mutation { calaOutboxImportJobCreate(input: CalaOutboxImportJobCreateInput!): CalaOutboxImportJobCreatePayload! bigQuery: BigQueryMutation! bitfinex: BitfinexMutation! - balanceSheet: BalanceSheetMutation! accountCreate(input: AccountCreateInput!): AccountCreatePayload! accountUpdate(id: UUID!, input: AccountUpdateInput!): AccountUpdatePayload! accountSetCreate(input: AccountSetCreateInput!): AccountSetCreatePayload! @@ -477,7 +476,7 @@ type Mutation { journalCreate(input: JournalCreateInput!): JournalCreatePayload! journalUpdate(id: UUID!, input: JournalUpdateInput!): JournalUpdatePayload! txTemplateCreate(input: TxTemplateCreateInput!): TxTemplateCreatePayload! - postTransaction(input: TransactionInput!): PostTransactionPayload! + transactionPost(input: TransactionInput!): TransactionPostPayload! } """ @@ -527,14 +526,10 @@ input ParamDefinitionInput { description: String } -type PostTransactionPayload { - transaction: Transaction! -} - type Query { serverVersion: String! + bigQuery: BigQueryQuery! bitfinex: BitfinexQuery! - balanceSheet: BalanceSheetQuery! account(id: UUID!): Account accountByExternalId(externalId: String!): Account accountByCode(code: String!): Account @@ -542,6 +537,7 @@ type Query { accountSet(id: UUID!): AccountSet journal(id: UUID!): Journal balance(journalId: UUID!, accountId: UUID!, currency: CurrencyCode!): Balance + balanceInRange(journalId: UUID!, accountId: UUID!, currency: CurrencyCode!, from: Timestamp!, until: Timestamp): RangedBalance transaction(id: UUID!): Transaction transactionByExternalId(externalId: String!): Transaction txTemplate(id: UUID!): TxTemplate @@ -549,6 +545,12 @@ type Query { jobs(first: Int!, after: String): JobConnection! } +type RangedBalance { + start: Balance! + end: Balance! + diff: Balance! +} + input RemoveFromAccountSetInput { accountSetId: UUID! memberId: UUID! @@ -588,13 +590,8 @@ input TransactionInput { params: JSON } -type TxInput { - effective: Expression! - journalId: Expression! - correlationId: Expression - externalId: Expression - description: Expression - metadata: Expression +type TransactionPostPayload { + transaction: Transaction! } type TxTemplate { @@ -603,8 +600,8 @@ type TxTemplate { version: Int! code: String! params: [ParamDefinition!] - txInput: TxInput! - entries: [EntryInput!]! + transaction: TxTemplateTransaction! + entries: [TxTemplateEntry!]! description: String metadata: JSON createdAt: Timestamp! @@ -615,7 +612,7 @@ input TxTemplateCreateInput { txTemplateId: UUID! code: String! params: [ParamDefinitionInput!] - txInput: TxTemplateTxInput! + transaction: TxTemplateTransactionInput! entries: [TxTemplateEntryInput!]! description: String metadata: JSON @@ -625,6 +622,16 @@ type TxTemplateCreatePayload { txTemplate: TxTemplate! } +type TxTemplateEntry { + entryType: Expression! + accountId: Expression! + layer: Expression! + direction: Expression! + units: Expression! + currency: Expression! + description: Expression +} + input TxTemplateEntryInput { entryType: Expression! accountId: Expression! @@ -635,7 +642,16 @@ input TxTemplateEntryInput { description: Expression } -input TxTemplateTxInput { +type TxTemplateTransaction { + effective: Expression! + journalId: Expression! + correlationId: Expression + externalId: Expression + description: Expression + metadata: Expression +} + +input TxTemplateTransactionInput { effective: Expression! journalId: Expression! correlationId: Expression diff --git a/vendir.lock.yml b/vendir.lock.yml index 02deefa..c6edb4a 100644 --- a/vendir.lock.yml +++ b/vendir.lock.yml @@ -2,10 +2,10 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'refactor: remove bfx omnibus account set' - sha: 13bd2e53f84ced6b6678681dbbc823ce051fb2af + commitTitle: 'chore: audit ignore' + sha: 3d52070e9341a4c0e2889c694bc3bb09ff178e9c tags: - - 0.3.5-4-g13bd2e5 + - 0.3.20-3-g3d52070 path: vendor path: schema kind: LockConfig