diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e6a9944 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# This allows generated code to be indexed correctly +*.go linguist-generated=false \ No newline at end of file diff --git a/README.md b/README.md index b876ec3..24f3c19 100755 --- a/README.md +++ b/README.md @@ -22,12 +22,14 @@ provider "airbyte" { -## Testing the provider locally +### Testing the provider locally Should you want to validate a change locally, the `--debug` flag allows you to execute the provider against a terraform instance locally. This also allows for debuggers (e.g. delve) to be attached to the provider. +### Example + ```sh go run main.go --debug # Copy the TF_REATTACH_PROVIDERS env var @@ -42,6 +44,10 @@ TF_REATTACH_PROVIDERS=... terraform apply + + + + Terraform allows you to use local provider builds by setting a `dev_overrides` block in a configuration file called `.terraformrc`. This block overrides all other configured installation methods. Terraform searches for the `.terraformrc` file in your home directory and applies any configuration settings you set. diff --git a/USAGE.md b/USAGE.md old mode 100755 new mode 100644 index d45e8dc..2ffc222 --- a/USAGE.md +++ b/USAGE.md @@ -1,10 +1,4 @@ -## Testing the provider locally - -Should you want to validate a change locally, the `--debug` flag allows you to execute the provider against a terraform instance locally. - -This also allows for debuggers (e.g. delve) to be attached to the provider. - ```sh go run main.go --debug # Copy the TF_REATTACH_PROVIDERS env var diff --git a/examples/README.md b/examples/README.md old mode 100755 new mode 100644 diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf old mode 100755 new mode 100644 diff --git a/examples/resources/airbyte_connection/resource.tf b/examples/resources/airbyte_connection/resource.tf old mode 100755 new mode 100644 index 7a82a2f..419de49 --- a/examples/resources/airbyte_connection/resource.tf +++ b/examples/resources/airbyte_connection/resource.tf @@ -1,6 +1,84 @@ resource "airbyte_connection" "my_connection" { - destination_id = "89bd9d8d-69a6-474e-8f46-7cc8796ed151" - namespace_format = "${SOURCE_NAMESPACE}" - source_id = "a05dfc2d-df7c-4c78-8a1b-a928fc816742" - status = "deprecated" - } \ No newline at end of file + destination_id = "2d0b4937-840e-4535-aba0-03060ced80fc" + geography = "auto" + name = "Sheldon Balistreri" + namespace_definition = "source" + namespace_format = SOURCE_NAMESPACE + non_breaking_changes_preference = "ignore" + notify_schema_changes = false + notify_schema_changes_by_email = true + operation_ids = [ + "fbb5835b-a03c-430b-b29d-f734fbd43f94", + ] + prefix = "...my_prefix..." + resource_requirements = { + cpu_limit = "...my_cpu_limit..." + cpu_request = "...my_cpu_request..." + memory_limit = "...my_memory_limit..." + memory_request = "...my_memory_request..." + } + schedule = { + time_unit = "minutes" + units = 9 + } + schedule_data = { + basic_schedule = { + time_unit = "weeks" + units = 7 + } + cron = { + cron_expression = "...my_cron_expression..." + cron_time_zone = "...my_cron_time_zone..." + } + } + schedule_type = "cron" + source_catalog_id = "5e6b8dd9-95b8-45b3-8db9-804e4cb5e145" + source_id = "1ef85fdd-6486-4396-b21f-097ee8d4067a" + status = "inactive" + sync_catalog = { + streams = [ + { + config = { + alias_name = "...my_alias_name..." + cursor_field = [ + "...", + ] + destination_sync_mode = "append_dedup" + field_selection_enabled = true + primary_key = [ + [ + "...", + ], + ] + selected = false + selected_fields = [ + { + field_path = [ + "...", + ] + }, + ] + suggested = false + sync_mode = "incremental" + } + stream = { + default_cursor_field = [ + "...", + ] + json_schema = {} + name = "Ms. June Bins" + namespace = "...my_namespace..." + source_defined_cursor = true + source_defined_primary_key = [ + [ + "...", + ], + ] + supported_sync_modes = [ + "incremental", + ] + } + }, + ] + } +} \ No newline at end of file diff --git a/examples/resources/airbyte_source/resource.tf b/examples/resources/airbyte_source/resource.tf old mode 100755 new mode 100644 index ee5c411..a921bcd --- a/examples/resources/airbyte_source/resource.tf +++ b/examples/resources/airbyte_source/resource.tf @@ -1,7 +1,7 @@ resource "airbyte_source" "my_source" { - connection_configuration = "{ \"see\": \"documentation\" }" - name = "Cory Emmerich" - source_definition_id = "05929396-fea7-4596-ab10-faaa2352c595" - source_id = "5907aff1-a3a2-4fa9-8677-39251aa52c3f" - workspace_id = "5ad019da-1ffe-478f-897b-0074f15471b5" - } \ No newline at end of file + connection_configuration = { "user" : "charles" } + name = "Austin Stracke" + secret_id = "airbyte_oauth_workspace_0509f049-d671-48cb-8105-0a23d47e6db6_secret_e0d38206-034e-4d75-9d21-da5a99b02826_v1" + source_definition_id = "2f95525d-bfb0-4168-a100-133587515722" + workspace_id = "b625efa1-bbfa-48d6-85f7-19d133279f15" +} \ No newline at end of file diff --git a/examples/resources/airbyte_source_definition/resource.tf b/examples/resources/airbyte_source_definition/resource.tf old mode 100755 new mode 100644 index 87e5d39..cbad8e9 --- a/examples/resources/airbyte_source_definition/resource.tf +++ b/examples/resources/airbyte_source_definition/resource.tf @@ -1,31 +1,29 @@ resource "airbyte_source_definition" "my_sourcedefinition" { - docker_image_tag = "...my_dockerImageTag..." - source_definition = { - docker_image_tag = "...my_dockerImageTag..." - docker_repository = "...my_dockerRepository..." - documentation_url = "https://immediate-tow-truck.com" - icon = "...my_icon..." - name = "Alison Mann" - resource_requirements = { - default = { - cpu_limit = "...my_cpu_limit..." - cpu_request = "...my_cpu_request..." - memory_limit = "...my_memory_limit..." - memory_request = "...my_memory_request..." - } - job_specific = [ - { - job_type = "check_connection" - resource_requirements = = { - cpu_limit = "...my_cpu_limit..." - cpu_request = "...my_cpu_request..." - memory_limit = "...my_memory_limit..." - memory_request = "...my_memory_request..." - } - }, - ] - } + source_definition = { + docker_image_tag = "...my_docker_image_tag..." + docker_repository = "...my_docker_repository..." + documentation_url = "https://tempting-lieutenant.net" + icon = "...my_icon..." + name = "Dale Weimann" + resource_requirements = { + default = { + cpu_limit = "...my_cpu_limit..." + cpu_request = "...my_cpu_request..." + memory_limit = "...my_memory_limit..." + memory_request = "...my_memory_request..." + } + job_specific = [ + { + job_type = "check_connection" + resource_requirements = { + cpu_limit = "...my_cpu_limit..." + cpu_request = "...my_cpu_request..." + memory_limit = "...my_memory_limit..." + memory_request = "...my_memory_request..." + } + }, + ] } - source_definition_id = "88e1e91e-450a-4d2a-bd44-269802d502a9" - workspace_id = "4bb4f63c-969e-49a3-afa7-7dfb14cd66ae" - } \ No newline at end of file + } + workspace_id = "fac9256c-f878-4498-930f-77eda0554f68" +} \ No newline at end of file diff --git a/examples/resources/airbyte_source_definition_manifest/resource.tf b/examples/resources/airbyte_source_definition_manifest/resource.tf old mode 100755 new mode 100644 index 9a7a6b5..8a38c13 --- a/examples/resources/airbyte_source_definition_manifest/resource.tf +++ b/examples/resources/airbyte_source_definition_manifest/resource.tf @@ -1,9 +1,11 @@ resource "airbyte_source_definition_manifest" "my_sourcedefinitionmanifest" { - declarative_manifest = { - description = "...my_description..." - manifest = {} - spec = {} - version = 2 - } - set_as_active_manifest = false - } \ No newline at end of file + declarative_manifest = { + description = "...my_description..." + manifest = {} + spec = {} + version = 3 + } + set_as_active_manifest = true + source_definition_id = "fc353545-7d24-4426-8ff9-77c6f814b5f1" + workspace_id = "dc406d3e-6067-4c0f-aa27-e0571d07b12f" +} \ No newline at end of file diff --git a/examples/resources/airbyte_workspace/resource.tf b/examples/resources/airbyte_workspace/resource.tf old mode 100755 new mode 100644 index 748a05e..29cc4bf --- a/examples/resources/airbyte_workspace/resource.tf +++ b/examples/resources/airbyte_workspace/resource.tf @@ -1,4 +1,84 @@ resource "airbyte_workspace" "my_workspace" { - name = "Sophia Wintheiser" - workspace_id = "ba88f3a6-6997-4074-ba44-69b6e2141959" - } \ No newline at end of file + anonymous_data_collection = true + default_geography = "auto" + display_setup_wizard = false + email = "Shana.Osinski@hotmail.com" + name = "Philip Hegmann" + news = false + notifications = [ + { + customerio_configuration = {} + notification_type = "slack" + send_on_failure = false + send_on_success = true + slack_configuration = { + webhook = "...my_webhook..." + } + }, + ] + notification_settings = { + send_on_connection_update = { + customerio_configuration = {} + notification_type = [ + "customerio", + ] + slack_configuration = { + webhook = "...my_webhook..." + } + } + send_on_connection_update_action_required = { + customerio_configuration = {} + notification_type = [ + "slack", + ] + slack_configuration = { + webhook = "...my_webhook..." + } + } + send_on_failure = { + customerio_configuration = {} + notification_type = [ + "slack", + ] + slack_configuration = { + webhook = "...my_webhook..." + } + } + send_on_success = { + customerio_configuration = {} + notification_type = [ + "customerio", + ] + slack_configuration = { + webhook = "...my_webhook..." + } + } + send_on_sync_disabled = { + customerio_configuration = {} + notification_type = [ + "customerio", + ] + slack_configuration = { + webhook = "...my_webhook..." + } + } + send_on_sync_disabled_warning = { + customerio_configuration = {} + notification_type = [ + "slack", + ] + slack_configuration = { + webhook = "...my_webhook..." + } + } + } + security_updates = false + webhook_configs = [ + { + auth_token = "...my_auth_token..." + id = "2038bc3c-1219-42fc-9206-51b10e8de28e" + name = "Travis Hegmann" + validation_url = "...my_validation_url..." + }, + ] +} \ No newline at end of file diff --git a/files.gen b/files.gen index aa76c5c..9c40b2c 100755 --- a/files.gen +++ b/files.gen @@ -1,52 +1,29 @@ -internal/sdk/attempt.go -internal/sdk/connection.go -internal/sdk/connectorbuilderproject.go +internal/sdk/workspace.go +internal/sdk/notifications.go +internal/sdk/sourcedefinition.go +internal/sdk/sourcedefinitionspecification.go internal/sdk/declarativesourcedefinitions.go -internal/sdk/destination.go +internal/sdk/connectorbuilderproject.go +internal/sdk/source.go +internal/sdk/internal.go internal/sdk/destinationdefinition.go internal/sdk/destinationdefinitionspecification.go +internal/sdk/destination.go +internal/sdk/connection.go +internal/sdk/state.go +internal/sdk/operation.go +internal/sdk/scheduler.go +internal/sdk/sourceoauth.go internal/sdk/destinationoauth.go -internal/sdk/health.go -internal/sdk/internal.go +internal/sdk/webbackend.go internal/sdk/jobs.go +internal/sdk/health.go internal/sdk/logs.go -internal/sdk/notifications.go internal/sdk/openapi.go -internal/sdk/operation.go -internal/sdk/scheduler.go -internal/sdk/source.go -internal/sdk/sourcedefinition.go -internal/sdk/sourcedefinitionspecification.go -internal/sdk/sourceoauth.go -internal/sdk/state.go +internal/sdk/attempt.go internal/sdk/streamstatuses.go internal/sdk/streams.go -internal/sdk/webbackend.go -internal/sdk/workspace.go internal/sdk/sdk.go -internal/provider/type_resource_requirements.go -internal/provider/type_connection_schedule.go -internal/provider/type_connection_schedule_data_basic_schedule.go -internal/provider/type_connection_schedule_data_cron.go -internal/provider/type_connection_schedule_data.go -internal/provider/type_selected_field_info.go -internal/provider/type_airbyte_stream_configuration.go -internal/provider/type_stream_json_schema.go -internal/provider/type_airbyte_stream.go -internal/provider/type_airbyte_stream_and_configuration.go -internal/provider/type_airbyte_catalog.go -internal/provider/type_invalid_input_property.go -internal/provider/type_resource_requirements1.go -internal/provider/type_job_type_resource_limit.go -internal/provider/type_actor_definition_resource_requirements.go -internal/provider/type_source_definition_create.go -internal/provider/type_declarative_manifest.go -internal/provider/type_source_definition_specification.go -internal/provider/type_declarative_source_manifest.go -internal/provider/type_customerio_notification_configuration.go -internal/provider/type_slack_notification_configuration.go -internal/provider/type_notification.go -internal/provider/type_webhook_config_write.go examples/README.md go.mod go.sum @@ -75,12 +52,16 @@ internal/provider/reflect/primitive.go internal/provider/reflect/slice.go internal/provider/reflect/struct.go internal/provider/utils.go +internal/sdk/pkg/models/sdkerrors/sdkerror.go internal/sdk/pkg/types/bigint.go internal/sdk/pkg/types/date.go internal/sdk/pkg/types/datetime.go +internal/sdk/pkg/types/decimal.go +internal/sdk/pkg/types/pointers.go internal/sdk/pkg/utils/contenttype.go internal/sdk/pkg/utils/form.go internal/sdk/pkg/utils/headers.go +internal/sdk/pkg/utils/json.go internal/sdk/pkg/utils/pathparams.go internal/sdk/pkg/utils/queryparams.go internal/sdk/pkg/utils/requestbody.go @@ -94,343 +75,362 @@ internal/validators/RFC3339Validator.go main.go terraform-registry-manifest.json tools/tools.go -internal/sdk/pkg/models/operations/savestats.go -internal/sdk/pkg/models/operations/savesyncconfig.go -internal/sdk/pkg/models/operations/setworkflowinattempt.go -internal/sdk/pkg/models/operations/createconnection.go -internal/sdk/pkg/models/operations/deleteconnection.go -internal/sdk/pkg/models/operations/getconnection.go -internal/sdk/pkg/models/operations/listallconnectionsforworkspace.go -internal/sdk/pkg/models/operations/listconnectionsbyactordefinition.go -internal/sdk/pkg/models/operations/listconnectionsforworkspace.go -internal/sdk/pkg/models/operations/resetconnection.go -internal/sdk/pkg/models/operations/resetconnectionstream.go -internal/sdk/pkg/models/operations/searchconnections.go -internal/sdk/pkg/models/operations/syncconnection.go -internal/sdk/pkg/models/operations/updateconnection.go +internal/sdk/pkg/models/operations/createworkspace.go +internal/sdk/pkg/models/operations/deleteworkspace.go +internal/sdk/pkg/models/operations/listworkspaces.go +internal/sdk/pkg/models/operations/getworkspace.go +internal/sdk/pkg/models/operations/getworkspacebyslug.go +internal/sdk/pkg/models/operations/getworkspacebyconnectionid.go +internal/sdk/pkg/models/operations/updateworkspace.go +internal/sdk/pkg/models/operations/updateworkspacename.go +internal/sdk/pkg/models/operations/updateworkspacefeedback.go +internal/sdk/pkg/models/operations/trynotificationconfig.go +internal/sdk/pkg/models/operations/updatesourcedefinition.go +internal/sdk/pkg/models/operations/listsourcedefinitions.go +internal/sdk/pkg/models/operations/listlatestsourcedefinitions.go +internal/sdk/pkg/models/operations/getsourcedefinition.go +internal/sdk/pkg/models/operations/deletesourcedefinition.go +internal/sdk/pkg/models/operations/listprivatesourcedefinitions.go +internal/sdk/pkg/models/operations/listsourcedefinitionsforworkspace.go +internal/sdk/pkg/models/operations/createcustomsourcedefinition.go +internal/sdk/pkg/models/operations/getsourcedefinitionforworkspace.go +internal/sdk/pkg/models/operations/grantsourcedefinitiontoworkspace.go +internal/sdk/pkg/models/operations/revokesourcedefinitionfromworkspace.go +internal/sdk/pkg/models/operations/getsourcedefinitionspecification.go +internal/sdk/pkg/models/operations/getspecificationforsourceid.go +internal/sdk/pkg/models/operations/createdeclarativesourcedefinitionmanifest.go +internal/sdk/pkg/models/operations/updatedeclarativemanifestversion.go +internal/sdk/pkg/models/operations/listdeclarativemanifests.go internal/sdk/pkg/models/operations/createconnectorbuilderproject.go -internal/sdk/pkg/models/operations/deleteconnectorbuilderproject.go -internal/sdk/pkg/models/operations/getconnectorbuilderproject.go -internal/sdk/pkg/models/operations/listconnectorbuilderprojects.go internal/sdk/pkg/models/operations/publishconnectorbuilderproject.go internal/sdk/pkg/models/operations/updateconnectorbuilderproject.go -internal/sdk/pkg/models/operations/createdeclarativesourcedefinitionmanifest.go -internal/sdk/pkg/models/operations/listdeclarativemanifests.go -internal/sdk/pkg/models/operations/updatedeclarativemanifestversion.go -internal/sdk/pkg/models/operations/checkconnectiontodestination.go -internal/sdk/pkg/models/operations/checkconnectiontodestinationforupdate.go -internal/sdk/pkg/models/operations/clonedestination.go -internal/sdk/pkg/models/operations/createdestination.go -internal/sdk/pkg/models/operations/deletedestination.go -internal/sdk/pkg/models/operations/getdestination.go -internal/sdk/pkg/models/operations/listdestinationsforworkspace.go -internal/sdk/pkg/models/operations/partialupdatedestination.go -internal/sdk/pkg/models/operations/searchdestinations.go -internal/sdk/pkg/models/operations/updatedestination.go -internal/sdk/pkg/models/operations/createcustomdestinationdefinition.go -internal/sdk/pkg/models/operations/deletedestinationdefinition.go -internal/sdk/pkg/models/operations/getdestinationdefinition.go -internal/sdk/pkg/models/operations/getdestinationdefinitionforworkspace.go -internal/sdk/pkg/models/operations/grantdestinationdefinitiontoworkspace.go +internal/sdk/pkg/models/operations/deleteconnectorbuilderproject.go +internal/sdk/pkg/models/operations/listconnectorbuilderprojects.go +internal/sdk/pkg/models/operations/getconnectorbuilderproject.go +internal/sdk/pkg/models/operations/createsource.go +internal/sdk/pkg/models/operations/updatesource.go +internal/sdk/pkg/models/operations/partialupdatesource.go +internal/sdk/pkg/models/operations/listsourcesforworkspace.go +internal/sdk/pkg/models/operations/getsource.go +internal/sdk/pkg/models/operations/getmostrecentsourceactorcatalog.go +internal/sdk/pkg/models/operations/searchsources.go +internal/sdk/pkg/models/operations/clonesource.go +internal/sdk/pkg/models/operations/deletesource.go +internal/sdk/pkg/models/operations/checkconnectiontosource.go +internal/sdk/pkg/models/operations/checkconnectiontosourceforupdate.go +internal/sdk/pkg/models/operations/discoverschemaforsource.go +internal/sdk/pkg/models/operations/applyschemachangeforsource.go +internal/sdk/pkg/models/operations/writediscovercatalogresult.go +internal/sdk/pkg/models/operations/createorupdatestate.go +internal/sdk/pkg/models/operations/getattemptnormalizationstatusesforjob.go +internal/sdk/pkg/models/operations/setworkflowinattempt.go +internal/sdk/pkg/models/operations/savestats.go +internal/sdk/pkg/models/operations/savesyncconfig.go +internal/sdk/pkg/models/operations/updatedestinationdefinition.go internal/sdk/pkg/models/operations/listdestinationdefinitions.go -internal/sdk/pkg/models/operations/listdestinationdefinitionsforworkspace.go internal/sdk/pkg/models/operations/listlatestdestinationdefinitions.go +internal/sdk/pkg/models/operations/getdestinationdefinition.go +internal/sdk/pkg/models/operations/deletedestinationdefinition.go internal/sdk/pkg/models/operations/listprivatedestinationdefinitions.go +internal/sdk/pkg/models/operations/listdestinationdefinitionsforworkspace.go +internal/sdk/pkg/models/operations/createcustomdestinationdefinition.go +internal/sdk/pkg/models/operations/getdestinationdefinitionforworkspace.go +internal/sdk/pkg/models/operations/grantdestinationdefinitiontoworkspace.go internal/sdk/pkg/models/operations/revokedestinationdefinitionfromworkspace.go -internal/sdk/pkg/models/operations/updatedestinationdefinition.go internal/sdk/pkg/models/operations/getdestinationdefinitionspecification.go internal/sdk/pkg/models/operations/getspecificationfordestinationid.go -internal/sdk/pkg/models/operations/completedestinationoauth.go -internal/sdk/pkg/models/operations/getdestinationoauthconsent.go -internal/sdk/pkg/models/operations/setinstancewidedestinationoauthparams.go -internal/sdk/pkg/models/operations/gethealthcheck.go -internal/sdk/pkg/models/operations/createorupdatestate.go -internal/sdk/pkg/models/operations/getattemptnormalizationstatusesforjob.go -internal/sdk/pkg/models/operations/writediscovercatalogresult.go -internal/sdk/pkg/models/operations/canceljob.go -internal/sdk/pkg/models/operations/getjobdebuginfo.go -internal/sdk/pkg/models/operations/getjobinfo.go -internal/sdk/pkg/models/operations/getjobinfolight.go -internal/sdk/pkg/models/operations/getjobinfowithoutlogs.go -internal/sdk/pkg/models/operations/getlastreplicationjob.go -internal/sdk/pkg/models/operations/listjobsfor.go -internal/sdk/pkg/models/operations/getlogs.go -internal/sdk/pkg/models/operations/trynotificationconfig.go -internal/sdk/pkg/models/operations/getopenapispec.go +internal/sdk/pkg/models/operations/createdestination.go +internal/sdk/pkg/models/operations/updatedestination.go +internal/sdk/pkg/models/operations/partialupdatedestination.go +internal/sdk/pkg/models/operations/listdestinationsforworkspace.go +internal/sdk/pkg/models/operations/getdestination.go +internal/sdk/pkg/models/operations/searchdestinations.go +internal/sdk/pkg/models/operations/checkconnectiontodestination.go +internal/sdk/pkg/models/operations/checkconnectiontodestinationforupdate.go +internal/sdk/pkg/models/operations/deletedestination.go +internal/sdk/pkg/models/operations/clonedestination.go +internal/sdk/pkg/models/operations/createconnection.go +internal/sdk/pkg/models/operations/updateconnection.go +internal/sdk/pkg/models/operations/listconnectionsforworkspace.go +internal/sdk/pkg/models/operations/listallconnectionsforworkspace.go +internal/sdk/pkg/models/operations/getconnection.go +internal/sdk/pkg/models/operations/listconnectionsbyactordefinition.go +internal/sdk/pkg/models/operations/searchconnections.go +internal/sdk/pkg/models/operations/deleteconnection.go +internal/sdk/pkg/models/operations/syncconnection.go +internal/sdk/pkg/models/operations/resetconnection.go +internal/sdk/pkg/models/operations/resetconnectionstream.go +internal/sdk/pkg/models/operations/getstate.go internal/sdk/pkg/models/operations/checkoperation.go internal/sdk/pkg/models/operations/createoperation.go -internal/sdk/pkg/models/operations/deleteoperation.go -internal/sdk/pkg/models/operations/getoperation.go -internal/sdk/pkg/models/operations/listoperationsforconnection.go internal/sdk/pkg/models/operations/updateoperation.go -internal/sdk/pkg/models/operations/executedestinationcheckconnection.go +internal/sdk/pkg/models/operations/listoperationsforconnection.go +internal/sdk/pkg/models/operations/getoperation.go +internal/sdk/pkg/models/operations/deleteoperation.go internal/sdk/pkg/models/operations/executesourcecheckconnection.go internal/sdk/pkg/models/operations/executesourcediscoverschema.go -internal/sdk/pkg/models/operations/applyschemachangeforsource.go -internal/sdk/pkg/models/operations/checkconnectiontosource.go -internal/sdk/pkg/models/operations/checkconnectiontosourceforupdate.go -internal/sdk/pkg/models/operations/clonesource.go -internal/sdk/pkg/models/operations/createsource.go -internal/sdk/pkg/models/operations/deletesource.go -internal/sdk/pkg/models/operations/discoverschemaforsource.go -internal/sdk/pkg/models/operations/getmostrecentsourceactorcatalog.go -internal/sdk/pkg/models/operations/getsource.go -internal/sdk/pkg/models/operations/listsourcesforworkspace.go -internal/sdk/pkg/models/operations/partialupdatesource.go -internal/sdk/pkg/models/operations/searchsources.go -internal/sdk/pkg/models/operations/updatesource.go -internal/sdk/pkg/models/operations/createcustomsourcedefinition.go -internal/sdk/pkg/models/operations/deletesourcedefinition.go -internal/sdk/pkg/models/operations/getsourcedefinition.go -internal/sdk/pkg/models/operations/getsourcedefinitionforworkspace.go -internal/sdk/pkg/models/operations/grantsourcedefinitiontoworkspace.go -internal/sdk/pkg/models/operations/listlatestsourcedefinitions.go -internal/sdk/pkg/models/operations/listprivatesourcedefinitions.go -internal/sdk/pkg/models/operations/listsourcedefinitions.go -internal/sdk/pkg/models/operations/listsourcedefinitionsforworkspace.go -internal/sdk/pkg/models/operations/revokesourcedefinitionfromworkspace.go -internal/sdk/pkg/models/operations/updatesourcedefinition.go -internal/sdk/pkg/models/operations/getsourcedefinitionspecification.go -internal/sdk/pkg/models/operations/getspecificationforsourceid.go -internal/sdk/pkg/models/operations/completesourceoauth.go +internal/sdk/pkg/models/operations/executedestinationcheckconnection.go +internal/sdk/pkg/models/operations/setinstancewidesourceoauthparams.go internal/sdk/pkg/models/operations/getsourceoauthconsent.go +internal/sdk/pkg/models/operations/completesourceoauth.go internal/sdk/pkg/models/operations/revokesourceoauthtokens.go -internal/sdk/pkg/models/operations/setinstancewidesourceoauthparams.go -internal/sdk/pkg/models/operations/getstate.go -internal/sdk/pkg/models/operations/createstreamstatus.go -internal/sdk/pkg/models/operations/getstreamstatuses.go -internal/sdk/pkg/models/operations/updatestreamstatus.go -internal/sdk/pkg/models/operations/getstatetype.go +internal/sdk/pkg/models/operations/getdestinationoauthconsent.go +internal/sdk/pkg/models/operations/completedestinationoauth.go +internal/sdk/pkg/models/operations/setinstancewidedestinationoauthparams.go internal/sdk/pkg/models/operations/webbackendcheckupdates.go -internal/sdk/pkg/models/operations/webbackendcreateconnection.go +internal/sdk/pkg/models/operations/webbackendlistconnectionsforworkspace.go internal/sdk/pkg/models/operations/webbackendgetconnection.go +internal/sdk/pkg/models/operations/webbackendcreateconnection.go +internal/sdk/pkg/models/operations/webbackendupdateconnection.go +internal/sdk/pkg/models/operations/getstatetype.go internal/sdk/pkg/models/operations/webbackendgetworkspacestate.go -internal/sdk/pkg/models/operations/webbackendlistconnectionsforworkspace.go internal/sdk/pkg/models/operations/webbackendlistgeographies.go -internal/sdk/pkg/models/operations/webbackendupdateconnection.go -internal/sdk/pkg/models/operations/createworkspace.go -internal/sdk/pkg/models/operations/deleteworkspace.go -internal/sdk/pkg/models/operations/getworkspace.go -internal/sdk/pkg/models/operations/getworkspacebyconnectionid.go -internal/sdk/pkg/models/operations/getworkspacebyslug.go -internal/sdk/pkg/models/operations/listworkspaces.go -internal/sdk/pkg/models/operations/updateworkspace.go -internal/sdk/pkg/models/operations/updateworkspacefeedback.go -internal/sdk/pkg/models/operations/updateworkspacename.go -internal/sdk/pkg/models/shared/internaloperationresult.go -internal/sdk/pkg/models/shared/savestatsrequestbody.go -internal/sdk/pkg/models/shared/attemptstreamstats.go -internal/sdk/pkg/models/shared/attemptstats.go -internal/sdk/pkg/models/shared/saveattemptsyncconfigrequestbody.go -internal/sdk/pkg/models/shared/attemptsyncconfig.go -internal/sdk/pkg/models/shared/connectionstate.go -internal/sdk/pkg/models/shared/streamstate.go -internal/sdk/pkg/models/shared/stateblob.go -internal/sdk/pkg/models/shared/streamdescriptor.go -internal/sdk/pkg/models/shared/connectionstatetype.go -internal/sdk/pkg/models/shared/globalstate.go -internal/sdk/pkg/models/shared/setworkflowinattemptrequestbody.go -internal/sdk/pkg/models/shared/invalidinputexceptioninfo.go -internal/sdk/pkg/models/shared/invalidinputproperty.go -internal/sdk/pkg/models/shared/connectionread.go -internal/sdk/pkg/models/shared/airbytecatalog.go -internal/sdk/pkg/models/shared/airbytestreamandconfiguration.go -internal/sdk/pkg/models/shared/airbytestream.go -internal/sdk/pkg/models/shared/syncmode.go -internal/sdk/pkg/models/shared/streamjsonschema.go -internal/sdk/pkg/models/shared/airbytestreamconfiguration.go -internal/sdk/pkg/models/shared/selectedfieldinfo.go -internal/sdk/pkg/models/shared/destinationsyncmode.go -internal/sdk/pkg/models/shared/connectionstatus.go -internal/sdk/pkg/models/shared/connectionscheduletype.go -internal/sdk/pkg/models/shared/connectionscheduledata.go -internal/sdk/pkg/models/shared/connectionschedule.go -internal/sdk/pkg/models/shared/resourcerequirements.go -internal/sdk/pkg/models/shared/nonbreakingchangespreference.go -internal/sdk/pkg/models/shared/namespacedefinitiontype.go +internal/sdk/pkg/models/operations/listjobsfor.go +internal/sdk/pkg/models/operations/getjobinfo.go +internal/sdk/pkg/models/operations/getlastreplicationjob.go +internal/sdk/pkg/models/operations/getjobinfowithoutlogs.go +internal/sdk/pkg/models/operations/getjobinfolight.go +internal/sdk/pkg/models/operations/canceljob.go +internal/sdk/pkg/models/operations/getjobdebuginfo.go +internal/sdk/pkg/models/operations/gethealthcheck.go +internal/sdk/pkg/models/operations/getlogs.go +internal/sdk/pkg/models/operations/getopenapispec.go +internal/sdk/pkg/models/operations/getstreamstatuses.go +internal/sdk/pkg/models/operations/createstreamstatus.go +internal/sdk/pkg/models/operations/updatestreamstatus.go +internal/sdk/pkg/models/shared/invalidinputexceptioninfo.go +internal/sdk/pkg/models/shared/invalidinputproperty.go +internal/sdk/pkg/models/shared/workspaceread.go +internal/sdk/pkg/models/shared/webhookconfigread.go internal/sdk/pkg/models/shared/geography.go -internal/sdk/pkg/models/shared/connectioncreate.go +internal/sdk/pkg/models/shared/notificationsettings.go +internal/sdk/pkg/models/shared/notificationitem.go +internal/sdk/pkg/models/shared/customerionotificationconfiguration.go +internal/sdk/pkg/models/shared/slacknotificationconfiguration.go +internal/sdk/pkg/models/shared/notificationtype.go +internal/sdk/pkg/models/shared/notification.go +internal/sdk/pkg/models/shared/workspacecreate.go +internal/sdk/pkg/models/shared/webhookconfigwrite.go internal/sdk/pkg/models/shared/notfoundknownexceptioninfo.go -internal/sdk/pkg/models/shared/connectionidrequestbody.go -internal/sdk/pkg/models/shared/connectionreadlist.go internal/sdk/pkg/models/shared/workspaceidrequestbody.go -internal/sdk/pkg/models/shared/actordefinitionrequestbody.go -internal/sdk/pkg/models/shared/actortype.go -internal/sdk/pkg/models/shared/jobinforead.go -internal/sdk/pkg/models/shared/jobread.go -internal/sdk/pkg/models/shared/jobstatus.go -internal/sdk/pkg/models/shared/resetconfig.go -internal/sdk/pkg/models/shared/jobconfigtype.go -internal/sdk/pkg/models/shared/attemptinforead.go -internal/sdk/pkg/models/shared/logread.go -internal/sdk/pkg/models/shared/attemptread.go -internal/sdk/pkg/models/shared/attemptstatus.go -internal/sdk/pkg/models/shared/attemptfailuresummary.go +internal/sdk/pkg/models/shared/workspacereadlist.go +internal/sdk/pkg/models/shared/slugrequestbody.go +internal/sdk/pkg/models/shared/connectionidrequestbody.go +internal/sdk/pkg/models/shared/workspaceupdate.go +internal/sdk/pkg/models/shared/workspaceupdatename.go +internal/sdk/pkg/models/shared/workspacegivefeedback.go +internal/sdk/pkg/models/shared/notificationread.go +internal/sdk/pkg/models/shared/sourcedefinitionread.go +internal/sdk/pkg/models/shared/actordefinitionresourcerequirements.go +internal/sdk/pkg/models/shared/jobtyperesourcelimit.go +internal/sdk/pkg/models/shared/resourcerequirements.go +internal/sdk/pkg/models/shared/jobtype.go +internal/sdk/pkg/models/shared/releasestage.go +internal/sdk/pkg/models/shared/sourcedefinitionupdate.go +internal/sdk/pkg/models/shared/sourcedefinitionreadlist.go +internal/sdk/pkg/models/shared/sourcedefinitionidrequestbody.go +internal/sdk/pkg/models/shared/privatesourcedefinitionreadlist.go +internal/sdk/pkg/models/shared/privatesourcedefinitionread.go +internal/sdk/pkg/models/shared/customsourcedefinitioncreate.go +internal/sdk/pkg/models/shared/sourcedefinitioncreate.go +internal/sdk/pkg/models/shared/sourcedefinitionidwithworkspaceid.go +internal/sdk/pkg/models/shared/sourcedefinitionspecificationread.go +internal/sdk/pkg/models/shared/synchronousjobread.go internal/sdk/pkg/models/shared/failurereason.go internal/sdk/pkg/models/shared/failuretype.go internal/sdk/pkg/models/shared/failureorigin.go -internal/sdk/pkg/models/shared/connectionstreamrequestbody.go -internal/sdk/pkg/models/shared/connectionstream.go -internal/sdk/pkg/models/shared/connectionsearch.go -internal/sdk/pkg/models/shared/sourcesearch.go -internal/sdk/pkg/models/shared/destinationsearch.go -internal/sdk/pkg/models/shared/connectionupdate.go +internal/sdk/pkg/models/shared/logread.go +internal/sdk/pkg/models/shared/jobconfigtype.go +internal/sdk/pkg/models/shared/advancedauth.go +internal/sdk/pkg/models/shared/oauthconfigspecification.go +internal/sdk/pkg/models/shared/sourcedefinitionspecification.go +internal/sdk/pkg/models/shared/sourceidrequestbody.go +internal/sdk/pkg/models/shared/declarativesourcedefinitioncreatemanifestrequestbody.go +internal/sdk/pkg/models/shared/declarativesourcemanifest.go +internal/sdk/pkg/models/shared/declarativemanifest.go +internal/sdk/pkg/models/shared/updateactivemanifestrequestbody.go +internal/sdk/pkg/models/shared/declarativemanifestsreadlist.go +internal/sdk/pkg/models/shared/declarativemanifestversionread.go +internal/sdk/pkg/models/shared/listdeclarativemanifestsrequestbody.go internal/sdk/pkg/models/shared/connectorbuilderprojectidwithworkspaceid.go internal/sdk/pkg/models/shared/connectorbuilderprojectwithworkspaceid.go internal/sdk/pkg/models/shared/connectorbuilderprojectdetails.go -internal/sdk/pkg/models/shared/declarativemanifest.go -internal/sdk/pkg/models/shared/connectorbuilderprojectread.go -internal/sdk/pkg/models/shared/declarativemanifestread.go -internal/sdk/pkg/models/shared/connectorbuilderprojectdetailsread.go -internal/sdk/pkg/models/shared/connectorbuilderprojectreadlist.go internal/sdk/pkg/models/shared/sourcedefinitionidbody.go internal/sdk/pkg/models/shared/connectorbuilderpublishrequestbody.go -internal/sdk/pkg/models/shared/declarativesourcemanifest.go -internal/sdk/pkg/models/shared/sourcedefinitionspecification.go internal/sdk/pkg/models/shared/existingconnectorbuilderprojectwithworkspaceid.go -internal/sdk/pkg/models/shared/declarativesourcedefinitioncreatemanifestrequestbody.go -internal/sdk/pkg/models/shared/declarativemanifestsreadlist.go -internal/sdk/pkg/models/shared/declarativemanifestversionread.go -internal/sdk/pkg/models/shared/listdeclarativemanifestsrequestbody.go -internal/sdk/pkg/models/shared/updateactivemanifestrequestbody.go +internal/sdk/pkg/models/shared/connectorbuilderprojectreadlist.go +internal/sdk/pkg/models/shared/connectorbuilderprojectdetailsread.go +internal/sdk/pkg/models/shared/connectorbuilderprojectread.go +internal/sdk/pkg/models/shared/declarativemanifestread.go +internal/sdk/pkg/models/shared/sourceread.go +internal/sdk/pkg/models/shared/sourcecreate.go +internal/sdk/pkg/models/shared/sourceupdate.go +internal/sdk/pkg/models/shared/partialsourceupdate.go +internal/sdk/pkg/models/shared/sourcereadlist.go +internal/sdk/pkg/models/shared/actorcatalogwithupdatedat.go +internal/sdk/pkg/models/shared/sourcesearch.go +internal/sdk/pkg/models/shared/sourceclonerequestbody.go +internal/sdk/pkg/models/shared/sourcecloneconfiguration.go internal/sdk/pkg/models/shared/checkconnectionread.go -internal/sdk/pkg/models/shared/synchronousjobread.go -internal/sdk/pkg/models/shared/destinationidrequestbody.go -internal/sdk/pkg/models/shared/destinationupdate.go -internal/sdk/pkg/models/shared/destinationread.go -internal/sdk/pkg/models/shared/destinationclonerequestbody.go -internal/sdk/pkg/models/shared/destinationcloneconfiguration.go -internal/sdk/pkg/models/shared/destinationcreate.go -internal/sdk/pkg/models/shared/destinationreadlist.go -internal/sdk/pkg/models/shared/partialdestinationupdate.go +internal/sdk/pkg/models/shared/sourcediscoverschemaread.go +internal/sdk/pkg/models/shared/connectionstatus.go +internal/sdk/pkg/models/shared/catalogdiff.go +internal/sdk/pkg/models/shared/streamtransform.go +internal/sdk/pkg/models/shared/fieldtransform.go +internal/sdk/pkg/models/shared/fieldschemaupdate.go +internal/sdk/pkg/models/shared/fieldschema.go +internal/sdk/pkg/models/shared/fieldremove.go +internal/sdk/pkg/models/shared/fieldadd.go +internal/sdk/pkg/models/shared/streamdescriptor.go +internal/sdk/pkg/models/shared/airbytecatalog.go +internal/sdk/pkg/models/shared/airbytestreamandconfiguration.go +internal/sdk/pkg/models/shared/airbytestreamconfiguration.go +internal/sdk/pkg/models/shared/selectedfieldinfo.go +internal/sdk/pkg/models/shared/destinationsyncmode.go +internal/sdk/pkg/models/shared/syncmode.go +internal/sdk/pkg/models/shared/airbytestream.go +internal/sdk/pkg/models/shared/streamjsonschema.go +internal/sdk/pkg/models/shared/sourcediscoverschemarequestbody.go +internal/sdk/pkg/models/shared/sourceautopropagatechange.go +internal/sdk/pkg/models/shared/discovercatalogresult.go +internal/sdk/pkg/models/shared/sourcediscoverschemawriterequestbody.go +internal/sdk/pkg/models/shared/connectionstate.go +internal/sdk/pkg/models/shared/globalstate.go +internal/sdk/pkg/models/shared/streamstate.go +internal/sdk/pkg/models/shared/stateblob.go +internal/sdk/pkg/models/shared/connectionstatetype.go +internal/sdk/pkg/models/shared/connectionstatecreateorupdate.go +internal/sdk/pkg/models/shared/attemptnormalizationstatusreadlist.go +internal/sdk/pkg/models/shared/attemptnormalizationstatusread.go +internal/sdk/pkg/models/shared/jobidrequestbody.go +internal/sdk/pkg/models/shared/internaloperationresult.go +internal/sdk/pkg/models/shared/setworkflowinattemptrequestbody.go +internal/sdk/pkg/models/shared/savestatsrequestbody.go +internal/sdk/pkg/models/shared/attemptstreamstats.go +internal/sdk/pkg/models/shared/attemptstats.go +internal/sdk/pkg/models/shared/saveattemptsyncconfigrequestbody.go +internal/sdk/pkg/models/shared/attemptsyncconfig.go internal/sdk/pkg/models/shared/destinationdefinitionread.go -internal/sdk/pkg/models/shared/actordefinitionresourcerequirements.go -internal/sdk/pkg/models/shared/jobtyperesourcelimit.go -internal/sdk/pkg/models/shared/jobtype.go -internal/sdk/pkg/models/shared/releasestage.go internal/sdk/pkg/models/shared/normalizationdestinationdefinitionconfig.go +internal/sdk/pkg/models/shared/destinationdefinitionupdate.go +internal/sdk/pkg/models/shared/destinationdefinitionreadlist.go +internal/sdk/pkg/models/shared/destinationdefinitionidrequestbody.go +internal/sdk/pkg/models/shared/privatedestinationdefinitionreadlist.go +internal/sdk/pkg/models/shared/privatedestinationdefinitionread.go internal/sdk/pkg/models/shared/customdestinationdefinitioncreate.go internal/sdk/pkg/models/shared/destinationdefinitioncreate.go -internal/sdk/pkg/models/shared/destinationdefinitionidrequestbody.go internal/sdk/pkg/models/shared/destinationdefinitionidwithworkspaceid.go -internal/sdk/pkg/models/shared/privatedestinationdefinitionread.go -internal/sdk/pkg/models/shared/destinationdefinitionreadlist.go -internal/sdk/pkg/models/shared/privatedestinationdefinitionreadlist.go -internal/sdk/pkg/models/shared/destinationdefinitionupdate.go internal/sdk/pkg/models/shared/destinationdefinitionspecificationread.go internal/sdk/pkg/models/shared/destinationdefinitionspecification.go -internal/sdk/pkg/models/shared/advancedauth.go -internal/sdk/pkg/models/shared/oauthconfigspecification.go -internal/sdk/pkg/models/shared/completeoauthresponse.go -internal/sdk/pkg/models/shared/completedestinationoauthrequest.go -internal/sdk/pkg/models/shared/oauthconsentread.go -internal/sdk/pkg/models/shared/destinationoauthconsentrequest.go -internal/sdk/pkg/models/shared/knownexceptioninfo.go -internal/sdk/pkg/models/shared/setinstancewidedestinationoauthparamsrequestbody.go -internal/sdk/pkg/models/shared/healthcheckread.go -internal/sdk/pkg/models/shared/connectionstatecreateorupdate.go -internal/sdk/pkg/models/shared/attemptnormalizationstatusreadlist.go -internal/sdk/pkg/models/shared/attemptnormalizationstatusread.go -internal/sdk/pkg/models/shared/jobidrequestbody.go -internal/sdk/pkg/models/shared/discovercatalogresult.go -internal/sdk/pkg/models/shared/sourcediscoverschemawriterequestbody.go -internal/sdk/pkg/models/shared/jobdebuginforead.go -internal/sdk/pkg/models/shared/workflowstateread.go -internal/sdk/pkg/models/shared/jobdebugread.go -internal/sdk/pkg/models/shared/sourcedefinitionread.go -internal/sdk/pkg/models/shared/jobinfolightread.go -internal/sdk/pkg/models/shared/joboptionalread.go -internal/sdk/pkg/models/shared/jobreadlist.go -internal/sdk/pkg/models/shared/jobwithattemptsread.go -internal/sdk/pkg/models/shared/joblistrequestbody.go -internal/sdk/pkg/models/shared/pagination.go -internal/sdk/pkg/models/shared/logsrequestbody.go -internal/sdk/pkg/models/shared/logtype.go -internal/sdk/pkg/models/shared/notificationread.go -internal/sdk/pkg/models/shared/notification.go -internal/sdk/pkg/models/shared/slacknotificationconfiguration.go -internal/sdk/pkg/models/shared/notificationtype.go -internal/sdk/pkg/models/shared/customerionotificationconfiguration.go +internal/sdk/pkg/models/shared/destinationidrequestbody.go +internal/sdk/pkg/models/shared/destinationread.go +internal/sdk/pkg/models/shared/destinationcreate.go +internal/sdk/pkg/models/shared/destinationupdate.go +internal/sdk/pkg/models/shared/partialdestinationupdate.go +internal/sdk/pkg/models/shared/destinationreadlist.go +internal/sdk/pkg/models/shared/destinationsearch.go +internal/sdk/pkg/models/shared/destinationclonerequestbody.go +internal/sdk/pkg/models/shared/destinationcloneconfiguration.go +internal/sdk/pkg/models/shared/connectionread.go +internal/sdk/pkg/models/shared/nonbreakingchangespreference.go +internal/sdk/pkg/models/shared/connectionscheduledata.go +internal/sdk/pkg/models/shared/connectionscheduletype.go +internal/sdk/pkg/models/shared/connectionschedule.go +internal/sdk/pkg/models/shared/namespacedefinitiontype.go +internal/sdk/pkg/models/shared/connectioncreate.go +internal/sdk/pkg/models/shared/connectionupdate.go +internal/sdk/pkg/models/shared/connectionreadlist.go +internal/sdk/pkg/models/shared/actordefinitionrequestbody.go +internal/sdk/pkg/models/shared/actortype.go +internal/sdk/pkg/models/shared/connectionsearch.go +internal/sdk/pkg/models/shared/jobinforead.go +internal/sdk/pkg/models/shared/attemptinforead.go +internal/sdk/pkg/models/shared/attemptread.go +internal/sdk/pkg/models/shared/attemptfailuresummary.go +internal/sdk/pkg/models/shared/attemptstatus.go +internal/sdk/pkg/models/shared/jobread.go +internal/sdk/pkg/models/shared/resetconfig.go +internal/sdk/pkg/models/shared/jobstatus.go +internal/sdk/pkg/models/shared/connectionstreamrequestbody.go +internal/sdk/pkg/models/shared/connectionstream.go internal/sdk/pkg/models/shared/checkoperationread.go internal/sdk/pkg/models/shared/operatorconfiguration.go internal/sdk/pkg/models/shared/operatorwebhook.go -internal/sdk/pkg/models/shared/operatortype.go -internal/sdk/pkg/models/shared/operatornormalization.go internal/sdk/pkg/models/shared/operatordbt.go +internal/sdk/pkg/models/shared/operatornormalization.go +internal/sdk/pkg/models/shared/operatortype.go internal/sdk/pkg/models/shared/operationread.go internal/sdk/pkg/models/shared/operationcreate.go -internal/sdk/pkg/models/shared/operationidrequestbody.go -internal/sdk/pkg/models/shared/operationreadlist.go internal/sdk/pkg/models/shared/operationupdate.go -internal/sdk/pkg/models/shared/destinationcoreconfig.go +internal/sdk/pkg/models/shared/operationreadlist.go +internal/sdk/pkg/models/shared/operationidrequestbody.go internal/sdk/pkg/models/shared/sourcecoreconfig.go -internal/sdk/pkg/models/shared/sourcediscoverschemaread.go -internal/sdk/pkg/models/shared/catalogdiff.go -internal/sdk/pkg/models/shared/streamtransform.go -internal/sdk/pkg/models/shared/fieldtransform.go -internal/sdk/pkg/models/shared/fieldschemaupdate.go -internal/sdk/pkg/models/shared/fieldschema.go -internal/sdk/pkg/models/shared/fieldremove.go -internal/sdk/pkg/models/shared/fieldadd.go -internal/sdk/pkg/models/shared/sourceautopropagatechange.go -internal/sdk/pkg/models/shared/sourceidrequestbody.go -internal/sdk/pkg/models/shared/sourceupdate.go -internal/sdk/pkg/models/shared/sourceread.go -internal/sdk/pkg/models/shared/sourceclonerequestbody.go -internal/sdk/pkg/models/shared/sourcecloneconfiguration.go -internal/sdk/pkg/models/shared/sourcecreate.go -internal/sdk/pkg/models/shared/sourcediscoverschemarequestbody.go -internal/sdk/pkg/models/shared/actorcatalogwithupdatedat.go -internal/sdk/pkg/models/shared/sourcereadlist.go -internal/sdk/pkg/models/shared/partialsourceupdate.go -internal/sdk/pkg/models/shared/customsourcedefinitioncreate.go -internal/sdk/pkg/models/shared/sourcedefinitioncreate.go -internal/sdk/pkg/models/shared/sourcedefinitionidrequestbody.go -internal/sdk/pkg/models/shared/sourcedefinitionidwithworkspaceid.go -internal/sdk/pkg/models/shared/privatesourcedefinitionread.go -internal/sdk/pkg/models/shared/sourcedefinitionreadlist.go -internal/sdk/pkg/models/shared/privatesourcedefinitionreadlist.go -internal/sdk/pkg/models/shared/sourcedefinitionupdate.go -internal/sdk/pkg/models/shared/sourcedefinitionspecificationread.go -internal/sdk/pkg/models/shared/completesourceoauthrequest.go +internal/sdk/pkg/models/shared/destinationcoreconfig.go +internal/sdk/pkg/models/shared/knownexceptioninfo.go +internal/sdk/pkg/models/shared/setinstancewidesourceoauthparamsrequestbody.go +internal/sdk/pkg/models/shared/oauthconsentread.go internal/sdk/pkg/models/shared/sourceoauthconsentrequest.go +internal/sdk/pkg/models/shared/completeoauthresponse.go +internal/sdk/pkg/models/shared/completesourceoauthrequest.go internal/sdk/pkg/models/shared/revokesourceoauthtokensrequest.go -internal/sdk/pkg/models/shared/setinstancewidesourceoauthparamsrequestbody.go -internal/sdk/pkg/models/shared/streamstatusread.go -internal/sdk/pkg/models/shared/streamstatusrunstate.go -internal/sdk/pkg/models/shared/streamstatusjobtype.go -internal/sdk/pkg/models/shared/streamstatusincompleteruncause.go -internal/sdk/pkg/models/shared/streamstatuscreaterequestbody.go -internal/sdk/pkg/models/shared/streamstatusreadlist.go -internal/sdk/pkg/models/shared/streamstatuslistrequestbody.go -internal/sdk/pkg/models/shared/streamstatusupdaterequestbody.go +internal/sdk/pkg/models/shared/destinationoauthconsentrequest.go +internal/sdk/pkg/models/shared/completedestinationoauthrequest.go +internal/sdk/pkg/models/shared/setinstancewidedestinationoauthparamsrequestbody.go internal/sdk/pkg/models/shared/webbackendcheckupdatesread.go -internal/sdk/pkg/models/shared/webbackendconnectionread.go -internal/sdk/pkg/models/shared/schemachange.go -internal/sdk/pkg/models/shared/webbackendconnectioncreate.go -internal/sdk/pkg/models/shared/webbackendconnectionrequestbody.go -internal/sdk/pkg/models/shared/webbackendworkspacestateresult.go -internal/sdk/pkg/models/shared/webbackendworkspacestate.go internal/sdk/pkg/models/shared/webbackendconnectionreadlist.go internal/sdk/pkg/models/shared/webbackendconnectionlistitem.go -internal/sdk/pkg/models/shared/sourcesnippetread.go +internal/sdk/pkg/models/shared/schemachange.go internal/sdk/pkg/models/shared/destinationsnippetread.go +internal/sdk/pkg/models/shared/sourcesnippetread.go internal/sdk/pkg/models/shared/webbackendconnectionlistrequestbody.go -internal/sdk/pkg/models/shared/webbackendgeographieslistresult.go +internal/sdk/pkg/models/shared/webbackendconnectionread.go +internal/sdk/pkg/models/shared/webbackendconnectionrequestbody.go +internal/sdk/pkg/models/shared/webbackendconnectioncreate.go internal/sdk/pkg/models/shared/webbackendconnectionupdate.go internal/sdk/pkg/models/shared/webbackendoperationcreateorupdate.go -internal/sdk/pkg/models/shared/workspaceread.go -internal/sdk/pkg/models/shared/webhookconfigread.go -internal/sdk/pkg/models/shared/notificationsettings.go -internal/sdk/pkg/models/shared/notificationitem.go -internal/sdk/pkg/models/shared/workspacecreate.go -internal/sdk/pkg/models/shared/webhookconfigwrite.go -internal/sdk/pkg/models/shared/slugrequestbody.go -internal/sdk/pkg/models/shared/workspacereadlist.go -internal/sdk/pkg/models/shared/workspaceupdate.go -internal/sdk/pkg/models/shared/workspacegivefeedback.go -internal/sdk/pkg/models/shared/workspaceupdatename.go +internal/sdk/pkg/models/shared/webbackendworkspacestateresult.go +internal/sdk/pkg/models/shared/webbackendworkspacestate.go +internal/sdk/pkg/models/shared/webbackendgeographieslistresult.go +internal/sdk/pkg/models/shared/jobreadlist.go +internal/sdk/pkg/models/shared/jobwithattemptsread.go +internal/sdk/pkg/models/shared/joblistrequestbody.go +internal/sdk/pkg/models/shared/pagination.go +internal/sdk/pkg/models/shared/joboptionalread.go +internal/sdk/pkg/models/shared/jobinfolightread.go +internal/sdk/pkg/models/shared/jobdebuginforead.go +internal/sdk/pkg/models/shared/workflowstateread.go +internal/sdk/pkg/models/shared/jobdebugread.go +internal/sdk/pkg/models/shared/healthcheckread.go +internal/sdk/pkg/models/shared/logsrequestbody.go +internal/sdk/pkg/models/shared/logtype.go +internal/sdk/pkg/models/shared/streamstatusreadlist.go +internal/sdk/pkg/models/shared/streamstatusread.go +internal/sdk/pkg/models/shared/streamstatusrunstate.go +internal/sdk/pkg/models/shared/streamstatusjobtype.go +internal/sdk/pkg/models/shared/streamstatusincompleteruncause.go +internal/sdk/pkg/models/shared/streamstatuslistrequestbody.go +internal/sdk/pkg/models/shared/streamstatuscreaterequestbody.go +internal/sdk/pkg/models/shared/streamstatusupdaterequestbody.go internal/sdk/pkg/models/shared/security.go +internal/provider/type_resource_requirements.go +internal/provider/type_connection_schedule.go +internal/provider/type_cron.go +internal/provider/type_connection_schedule_data.go +internal/provider/type_selected_field_info.go +internal/provider/type_airbyte_stream_configuration.go +internal/provider/type_stream_json_schema.go +internal/provider/type_airbyte_stream.go +internal/provider/type_airbyte_stream_and_configuration.go +internal/provider/type_airbyte_catalog.go +internal/provider/type_job_type_resource_limit.go +internal/provider/type_actor_definition_resource_requirements.go +internal/provider/type_source_definition_create.go +internal/provider/type_declarative_source_manifest.go +internal/provider/type_slack_notification_configuration.go +internal/provider/type_notification.go +internal/provider/type_notification_item.go +internal/provider/type_notification_settings.go +internal/provider/type_webhook_config_read.go USAGE.md internal/provider/provider.go examples/provider/provider.tf @@ -448,4 +448,6 @@ internal/provider/sourcedefinitionmanifest_resource_sdk.go examples/resources/airbyte_source_definition_manifest/resource.tf internal/provider/workspace_resource.go internal/provider/workspace_resource_sdk.go -examples/resources/airbyte_workspace/resource.tf \ No newline at end of file +examples/resources/airbyte_workspace/resource.tf +internal/sdk/pkg/models/operations/options.go +.gitattributes \ No newline at end of file diff --git a/gen.yaml b/gen.yaml old mode 100644 new mode 100755 index 85595bc..87fdd29 --- a/gen.yaml +++ b/gen.yaml @@ -1,18 +1,28 @@ -configVersion: 1.0.1 -management: - docChecksum: f9e4916f5224f36a702df791dcda1286 - docVersion: 1.0.0 - speakeasyVersion: 1.65.2 - generationVersion: 2.75.1 +configVersion: 1.0.0 generation: - comments: - disableComments: false - omitDescriptionIfSummaryPresent: false - baseServerURL: "" - sdkClassName: airbyte - singleTagPerOp: false - tagNamespacingDisabled: false + comments: {} + sdkClassName: SDK + maintainOpenAPIOrder: true + usageSnippets: + optionalPropertyRendering: withExample +features: + terraform: + constsAndDefaults: 0.1.1 + core: 3.4.5 + deprecations: 2.81.1 + globalSecurity: 2.81.1 + globalServerURLs: 2.82.0 terraform: - version: 1.0.4 + version: 1.0.5 author: aballiet + imports: + option: openapi + paths: + callbacks: callbacks + errors: sdkerrors + operations: operations + shared: shared + webhooks: webhooks + inputModelSuffix: input + outputModelSuffix: output packageName: airbyte diff --git a/gen.yaml.bak b/gen.yaml.bak new file mode 100644 index 0000000..85595bc --- /dev/null +++ b/gen.yaml.bak @@ -0,0 +1,18 @@ +configVersion: 1.0.1 +management: + docChecksum: f9e4916f5224f36a702df791dcda1286 + docVersion: 1.0.0 + speakeasyVersion: 1.65.2 + generationVersion: 2.75.1 +generation: + comments: + disableComments: false + omitDescriptionIfSummaryPresent: false + baseServerURL: "" + sdkClassName: airbyte + singleTagPerOp: false + tagNamespacingDisabled: false +terraform: + version: 1.0.4 + author: aballiet + packageName: airbyte diff --git a/go.mod b/go.mod old mode 100755 new mode 100644 index 68553b0..d7332cd --- a/go.mod +++ b/go.mod @@ -1,63 +1,66 @@ -module airbyte +module github.com/aballiet/terraform-provider-airbyte go 1.18 require ( - github.com/cenkalti/backoff/v4 v4.2.0 - github.com/hashicorp/terraform-plugin-framework v1.3.0 - github.com/hashicorp/terraform-plugin-go v0.15.0 + github.com/cenkalti/backoff/v4 v4.2.0 + github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 + github.com/hashicorp/terraform-plugin-framework v1.3.5 + github.com/hashicorp/terraform-plugin-go v0.18.0 + github.com/spyzhov/ajson v0.9.0 ) require ( - github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.1.1 // indirect - github.com/Masterminds/sprig/v3 v3.2.2 // indirect - github.com/armon/go-radix v1.0.0 // indirect - github.com/bgentry/speakeasy v0.1.0 // indirect - github.com/fatih/color v1.13.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-checkpoint v0.5.0 // indirect - github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-hclog v1.5.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.4.9 // indirect - github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/hc-install v0.4.0 // indirect - github.com/hashicorp/terraform-exec v0.17.2 // indirect - github.com/hashicorp/terraform-json v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.0 // indirect - github.com/hashicorp/terraform-svchost v0.0.1 // indirect - github.com/huandu/xstrings v1.3.2 // indirect - github.com/imdario/mergo v0.3.13 // indirect - github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect - github.com/mitchellh/cli v1.1.4 // 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/oklog/run v1.0.0 // indirect - github.com/posener/complete v1.2.3 // indirect - github.com/russross/blackfriday v1.6.0 // indirect - github.com/shopspring/decimal v1.3.1 // indirect - github.com/spf13/cast v1.5.0 // indirect - github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect - github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - github.com/zclconf/go-cty v1.12.1 // indirect - golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect - google.golang.org/grpc v1.54.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver/v3 v3.1.1 // indirect + github.com/Masterminds/sprig/v3 v3.2.2 // indirect + github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/armon/go-radix v1.0.0 // indirect + github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/fatih/color v1.13.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-checkpoint v0.5.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-plugin v1.4.10 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/hc-install v0.4.0 // indirect + github.com/hashicorp/terraform-exec v0.17.2 // indirect + github.com/hashicorp/terraform-json v0.14.0 // indirect + github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect + github.com/hashicorp/terraform-registry-address v0.2.1 // indirect + github.com/hashicorp/terraform-svchost v0.1.1 // indirect + github.com/huandu/xstrings v1.3.2 // indirect + github.com/imdario/mergo v0.3.13 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mitchellh/cli v1.1.4 // 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/oklog/run v1.0.0 // indirect + github.com/posener/complete v1.2.3 // indirect + github.com/russross/blackfriday v1.6.0 // indirect + github.com/shopspring/decimal v1.3.1 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/zclconf/go-cty v1.13.1 // indirect + golang.org/x/crypto v0.10.0 // indirect + golang.org/x/net v0.11.0 // indirect + golang.org/x/sys v0.9.0 // indirect + golang.org/x/text v0.10.0 // indirect + google.golang.org/grpc v1.56.1 // indirect + google.golang.org/protobuf v1.31.0 // indirect ) require ( - github.com/hashicorp/terraform-plugin-docs v0.13.0 - github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 - github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + github.com/hashicorp/terraform-plugin-docs v0.13.0 + github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 + github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect ) diff --git a/go.sum b/go.sum old mode 100755 new mode 100644 index d555d87..853448b --- a/go.sum +++ b/go.sum @@ -15,6 +15,7 @@ github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= @@ -30,6 +31,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuLLZsyM5ybUzgc/mPjIYk2AZqufieooe98uw= +github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= @@ -48,8 +51,8 @@ github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -72,8 +75,8 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-plugin v1.4.9 h1:ESiK220/qE0aGxWdzKIvRH69iLiuN/PjoLTm69RoWtU= -github.com/hashicorp/go-plugin v1.4.9/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= +github.com/hashicorp/go-plugin v1.4.10 h1:xUbmA4jC6Dq163/fWcp8P3JuHilrHHMLNRxzGQJ9hNk= +github.com/hashicorp/go-plugin v1.4.10/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -88,18 +91,18 @@ github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY= github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ= -github.com/hashicorp/terraform-plugin-framework v1.3.0 h1:WtP1CIaWAfbzME17xoUXvJcyh5Ewu9attdhbfWNnYLs= -github.com/hashicorp/terraform-plugin-framework v1.3.0/go.mod h1:A1WD3Ry7FhrThViUTbkx4ZDsMq9oaAv4U9oTI8bBzCU= +github.com/hashicorp/terraform-plugin-framework v1.3.5 h1:FJ6s3CVWVAxlhiF/jhy6hzs4AnPHiflsp9KgzTGl1wo= +github.com/hashicorp/terraform-plugin-framework v1.3.5/go.mod h1:2gGDpWiTI0irr9NSTLFAKlTi6KwGti3AoU19rFqU30o= github.com/hashicorp/terraform-plugin-framework-validators v0.10.0 h1:4L0tmy/8esP6OcvocVymw52lY0HyQ5OxB7VNl7k4bS0= github.com/hashicorp/terraform-plugin-framework-validators v0.10.0/go.mod h1:qdQJCdimB9JeX2YwOpItEu+IrfoJjWQ5PhLpAOMDQAE= -github.com/hashicorp/terraform-plugin-go v0.15.0 h1:1BJNSUFs09DS8h/XNyJNJaeusQuWc/T9V99ylU9Zwp0= -github.com/hashicorp/terraform-plugin-go v0.15.0/go.mod h1:tk9E3/Zx4RlF/9FdGAhwxHExqIHHldqiQGt20G6g+nQ= +github.com/hashicorp/terraform-plugin-go v0.18.0 h1:IwTkOS9cOW1ehLd/rG0y+u/TGLK9y6fGoBjXVUquzpE= +github.com/hashicorp/terraform-plugin-go v0.18.0/go.mod h1:l7VK+2u5Kf2y+A+742GX0ouLut3gttudmvMgN0PA74Y= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-registry-address v0.2.0 h1:92LUg03NhfgZv44zpNTLBGIbiyTokQCDcdH5BhVHT3s= -github.com/hashicorp/terraform-registry-address v0.2.0/go.mod h1:478wuzJPzdmqT6OGbB/iH82EDcI8VFM4yujknh/1nIs= -github.com/hashicorp/terraform-svchost v0.0.1 h1:Zj6fR5wnpOHnJUmLyWozjMeDaVuE+cstMPj41/eKmSQ= -github.com/hashicorp/terraform-svchost v0.0.1/go.mod h1:ut8JaH0vumgdCfJaihdcZULqkAwHdQNwNH7taIDdsZM= +github.com/hashicorp/terraform-registry-address v0.2.1 h1:QuTf6oJ1+WSflJw6WYOHhLgwUiQ0FrROpHPYFtwTYWM= +github.com/hashicorp/terraform-registry-address v0.2.1/go.mod h1:BSE9fIFzp0qWsJUUyGquo4ldV9k2n+psif6NYkBRS3Y= +github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= +github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -168,6 +171,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spyzhov/ajson v0.9.0 h1:tF46gJGOenYVj+k9K1U1XpCxVWhmiyY5PsVCAs1+OJ0= +github.com/spyzhov/ajson v0.9.0/go.mod h1:a6oSw0MMb7Z5aD2tPoPO+jq11ETKgXUr2XktHdT8Wt8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -189,8 +194,8 @@ github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.12.1 h1:PcupnljUm9EIvbgSHQnHhUr3fO6oFmkOrvs2BAFNXXY= -github.com/zclconf/go-cty v1.12.1/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= +github.com/zclconf/go-cty v1.13.1 h1:0a6bRwuiSHtAmqCqNOE+c2oHgepv0ctoxU4FUe43kwc= +github.com/zclconf/go-cty v1.13.1/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -199,16 +204,16 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/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-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -226,27 +231,27 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/planmodifiers/boolplanmodifier/suppress_diff.go b/internal/planmodifiers/boolplanmodifier/suppress_diff.go old mode 100755 new mode 100644 index 71fce27..9999e49 --- a/internal/planmodifiers/boolplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/boolplanmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package boolplanmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/float64planmodifier/suppress_diff.go b/internal/planmodifiers/float64planmodifier/suppress_diff.go old mode 100755 new mode 100644 index 090269a..f45f281 --- a/internal/planmodifiers/float64planmodifier/suppress_diff.go +++ b/internal/planmodifiers/float64planmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package float64planmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/int64planmodifier/suppress_diff.go b/internal/planmodifiers/int64planmodifier/suppress_diff.go old mode 100755 new mode 100644 index c65c048..dbb1dd4 --- a/internal/planmodifiers/int64planmodifier/suppress_diff.go +++ b/internal/planmodifiers/int64planmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package int64planmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/listplanmodifier/suppress_diff.go b/internal/planmodifiers/listplanmodifier/suppress_diff.go old mode 100755 new mode 100644 index a986c9a..48d72d4 --- a/internal/planmodifiers/listplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/listplanmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package listplanmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/mapplanmodifier/suppress_diff.go b/internal/planmodifiers/mapplanmodifier/suppress_diff.go old mode 100755 new mode 100644 index cb16380..fa51fa5 --- a/internal/planmodifiers/mapplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/mapplanmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package mapplanmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/numberplanmodifier/suppress_diff.go b/internal/planmodifiers/numberplanmodifier/suppress_diff.go old mode 100755 new mode 100644 index 319b8b9..a6823de --- a/internal/planmodifiers/numberplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/numberplanmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package numberplanmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/objectplanmodifier/suppress_diff.go b/internal/planmodifiers/objectplanmodifier/suppress_diff.go old mode 100755 new mode 100644 index 0b2b47f..12e575a --- a/internal/planmodifiers/objectplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/objectplanmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package objectplanmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/setplanmodifier/suppress_diff.go b/internal/planmodifiers/setplanmodifier/suppress_diff.go old mode 100755 new mode 100644 index 46c512a..24c9866 --- a/internal/planmodifiers/setplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/setplanmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package setplanmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/stringplanmodifier/suppress_diff.go b/internal/planmodifiers/stringplanmodifier/suppress_diff.go old mode 100755 new mode 100644 index 81f0cbd..a2caa32 --- a/internal/planmodifiers/stringplanmodifier/suppress_diff.go +++ b/internal/planmodifiers/stringplanmodifier/suppress_diff.go @@ -3,8 +3,8 @@ package stringplanmodifier import ( - "airbyte/internal/planmodifiers/utils" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/planmodifiers/utils" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" ) diff --git a/internal/planmodifiers/utils/state_check.go b/internal/planmodifiers/utils/state_check.go old mode 100755 new mode 100644 diff --git a/internal/provider/connection_resource.go b/internal/provider/connection_resource.go old mode 100755 new mode 100644 index ff4f2cd..5de3081 --- a/internal/provider/connection_resource.go +++ b/internal/provider/connection_resource.go @@ -3,9 +3,9 @@ package provider import ( - "airbyte/internal/sdk" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -27,7 +27,7 @@ func NewConnectionResource() resource.Resource { // ConnectionResource defines the resource implementation. type ConnectionResource struct { - client *sdk.Airbyte + client *sdk.SDK } // ConnectionResourceModel describes the resource data model. @@ -77,8 +77,9 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ Required: true, }, "geography": schema.StringAttribute{ - Computed: true, - Optional: true, + Computed: true, + Optional: true, + Description: `must be one of ["auto", "us", "eu"]`, Validators: []validator.String{ stringvalidator.OneOf( "auto", @@ -86,7 +87,6 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "eu", ), }, - Description: `must be one of [auto, us, eu]`, }, "name": schema.StringAttribute{ Computed: true, @@ -96,6 +96,8 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "namespace_definition": schema.StringAttribute{ Computed: true, Optional: true, + MarkdownDescription: `must be one of ["source", "destination", "customformat"]` + "\n" + + `Method used for computing final namespace in destination`, Validators: []validator.String{ stringvalidator.OneOf( "source", @@ -103,17 +105,17 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "customformat", ), }, - MarkdownDescription: `must be one of [source, destination, customformat]` + "\n" + - `Method used for computing final namespace in destination`, }, "namespace_format": schema.StringAttribute{ - Computed: true, - Optional: true, - Description: `Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'.`, - }, - "non_breaking_changes_preference": schema.StringAttribute{ Computed: true, Optional: true, + MarkdownDescription: `Default: null` + "\n" + + `Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'.`, + }, + "non_breaking_changes_preference": schema.StringAttribute{ + Computed: true, + Optional: true, + Description: `must be one of ["ignore", "disable", "propagate_columns", "propagate_fully"]`, Validators: []validator.String{ stringvalidator.OneOf( "ignore", @@ -122,7 +124,6 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "propagate_fully", ), }, - Description: `must be one of [ignore, disable, propagate_columns, propagate_fully]`, }, "notify_schema_changes": schema.BoolAttribute{ Computed: true, @@ -170,7 +171,8 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ Optional: true, Attributes: map[string]schema.Attribute{ "time_unit": schema.StringAttribute{ - Required: true, + Required: true, + Description: `must be one of ["minutes", "hours", "days", "weeks", "months"]`, Validators: []validator.String{ stringvalidator.OneOf( "minutes", @@ -180,7 +182,6 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "months", ), }, - Description: `must be one of [minutes, hours, days, weeks, months]`, }, "units": schema.Int64Attribute{ Required: true, @@ -197,7 +198,8 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ Optional: true, Attributes: map[string]schema.Attribute{ "time_unit": schema.StringAttribute{ - Required: true, + Required: true, + Description: `must be one of ["minutes", "hours", "days", "weeks", "months"]`, Validators: []validator.String{ stringvalidator.OneOf( "minutes", @@ -207,7 +209,6 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "months", ), }, - Description: `must be one of [minutes, hours, days, weeks, months]`, }, "units": schema.Int64Attribute{ Required: true, @@ -232,6 +233,8 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "schedule_type": schema.StringAttribute{ Computed: true, Optional: true, + MarkdownDescription: `must be one of ["manual", "basic", "cron"]` + "\n" + + `determine how the schedule data should be interpreted`, Validators: []validator.String{ stringvalidator.OneOf( "manual", @@ -239,8 +242,6 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "cron", ), }, - MarkdownDescription: `must be one of [manual, basic, cron]` + "\n" + - `determine how the schedule data should be interpreted`, }, "source_catalog_id": schema.StringAttribute{ Computed: true, @@ -254,6 +255,8 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ }, "status": schema.StringAttribute{ Required: true, + MarkdownDescription: `must be one of ["active", "inactive", "deprecated"]` + "\n" + + `Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced.`, Validators: []validator.String{ stringvalidator.OneOf( "active", @@ -261,8 +264,6 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "deprecated", ), }, - MarkdownDescription: `must be one of [active, inactive, deprecated]` + "\n" + - `Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced.`, }, "sync_catalog": schema.SingleNestedAttribute{ Computed: true, @@ -288,7 +289,8 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ Description: `Path to the field that will be used to determine if a record is new or modified since the last sync. This field is REQUIRED if ` + "`" + `sync_mode` + "`" + ` is ` + "`" + `incremental` + "`" + `. Otherwise it is ignored.`, }, "destination_sync_mode": schema.StringAttribute{ - Required: true, + Required: true, + Description: `must be one of ["append", "overwrite", "append_dedup"]`, Validators: []validator.String{ stringvalidator.OneOf( "append", @@ -296,7 +298,6 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ "append_dedup", ), }, - Description: `must be one of [append, overwrite, append_dedup]`, }, "field_selection_enabled": schema.BoolAttribute{ Computed: true, @@ -336,14 +337,14 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ Description: `Does the connector suggest that this stream be enabled by default?`, }, "sync_mode": schema.StringAttribute{ - Required: true, + Required: true, + Description: `must be one of ["full_refresh", "incremental"]`, Validators: []validator.String{ stringvalidator.OneOf( "full_refresh", "incremental", ), }, - Description: `must be one of [full_refresh, incremental]`, }, }, Description: `the mutable part of the stream to configure the destination`, @@ -413,12 +414,12 @@ func (r *ConnectionResource) Configure(ctx context.Context, req resource.Configu return } - client, ok := req.ProviderData.(*sdk.Airbyte) + client, ok := req.ProviderData.(*sdk.SDK) if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Airbyte, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *sdk.SDK, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return @@ -449,6 +450,9 @@ func (r *ConnectionResource) Create(ctx context.Context, req resource.CreateRequ res, err := r.client.Connection.CreateConnection(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -504,6 +508,9 @@ func (r *ConnectionResource) Update(ctx context.Context, req resource.UpdateRequ res, err := r.client.Connection.UpdateConnection(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -546,6 +553,9 @@ func (r *ConnectionResource) Delete(ctx context.Context, req resource.DeleteRequ res, err := r.client.Connection.DeleteConnection(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { diff --git a/internal/provider/connection_resource_sdk.go b/internal/provider/connection_resource_sdk.go old mode 100755 new mode 100644 index dd77595..1909d7e --- a/internal/provider/connection_resource_sdk.go +++ b/internal/provider/connection_resource_sdk.go @@ -3,18 +3,11 @@ package provider import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) func (r *ConnectionResourceModel) ToCreateSDKType() *shared.ConnectionCreate { - destinationID := r.DestinationID.ValueString() - geography := new(shared.Geography) - if !r.Geography.IsUnknown() && !r.Geography.IsNull() { - *geography = shared.Geography(r.Geography.ValueString()) - } else { - geography = nil - } name := new(string) if !r.Name.IsUnknown() && !r.Name.IsNull() { *name = r.Name.ValueString() @@ -33,155 +26,110 @@ func (r *ConnectionResourceModel) ToCreateSDKType() *shared.ConnectionCreate { } else { namespaceFormat = nil } - nonBreakingChangesPreference := new(shared.NonBreakingChangesPreference) - if !r.NonBreakingChangesPreference.IsUnknown() && !r.NonBreakingChangesPreference.IsNull() { - *nonBreakingChangesPreference = shared.NonBreakingChangesPreference(r.NonBreakingChangesPreference.ValueString()) - } else { - nonBreakingChangesPreference = nil - } - notifySchemaChanges := new(bool) - if !r.NotifySchemaChanges.IsUnknown() && !r.NotifySchemaChanges.IsNull() { - *notifySchemaChanges = r.NotifySchemaChanges.ValueBool() - } else { - notifySchemaChanges = nil - } - notifySchemaChangesByEmail := new(bool) - if !r.NotifySchemaChangesByEmail.IsUnknown() && !r.NotifySchemaChangesByEmail.IsNull() { - *notifySchemaChangesByEmail = r.NotifySchemaChangesByEmail.ValueBool() - } else { - notifySchemaChangesByEmail = nil - } - operationIds := make([]string, 0) - for _, operationIdsItem := range r.OperationIds { - operationIds = append(operationIds, operationIdsItem.ValueString()) - } prefix := new(string) if !r.Prefix.IsUnknown() && !r.Prefix.IsNull() { *prefix = r.Prefix.ValueString() } else { prefix = nil } - var resourceRequirements *shared.ResourceRequirements - if r.ResourceRequirements != nil { - cpuLimit := new(string) - if !r.ResourceRequirements.CPULimit.IsUnknown() && !r.ResourceRequirements.CPULimit.IsNull() { - *cpuLimit = r.ResourceRequirements.CPULimit.ValueString() - } else { - cpuLimit = nil - } - cpuRequest := new(string) - if !r.ResourceRequirements.CPURequest.IsUnknown() && !r.ResourceRequirements.CPURequest.IsNull() { - *cpuRequest = r.ResourceRequirements.CPURequest.ValueString() - } else { - cpuRequest = nil - } - memoryLimit := new(string) - if !r.ResourceRequirements.MemoryLimit.IsUnknown() && !r.ResourceRequirements.MemoryLimit.IsNull() { - *memoryLimit = r.ResourceRequirements.MemoryLimit.ValueString() - } else { - memoryLimit = nil - } - memoryRequest := new(string) - if !r.ResourceRequirements.MemoryRequest.IsUnknown() && !r.ResourceRequirements.MemoryRequest.IsNull() { - *memoryRequest = r.ResourceRequirements.MemoryRequest.ValueString() - } else { - memoryRequest = nil - } - resourceRequirements = &shared.ResourceRequirements{ - CPULimit: cpuLimit, - CPURequest: cpuRequest, - MemoryLimit: memoryLimit, - MemoryRequest: memoryRequest, - } - } - var schedule *shared.ConnectionSchedule - if r.Schedule != nil { - timeUnit := shared.ConnectionScheduleTimeUnit(r.Schedule.TimeUnit.ValueString()) - units := r.Schedule.Units.ValueInt64() - schedule = &shared.ConnectionSchedule{ - TimeUnit: timeUnit, - Units: units, - } - } - var scheduleData *shared.ConnectionScheduleData - if r.ScheduleData != nil { - var basicSchedule *shared.ConnectionScheduleDataBasicSchedule - if r.ScheduleData.BasicSchedule != nil { - timeUnit1 := shared.ConnectionScheduleDataBasicScheduleTimeUnit(r.ScheduleData.BasicSchedule.TimeUnit.ValueString()) - units1 := r.ScheduleData.BasicSchedule.Units.ValueInt64() - basicSchedule = &shared.ConnectionScheduleDataBasicSchedule{ - TimeUnit: timeUnit1, - Units: units1, - } - } - var cron *shared.ConnectionScheduleDataCron - if r.ScheduleData.Cron != nil { - cronExpression := r.ScheduleData.Cron.CronExpression.ValueString() - cronTimeZone := r.ScheduleData.Cron.CronTimeZone.ValueString() - cron = &shared.ConnectionScheduleDataCron{ - CronExpression: cronExpression, - CronTimeZone: cronTimeZone, - } - } - scheduleData = &shared.ConnectionScheduleData{ - BasicSchedule: basicSchedule, - Cron: cron, - } - } - scheduleType := new(shared.ConnectionScheduleType) - if !r.ScheduleType.IsUnknown() && !r.ScheduleType.IsNull() { - *scheduleType = shared.ConnectionScheduleType(r.ScheduleType.ValueString()) - } else { - scheduleType = nil - } - sourceCatalogID := new(string) - if !r.SourceCatalogID.IsUnknown() && !r.SourceCatalogID.IsNull() { - *sourceCatalogID = r.SourceCatalogID.ValueString() - } else { - sourceCatalogID = nil - } sourceID := r.SourceID.ValueString() - status := shared.ConnectionStatus(r.Status.ValueString()) + destinationID := r.DestinationID.ValueString() + var operationIds []string = nil + for _, operationIdsItem := range r.OperationIds { + operationIds = append(operationIds, operationIdsItem.ValueString()) + } var syncCatalog *shared.AirbyteCatalog if r.SyncCatalog != nil { - streams := make([]shared.AirbyteStreamAndConfiguration, 0) + var streams []shared.AirbyteStreamAndConfiguration = nil for _, streamsItem := range r.SyncCatalog.Streams { - var config *shared.AirbyteStreamConfiguration - if streamsItem.Config != nil { - aliasName := new(string) - if !streamsItem.Config.AliasName.IsUnknown() && !streamsItem.Config.AliasName.IsNull() { - *aliasName = streamsItem.Config.AliasName.ValueString() + var stream *shared.AirbyteStream + if streamsItem.Stream != nil { + name1 := streamsItem.Stream.Name.ValueString() + var jsonSchema *shared.StreamJSONSchema + if streamsItem.Stream.JSONSchema != nil { + jsonSchema = &shared.StreamJSONSchema{} + } + var supportedSyncModes []shared.SyncMode = nil + for _, supportedSyncModesItem := range streamsItem.Stream.SupportedSyncModes { + supportedSyncModes = append(supportedSyncModes, shared.SyncMode(supportedSyncModesItem.ValueString())) + } + sourceDefinedCursor := new(bool) + if !streamsItem.Stream.SourceDefinedCursor.IsUnknown() && !streamsItem.Stream.SourceDefinedCursor.IsNull() { + *sourceDefinedCursor = streamsItem.Stream.SourceDefinedCursor.ValueBool() } else { - aliasName = nil + sourceDefinedCursor = nil + } + var defaultCursorField []string = nil + for _, defaultCursorFieldItem := range streamsItem.Stream.DefaultCursorField { + defaultCursorField = append(defaultCursorField, defaultCursorFieldItem.ValueString()) + } + var sourceDefinedPrimaryKey [][]string = nil + for _, sourceDefinedPrimaryKeyItem := range streamsItem.Stream.SourceDefinedPrimaryKey { + var sourceDefinedPrimaryKeyTmp []string = nil + for _, item := range sourceDefinedPrimaryKeyItem { + sourceDefinedPrimaryKeyTmp = append(sourceDefinedPrimaryKeyTmp, item.ValueString()) + } + sourceDefinedPrimaryKey = append(sourceDefinedPrimaryKey, sourceDefinedPrimaryKeyTmp) + } + namespace := new(string) + if !streamsItem.Stream.Namespace.IsUnknown() && !streamsItem.Stream.Namespace.IsNull() { + *namespace = streamsItem.Stream.Namespace.ValueString() + } else { + namespace = nil + } + stream = &shared.AirbyteStream{ + Name: name1, + JSONSchema: jsonSchema, + SupportedSyncModes: supportedSyncModes, + SourceDefinedCursor: sourceDefinedCursor, + DefaultCursorField: defaultCursorField, + SourceDefinedPrimaryKey: sourceDefinedPrimaryKey, + Namespace: namespace, } - cursorField := make([]string, 0) + } + var config *shared.AirbyteStreamConfiguration + if streamsItem.Config != nil { + syncMode := shared.SyncMode(streamsItem.Config.SyncMode.ValueString()) + var cursorField []string = nil for _, cursorFieldItem := range streamsItem.Config.CursorField { cursorField = append(cursorField, cursorFieldItem.ValueString()) } destinationSyncMode := shared.DestinationSyncMode(streamsItem.Config.DestinationSyncMode.ValueString()) - fieldSelectionEnabled := new(bool) - if !streamsItem.Config.FieldSelectionEnabled.IsUnknown() && !streamsItem.Config.FieldSelectionEnabled.IsNull() { - *fieldSelectionEnabled = streamsItem.Config.FieldSelectionEnabled.ValueBool() - } else { - fieldSelectionEnabled = nil - } - primaryKey := make([][]string, 0) + var primaryKey [][]string = nil for _, primaryKeyItem := range streamsItem.Config.PrimaryKey { - primaryKeyTmp := make([]string, 0) - for _, item := range primaryKeyItem { - primaryKeyTmp = append(primaryKeyTmp, item.ValueString()) + var primaryKeyTmp []string = nil + for _, item1 := range primaryKeyItem { + primaryKeyTmp = append(primaryKeyTmp, item1.ValueString()) } primaryKey = append(primaryKey, primaryKeyTmp) } + aliasName := new(string) + if !streamsItem.Config.AliasName.IsUnknown() && !streamsItem.Config.AliasName.IsNull() { + *aliasName = streamsItem.Config.AliasName.ValueString() + } else { + aliasName = nil + } selected := new(bool) if !streamsItem.Config.Selected.IsUnknown() && !streamsItem.Config.Selected.IsNull() { *selected = streamsItem.Config.Selected.ValueBool() } else { selected = nil } - selectedFields := make([]shared.SelectedFieldInfo, 0) + suggested := new(bool) + if !streamsItem.Config.Suggested.IsUnknown() && !streamsItem.Config.Suggested.IsNull() { + *suggested = streamsItem.Config.Suggested.ValueBool() + } else { + suggested = nil + } + fieldSelectionEnabled := new(bool) + if !streamsItem.Config.FieldSelectionEnabled.IsUnknown() && !streamsItem.Config.FieldSelectionEnabled.IsNull() { + *fieldSelectionEnabled = streamsItem.Config.FieldSelectionEnabled.ValueBool() + } else { + fieldSelectionEnabled = nil + } + var selectedFields []shared.SelectedFieldInfo = nil for _, selectedFieldsItem := range streamsItem.Config.SelectedFields { - fieldPath := make([]string, 0) + var fieldPath []string = nil for _, fieldPathItem := range selectedFieldsItem.FieldPath { fieldPath = append(fieldPath, fieldPathItem.ValueString()) } @@ -189,122 +137,156 @@ func (r *ConnectionResourceModel) ToCreateSDKType() *shared.ConnectionCreate { FieldPath: fieldPath, }) } - suggested := new(bool) - if !streamsItem.Config.Suggested.IsUnknown() && !streamsItem.Config.Suggested.IsNull() { - *suggested = streamsItem.Config.Suggested.ValueBool() - } else { - suggested = nil - } - syncMode := shared.SyncMode(streamsItem.Config.SyncMode.ValueString()) config = &shared.AirbyteStreamConfiguration{ - AliasName: aliasName, + SyncMode: syncMode, CursorField: cursorField, DestinationSyncMode: destinationSyncMode, - FieldSelectionEnabled: fieldSelectionEnabled, PrimaryKey: primaryKey, + AliasName: aliasName, Selected: selected, - SelectedFields: selectedFields, Suggested: suggested, - SyncMode: syncMode, - } - } - var stream *shared.AirbyteStream - if streamsItem.Stream != nil { - defaultCursorField := make([]string, 0) - for _, defaultCursorFieldItem := range streamsItem.Stream.DefaultCursorField { - defaultCursorField = append(defaultCursorField, defaultCursorFieldItem.ValueString()) - } - var jsonSchema *shared.StreamJSONSchema - if streamsItem.Stream.JSONSchema != nil { - jsonSchema = &shared.StreamJSONSchema{} - } - name1 := streamsItem.Stream.Name.ValueString() - namespace := new(string) - if !streamsItem.Stream.Namespace.IsUnknown() && !streamsItem.Stream.Namespace.IsNull() { - *namespace = streamsItem.Stream.Namespace.ValueString() - } else { - namespace = nil - } - sourceDefinedCursor := new(bool) - if !streamsItem.Stream.SourceDefinedCursor.IsUnknown() && !streamsItem.Stream.SourceDefinedCursor.IsNull() { - *sourceDefinedCursor = streamsItem.Stream.SourceDefinedCursor.ValueBool() - } else { - sourceDefinedCursor = nil - } - sourceDefinedPrimaryKey := make([][]string, 0) - for _, sourceDefinedPrimaryKeyItem := range streamsItem.Stream.SourceDefinedPrimaryKey { - sourceDefinedPrimaryKeyTmp := make([]string, 0) - for _, item1 := range sourceDefinedPrimaryKeyItem { - sourceDefinedPrimaryKeyTmp = append(sourceDefinedPrimaryKeyTmp, item1.ValueString()) - } - sourceDefinedPrimaryKey = append(sourceDefinedPrimaryKey, sourceDefinedPrimaryKeyTmp) - } - supportedSyncModes := make([]shared.SyncMode, 0) - for _, supportedSyncModesItem := range streamsItem.Stream.SupportedSyncModes { - supportedSyncModes = append(supportedSyncModes, shared.SyncMode(supportedSyncModesItem.ValueString())) - } - stream = &shared.AirbyteStream{ - DefaultCursorField: defaultCursorField, - JSONSchema: jsonSchema, - Name: name1, - Namespace: namespace, - SourceDefinedCursor: sourceDefinedCursor, - SourceDefinedPrimaryKey: sourceDefinedPrimaryKey, - SupportedSyncModes: supportedSyncModes, + FieldSelectionEnabled: fieldSelectionEnabled, + SelectedFields: selectedFields, } } streams = append(streams, shared.AirbyteStreamAndConfiguration{ - Config: config, Stream: stream, + Config: config, }) } syncCatalog = &shared.AirbyteCatalog{ Streams: streams, } } + var schedule *shared.ConnectionSchedule + if r.Schedule != nil { + units := r.Schedule.Units.ValueInt64() + timeUnit := shared.TimeUnit(r.Schedule.TimeUnit.ValueString()) + schedule = &shared.ConnectionSchedule{ + Units: units, + TimeUnit: timeUnit, + } + } + scheduleType := new(shared.ConnectionScheduleType) + if !r.ScheduleType.IsUnknown() && !r.ScheduleType.IsNull() { + *scheduleType = shared.ConnectionScheduleType(r.ScheduleType.ValueString()) + } else { + scheduleType = nil + } + var scheduleData *shared.ConnectionScheduleData + if r.ScheduleData != nil { + var basicSchedule *shared.BasicSchedule + if r.ScheduleData.BasicSchedule != nil { + timeUnit1 := shared.ConnectionScheduleDataTimeUnit(r.ScheduleData.BasicSchedule.TimeUnit.ValueString()) + units1 := r.ScheduleData.BasicSchedule.Units.ValueInt64() + basicSchedule = &shared.BasicSchedule{ + TimeUnit: timeUnit1, + Units: units1, + } + } + var cron *shared.Cron + if r.ScheduleData.Cron != nil { + cronExpression := r.ScheduleData.Cron.CronExpression.ValueString() + cronTimeZone := r.ScheduleData.Cron.CronTimeZone.ValueString() + cron = &shared.Cron{ + CronExpression: cronExpression, + CronTimeZone: cronTimeZone, + } + } + scheduleData = &shared.ConnectionScheduleData{ + BasicSchedule: basicSchedule, + Cron: cron, + } + } + status := shared.ConnectionStatus(r.Status.ValueString()) + var resourceRequirements *shared.ResourceRequirements + if r.ResourceRequirements != nil { + cpuRequest := new(string) + if !r.ResourceRequirements.CPURequest.IsUnknown() && !r.ResourceRequirements.CPURequest.IsNull() { + *cpuRequest = r.ResourceRequirements.CPURequest.ValueString() + } else { + cpuRequest = nil + } + cpuLimit := new(string) + if !r.ResourceRequirements.CPULimit.IsUnknown() && !r.ResourceRequirements.CPULimit.IsNull() { + *cpuLimit = r.ResourceRequirements.CPULimit.ValueString() + } else { + cpuLimit = nil + } + memoryRequest := new(string) + if !r.ResourceRequirements.MemoryRequest.IsUnknown() && !r.ResourceRequirements.MemoryRequest.IsNull() { + *memoryRequest = r.ResourceRequirements.MemoryRequest.ValueString() + } else { + memoryRequest = nil + } + memoryLimit := new(string) + if !r.ResourceRequirements.MemoryLimit.IsUnknown() && !r.ResourceRequirements.MemoryLimit.IsNull() { + *memoryLimit = r.ResourceRequirements.MemoryLimit.ValueString() + } else { + memoryLimit = nil + } + resourceRequirements = &shared.ResourceRequirements{ + CPURequest: cpuRequest, + CPULimit: cpuLimit, + MemoryRequest: memoryRequest, + MemoryLimit: memoryLimit, + } + } + sourceCatalogID := new(string) + if !r.SourceCatalogID.IsUnknown() && !r.SourceCatalogID.IsNull() { + *sourceCatalogID = r.SourceCatalogID.ValueString() + } else { + sourceCatalogID = nil + } + geography := new(shared.Geography) + if !r.Geography.IsUnknown() && !r.Geography.IsNull() { + *geography = shared.Geography(r.Geography.ValueString()) + } else { + geography = nil + } + notifySchemaChanges := new(bool) + if !r.NotifySchemaChanges.IsUnknown() && !r.NotifySchemaChanges.IsNull() { + *notifySchemaChanges = r.NotifySchemaChanges.ValueBool() + } else { + notifySchemaChanges = nil + } + notifySchemaChangesByEmail := new(bool) + if !r.NotifySchemaChangesByEmail.IsUnknown() && !r.NotifySchemaChangesByEmail.IsNull() { + *notifySchemaChangesByEmail = r.NotifySchemaChangesByEmail.ValueBool() + } else { + notifySchemaChangesByEmail = nil + } + nonBreakingChangesPreference := new(shared.NonBreakingChangesPreference) + if !r.NonBreakingChangesPreference.IsUnknown() && !r.NonBreakingChangesPreference.IsNull() { + *nonBreakingChangesPreference = shared.NonBreakingChangesPreference(r.NonBreakingChangesPreference.ValueString()) + } else { + nonBreakingChangesPreference = nil + } out := shared.ConnectionCreate{ - DestinationID: destinationID, - Geography: geography, Name: name, NamespaceDefinition: namespaceDefinition, NamespaceFormat: namespaceFormat, - NonBreakingChangesPreference: nonBreakingChangesPreference, - NotifySchemaChanges: notifySchemaChanges, - NotifySchemaChangesByEmail: notifySchemaChangesByEmail, - OperationIds: operationIds, Prefix: prefix, - ResourceRequirements: resourceRequirements, + SourceID: sourceID, + DestinationID: destinationID, + OperationIds: operationIds, + SyncCatalog: syncCatalog, Schedule: schedule, - ScheduleData: scheduleData, ScheduleType: scheduleType, - SourceCatalogID: sourceCatalogID, - SourceID: sourceID, + ScheduleData: scheduleData, Status: status, - SyncCatalog: syncCatalog, + ResourceRequirements: resourceRequirements, + SourceCatalogID: sourceCatalogID, + Geography: geography, + NotifySchemaChanges: notifySchemaChanges, + NotifySchemaChangesByEmail: notifySchemaChangesByEmail, + NonBreakingChangesPreference: nonBreakingChangesPreference, } return &out } func (r *ConnectionResourceModel) ToUpdateSDKType() *shared.ConnectionUpdate { - breakingChange := new(bool) - if !r.BreakingChange.IsUnknown() && !r.BreakingChange.IsNull() { - *breakingChange = r.BreakingChange.ValueBool() - } else { - breakingChange = nil - } connectionID := r.ConnectionID.ValueString() - geography := new(shared.Geography) - if !r.Geography.IsUnknown() && !r.Geography.IsNull() { - *geography = shared.Geography(r.Geography.ValueString()) - } else { - geography = nil - } - name := new(string) - if !r.Name.IsUnknown() && !r.Name.IsNull() { - *name = r.Name.ValueString() - } else { - name = nil - } namespaceDefinition := new(shared.NamespaceDefinitionType) if !r.NamespaceDefinition.IsUnknown() && !r.NamespaceDefinition.IsNull() { *namespaceDefinition = shared.NamespaceDefinitionType(r.NamespaceDefinition.ValueString()) @@ -317,27 +299,11 @@ func (r *ConnectionResourceModel) ToUpdateSDKType() *shared.ConnectionUpdate { } else { namespaceFormat = nil } - nonBreakingChangesPreference := new(shared.NonBreakingChangesPreference) - if !r.NonBreakingChangesPreference.IsUnknown() && !r.NonBreakingChangesPreference.IsNull() { - *nonBreakingChangesPreference = shared.NonBreakingChangesPreference(r.NonBreakingChangesPreference.ValueString()) - } else { - nonBreakingChangesPreference = nil - } - notifySchemaChanges := new(bool) - if !r.NotifySchemaChanges.IsUnknown() && !r.NotifySchemaChanges.IsNull() { - *notifySchemaChanges = r.NotifySchemaChanges.ValueBool() - } else { - notifySchemaChanges = nil - } - notifySchemaChangesByEmail := new(bool) - if !r.NotifySchemaChangesByEmail.IsUnknown() && !r.NotifySchemaChangesByEmail.IsNull() { - *notifySchemaChangesByEmail = r.NotifySchemaChangesByEmail.ValueBool() + name := new(string) + if !r.Name.IsUnknown() && !r.Name.IsNull() { + *name = r.Name.ValueString() } else { - notifySchemaChangesByEmail = nil - } - operationIds := make([]string, 0) - for _, operationIdsItem := range r.OperationIds { - operationIds = append(operationIds, operationIdsItem.ValueString()) + name = nil } prefix := new(string) if !r.Prefix.IsUnknown() && !r.Prefix.IsNull() { @@ -345,64 +311,161 @@ func (r *ConnectionResourceModel) ToUpdateSDKType() *shared.ConnectionUpdate { } else { prefix = nil } - var resourceRequirements *shared.ResourceRequirements - if r.ResourceRequirements != nil { - cpuLimit := new(string) - if !r.ResourceRequirements.CPULimit.IsUnknown() && !r.ResourceRequirements.CPULimit.IsNull() { - *cpuLimit = r.ResourceRequirements.CPULimit.ValueString() - } else { - cpuLimit = nil - } - cpuRequest := new(string) - if !r.ResourceRequirements.CPURequest.IsUnknown() && !r.ResourceRequirements.CPURequest.IsNull() { - *cpuRequest = r.ResourceRequirements.CPURequest.ValueString() - } else { - cpuRequest = nil - } - memoryLimit := new(string) - if !r.ResourceRequirements.MemoryLimit.IsUnknown() && !r.ResourceRequirements.MemoryLimit.IsNull() { - *memoryLimit = r.ResourceRequirements.MemoryLimit.ValueString() - } else { - memoryLimit = nil - } - memoryRequest := new(string) - if !r.ResourceRequirements.MemoryRequest.IsUnknown() && !r.ResourceRequirements.MemoryRequest.IsNull() { - *memoryRequest = r.ResourceRequirements.MemoryRequest.ValueString() - } else { - memoryRequest = nil + var operationIds []string = nil + for _, operationIdsItem := range r.OperationIds { + operationIds = append(operationIds, operationIdsItem.ValueString()) + } + var syncCatalog *shared.AirbyteCatalog + if r.SyncCatalog != nil { + var streams []shared.AirbyteStreamAndConfiguration = nil + for _, streamsItem := range r.SyncCatalog.Streams { + var stream *shared.AirbyteStream + if streamsItem.Stream != nil { + name1 := streamsItem.Stream.Name.ValueString() + var jsonSchema *shared.StreamJSONSchema + if streamsItem.Stream.JSONSchema != nil { + jsonSchema = &shared.StreamJSONSchema{} + } + var supportedSyncModes []shared.SyncMode = nil + for _, supportedSyncModesItem := range streamsItem.Stream.SupportedSyncModes { + supportedSyncModes = append(supportedSyncModes, shared.SyncMode(supportedSyncModesItem.ValueString())) + } + sourceDefinedCursor := new(bool) + if !streamsItem.Stream.SourceDefinedCursor.IsUnknown() && !streamsItem.Stream.SourceDefinedCursor.IsNull() { + *sourceDefinedCursor = streamsItem.Stream.SourceDefinedCursor.ValueBool() + } else { + sourceDefinedCursor = nil + } + var defaultCursorField []string = nil + for _, defaultCursorFieldItem := range streamsItem.Stream.DefaultCursorField { + defaultCursorField = append(defaultCursorField, defaultCursorFieldItem.ValueString()) + } + var sourceDefinedPrimaryKey [][]string = nil + for _, sourceDefinedPrimaryKeyItem := range streamsItem.Stream.SourceDefinedPrimaryKey { + var sourceDefinedPrimaryKeyTmp []string = nil + for _, item := range sourceDefinedPrimaryKeyItem { + sourceDefinedPrimaryKeyTmp = append(sourceDefinedPrimaryKeyTmp, item.ValueString()) + } + sourceDefinedPrimaryKey = append(sourceDefinedPrimaryKey, sourceDefinedPrimaryKeyTmp) + } + namespace := new(string) + if !streamsItem.Stream.Namespace.IsUnknown() && !streamsItem.Stream.Namespace.IsNull() { + *namespace = streamsItem.Stream.Namespace.ValueString() + } else { + namespace = nil + } + stream = &shared.AirbyteStream{ + Name: name1, + JSONSchema: jsonSchema, + SupportedSyncModes: supportedSyncModes, + SourceDefinedCursor: sourceDefinedCursor, + DefaultCursorField: defaultCursorField, + SourceDefinedPrimaryKey: sourceDefinedPrimaryKey, + Namespace: namespace, + } + } + var config *shared.AirbyteStreamConfiguration + if streamsItem.Config != nil { + syncMode := shared.SyncMode(streamsItem.Config.SyncMode.ValueString()) + var cursorField []string = nil + for _, cursorFieldItem := range streamsItem.Config.CursorField { + cursorField = append(cursorField, cursorFieldItem.ValueString()) + } + destinationSyncMode := shared.DestinationSyncMode(streamsItem.Config.DestinationSyncMode.ValueString()) + var primaryKey [][]string = nil + for _, primaryKeyItem := range streamsItem.Config.PrimaryKey { + var primaryKeyTmp []string = nil + for _, item1 := range primaryKeyItem { + primaryKeyTmp = append(primaryKeyTmp, item1.ValueString()) + } + primaryKey = append(primaryKey, primaryKeyTmp) + } + aliasName := new(string) + if !streamsItem.Config.AliasName.IsUnknown() && !streamsItem.Config.AliasName.IsNull() { + *aliasName = streamsItem.Config.AliasName.ValueString() + } else { + aliasName = nil + } + selected := new(bool) + if !streamsItem.Config.Selected.IsUnknown() && !streamsItem.Config.Selected.IsNull() { + *selected = streamsItem.Config.Selected.ValueBool() + } else { + selected = nil + } + suggested := new(bool) + if !streamsItem.Config.Suggested.IsUnknown() && !streamsItem.Config.Suggested.IsNull() { + *suggested = streamsItem.Config.Suggested.ValueBool() + } else { + suggested = nil + } + fieldSelectionEnabled := new(bool) + if !streamsItem.Config.FieldSelectionEnabled.IsUnknown() && !streamsItem.Config.FieldSelectionEnabled.IsNull() { + *fieldSelectionEnabled = streamsItem.Config.FieldSelectionEnabled.ValueBool() + } else { + fieldSelectionEnabled = nil + } + var selectedFields []shared.SelectedFieldInfo = nil + for _, selectedFieldsItem := range streamsItem.Config.SelectedFields { + var fieldPath []string = nil + for _, fieldPathItem := range selectedFieldsItem.FieldPath { + fieldPath = append(fieldPath, fieldPathItem.ValueString()) + } + selectedFields = append(selectedFields, shared.SelectedFieldInfo{ + FieldPath: fieldPath, + }) + } + config = &shared.AirbyteStreamConfiguration{ + SyncMode: syncMode, + CursorField: cursorField, + DestinationSyncMode: destinationSyncMode, + PrimaryKey: primaryKey, + AliasName: aliasName, + Selected: selected, + Suggested: suggested, + FieldSelectionEnabled: fieldSelectionEnabled, + SelectedFields: selectedFields, + } + } + streams = append(streams, shared.AirbyteStreamAndConfiguration{ + Stream: stream, + Config: config, + }) } - resourceRequirements = &shared.ResourceRequirements{ - CPULimit: cpuLimit, - CPURequest: cpuRequest, - MemoryLimit: memoryLimit, - MemoryRequest: memoryRequest, + syncCatalog = &shared.AirbyteCatalog{ + Streams: streams, } } var schedule *shared.ConnectionSchedule if r.Schedule != nil { - timeUnit := shared.ConnectionScheduleTimeUnit(r.Schedule.TimeUnit.ValueString()) units := r.Schedule.Units.ValueInt64() + timeUnit := shared.TimeUnit(r.Schedule.TimeUnit.ValueString()) schedule = &shared.ConnectionSchedule{ - TimeUnit: timeUnit, Units: units, + TimeUnit: timeUnit, } } + scheduleType := new(shared.ConnectionScheduleType) + if !r.ScheduleType.IsUnknown() && !r.ScheduleType.IsNull() { + *scheduleType = shared.ConnectionScheduleType(r.ScheduleType.ValueString()) + } else { + scheduleType = nil + } var scheduleData *shared.ConnectionScheduleData if r.ScheduleData != nil { - var basicSchedule *shared.ConnectionScheduleDataBasicSchedule + var basicSchedule *shared.BasicSchedule if r.ScheduleData.BasicSchedule != nil { - timeUnit1 := shared.ConnectionScheduleDataBasicScheduleTimeUnit(r.ScheduleData.BasicSchedule.TimeUnit.ValueString()) + timeUnit1 := shared.ConnectionScheduleDataTimeUnit(r.ScheduleData.BasicSchedule.TimeUnit.ValueString()) units1 := r.ScheduleData.BasicSchedule.Units.ValueInt64() - basicSchedule = &shared.ConnectionScheduleDataBasicSchedule{ + basicSchedule = &shared.BasicSchedule{ TimeUnit: timeUnit1, Units: units1, } } - var cron *shared.ConnectionScheduleDataCron + var cron *shared.Cron if r.ScheduleData.Cron != nil { cronExpression := r.ScheduleData.Cron.CronExpression.ValueString() cronTimeZone := r.ScheduleData.Cron.CronTimeZone.ValueString() - cron = &shared.ConnectionScheduleDataCron{ + cron = &shared.Cron{ CronExpression: cronExpression, CronTimeZone: cronTimeZone, } @@ -412,11 +475,44 @@ func (r *ConnectionResourceModel) ToUpdateSDKType() *shared.ConnectionUpdate { Cron: cron, } } - scheduleType := new(shared.ConnectionScheduleType) - if !r.ScheduleType.IsUnknown() && !r.ScheduleType.IsNull() { - *scheduleType = shared.ConnectionScheduleType(r.ScheduleType.ValueString()) + status := new(shared.ConnectionStatus) + if !r.Status.IsUnknown() && !r.Status.IsNull() { + *status = shared.ConnectionStatus(r.Status.ValueString()) } else { - scheduleType = nil + status = nil + } + var resourceRequirements *shared.ResourceRequirements + if r.ResourceRequirements != nil { + cpuRequest := new(string) + if !r.ResourceRequirements.CPURequest.IsUnknown() && !r.ResourceRequirements.CPURequest.IsNull() { + *cpuRequest = r.ResourceRequirements.CPURequest.ValueString() + } else { + cpuRequest = nil + } + cpuLimit := new(string) + if !r.ResourceRequirements.CPULimit.IsUnknown() && !r.ResourceRequirements.CPULimit.IsNull() { + *cpuLimit = r.ResourceRequirements.CPULimit.ValueString() + } else { + cpuLimit = nil + } + memoryRequest := new(string) + if !r.ResourceRequirements.MemoryRequest.IsUnknown() && !r.ResourceRequirements.MemoryRequest.IsNull() { + *memoryRequest = r.ResourceRequirements.MemoryRequest.ValueString() + } else { + memoryRequest = nil + } + memoryLimit := new(string) + if !r.ResourceRequirements.MemoryLimit.IsUnknown() && !r.ResourceRequirements.MemoryLimit.IsNull() { + *memoryLimit = r.ResourceRequirements.MemoryLimit.ValueString() + } else { + memoryLimit = nil + } + resourceRequirements = &shared.ResourceRequirements{ + CPURequest: cpuRequest, + CPULimit: cpuLimit, + MemoryRequest: memoryRequest, + MemoryLimit: memoryLimit, + } } sourceCatalogID := new(string) if !r.SourceCatalogID.IsUnknown() && !r.SourceCatalogID.IsNull() { @@ -424,151 +520,55 @@ func (r *ConnectionResourceModel) ToUpdateSDKType() *shared.ConnectionUpdate { } else { sourceCatalogID = nil } - status := new(shared.ConnectionStatus) - if !r.Status.IsUnknown() && !r.Status.IsNull() { - *status = shared.ConnectionStatus(r.Status.ValueString()) + geography := new(shared.Geography) + if !r.Geography.IsUnknown() && !r.Geography.IsNull() { + *geography = shared.Geography(r.Geography.ValueString()) } else { - status = nil + geography = nil } - var syncCatalog *shared.AirbyteCatalog - if r.SyncCatalog != nil { - streams := make([]shared.AirbyteStreamAndConfiguration, 0) - for _, streamsItem := range r.SyncCatalog.Streams { - var config *shared.AirbyteStreamConfiguration - if streamsItem.Config != nil { - aliasName := new(string) - if !streamsItem.Config.AliasName.IsUnknown() && !streamsItem.Config.AliasName.IsNull() { - *aliasName = streamsItem.Config.AliasName.ValueString() - } else { - aliasName = nil - } - cursorField := make([]string, 0) - for _, cursorFieldItem := range streamsItem.Config.CursorField { - cursorField = append(cursorField, cursorFieldItem.ValueString()) - } - destinationSyncMode := shared.DestinationSyncMode(streamsItem.Config.DestinationSyncMode.ValueString()) - fieldSelectionEnabled := new(bool) - if !streamsItem.Config.FieldSelectionEnabled.IsUnknown() && !streamsItem.Config.FieldSelectionEnabled.IsNull() { - *fieldSelectionEnabled = streamsItem.Config.FieldSelectionEnabled.ValueBool() - } else { - fieldSelectionEnabled = nil - } - primaryKey := make([][]string, 0) - for _, primaryKeyItem := range streamsItem.Config.PrimaryKey { - primaryKeyTmp := make([]string, 0) - for _, item := range primaryKeyItem { - primaryKeyTmp = append(primaryKeyTmp, item.ValueString()) - } - primaryKey = append(primaryKey, primaryKeyTmp) - } - selected := new(bool) - if !streamsItem.Config.Selected.IsUnknown() && !streamsItem.Config.Selected.IsNull() { - *selected = streamsItem.Config.Selected.ValueBool() - } else { - selected = nil - } - selectedFields := make([]shared.SelectedFieldInfo, 0) - for _, selectedFieldsItem := range streamsItem.Config.SelectedFields { - fieldPath := make([]string, 0) - for _, fieldPathItem := range selectedFieldsItem.FieldPath { - fieldPath = append(fieldPath, fieldPathItem.ValueString()) - } - selectedFields = append(selectedFields, shared.SelectedFieldInfo{ - FieldPath: fieldPath, - }) - } - suggested := new(bool) - if !streamsItem.Config.Suggested.IsUnknown() && !streamsItem.Config.Suggested.IsNull() { - *suggested = streamsItem.Config.Suggested.ValueBool() - } else { - suggested = nil - } - syncMode := shared.SyncMode(streamsItem.Config.SyncMode.ValueString()) - config = &shared.AirbyteStreamConfiguration{ - AliasName: aliasName, - CursorField: cursorField, - DestinationSyncMode: destinationSyncMode, - FieldSelectionEnabled: fieldSelectionEnabled, - PrimaryKey: primaryKey, - Selected: selected, - SelectedFields: selectedFields, - Suggested: suggested, - SyncMode: syncMode, - } - } - var stream *shared.AirbyteStream - if streamsItem.Stream != nil { - defaultCursorField := make([]string, 0) - for _, defaultCursorFieldItem := range streamsItem.Stream.DefaultCursorField { - defaultCursorField = append(defaultCursorField, defaultCursorFieldItem.ValueString()) - } - var jsonSchema *shared.StreamJSONSchema - if streamsItem.Stream.JSONSchema != nil { - jsonSchema = &shared.StreamJSONSchema{} - } - name1 := streamsItem.Stream.Name.ValueString() - namespace := new(string) - if !streamsItem.Stream.Namespace.IsUnknown() && !streamsItem.Stream.Namespace.IsNull() { - *namespace = streamsItem.Stream.Namespace.ValueString() - } else { - namespace = nil - } - sourceDefinedCursor := new(bool) - if !streamsItem.Stream.SourceDefinedCursor.IsUnknown() && !streamsItem.Stream.SourceDefinedCursor.IsNull() { - *sourceDefinedCursor = streamsItem.Stream.SourceDefinedCursor.ValueBool() - } else { - sourceDefinedCursor = nil - } - sourceDefinedPrimaryKey := make([][]string, 0) - for _, sourceDefinedPrimaryKeyItem := range streamsItem.Stream.SourceDefinedPrimaryKey { - sourceDefinedPrimaryKeyTmp := make([]string, 0) - for _, item1 := range sourceDefinedPrimaryKeyItem { - sourceDefinedPrimaryKeyTmp = append(sourceDefinedPrimaryKeyTmp, item1.ValueString()) - } - sourceDefinedPrimaryKey = append(sourceDefinedPrimaryKey, sourceDefinedPrimaryKeyTmp) - } - supportedSyncModes := make([]shared.SyncMode, 0) - for _, supportedSyncModesItem := range streamsItem.Stream.SupportedSyncModes { - supportedSyncModes = append(supportedSyncModes, shared.SyncMode(supportedSyncModesItem.ValueString())) - } - stream = &shared.AirbyteStream{ - DefaultCursorField: defaultCursorField, - JSONSchema: jsonSchema, - Name: name1, - Namespace: namespace, - SourceDefinedCursor: sourceDefinedCursor, - SourceDefinedPrimaryKey: sourceDefinedPrimaryKey, - SupportedSyncModes: supportedSyncModes, - } - } - streams = append(streams, shared.AirbyteStreamAndConfiguration{ - Config: config, - Stream: stream, - }) - } - syncCatalog = &shared.AirbyteCatalog{ - Streams: streams, - } + notifySchemaChanges := new(bool) + if !r.NotifySchemaChanges.IsUnknown() && !r.NotifySchemaChanges.IsNull() { + *notifySchemaChanges = r.NotifySchemaChanges.ValueBool() + } else { + notifySchemaChanges = nil + } + notifySchemaChangesByEmail := new(bool) + if !r.NotifySchemaChangesByEmail.IsUnknown() && !r.NotifySchemaChangesByEmail.IsNull() { + *notifySchemaChangesByEmail = r.NotifySchemaChangesByEmail.ValueBool() + } else { + notifySchemaChangesByEmail = nil + } + nonBreakingChangesPreference := new(shared.NonBreakingChangesPreference) + if !r.NonBreakingChangesPreference.IsUnknown() && !r.NonBreakingChangesPreference.IsNull() { + *nonBreakingChangesPreference = shared.NonBreakingChangesPreference(r.NonBreakingChangesPreference.ValueString()) + } else { + nonBreakingChangesPreference = nil + } + breakingChange := new(bool) + if !r.BreakingChange.IsUnknown() && !r.BreakingChange.IsNull() { + *breakingChange = r.BreakingChange.ValueBool() + } else { + breakingChange = nil } out := shared.ConnectionUpdate{ - BreakingChange: breakingChange, ConnectionID: connectionID, - Geography: geography, - Name: name, NamespaceDefinition: namespaceDefinition, NamespaceFormat: namespaceFormat, - NonBreakingChangesPreference: nonBreakingChangesPreference, - NotifySchemaChanges: notifySchemaChanges, - NotifySchemaChangesByEmail: notifySchemaChangesByEmail, - OperationIds: operationIds, + Name: name, Prefix: prefix, - ResourceRequirements: resourceRequirements, + OperationIds: operationIds, + SyncCatalog: syncCatalog, Schedule: schedule, - ScheduleData: scheduleData, ScheduleType: scheduleType, - SourceCatalogID: sourceCatalogID, + ScheduleData: scheduleData, Status: status, - SyncCatalog: syncCatalog, + ResourceRequirements: resourceRequirements, + SourceCatalogID: sourceCatalogID, + Geography: geography, + NotifySchemaChanges: notifySchemaChanges, + NotifySchemaChangesByEmail: notifySchemaChangesByEmail, + NonBreakingChangesPreference: nonBreakingChangesPreference, + BreakingChange: breakingChange, } return &out } @@ -625,9 +625,6 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect } else { r.Prefix = types.StringNull() } - if r.ResourceRequirements == nil { - r.ResourceRequirements = &ResourceRequirements{} - } if resp.ResourceRequirements == nil { r.ResourceRequirements = nil } else { @@ -653,9 +650,6 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect r.ResourceRequirements.MemoryRequest = types.StringNull() } } - if r.Schedule == nil { - r.Schedule = &ConnectionSchedule{} - } if resp.Schedule == nil { r.Schedule = nil } else { @@ -663,30 +657,21 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect r.Schedule.TimeUnit = types.StringValue(string(resp.Schedule.TimeUnit)) r.Schedule.Units = types.Int64Value(resp.Schedule.Units) } - if r.ScheduleData == nil { - r.ScheduleData = &ConnectionScheduleData{} - } if resp.ScheduleData == nil { r.ScheduleData = nil } else { r.ScheduleData = &ConnectionScheduleData{} - if r.ScheduleData.BasicSchedule == nil { - r.ScheduleData.BasicSchedule = &ConnectionScheduleDataBasicSchedule{} - } if resp.ScheduleData.BasicSchedule == nil { r.ScheduleData.BasicSchedule = nil } else { - r.ScheduleData.BasicSchedule = &ConnectionScheduleDataBasicSchedule{} + r.ScheduleData.BasicSchedule = &ConnectionSchedule{} r.ScheduleData.BasicSchedule.TimeUnit = types.StringValue(string(resp.ScheduleData.BasicSchedule.TimeUnit)) r.ScheduleData.BasicSchedule.Units = types.Int64Value(resp.ScheduleData.BasicSchedule.Units) } - if r.ScheduleData.Cron == nil { - r.ScheduleData.Cron = &ConnectionScheduleDataCron{} - } if resp.ScheduleData.Cron == nil { r.ScheduleData.Cron = nil } else { - r.ScheduleData.Cron = &ConnectionScheduleDataCron{} + r.ScheduleData.Cron = &Cron{} r.ScheduleData.Cron.CronExpression = types.StringValue(resp.ScheduleData.Cron.CronExpression) r.ScheduleData.Cron.CronTimeZone = types.StringValue(resp.ScheduleData.Cron.CronTimeZone) } @@ -706,12 +691,11 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect if r.SyncCatalog == nil { r.SyncCatalog = &AirbyteCatalog{} } - r.SyncCatalog.Streams = nil - for _, streamsItem := range resp.SyncCatalog.Streams { + if len(r.SyncCatalog.Streams) > len(resp.SyncCatalog.Streams) { + r.SyncCatalog.Streams = r.SyncCatalog.Streams[:len(resp.SyncCatalog.Streams)] + } + for streamsCount, streamsItem := range resp.SyncCatalog.Streams { var streams1 AirbyteStreamAndConfiguration - if streams1.Config == nil { - streams1.Config = &AirbyteStreamConfiguration{} - } if streamsItem.Config == nil { streams1.Config = nil } else { @@ -745,14 +729,20 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect } else { streams1.Config.Selected = types.BoolNull() } - streams1.Config.SelectedFields = nil - for _, selectedFieldsItem := range streamsItem.Config.SelectedFields { + if len(streams1.Config.SelectedFields) > len(streamsItem.Config.SelectedFields) { + streams1.Config.SelectedFields = streams1.Config.SelectedFields[:len(streamsItem.Config.SelectedFields)] + } + for selectedFieldsCount, selectedFieldsItem := range streamsItem.Config.SelectedFields { var selectedFields1 SelectedFieldInfo selectedFields1.FieldPath = nil for _, v := range selectedFieldsItem.FieldPath { selectedFields1.FieldPath = append(selectedFields1.FieldPath, types.StringValue(v)) } - streams1.Config.SelectedFields = append(streams1.Config.SelectedFields, selectedFields1) + if selectedFieldsCount+1 > len(streams1.Config.SelectedFields) { + streams1.Config.SelectedFields = append(streams1.Config.SelectedFields, selectedFields1) + } else { + streams1.Config.SelectedFields[selectedFieldsCount].FieldPath = selectedFields1.FieldPath + } } if streamsItem.Config.Suggested != nil { streams1.Config.Suggested = types.BoolValue(*streamsItem.Config.Suggested) @@ -761,9 +751,6 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect } streams1.Config.SyncMode = types.StringValue(string(streamsItem.Config.SyncMode)) } - if streams1.Stream == nil { - streams1.Stream = &AirbyteStream{} - } if streamsItem.Stream == nil { streams1.Stream = nil } else { @@ -772,9 +759,6 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect for _, v := range streamsItem.Stream.DefaultCursorField { streams1.Stream.DefaultCursorField = append(streams1.Stream.DefaultCursorField, types.StringValue(v)) } - if streams1.Stream.JSONSchema == nil { - streams1.Stream.JSONSchema = &StreamJSONSchema{} - } if streamsItem.Stream.JSONSchema == nil { streams1.Stream.JSONSchema = nil } else { @@ -805,7 +789,12 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect streams1.Stream.SupportedSyncModes = append(streams1.Stream.SupportedSyncModes, types.StringValue(string(v))) } } - r.SyncCatalog.Streams = append(r.SyncCatalog.Streams, streams1) + if streamsCount+1 > len(r.SyncCatalog.Streams) { + r.SyncCatalog.Streams = append(r.SyncCatalog.Streams, streams1) + } else { + r.SyncCatalog.Streams[streamsCount].Config = streams1.Config + r.SyncCatalog.Streams[streamsCount].Stream = streams1.Stream + } } if resp.WorkspaceID != nil { r.WorkspaceID = types.StringValue(*resp.WorkspaceID) diff --git a/internal/provider/provider.go b/internal/provider/provider.go old mode 100755 new mode 100644 index 79e48c7..701ff3a --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -3,9 +3,9 @@ package provider import ( - "airbyte/internal/sdk" - "airbyte/internal/sdk/pkg/models/shared" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/provider" @@ -26,8 +26,8 @@ type AirbyteProvider struct { // AirbyteProviderModel describes the provider data model. type AirbyteProviderModel struct { ServerURL types.String `tfsdk:"server_url"` - Password types.String `tfsdk:"password"` Username types.String `tfsdk:"username"` + Password types.String `tfsdk:"password"` } func (p *AirbyteProvider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) { @@ -67,11 +67,11 @@ func (p *AirbyteProvider) Schema(ctx context.Context, req provider.SchemaRequest Optional: true, Required: false, }, - "password": schema.StringAttribute{ + "username": schema.StringAttribute{ Optional: true, Sensitive: true, }, - "username": schema.StringAttribute{ + "password": schema.StringAttribute{ Optional: true, Sensitive: true, }, @@ -94,11 +94,11 @@ func (p *AirbyteProvider) Configure(ctx context.Context, req provider.ConfigureR ServerURL = "http://localhost:8000/api" } - password := data.Password.ValueString() username := data.Username.ValueString() + password := data.Password.ValueString() security := shared.Security{ - Password: password, Username: username, + Password: password, } opts := []sdk.SDKOption{ diff --git a/internal/provider/reflect/diags.go b/internal/provider/reflect/diags.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/doc.go b/internal/provider/reflect/doc.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/generic_attr_value.go b/internal/provider/reflect/generic_attr_value.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/helpers.go b/internal/provider/reflect/helpers.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/interfaces.go b/internal/provider/reflect/interfaces.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/into.go b/internal/provider/reflect/into.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/map.go b/internal/provider/reflect/map.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/number.go b/internal/provider/reflect/number.go old mode 100755 new mode 100644 index a0e4126..37eef21 --- a/internal/provider/reflect/number.go +++ b/internal/provider/reflect/number.go @@ -206,7 +206,7 @@ func Number(ctx context.Context, typ attr.Type, val tftypes.Value, target reflec } else if acc == big.Below { if floatResult == math.Inf(-1) || floatResult == -math.MaxFloat64 { floatResult = -math.MaxFloat64 - } else if floatResult == -0.0 || floatResult == -math.SmallestNonzeroFloat64 { //nolint:staticcheck + } else if floatResult == 0.0 || floatResult == -math.SmallestNonzeroFloat64 { floatResult = math.SmallestNonzeroFloat64 } else { err := fmt.Errorf("not sure how to round %s and %f", acc, floatResult) diff --git a/internal/provider/reflect/options.go b/internal/provider/reflect/options.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/outof.go b/internal/provider/reflect/outof.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/pointer.go b/internal/provider/reflect/pointer.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/primitive.go b/internal/provider/reflect/primitive.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/slice.go b/internal/provider/reflect/slice.go old mode 100755 new mode 100644 diff --git a/internal/provider/reflect/struct.go b/internal/provider/reflect/struct.go old mode 100755 new mode 100644 diff --git a/internal/provider/source_resource.go b/internal/provider/source_resource.go old mode 100755 new mode 100644 index 20a7633..c571092 --- a/internal/provider/source_resource.go +++ b/internal/provider/source_resource.go @@ -3,11 +3,11 @@ package provider import ( - "airbyte/internal/sdk" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk" - "airbyte/internal/validators" + "github.com/aballiet/terraform-provider-airbyte/internal/validators" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" @@ -27,20 +27,19 @@ func NewSourceResource() resource.Resource { // SourceResource defines the resource implementation. type SourceResource struct { - client *sdk.Airbyte + client *sdk.SDK } // SourceResourceModel describes the resource data model. type SourceResourceModel struct { - ConnectionConfiguration types.String `tfsdk:"connection_configuration"` - ExceptionClassName types.String `tfsdk:"exception_class_name"` - ExceptionStack []types.String `tfsdk:"exception_stack"` - Message types.String `tfsdk:"message"` - Name types.String `tfsdk:"name"` - SourceDefinitionID types.String `tfsdk:"source_definition_id"` - SourceID types.String `tfsdk:"source_id"` - ValidationErrors []InvalidInputProperty `tfsdk:"validation_errors"` - WorkspaceID types.String `tfsdk:"workspace_id"` + ConnectionConfiguration types.String `tfsdk:"connection_configuration"` + Icon types.String `tfsdk:"icon"` + Name types.String `tfsdk:"name"` + SecretID types.String `tfsdk:"secret_id"` + SourceDefinitionID types.String `tfsdk:"source_definition_id"` + SourceID types.String `tfsdk:"source_id"` + SourceName types.String `tfsdk:"source_name"` + WorkspaceID types.String `tfsdk:"workspace_id"` } func (r *SourceResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -54,25 +53,21 @@ func (r *SourceResource) Schema(ctx context.Context, req resource.SchemaRequest, Attributes: map[string]schema.Attribute{ "connection_configuration": schema.StringAttribute{ Required: true, + MarkdownDescription: `Parsed as JSON.` + "\n" + + `The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source.`, Validators: []validator.String{ validators.IsValidJSON(), }, - MarkdownDescription: `Parsed as JSON.` + "\n" + - `The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source.`, }, - "exception_class_name": schema.StringAttribute{ - Computed: true, - }, - "exception_stack": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, - }, - "message": schema.StringAttribute{ + "icon": schema.StringAttribute{ Computed: true, }, "name": schema.StringAttribute{ Required: true, }, + "secret_id": schema.StringAttribute{ + Optional: true, + }, "source_definition_id": schema.StringAttribute{ PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), @@ -80,23 +75,10 @@ func (r *SourceResource) Schema(ctx context.Context, req resource.SchemaRequest, Required: true, }, "source_id": schema.StringAttribute{ - Required: true, + Computed: true, }, - "validation_errors": schema.ListNestedAttribute{ + "source_name": schema.StringAttribute{ Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "invalid_value": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "property_path": schema.StringAttribute{ - Computed: true, - }, - }, - }, }, "workspace_id": schema.StringAttribute{ PlanModifiers: []planmodifier.String{ @@ -114,12 +96,12 @@ func (r *SourceResource) Configure(ctx context.Context, req resource.ConfigureRe return } - client, ok := req.ProviderData.(*sdk.Airbyte) + client, ok := req.ProviderData.(*sdk.SDK) if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Airbyte, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *sdk.SDK, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return @@ -150,6 +132,9 @@ func (r *SourceResource) Create(ctx context.Context, req resource.CreateRequest, res, err := r.client.Source.CreateSource(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -160,11 +145,11 @@ func (r *SourceResource) Create(ctx context.Context, req resource.CreateRequest, resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.InvalidInputExceptionInfo == nil { + if res.SourceRead == nil { resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) return } - data.RefreshFromCreateResponse(res.InvalidInputExceptionInfo) + data.RefreshFromCreateResponse(res.SourceRead) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) @@ -205,6 +190,9 @@ func (r *SourceResource) Update(ctx context.Context, req resource.UpdateRequest, res, err := r.client.Source.UpdateSource(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -215,11 +203,11 @@ func (r *SourceResource) Update(ctx context.Context, req resource.UpdateRequest, resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.InvalidInputExceptionInfo == nil { + if res.SourceRead == nil { resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) return } - data.RefreshFromUpdateResponse(res.InvalidInputExceptionInfo) + data.RefreshFromUpdateResponse(res.SourceRead) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) @@ -247,6 +235,9 @@ func (r *SourceResource) Delete(ctx context.Context, req resource.DeleteRequest, res, err := r.client.Source.DeleteSource(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { diff --git a/internal/provider/source_resource_sdk.go b/internal/provider/source_resource_sdk.go old mode 100755 new mode 100644 index 9c5eba5..e59208d --- a/internal/provider/source_resource_sdk.go +++ b/internal/provider/source_resource_sdk.go @@ -3,35 +3,49 @@ package provider import ( - "airbyte/internal/sdk/pkg/models/shared" "encoding/json" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) func (r *SourceResourceModel) ToCreateSDKType() *shared.SourceCreate { + sourceDefinitionID := r.SourceDefinitionID.ValueString() var connectionConfiguration interface{} _ = json.Unmarshal([]byte(r.ConnectionConfiguration.ValueString()), &connectionConfiguration) - name := r.Name.ValueString() - sourceDefinitionID := r.SourceDefinitionID.ValueString() workspaceID := r.WorkspaceID.ValueString() + name := r.Name.ValueString() + secretID := new(string) + if !r.SecretID.IsUnknown() && !r.SecretID.IsNull() { + *secretID = r.SecretID.ValueString() + } else { + secretID = nil + } out := shared.SourceCreate{ - ConnectionConfiguration: connectionConfiguration, - Name: name, SourceDefinitionID: sourceDefinitionID, + ConnectionConfiguration: connectionConfiguration, WorkspaceID: workspaceID, + Name: name, + SecretID: secretID, } return &out } func (r *SourceResourceModel) ToUpdateSDKType() *shared.SourceUpdate { + sourceID := r.SourceID.ValueString() var connectionConfiguration interface{} _ = json.Unmarshal([]byte(r.ConnectionConfiguration.ValueString()), &connectionConfiguration) name := r.Name.ValueString() - sourceID := r.SourceID.ValueString() + secretID := new(string) + if !r.SecretID.IsUnknown() && !r.SecretID.IsNull() { + *secretID = r.SecretID.ValueString() + } else { + secretID = nil + } out := shared.SourceUpdate{ + SourceID: sourceID, ConnectionConfiguration: connectionConfiguration, Name: name, - SourceID: sourceID, + SecretID: secretID, } return &out } @@ -44,35 +58,21 @@ func (r *SourceResourceModel) ToDeleteSDKType() *shared.SourceIDRequestBody { return &out } -func (r *SourceResourceModel) RefreshFromCreateResponse(resp *shared.InvalidInputExceptionInfo) { - if resp.ExceptionClassName != nil { - r.ExceptionClassName = types.StringValue(*resp.ExceptionClassName) +func (r *SourceResourceModel) RefreshFromCreateResponse(resp *shared.SourceRead) { + connectionConfigurationResult, _ := json.Marshal(resp.ConnectionConfiguration) + r.ConnectionConfiguration = types.StringValue(string(connectionConfigurationResult)) + if resp.Icon != nil { + r.Icon = types.StringValue(*resp.Icon) } else { - r.ExceptionClassName = types.StringNull() - } - r.ExceptionStack = nil - for _, v := range resp.ExceptionStack { - r.ExceptionStack = append(r.ExceptionStack, types.StringValue(v)) - } - r.Message = types.StringValue(resp.Message) - r.ValidationErrors = nil - for _, validationErrorsItem := range resp.ValidationErrors { - var validationErrors1 InvalidInputProperty - if validationErrorsItem.InvalidValue != nil { - validationErrors1.InvalidValue = types.StringValue(*validationErrorsItem.InvalidValue) - } else { - validationErrors1.InvalidValue = types.StringNull() - } - if validationErrorsItem.Message != nil { - validationErrors1.Message = types.StringValue(*validationErrorsItem.Message) - } else { - validationErrors1.Message = types.StringNull() - } - validationErrors1.PropertyPath = types.StringValue(validationErrorsItem.PropertyPath) - r.ValidationErrors = append(r.ValidationErrors, validationErrors1) + r.Icon = types.StringNull() } + r.Name = types.StringValue(resp.Name) + r.SourceDefinitionID = types.StringValue(resp.SourceDefinitionID) + r.SourceID = types.StringValue(resp.SourceID) + r.SourceName = types.StringValue(resp.SourceName) + r.WorkspaceID = types.StringValue(resp.WorkspaceID) } -func (r *SourceResourceModel) RefreshFromUpdateResponse(resp *shared.InvalidInputExceptionInfo) { +func (r *SourceResourceModel) RefreshFromUpdateResponse(resp *shared.SourceRead) { r.RefreshFromCreateResponse(resp) } diff --git a/internal/provider/sourcedefinition_resource.go b/internal/provider/sourcedefinition_resource.go old mode 100755 new mode 100644 index 0810b88..559d227 --- a/internal/provider/sourcedefinition_resource.go +++ b/internal/provider/sourcedefinition_resource.go @@ -3,10 +3,11 @@ package provider import ( - "airbyte/internal/sdk" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk" + "github.com/aballiet/terraform-provider-airbyte/internal/validators" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -29,19 +30,25 @@ func NewSourceDefinitionResource() resource.Resource { // SourceDefinitionResource defines the resource implementation. type SourceDefinitionResource struct { - client *sdk.Airbyte + client *sdk.SDK } // SourceDefinitionResourceModel describes the resource data model. type SourceDefinitionResourceModel struct { - DockerImageTag types.String `tfsdk:"docker_image_tag"` - ExceptionClassName types.String `tfsdk:"exception_class_name"` - ExceptionStack []types.String `tfsdk:"exception_stack"` - Message types.String `tfsdk:"message"` - SourceDefinition SourceDefinitionCreate `tfsdk:"source_definition"` - SourceDefinitionID types.String `tfsdk:"source_definition_id"` - ValidationErrors []InvalidInputProperty `tfsdk:"validation_errors"` - WorkspaceID types.String `tfsdk:"workspace_id"` + DockerImageTag types.String `tfsdk:"docker_image_tag"` + DockerRepository types.String `tfsdk:"docker_repository"` + DocumentationURL types.String `tfsdk:"documentation_url"` + Icon types.String `tfsdk:"icon"` + MaxSecondsBetweenMessages types.Int64 `tfsdk:"max_seconds_between_messages"` + Name types.String `tfsdk:"name"` + ProtocolVersion types.String `tfsdk:"protocol_version"` + ReleaseDate types.String `tfsdk:"release_date"` + ReleaseStage types.String `tfsdk:"release_stage"` + ResourceRequirements *ActorDefinitionResourceRequirements `tfsdk:"resource_requirements"` + SourceDefinition SourceDefinitionCreate `tfsdk:"source_definition"` + SourceDefinitionID types.String `tfsdk:"source_definition_id"` + SourceType types.String `tfsdk:"source_type"` + WorkspaceID types.String `tfsdk:"workspace_id"` } func (r *SourceDefinitionResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -54,18 +61,112 @@ func (r *SourceDefinitionResource) Schema(ctx context.Context, req resource.Sche Attributes: map[string]schema.Attribute{ "docker_image_tag": schema.StringAttribute{ - Required: true, + Computed: true, + }, + "docker_repository": schema.StringAttribute{ + Computed: true, + }, + "documentation_url": schema.StringAttribute{ + Computed: true, }, - "exception_class_name": schema.StringAttribute{ + "icon": schema.StringAttribute{ Computed: true, }, - "exception_stack": schema.ListAttribute{ + "max_seconds_between_messages": schema.Int64Attribute{ Computed: true, - ElementType: types.StringType, + Description: `Number of seconds allowed between 2 airbyte protocol messages. The source will timeout if this delay is reach`, }, - "message": schema.StringAttribute{ + "name": schema.StringAttribute{ Computed: true, }, + "protocol_version": schema.StringAttribute{ + Computed: true, + Description: `The Airbyte Protocol version supported by the connector`, + }, + "release_date": schema.StringAttribute{ + Computed: true, + Description: `The date when this connector was first released, in yyyy-mm-dd format.`, + Validators: []validator.String{ + validators.IsValidDate(), + }, + }, + "release_stage": schema.StringAttribute{ + Computed: true, + Description: `must be one of ["alpha", "beta", "generally_available", "custom"]`, + Validators: []validator.String{ + stringvalidator.OneOf( + "alpha", + "beta", + "generally_available", + "custom", + ), + }, + }, + "resource_requirements": schema.SingleNestedAttribute{ + Computed: true, + Attributes: map[string]schema.Attribute{ + "default": schema.SingleNestedAttribute{ + Computed: true, + Attributes: map[string]schema.Attribute{ + "cpu_limit": schema.StringAttribute{ + Computed: true, + }, + "cpu_request": schema.StringAttribute{ + Computed: true, + }, + "memory_limit": schema.StringAttribute{ + Computed: true, + }, + "memory_request": schema.StringAttribute{ + Computed: true, + }, + }, + Description: `optional resource requirements to run workers (blank for unbounded allocations)`, + }, + "job_specific": schema.ListNestedAttribute{ + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "job_type": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `must be one of ["get_spec", "check_connection", "discover_schema", "sync", "reset_connection", "connection_updater", "replicate"]` + "\n" + + `enum that describes the different types of jobs that the platform runs.`, + Validators: []validator.String{ + stringvalidator.OneOf( + "get_spec", + "check_connection", + "discover_schema", + "sync", + "reset_connection", + "connection_updater", + "replicate", + ), + }, + }, + "resource_requirements": schema.SingleNestedAttribute{ + Computed: true, + Attributes: map[string]schema.Attribute{ + "cpu_limit": schema.StringAttribute{ + Computed: true, + }, + "cpu_request": schema.StringAttribute{ + Computed: true, + }, + "memory_limit": schema.StringAttribute{ + Computed: true, + }, + "memory_request": schema.StringAttribute{ + Computed: true, + }, + }, + Description: `optional resource requirements to run workers (blank for unbounded allocations)`, + }, + }, + }, + }, + }, + Description: `actor definition specific resource requirements. if default is set, these are the requirements that should be set for ALL jobs run for this actor definition. it is overriden by the job type specific configurations. if not set, the platform will use defaults. these values will be overriden by configuration at the connection level.`, + }, "source_definition": schema.SingleNestedAttribute{ PlanModifiers: []planmodifier.Object{ objectplanmodifier.RequiresReplace(), @@ -153,6 +254,8 @@ func (r *SourceDefinitionResource) Schema(ctx context.Context, req resource.Sche stringplanmodifier.RequiresReplace(), }, Required: true, + MarkdownDescription: `must be one of ["get_spec", "check_connection", "discover_schema", "sync", "reset_connection", "connection_updater", "replicate"]` + "\n" + + `enum that describes the different types of jobs that the platform runs.`, Validators: []validator.String{ stringvalidator.OneOf( "get_spec", @@ -164,8 +267,6 @@ func (r *SourceDefinitionResource) Schema(ctx context.Context, req resource.Sche "replicate", ), }, - MarkdownDescription: `must be one of [get_spec, check_connection, discover_schema, sync, reset_connection, connection_updater, replicate]` + "\n" + - `enum that describes the different types of jobs that the platform runs.`, }, "resource_requirements": schema.SingleNestedAttribute{ PlanModifiers: []planmodifier.Object{ @@ -209,22 +310,18 @@ func (r *SourceDefinitionResource) Schema(ctx context.Context, req resource.Sche }, }, "source_definition_id": schema.StringAttribute{ - Required: true, - }, - "validation_errors": schema.ListNestedAttribute{ Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "invalid_value": schema.StringAttribute{ - Computed: true, - }, - "message": schema.StringAttribute{ - Computed: true, - }, - "property_path": schema.StringAttribute{ - Computed: true, - }, - }, + }, + "source_type": schema.StringAttribute{ + Computed: true, + Description: `must be one of ["api", "file", "database", "custom"]`, + Validators: []validator.String{ + stringvalidator.OneOf( + "api", + "file", + "database", + "custom", + ), }, }, "workspace_id": schema.StringAttribute{ @@ -243,12 +340,12 @@ func (r *SourceDefinitionResource) Configure(ctx context.Context, req resource.C return } - client, ok := req.ProviderData.(*sdk.Airbyte) + client, ok := req.ProviderData.(*sdk.SDK) if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Airbyte, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *sdk.SDK, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return @@ -275,10 +372,13 @@ func (r *SourceDefinitionResource) Create(ctx context.Context, req resource.Crea return } - request := *data.ToCreateSDKType() + request := data.ToCreateSDKType() res, err := r.client.SourceDefinition.CreateCustomSourceDefinition(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -289,11 +389,11 @@ func (r *SourceDefinitionResource) Create(ctx context.Context, req resource.Crea resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.InvalidInputExceptionInfo == nil { + if res.SourceDefinitionRead == nil { resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) return } - data.RefreshFromCreateResponse(res.InvalidInputExceptionInfo) + data.RefreshFromCreateResponse(res.SourceDefinitionRead) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) @@ -330,10 +430,13 @@ func (r *SourceDefinitionResource) Update(ctx context.Context, req resource.Upda return } - request := *data.ToUpdateSDKType() + request := data.ToUpdateSDKType() res, err := r.client.SourceDefinition.UpdateSourceDefinition(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -344,11 +447,11 @@ func (r *SourceDefinitionResource) Update(ctx context.Context, req resource.Upda resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.InvalidInputExceptionInfo == nil { + if res.SourceDefinitionRead == nil { resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) return } - data.RefreshFromUpdateResponse(res.InvalidInputExceptionInfo) + data.RefreshFromUpdateResponse(res.SourceDefinitionRead) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) @@ -376,6 +479,9 @@ func (r *SourceDefinitionResource) Delete(ctx context.Context, req resource.Dele res, err := r.client.SourceDefinition.DeleteSourceDefinition(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { diff --git a/internal/provider/sourcedefinition_resource_sdk.go b/internal/provider/sourcedefinition_resource_sdk.go old mode 100755 new mode 100644 index 5e783f4..422ed72 --- a/internal/provider/sourcedefinition_resource_sdk.go +++ b/internal/provider/sourcedefinition_resource_sdk.go @@ -3,13 +3,15 @@ package provider import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) func (r *SourceDefinitionResourceModel) ToCreateSDKType() *shared.CustomSourceDefinitionCreate { - dockerImageTag := r.SourceDefinition.DockerImageTag.ValueString() + workspaceID := r.WorkspaceID.ValueString() + name := r.SourceDefinition.Name.ValueString() dockerRepository := r.SourceDefinition.DockerRepository.ValueString() + dockerImageTag := r.SourceDefinition.DockerImageTag.ValueString() documentationURL := r.SourceDefinition.DocumentationURL.ValueString() icon := new(string) if !r.SourceDefinition.Icon.IsUnknown() && !r.SourceDefinition.Icon.IsNull() { @@ -17,28 +19,21 @@ func (r *SourceDefinitionResourceModel) ToCreateSDKType() *shared.CustomSourceDe } else { icon = nil } - name := r.SourceDefinition.Name.ValueString() var resourceRequirements *shared.ActorDefinitionResourceRequirements if r.SourceDefinition.ResourceRequirements != nil { - var default1 *shared.ResourceRequirements + var defaultVar *shared.ResourceRequirements if r.SourceDefinition.ResourceRequirements.Default != nil { - cpuLimit := new(string) - if !r.SourceDefinition.ResourceRequirements.Default.CPULimit.IsUnknown() && !r.SourceDefinition.ResourceRequirements.Default.CPULimit.IsNull() { - *cpuLimit = r.SourceDefinition.ResourceRequirements.Default.CPULimit.ValueString() - } else { - cpuLimit = nil - } cpuRequest := new(string) if !r.SourceDefinition.ResourceRequirements.Default.CPURequest.IsUnknown() && !r.SourceDefinition.ResourceRequirements.Default.CPURequest.IsNull() { *cpuRequest = r.SourceDefinition.ResourceRequirements.Default.CPURequest.ValueString() } else { cpuRequest = nil } - memoryLimit := new(string) - if !r.SourceDefinition.ResourceRequirements.Default.MemoryLimit.IsUnknown() && !r.SourceDefinition.ResourceRequirements.Default.MemoryLimit.IsNull() { - *memoryLimit = r.SourceDefinition.ResourceRequirements.Default.MemoryLimit.ValueString() + cpuLimit := new(string) + if !r.SourceDefinition.ResourceRequirements.Default.CPULimit.IsUnknown() && !r.SourceDefinition.ResourceRequirements.Default.CPULimit.IsNull() { + *cpuLimit = r.SourceDefinition.ResourceRequirements.Default.CPULimit.ValueString() } else { - memoryLimit = nil + cpuLimit = nil } memoryRequest := new(string) if !r.SourceDefinition.ResourceRequirements.Default.MemoryRequest.IsUnknown() && !r.SourceDefinition.ResourceRequirements.Default.MemoryRequest.IsNull() { @@ -46,33 +41,33 @@ func (r *SourceDefinitionResourceModel) ToCreateSDKType() *shared.CustomSourceDe } else { memoryRequest = nil } - default1 = &shared.ResourceRequirements{ - CPULimit: cpuLimit, + memoryLimit := new(string) + if !r.SourceDefinition.ResourceRequirements.Default.MemoryLimit.IsUnknown() && !r.SourceDefinition.ResourceRequirements.Default.MemoryLimit.IsNull() { + *memoryLimit = r.SourceDefinition.ResourceRequirements.Default.MemoryLimit.ValueString() + } else { + memoryLimit = nil + } + defaultVar = &shared.ResourceRequirements{ CPURequest: cpuRequest, - MemoryLimit: memoryLimit, + CPULimit: cpuLimit, MemoryRequest: memoryRequest, + MemoryLimit: memoryLimit, } } - jobSpecific := make([]shared.JobTypeResourceLimit, 0) + var jobSpecific []shared.JobTypeResourceLimit = nil for _, jobSpecificItem := range r.SourceDefinition.ResourceRequirements.JobSpecific { jobType := shared.JobType(jobSpecificItem.JobType.ValueString()) - cpuLimit1 := new(string) - if !jobSpecificItem.ResourceRequirements.CPULimit.IsUnknown() && !jobSpecificItem.ResourceRequirements.CPULimit.IsNull() { - *cpuLimit1 = jobSpecificItem.ResourceRequirements.CPULimit.ValueString() - } else { - cpuLimit1 = nil - } cpuRequest1 := new(string) if !jobSpecificItem.ResourceRequirements.CPURequest.IsUnknown() && !jobSpecificItem.ResourceRequirements.CPURequest.IsNull() { *cpuRequest1 = jobSpecificItem.ResourceRequirements.CPURequest.ValueString() } else { cpuRequest1 = nil } - memoryLimit1 := new(string) - if !jobSpecificItem.ResourceRequirements.MemoryLimit.IsUnknown() && !jobSpecificItem.ResourceRequirements.MemoryLimit.IsNull() { - *memoryLimit1 = jobSpecificItem.ResourceRequirements.MemoryLimit.ValueString() + cpuLimit1 := new(string) + if !jobSpecificItem.ResourceRequirements.CPULimit.IsUnknown() && !jobSpecificItem.ResourceRequirements.CPULimit.IsNull() { + *cpuLimit1 = jobSpecificItem.ResourceRequirements.CPULimit.ValueString() } else { - memoryLimit1 = nil + cpuLimit1 = nil } memoryRequest1 := new(string) if !jobSpecificItem.ResourceRequirements.MemoryRequest.IsUnknown() && !jobSpecificItem.ResourceRequirements.MemoryRequest.IsNull() { @@ -80,11 +75,17 @@ func (r *SourceDefinitionResourceModel) ToCreateSDKType() *shared.CustomSourceDe } else { memoryRequest1 = nil } + memoryLimit1 := new(string) + if !jobSpecificItem.ResourceRequirements.MemoryLimit.IsUnknown() && !jobSpecificItem.ResourceRequirements.MemoryLimit.IsNull() { + *memoryLimit1 = jobSpecificItem.ResourceRequirements.MemoryLimit.ValueString() + } else { + memoryLimit1 = nil + } resourceRequirements1 := shared.ResourceRequirements{ - CPULimit: cpuLimit1, CPURequest: cpuRequest1, - MemoryLimit: memoryLimit1, + CPULimit: cpuLimit1, MemoryRequest: memoryRequest1, + MemoryLimit: memoryLimit1, } jobSpecific = append(jobSpecific, shared.JobTypeResourceLimit{ JobType: jobType, @@ -92,32 +93,110 @@ func (r *SourceDefinitionResourceModel) ToCreateSDKType() *shared.CustomSourceDe }) } resourceRequirements = &shared.ActorDefinitionResourceRequirements{ - Default: default1, + Default: defaultVar, JobSpecific: jobSpecific, } } sourceDefinition := shared.SourceDefinitionCreate{ - DockerImageTag: dockerImageTag, + Name: name, DockerRepository: dockerRepository, + DockerImageTag: dockerImageTag, DocumentationURL: documentationURL, Icon: icon, - Name: name, ResourceRequirements: resourceRequirements, } - workspaceID := r.WorkspaceID.ValueString() out := shared.CustomSourceDefinitionCreate{ - SourceDefinition: sourceDefinition, WorkspaceID: workspaceID, + SourceDefinition: sourceDefinition, } return &out } func (r *SourceDefinitionResourceModel) ToUpdateSDKType() *shared.SourceDefinitionUpdate { - dockerImageTag := r.DockerImageTag.ValueString() sourceDefinitionID := r.SourceDefinitionID.ValueString() + dockerImageTag := r.DockerImageTag.ValueString() + var resourceRequirements *shared.ActorDefinitionResourceRequirements + if r.ResourceRequirements != nil { + var defaultVar *shared.ResourceRequirements + if r.ResourceRequirements.Default != nil { + cpuRequest := new(string) + if !r.ResourceRequirements.Default.CPURequest.IsUnknown() && !r.ResourceRequirements.Default.CPURequest.IsNull() { + *cpuRequest = r.ResourceRequirements.Default.CPURequest.ValueString() + } else { + cpuRequest = nil + } + cpuLimit := new(string) + if !r.ResourceRequirements.Default.CPULimit.IsUnknown() && !r.ResourceRequirements.Default.CPULimit.IsNull() { + *cpuLimit = r.ResourceRequirements.Default.CPULimit.ValueString() + } else { + cpuLimit = nil + } + memoryRequest := new(string) + if !r.ResourceRequirements.Default.MemoryRequest.IsUnknown() && !r.ResourceRequirements.Default.MemoryRequest.IsNull() { + *memoryRequest = r.ResourceRequirements.Default.MemoryRequest.ValueString() + } else { + memoryRequest = nil + } + memoryLimit := new(string) + if !r.ResourceRequirements.Default.MemoryLimit.IsUnknown() && !r.ResourceRequirements.Default.MemoryLimit.IsNull() { + *memoryLimit = r.ResourceRequirements.Default.MemoryLimit.ValueString() + } else { + memoryLimit = nil + } + defaultVar = &shared.ResourceRequirements{ + CPURequest: cpuRequest, + CPULimit: cpuLimit, + MemoryRequest: memoryRequest, + MemoryLimit: memoryLimit, + } + } + var jobSpecific []shared.JobTypeResourceLimit = nil + for _, jobSpecificItem := range r.ResourceRequirements.JobSpecific { + jobType := shared.JobType(jobSpecificItem.JobType.ValueString()) + cpuRequest1 := new(string) + if !jobSpecificItem.ResourceRequirements.CPURequest.IsUnknown() && !jobSpecificItem.ResourceRequirements.CPURequest.IsNull() { + *cpuRequest1 = jobSpecificItem.ResourceRequirements.CPURequest.ValueString() + } else { + cpuRequest1 = nil + } + cpuLimit1 := new(string) + if !jobSpecificItem.ResourceRequirements.CPULimit.IsUnknown() && !jobSpecificItem.ResourceRequirements.CPULimit.IsNull() { + *cpuLimit1 = jobSpecificItem.ResourceRequirements.CPULimit.ValueString() + } else { + cpuLimit1 = nil + } + memoryRequest1 := new(string) + if !jobSpecificItem.ResourceRequirements.MemoryRequest.IsUnknown() && !jobSpecificItem.ResourceRequirements.MemoryRequest.IsNull() { + *memoryRequest1 = jobSpecificItem.ResourceRequirements.MemoryRequest.ValueString() + } else { + memoryRequest1 = nil + } + memoryLimit1 := new(string) + if !jobSpecificItem.ResourceRequirements.MemoryLimit.IsUnknown() && !jobSpecificItem.ResourceRequirements.MemoryLimit.IsNull() { + *memoryLimit1 = jobSpecificItem.ResourceRequirements.MemoryLimit.ValueString() + } else { + memoryLimit1 = nil + } + resourceRequirements1 := shared.ResourceRequirements{ + CPURequest: cpuRequest1, + CPULimit: cpuLimit1, + MemoryRequest: memoryRequest1, + MemoryLimit: memoryLimit1, + } + jobSpecific = append(jobSpecific, shared.JobTypeResourceLimit{ + JobType: jobType, + ResourceRequirements: resourceRequirements1, + }) + } + resourceRequirements = &shared.ActorDefinitionResourceRequirements{ + Default: defaultVar, + JobSpecific: jobSpecific, + } + } out := shared.SourceDefinitionUpdate{ - DockerImageTag: dockerImageTag, - SourceDefinitionID: sourceDefinitionID, + SourceDefinitionID: sourceDefinitionID, + DockerImageTag: dockerImageTag, + ResourceRequirements: resourceRequirements, } return &out } @@ -130,35 +209,111 @@ func (r *SourceDefinitionResourceModel) ToDeleteSDKType() *shared.SourceDefiniti return &out } -func (r *SourceDefinitionResourceModel) RefreshFromCreateResponse(resp *shared.InvalidInputExceptionInfo) { - if resp.ExceptionClassName != nil { - r.ExceptionClassName = types.StringValue(*resp.ExceptionClassName) +func (r *SourceDefinitionResourceModel) RefreshFromCreateResponse(resp *shared.SourceDefinitionRead) { + r.DockerImageTag = types.StringValue(resp.DockerImageTag) + r.DockerRepository = types.StringValue(resp.DockerRepository) + if resp.DocumentationURL != nil { + r.DocumentationURL = types.StringValue(*resp.DocumentationURL) + } else { + r.DocumentationURL = types.StringNull() + } + if resp.Icon != nil { + r.Icon = types.StringValue(*resp.Icon) } else { - r.ExceptionClassName = types.StringNull() + r.Icon = types.StringNull() } - r.ExceptionStack = nil - for _, v := range resp.ExceptionStack { - r.ExceptionStack = append(r.ExceptionStack, types.StringValue(v)) + if resp.MaxSecondsBetweenMessages != nil { + r.MaxSecondsBetweenMessages = types.Int64Value(*resp.MaxSecondsBetweenMessages) + } else { + r.MaxSecondsBetweenMessages = types.Int64Null() + } + r.Name = types.StringValue(resp.Name) + if resp.ProtocolVersion != nil { + r.ProtocolVersion = types.StringValue(*resp.ProtocolVersion) + } else { + r.ProtocolVersion = types.StringNull() + } + if resp.ReleaseDate != nil { + r.ReleaseDate = types.StringValue(resp.ReleaseDate.String()) + } else { + r.ReleaseDate = types.StringNull() } - r.Message = types.StringValue(resp.Message) - r.ValidationErrors = nil - for _, validationErrorsItem := range resp.ValidationErrors { - var validationErrors1 InvalidInputProperty - if validationErrorsItem.InvalidValue != nil { - validationErrors1.InvalidValue = types.StringValue(*validationErrorsItem.InvalidValue) + if resp.ReleaseStage != nil { + r.ReleaseStage = types.StringValue(string(*resp.ReleaseStage)) + } else { + r.ReleaseStage = types.StringNull() + } + if resp.ResourceRequirements == nil { + r.ResourceRequirements = nil + } else { + r.ResourceRequirements = &ActorDefinitionResourceRequirements{} + if resp.ResourceRequirements.Default == nil { + r.ResourceRequirements.Default = nil } else { - validationErrors1.InvalidValue = types.StringNull() + r.ResourceRequirements.Default = &ResourceRequirements{} + if resp.ResourceRequirements.Default.CPULimit != nil { + r.ResourceRequirements.Default.CPULimit = types.StringValue(*resp.ResourceRequirements.Default.CPULimit) + } else { + r.ResourceRequirements.Default.CPULimit = types.StringNull() + } + if resp.ResourceRequirements.Default.CPURequest != nil { + r.ResourceRequirements.Default.CPURequest = types.StringValue(*resp.ResourceRequirements.Default.CPURequest) + } else { + r.ResourceRequirements.Default.CPURequest = types.StringNull() + } + if resp.ResourceRequirements.Default.MemoryLimit != nil { + r.ResourceRequirements.Default.MemoryLimit = types.StringValue(*resp.ResourceRequirements.Default.MemoryLimit) + } else { + r.ResourceRequirements.Default.MemoryLimit = types.StringNull() + } + if resp.ResourceRequirements.Default.MemoryRequest != nil { + r.ResourceRequirements.Default.MemoryRequest = types.StringValue(*resp.ResourceRequirements.Default.MemoryRequest) + } else { + r.ResourceRequirements.Default.MemoryRequest = types.StringNull() + } } - if validationErrorsItem.Message != nil { - validationErrors1.Message = types.StringValue(*validationErrorsItem.Message) - } else { - validationErrors1.Message = types.StringNull() + if len(r.ResourceRequirements.JobSpecific) > len(resp.ResourceRequirements.JobSpecific) { + r.ResourceRequirements.JobSpecific = r.ResourceRequirements.JobSpecific[:len(resp.ResourceRequirements.JobSpecific)] + } + for jobSpecificCount, jobSpecificItem := range resp.ResourceRequirements.JobSpecific { + var jobSpecific1 JobTypeResourceLimit + jobSpecific1.JobType = types.StringValue(string(jobSpecificItem.JobType)) + if jobSpecificItem.ResourceRequirements.CPULimit != nil { + jobSpecific1.ResourceRequirements.CPULimit = types.StringValue(*jobSpecificItem.ResourceRequirements.CPULimit) + } else { + jobSpecific1.ResourceRequirements.CPULimit = types.StringNull() + } + if jobSpecificItem.ResourceRequirements.CPURequest != nil { + jobSpecific1.ResourceRequirements.CPURequest = types.StringValue(*jobSpecificItem.ResourceRequirements.CPURequest) + } else { + jobSpecific1.ResourceRequirements.CPURequest = types.StringNull() + } + if jobSpecificItem.ResourceRequirements.MemoryLimit != nil { + jobSpecific1.ResourceRequirements.MemoryLimit = types.StringValue(*jobSpecificItem.ResourceRequirements.MemoryLimit) + } else { + jobSpecific1.ResourceRequirements.MemoryLimit = types.StringNull() + } + if jobSpecificItem.ResourceRequirements.MemoryRequest != nil { + jobSpecific1.ResourceRequirements.MemoryRequest = types.StringValue(*jobSpecificItem.ResourceRequirements.MemoryRequest) + } else { + jobSpecific1.ResourceRequirements.MemoryRequest = types.StringNull() + } + if jobSpecificCount+1 > len(r.ResourceRequirements.JobSpecific) { + r.ResourceRequirements.JobSpecific = append(r.ResourceRequirements.JobSpecific, jobSpecific1) + } else { + r.ResourceRequirements.JobSpecific[jobSpecificCount].JobType = jobSpecific1.JobType + r.ResourceRequirements.JobSpecific[jobSpecificCount].ResourceRequirements = jobSpecific1.ResourceRequirements + } } - validationErrors1.PropertyPath = types.StringValue(validationErrorsItem.PropertyPath) - r.ValidationErrors = append(r.ValidationErrors, validationErrors1) + } + r.SourceDefinitionID = types.StringValue(resp.SourceDefinitionID) + if resp.SourceType != nil { + r.SourceType = types.StringValue(string(*resp.SourceType)) + } else { + r.SourceType = types.StringNull() } } -func (r *SourceDefinitionResourceModel) RefreshFromUpdateResponse(resp *shared.InvalidInputExceptionInfo) { +func (r *SourceDefinitionResourceModel) RefreshFromUpdateResponse(resp *shared.SourceDefinitionRead) { r.RefreshFromCreateResponse(resp) } diff --git a/internal/provider/sourcedefinitionmanifest_resource.go b/internal/provider/sourcedefinitionmanifest_resource.go old mode 100755 new mode 100644 index 5009ee5..52b449a --- a/internal/provider/sourcedefinitionmanifest_resource.go +++ b/internal/provider/sourcedefinitionmanifest_resource.go @@ -3,9 +3,9 @@ package provider import ( - "airbyte/internal/sdk" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -28,7 +28,7 @@ func NewSourceDefinitionManifestResource() resource.Resource { // SourceDefinitionManifestResource defines the resource implementation. type SourceDefinitionManifestResource struct { - client *sdk.Airbyte + client *sdk.SDK } // SourceDefinitionManifestResourceModel describes the resource data model. @@ -41,6 +41,8 @@ type SourceDefinitionManifestResourceModel struct { RootCauseExceptionClassName types.String `tfsdk:"root_cause_exception_class_name"` RootCauseExceptionStack []types.String `tfsdk:"root_cause_exception_stack"` SetAsActiveManifest types.Bool `tfsdk:"set_as_active_manifest"` + SourceDefinitionID types.String `tfsdk:"source_definition_id"` + WorkspaceID types.String `tfsdk:"workspace_id"` } func (r *SourceDefinitionManifestResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -114,6 +116,12 @@ func (r *SourceDefinitionManifestResource) Schema(ctx context.Context, req resou }, Required: true, }, + "source_definition_id": schema.StringAttribute{ + Required: true, + }, + "workspace_id": schema.StringAttribute{ + Required: true, + }, }, } } @@ -124,12 +132,12 @@ func (r *SourceDefinitionManifestResource) Configure(ctx context.Context, req re return } - client, ok := req.ProviderData.(*sdk.Airbyte) + client, ok := req.ProviderData.(*sdk.SDK) if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Airbyte, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *sdk.SDK, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return @@ -160,6 +168,9 @@ func (r *SourceDefinitionManifestResource) Create(ctx context.Context, req resou res, err := r.client.DeclarativeSourceDefinitions.CreateDeclarativeSourceDefinitionManifest(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -215,6 +226,9 @@ func (r *SourceDefinitionManifestResource) Update(ctx context.Context, req resou res, err := r.client.DeclarativeSourceDefinitions.UpdateDeclarativeManifestVersion(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { diff --git a/internal/provider/sourcedefinitionmanifest_resource_sdk.go b/internal/provider/sourcedefinitionmanifest_resource_sdk.go old mode 100755 new mode 100644 index f149d85..025483e --- a/internal/provider/sourcedefinitionmanifest_resource_sdk.go +++ b/internal/provider/sourcedefinitionmanifest_resource_sdk.go @@ -3,11 +3,14 @@ package provider import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) func (r *SourceDefinitionManifestResourceModel) ToCreateSDKType() *shared.DeclarativeSourceDefinitionCreateManifestRequestBody { + workspaceID := r.WorkspaceID.ValueString() + sourceDefinitionID := r.SourceDefinitionID.ValueString() + setAsActiveManifest := r.SetAsActiveManifest.ValueBool() description := r.DeclarativeManifest.Description.ValueString() manifest := shared.DeclarativeManifest{} spec := shared.SourceDefinitionSpecification{} @@ -18,16 +21,22 @@ func (r *SourceDefinitionManifestResourceModel) ToCreateSDKType() *shared.Declar Spec: spec, Version: version, } - setAsActiveManifest := r.SetAsActiveManifest.ValueBool() out := shared.DeclarativeSourceDefinitionCreateManifestRequestBody{ - DeclarativeManifest: declarativeManifest, + WorkspaceID: workspaceID, + SourceDefinitionID: sourceDefinitionID, SetAsActiveManifest: setAsActiveManifest, + DeclarativeManifest: declarativeManifest, } return &out } func (r *SourceDefinitionManifestResourceModel) ToUpdateSDKType() *shared.UpdateActiveManifestRequestBody { - out := shared.UpdateActiveManifestRequestBody{} + workspaceID := r.WorkspaceID.ValueString() + sourceDefinitionID := r.SourceDefinitionID.ValueString() + out := shared.UpdateActiveManifestRequestBody{ + WorkspaceID: workspaceID, + SourceDefinitionID: sourceDefinitionID, + } return &out } diff --git a/internal/provider/type_actor_definition_resource_requirements.go b/internal/provider/type_actor_definition_resource_requirements.go old mode 100755 new mode 100644 index 823a82b..cf3c2d0 --- a/internal/provider/type_actor_definition_resource_requirements.go +++ b/internal/provider/type_actor_definition_resource_requirements.go @@ -3,6 +3,6 @@ package provider type ActorDefinitionResourceRequirements struct { - Default *ResourceRequirements1 `tfsdk:"default"` + Default *ResourceRequirements `tfsdk:"default"` JobSpecific []JobTypeResourceLimit `tfsdk:"job_specific"` } diff --git a/internal/provider/type_airbyte_catalog.go b/internal/provider/type_airbyte_catalog.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_airbyte_stream.go b/internal/provider/type_airbyte_stream.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_airbyte_stream_and_configuration.go b/internal/provider/type_airbyte_stream_and_configuration.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_airbyte_stream_configuration.go b/internal/provider/type_airbyte_stream_configuration.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_connection_schedule.go b/internal/provider/type_connection_schedule.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_connection_schedule_data.go b/internal/provider/type_connection_schedule_data.go old mode 100755 new mode 100644 index 3cc8e01..566b5e6 --- a/internal/provider/type_connection_schedule_data.go +++ b/internal/provider/type_connection_schedule_data.go @@ -3,6 +3,6 @@ package provider type ConnectionScheduleData struct { - BasicSchedule *ConnectionScheduleDataBasicSchedule `tfsdk:"basic_schedule"` - Cron *ConnectionScheduleDataCron `tfsdk:"cron"` + BasicSchedule *ConnectionSchedule `tfsdk:"basic_schedule"` + Cron *Cron `tfsdk:"cron"` } diff --git a/internal/provider/type_connection_schedule_data_basic_schedule.go b/internal/provider/type_connection_schedule_data_basic_schedule.go deleted file mode 100755 index 28a94fc..0000000 --- a/internal/provider/type_connection_schedule_data_basic_schedule.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ConnectionScheduleDataBasicSchedule struct { - TimeUnit types.String `tfsdk:"time_unit"` - Units types.Int64 `tfsdk:"units"` -} diff --git a/internal/provider/type_connection_schedule_data_cron.go b/internal/provider/type_cron.go old mode 100755 new mode 100644 similarity index 86% rename from internal/provider/type_connection_schedule_data_cron.go rename to internal/provider/type_cron.go index 75822d5..7ac4e1f --- a/internal/provider/type_connection_schedule_data_cron.go +++ b/internal/provider/type_cron.go @@ -4,7 +4,7 @@ package provider import "github.com/hashicorp/terraform-plugin-framework/types" -type ConnectionScheduleDataCron struct { +type Cron struct { CronExpression types.String `tfsdk:"cron_expression"` CronTimeZone types.String `tfsdk:"cron_time_zone"` } diff --git a/internal/provider/type_customerio_notification_configuration.go b/internal/provider/type_customerio_notification_configuration.go deleted file mode 100755 index b9a5a0e..0000000 --- a/internal/provider/type_customerio_notification_configuration.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -type CustomerioNotificationConfiguration struct { -} diff --git a/internal/provider/type_declarative_manifest.go b/internal/provider/type_declarative_manifest.go deleted file mode 100755 index 74a2ac8..0000000 --- a/internal/provider/type_declarative_manifest.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -type DeclarativeManifest struct { -} diff --git a/internal/provider/type_declarative_source_manifest.go b/internal/provider/type_declarative_source_manifest.go old mode 100755 new mode 100644 index ee13237..5edef62 --- a/internal/provider/type_declarative_source_manifest.go +++ b/internal/provider/type_declarative_source_manifest.go @@ -5,8 +5,8 @@ package provider import "github.com/hashicorp/terraform-plugin-framework/types" type DeclarativeSourceManifest struct { - Description types.String `tfsdk:"description"` - Manifest DeclarativeManifest `tfsdk:"manifest"` - Spec SourceDefinitionSpecification `tfsdk:"spec"` - Version types.Int64 `tfsdk:"version"` + Description types.String `tfsdk:"description"` + Manifest StreamJSONSchema `tfsdk:"manifest"` + Spec StreamJSONSchema `tfsdk:"spec"` + Version types.Int64 `tfsdk:"version"` } diff --git a/internal/provider/type_invalid_input_property.go b/internal/provider/type_invalid_input_property.go deleted file mode 100755 index 9886e90..0000000 --- a/internal/provider/type_invalid_input_property.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type InvalidInputProperty struct { - InvalidValue types.String `tfsdk:"invalid_value"` - Message types.String `tfsdk:"message"` - PropertyPath types.String `tfsdk:"property_path"` -} diff --git a/internal/provider/type_job_type_resource_limit.go b/internal/provider/type_job_type_resource_limit.go old mode 100755 new mode 100644 index d63086c..1f9bf60 --- a/internal/provider/type_job_type_resource_limit.go +++ b/internal/provider/type_job_type_resource_limit.go @@ -5,6 +5,6 @@ package provider import "github.com/hashicorp/terraform-plugin-framework/types" type JobTypeResourceLimit struct { - JobType types.String `tfsdk:"job_type"` - ResourceRequirements ResourceRequirements1 `tfsdk:"resource_requirements"` + JobType types.String `tfsdk:"job_type"` + ResourceRequirements ResourceRequirements `tfsdk:"resource_requirements"` } diff --git a/internal/provider/type_notification.go b/internal/provider/type_notification.go old mode 100755 new mode 100644 index 4c85ec3..5a8953b --- a/internal/provider/type_notification.go +++ b/internal/provider/type_notification.go @@ -5,9 +5,9 @@ package provider import "github.com/hashicorp/terraform-plugin-framework/types" type Notification struct { - CustomerioConfiguration *CustomerioNotificationConfiguration `tfsdk:"customerio_configuration"` - NotificationType types.String `tfsdk:"notification_type"` - SendOnFailure types.Bool `tfsdk:"send_on_failure"` - SendOnSuccess types.Bool `tfsdk:"send_on_success"` - SlackConfiguration *SlackNotificationConfiguration `tfsdk:"slack_configuration"` + CustomerioConfiguration *StreamJSONSchema `tfsdk:"customerio_configuration"` + NotificationType types.String `tfsdk:"notification_type"` + SendOnFailure types.Bool `tfsdk:"send_on_failure"` + SendOnSuccess types.Bool `tfsdk:"send_on_success"` + SlackConfiguration *SlackNotificationConfiguration `tfsdk:"slack_configuration"` } diff --git a/internal/provider/type_notification_item.go b/internal/provider/type_notification_item.go new file mode 100644 index 0000000..625c92a --- /dev/null +++ b/internal/provider/type_notification_item.go @@ -0,0 +1,11 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package provider + +import "github.com/hashicorp/terraform-plugin-framework/types" + +type NotificationItem struct { + CustomerioConfiguration *StreamJSONSchema `tfsdk:"customerio_configuration"` + NotificationType []types.String `tfsdk:"notification_type"` + SlackConfiguration *SlackNotificationConfiguration `tfsdk:"slack_configuration"` +} diff --git a/internal/provider/type_notification_settings.go b/internal/provider/type_notification_settings.go new file mode 100644 index 0000000..47f98ac --- /dev/null +++ b/internal/provider/type_notification_settings.go @@ -0,0 +1,12 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package provider + +type NotificationSettings struct { + SendOnConnectionUpdate *NotificationItem `tfsdk:"send_on_connection_update"` + SendOnConnectionUpdateActionRequired *NotificationItem `tfsdk:"send_on_connection_update_action_required"` + SendOnFailure *NotificationItem `tfsdk:"send_on_failure"` + SendOnSuccess *NotificationItem `tfsdk:"send_on_success"` + SendOnSyncDisabled *NotificationItem `tfsdk:"send_on_sync_disabled"` + SendOnSyncDisabledWarning *NotificationItem `tfsdk:"send_on_sync_disabled_warning"` +} diff --git a/internal/provider/type_resource_requirements.go b/internal/provider/type_resource_requirements.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_resource_requirements1.go b/internal/provider/type_resource_requirements1.go deleted file mode 100755 index 6ff72dd..0000000 --- a/internal/provider/type_resource_requirements1.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type ResourceRequirements1 struct { - CPULimit types.String `tfsdk:"cpu_limit"` - CPURequest types.String `tfsdk:"cpu_request"` - MemoryLimit types.String `tfsdk:"memory_limit"` - MemoryRequest types.String `tfsdk:"memory_request"` -} diff --git a/internal/provider/type_selected_field_info.go b/internal/provider/type_selected_field_info.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_slack_notification_configuration.go b/internal/provider/type_slack_notification_configuration.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_source_definition_create.go b/internal/provider/type_source_definition_create.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_source_definition_specification.go b/internal/provider/type_source_definition_specification.go deleted file mode 100755 index 32fc320..0000000 --- a/internal/provider/type_source_definition_specification.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -type SourceDefinitionSpecification struct { -} diff --git a/internal/provider/type_stream_json_schema.go b/internal/provider/type_stream_json_schema.go old mode 100755 new mode 100644 diff --git a/internal/provider/type_webhook_config_read.go b/internal/provider/type_webhook_config_read.go new file mode 100644 index 0000000..5658655 --- /dev/null +++ b/internal/provider/type_webhook_config_read.go @@ -0,0 +1,12 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package provider + +import "github.com/hashicorp/terraform-plugin-framework/types" + +type WebhookConfigRead struct { + AuthToken types.String `tfsdk:"auth_token"` + ID types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + ValidationURL types.String `tfsdk:"validation_url"` +} diff --git a/internal/provider/type_webhook_config_write.go b/internal/provider/type_webhook_config_write.go deleted file mode 100755 index a31760a..0000000 --- a/internal/provider/type_webhook_config_write.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package provider - -import "github.com/hashicorp/terraform-plugin-framework/types" - -type WebhookConfigWrite struct { - Name types.String `tfsdk:"name"` -} diff --git a/internal/provider/utils.go b/internal/provider/utils.go old mode 100755 new mode 100644 index e0b3617..cc623ed --- a/internal/provider/utils.go +++ b/internal/provider/utils.go @@ -3,10 +3,10 @@ package provider import ( - tfReflect "airbyte/internal/provider/reflect" "context" "encoding/json" "fmt" + tfReflect "github.com/aballiet/terraform-provider-airbyte/internal/provider/reflect" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -18,9 +18,12 @@ import ( ) func debugResponse(response *http.Response) string { - dumpReq, err := httputil.DumpRequest(response.Request, false) + dumpReq, err := httputil.DumpRequest(response.Request, true) if err != nil { - return err.Error() + dumpReq, err = httputil.DumpRequest(response.Request, false) + if err != nil { + return err.Error() + } } dumpRes, err := httputil.DumpResponse(response, true) if err != nil { diff --git a/internal/provider/workspace_resource.go b/internal/provider/workspace_resource.go old mode 100755 new mode 100644 index 8bc2b86..1b29cf4 --- a/internal/provider/workspace_resource.go +++ b/internal/provider/workspace_resource.go @@ -3,9 +3,9 @@ package provider import ( - "airbyte/internal/sdk" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -27,26 +27,27 @@ func NewWorkspaceResource() resource.Resource { // WorkspaceResource defines the resource implementation. type WorkspaceResource struct { - client *sdk.Airbyte + client *sdk.SDK } // WorkspaceResourceModel describes the resource data model. type WorkspaceResourceModel struct { - AnonymousDataCollection types.Bool `tfsdk:"anonymous_data_collection"` - DefaultGeography types.String `tfsdk:"default_geography"` - DisplaySetupWizard types.Bool `tfsdk:"display_setup_wizard"` - Email types.String `tfsdk:"email"` - ExceptionClassName types.String `tfsdk:"exception_class_name"` - ExceptionStack []types.String `tfsdk:"exception_stack"` - InitialSetupComplete types.Bool `tfsdk:"initial_setup_complete"` - Message types.String `tfsdk:"message"` - Name types.String `tfsdk:"name"` - News types.Bool `tfsdk:"news"` - Notifications []Notification `tfsdk:"notifications"` - SecurityUpdates types.Bool `tfsdk:"security_updates"` - ValidationErrors []InvalidInputProperty `tfsdk:"validation_errors"` - WebhookConfigs []WebhookConfigWrite `tfsdk:"webhook_configs"` - WorkspaceID types.String `tfsdk:"workspace_id"` + AnonymousDataCollection types.Bool `tfsdk:"anonymous_data_collection"` + CustomerID types.String `tfsdk:"customer_id"` + DefaultGeography types.String `tfsdk:"default_geography"` + DisplaySetupWizard types.Bool `tfsdk:"display_setup_wizard"` + Email types.String `tfsdk:"email"` + FeedbackDone types.Bool `tfsdk:"feedback_done"` + FirstCompletedSync types.Bool `tfsdk:"first_completed_sync"` + InitialSetupComplete types.Bool `tfsdk:"initial_setup_complete"` + Name types.String `tfsdk:"name"` + News types.Bool `tfsdk:"news"` + Notifications []Notification `tfsdk:"notifications"` + NotificationSettings *NotificationSettings `tfsdk:"notification_settings"` + SecurityUpdates types.Bool `tfsdk:"security_updates"` + Slug types.String `tfsdk:"slug"` + WebhookConfigs []WebhookConfigRead `tfsdk:"webhook_configs"` + WorkspaceID types.String `tfsdk:"workspace_id"` } func (r *WorkspaceResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -59,10 +60,16 @@ func (r *WorkspaceResource) Schema(ctx context.Context, req resource.SchemaReque Attributes: map[string]schema.Attribute{ "anonymous_data_collection": schema.BoolAttribute{ + Computed: true, Optional: true, }, + "customer_id": schema.StringAttribute{ + Computed: true, + }, "default_geography": schema.StringAttribute{ - Optional: true, + Computed: true, + Optional: true, + Description: `must be one of ["auto", "us", "eu"]`, Validators: []validator.String{ stringvalidator.OneOf( "auto", @@ -70,25 +77,22 @@ func (r *WorkspaceResource) Schema(ctx context.Context, req resource.SchemaReque "eu", ), }, - Description: `must be one of [auto, us, eu]`, }, "display_setup_wizard": schema.BoolAttribute{ + Computed: true, Optional: true, }, "email": schema.StringAttribute{ + Computed: true, Optional: true, }, - "exception_class_name": schema.StringAttribute{ + "feedback_done": schema.BoolAttribute{ Computed: true, }, - "exception_stack": schema.ListAttribute{ - Computed: true, - ElementType: types.StringType, + "first_completed_sync": schema.BoolAttribute{ + Computed: true, }, "initial_setup_complete": schema.BoolAttribute{ - Optional: true, - }, - "message": schema.StringAttribute{ Computed: true, }, "name": schema.StringAttribute{ @@ -98,33 +102,41 @@ func (r *WorkspaceResource) Schema(ctx context.Context, req resource.SchemaReque Required: true, }, "news": schema.BoolAttribute{ + Computed: true, Optional: true, }, "notifications": schema.ListNestedAttribute{ + Computed: true, Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ "customerio_configuration": schema.SingleNestedAttribute{ + Computed: true, Optional: true, Attributes: map[string]schema.Attribute{}, }, "notification_type": schema.StringAttribute{ - Required: true, + Required: true, + Description: `must be one of ["slack", "customerio"]`, Validators: []validator.String{ stringvalidator.OneOf( "slack", "customerio", ), }, - Description: `must be one of [slack, customerio]`, }, "send_on_failure": schema.BoolAttribute{ - Required: true, + Computed: true, + Optional: true, + Description: `Default: true`, }, "send_on_success": schema.BoolAttribute{ - Required: true, + Computed: true, + Optional: true, + Description: `Default: false`, }, "slack_configuration": schema.SingleNestedAttribute{ + Computed: true, Optional: true, Attributes: map[string]schema.Attribute{ "webhook": schema.StringAttribute{ @@ -135,38 +147,195 @@ func (r *WorkspaceResource) Schema(ctx context.Context, req resource.SchemaReque }, }, }, - "security_updates": schema.BoolAttribute{ - Optional: true, - }, - "validation_errors": schema.ListNestedAttribute{ + "notification_settings": schema.SingleNestedAttribute{ Computed: true, - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - "invalid_value": schema.StringAttribute{ - Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "send_on_connection_update": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "customerio_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{}, + }, + "notification_type": schema.ListAttribute{ + Computed: true, + Optional: true, + ElementType: types.StringType, + }, + "slack_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook": schema.StringAttribute{ + Required: true, + }, + }, + }, }, - "message": schema.StringAttribute{ - Computed: true, + }, + "send_on_connection_update_action_required": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "customerio_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{}, + }, + "notification_type": schema.ListAttribute{ + Computed: true, + Optional: true, + ElementType: types.StringType, + }, + "slack_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook": schema.StringAttribute{ + Required: true, + }, + }, + }, }, - "property_path": schema.StringAttribute{ - Computed: true, + }, + "send_on_failure": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "customerio_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{}, + }, + "notification_type": schema.ListAttribute{ + Computed: true, + Optional: true, + ElementType: types.StringType, + }, + "slack_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + }, + "send_on_success": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "customerio_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{}, + }, + "notification_type": schema.ListAttribute{ + Computed: true, + Optional: true, + ElementType: types.StringType, + }, + "slack_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + }, + "send_on_sync_disabled": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "customerio_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{}, + }, + "notification_type": schema.ListAttribute{ + Computed: true, + Optional: true, + ElementType: types.StringType, + }, + "slack_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook": schema.StringAttribute{ + Required: true, + }, + }, + }, + }, + }, + "send_on_sync_disabled_warning": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "customerio_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{}, + }, + "notification_type": schema.ListAttribute{ + Computed: true, + Optional: true, + ElementType: types.StringType, + }, + "slack_configuration": schema.SingleNestedAttribute{ + Computed: true, + Optional: true, + Attributes: map[string]schema.Attribute{ + "webhook": schema.StringAttribute{ + Required: true, + }, + }, + }, }, }, }, }, + "security_updates": schema.BoolAttribute{ + Computed: true, + Optional: true, + }, + "slug": schema.StringAttribute{ + Computed: true, + }, "webhook_configs": schema.ListNestedAttribute{ + Computed: true, Optional: true, NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ + "auth_token": schema.StringAttribute{ + Optional: true, + Description: `an auth token, to be passed as the value for an HTTP Authorization header.`, + }, + "id": schema.StringAttribute{ + Computed: true, + }, "name": schema.StringAttribute{ + Computed: true, Optional: true, Description: `human readable name for this webhook e.g. for UI display.`, }, + "validation_url": schema.StringAttribute{ + Optional: true, + Description: `if supplied, the webhook config will be validated by checking that this URL returns a 2xx response.`, + }, }, }, }, "workspace_id": schema.StringAttribute{ - Required: true, + Computed: true, }, }, } @@ -178,12 +347,12 @@ func (r *WorkspaceResource) Configure(ctx context.Context, req resource.Configur return } - client, ok := req.ProviderData.(*sdk.Airbyte) + client, ok := req.ProviderData.(*sdk.SDK) if !ok { resp.Diagnostics.AddError( "Unexpected Resource Configure Type", - fmt.Sprintf("Expected *sdk.Airbyte, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *sdk.SDK, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return @@ -214,6 +383,9 @@ func (r *WorkspaceResource) Create(ctx context.Context, req resource.CreateReque res, err := r.client.Workspace.CreateWorkspace(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -224,11 +396,11 @@ func (r *WorkspaceResource) Create(ctx context.Context, req resource.CreateReque resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.InvalidInputExceptionInfo == nil { + if res.WorkspaceRead == nil { resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) return } - data.RefreshFromCreateResponse(res.InvalidInputExceptionInfo) + data.RefreshFromCreateResponse(res.WorkspaceRead) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) @@ -269,6 +441,9 @@ func (r *WorkspaceResource) Update(ctx context.Context, req resource.UpdateReque res, err := r.client.Workspace.UpdateWorkspace(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { @@ -279,11 +454,11 @@ func (r *WorkspaceResource) Update(ctx context.Context, req resource.UpdateReque resp.Diagnostics.AddError(fmt.Sprintf("unexpected response from API. Got an unexpected response code %v", res.StatusCode), debugResponse(res.RawResponse)) return } - if res.InvalidInputExceptionInfo == nil { + if res.WorkspaceRead == nil { resp.Diagnostics.AddError("unexpected response from API. No response body", debugResponse(res.RawResponse)) return } - data.RefreshFromUpdateResponse(res.InvalidInputExceptionInfo) + data.RefreshFromUpdateResponse(res.WorkspaceRead) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) @@ -311,6 +486,9 @@ func (r *WorkspaceResource) Delete(ctx context.Context, req resource.DeleteReque res, err := r.client.Workspace.DeleteWorkspace(ctx, request) if err != nil { resp.Diagnostics.AddError("failure to invoke API", err.Error()) + if res != nil && res.RawResponse != nil { + resp.Diagnostics.AddError("unexpected http request/response", debugResponse(res.RawResponse)) + } return } if res == nil { diff --git a/internal/provider/workspace_resource_sdk.go b/internal/provider/workspace_resource_sdk.go old mode 100755 new mode 100644 index f390993..daccbd4 --- a/internal/provider/workspace_resource_sdk.go +++ b/internal/provider/workspace_resource_sdk.go @@ -3,35 +3,23 @@ package provider import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "github.com/hashicorp/terraform-plugin-framework/types" ) func (r *WorkspaceResourceModel) ToCreateSDKType() *shared.WorkspaceCreate { - anonymousDataCollection := new(bool) - if !r.AnonymousDataCollection.IsUnknown() && !r.AnonymousDataCollection.IsNull() { - *anonymousDataCollection = r.AnonymousDataCollection.ValueBool() - } else { - anonymousDataCollection = nil - } - defaultGeography := new(shared.Geography) - if !r.DefaultGeography.IsUnknown() && !r.DefaultGeography.IsNull() { - *defaultGeography = shared.Geography(r.DefaultGeography.ValueString()) - } else { - defaultGeography = nil - } - displaySetupWizard := new(bool) - if !r.DisplaySetupWizard.IsUnknown() && !r.DisplaySetupWizard.IsNull() { - *displaySetupWizard = r.DisplaySetupWizard.ValueBool() - } else { - displaySetupWizard = nil - } email := new(string) if !r.Email.IsUnknown() && !r.Email.IsNull() { *email = r.Email.ValueString() } else { email = nil } + anonymousDataCollection := new(bool) + if !r.AnonymousDataCollection.IsUnknown() && !r.AnonymousDataCollection.IsNull() { + *anonymousDataCollection = r.AnonymousDataCollection.ValueBool() + } else { + anonymousDataCollection = nil + } name := r.Name.ValueString() news := new(bool) if !r.News.IsUnknown() && !r.News.IsNull() { @@ -39,15 +27,27 @@ func (r *WorkspaceResourceModel) ToCreateSDKType() *shared.WorkspaceCreate { } else { news = nil } - notifications := make([]shared.Notification, 0) + securityUpdates := new(bool) + if !r.SecurityUpdates.IsUnknown() && !r.SecurityUpdates.IsNull() { + *securityUpdates = r.SecurityUpdates.ValueBool() + } else { + securityUpdates = nil + } + var notifications []shared.Notification = nil for _, notificationsItem := range r.Notifications { - var customerioConfiguration *shared.CustomerioNotificationConfiguration - if notificationsItem.CustomerioConfiguration != nil { - customerioConfiguration = &shared.CustomerioNotificationConfiguration{} - } notificationType := shared.NotificationType(notificationsItem.NotificationType.ValueString()) - sendOnFailure := notificationsItem.SendOnFailure.ValueBool() - sendOnSuccess := notificationsItem.SendOnSuccess.ValueBool() + sendOnSuccess := new(bool) + if !notificationsItem.SendOnSuccess.IsUnknown() && !notificationsItem.SendOnSuccess.IsNull() { + *sendOnSuccess = notificationsItem.SendOnSuccess.ValueBool() + } else { + sendOnSuccess = nil + } + sendOnFailure := new(bool) + if !notificationsItem.SendOnFailure.IsUnknown() && !notificationsItem.SendOnFailure.IsNull() { + *sendOnFailure = notificationsItem.SendOnFailure.ValueBool() + } else { + sendOnFailure = nil + } var slackConfiguration *shared.SlackNotificationConfiguration if notificationsItem.SlackConfiguration != nil { webhook := notificationsItem.SlackConfiguration.Webhook.ValueString() @@ -55,72 +55,222 @@ func (r *WorkspaceResourceModel) ToCreateSDKType() *shared.WorkspaceCreate { Webhook: webhook, } } + var customerioConfiguration *shared.CustomerioNotificationConfiguration + if notificationsItem.CustomerioConfiguration != nil { + customerioConfiguration = &shared.CustomerioNotificationConfiguration{} + } notifications = append(notifications, shared.Notification{ - CustomerioConfiguration: customerioConfiguration, NotificationType: notificationType, - SendOnFailure: sendOnFailure, SendOnSuccess: sendOnSuccess, + SendOnFailure: sendOnFailure, SlackConfiguration: slackConfiguration, + CustomerioConfiguration: customerioConfiguration, }) } - securityUpdates := new(bool) - if !r.SecurityUpdates.IsUnknown() && !r.SecurityUpdates.IsNull() { - *securityUpdates = r.SecurityUpdates.ValueBool() + var notificationSettings *shared.NotificationSettings + if r.NotificationSettings != nil { + var sendOnSuccess1 *shared.NotificationItem + if r.NotificationSettings.SendOnSuccess != nil { + var notificationType1 []shared.NotificationType = nil + for _, notificationTypeItem := range r.NotificationSettings.SendOnSuccess.NotificationType { + notificationType1 = append(notificationType1, shared.NotificationType(notificationTypeItem.ValueString())) + } + var slackConfiguration1 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnSuccess.SlackConfiguration != nil { + webhook1 := r.NotificationSettings.SendOnSuccess.SlackConfiguration.Webhook.ValueString() + slackConfiguration1 = &shared.SlackNotificationConfiguration{ + Webhook: webhook1, + } + } + var customerioConfiguration1 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnSuccess.CustomerioConfiguration != nil { + customerioConfiguration1 = &shared.CustomerioNotificationConfiguration{} + } + sendOnSuccess1 = &shared.NotificationItem{ + NotificationType: notificationType1, + SlackConfiguration: slackConfiguration1, + CustomerioConfiguration: customerioConfiguration1, + } + } + var sendOnFailure1 *shared.NotificationItem + if r.NotificationSettings.SendOnFailure != nil { + var notificationType2 []shared.NotificationType = nil + for _, notificationTypeItem1 := range r.NotificationSettings.SendOnFailure.NotificationType { + notificationType2 = append(notificationType2, shared.NotificationType(notificationTypeItem1.ValueString())) + } + var slackConfiguration2 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnFailure.SlackConfiguration != nil { + webhook2 := r.NotificationSettings.SendOnFailure.SlackConfiguration.Webhook.ValueString() + slackConfiguration2 = &shared.SlackNotificationConfiguration{ + Webhook: webhook2, + } + } + var customerioConfiguration2 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnFailure.CustomerioConfiguration != nil { + customerioConfiguration2 = &shared.CustomerioNotificationConfiguration{} + } + sendOnFailure1 = &shared.NotificationItem{ + NotificationType: notificationType2, + SlackConfiguration: slackConfiguration2, + CustomerioConfiguration: customerioConfiguration2, + } + } + var sendOnSyncDisabled *shared.NotificationItem + if r.NotificationSettings.SendOnSyncDisabled != nil { + var notificationType3 []shared.NotificationType = nil + for _, notificationTypeItem2 := range r.NotificationSettings.SendOnSyncDisabled.NotificationType { + notificationType3 = append(notificationType3, shared.NotificationType(notificationTypeItem2.ValueString())) + } + var slackConfiguration3 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnSyncDisabled.SlackConfiguration != nil { + webhook3 := r.NotificationSettings.SendOnSyncDisabled.SlackConfiguration.Webhook.ValueString() + slackConfiguration3 = &shared.SlackNotificationConfiguration{ + Webhook: webhook3, + } + } + var customerioConfiguration3 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnSyncDisabled.CustomerioConfiguration != nil { + customerioConfiguration3 = &shared.CustomerioNotificationConfiguration{} + } + sendOnSyncDisabled = &shared.NotificationItem{ + NotificationType: notificationType3, + SlackConfiguration: slackConfiguration3, + CustomerioConfiguration: customerioConfiguration3, + } + } + var sendOnSyncDisabledWarning *shared.NotificationItem + if r.NotificationSettings.SendOnSyncDisabledWarning != nil { + var notificationType4 []shared.NotificationType = nil + for _, notificationTypeItem3 := range r.NotificationSettings.SendOnSyncDisabledWarning.NotificationType { + notificationType4 = append(notificationType4, shared.NotificationType(notificationTypeItem3.ValueString())) + } + var slackConfiguration4 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration != nil { + webhook4 := r.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration.Webhook.ValueString() + slackConfiguration4 = &shared.SlackNotificationConfiguration{ + Webhook: webhook4, + } + } + var customerioConfiguration4 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnSyncDisabledWarning.CustomerioConfiguration != nil { + customerioConfiguration4 = &shared.CustomerioNotificationConfiguration{} + } + sendOnSyncDisabledWarning = &shared.NotificationItem{ + NotificationType: notificationType4, + SlackConfiguration: slackConfiguration4, + CustomerioConfiguration: customerioConfiguration4, + } + } + var sendOnConnectionUpdate *shared.NotificationItem + if r.NotificationSettings.SendOnConnectionUpdate != nil { + var notificationType5 []shared.NotificationType = nil + for _, notificationTypeItem4 := range r.NotificationSettings.SendOnConnectionUpdate.NotificationType { + notificationType5 = append(notificationType5, shared.NotificationType(notificationTypeItem4.ValueString())) + } + var slackConfiguration5 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration != nil { + webhook5 := r.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration.Webhook.ValueString() + slackConfiguration5 = &shared.SlackNotificationConfiguration{ + Webhook: webhook5, + } + } + var customerioConfiguration5 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnConnectionUpdate.CustomerioConfiguration != nil { + customerioConfiguration5 = &shared.CustomerioNotificationConfiguration{} + } + sendOnConnectionUpdate = &shared.NotificationItem{ + NotificationType: notificationType5, + SlackConfiguration: slackConfiguration5, + CustomerioConfiguration: customerioConfiguration5, + } + } + var sendOnConnectionUpdateActionRequired *shared.NotificationItem + if r.NotificationSettings.SendOnConnectionUpdateActionRequired != nil { + var notificationType6 []shared.NotificationType = nil + for _, notificationTypeItem5 := range r.NotificationSettings.SendOnConnectionUpdateActionRequired.NotificationType { + notificationType6 = append(notificationType6, shared.NotificationType(notificationTypeItem5.ValueString())) + } + var slackConfiguration6 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration != nil { + webhook6 := r.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration.Webhook.ValueString() + slackConfiguration6 = &shared.SlackNotificationConfiguration{ + Webhook: webhook6, + } + } + var customerioConfiguration6 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnConnectionUpdateActionRequired.CustomerioConfiguration != nil { + customerioConfiguration6 = &shared.CustomerioNotificationConfiguration{} + } + sendOnConnectionUpdateActionRequired = &shared.NotificationItem{ + NotificationType: notificationType6, + SlackConfiguration: slackConfiguration6, + CustomerioConfiguration: customerioConfiguration6, + } + } + notificationSettings = &shared.NotificationSettings{ + SendOnSuccess: sendOnSuccess1, + SendOnFailure: sendOnFailure1, + SendOnSyncDisabled: sendOnSyncDisabled, + SendOnSyncDisabledWarning: sendOnSyncDisabledWarning, + SendOnConnectionUpdate: sendOnConnectionUpdate, + SendOnConnectionUpdateActionRequired: sendOnConnectionUpdateActionRequired, + } + } + displaySetupWizard := new(bool) + if !r.DisplaySetupWizard.IsUnknown() && !r.DisplaySetupWizard.IsNull() { + *displaySetupWizard = r.DisplaySetupWizard.ValueBool() } else { - securityUpdates = nil + displaySetupWizard = nil + } + defaultGeography := new(shared.Geography) + if !r.DefaultGeography.IsUnknown() && !r.DefaultGeography.IsNull() { + *defaultGeography = shared.Geography(r.DefaultGeography.ValueString()) + } else { + defaultGeography = nil } - webhookConfigs := make([]shared.WebhookConfigWrite, 0) + var webhookConfigs []shared.WebhookConfigWrite = nil for _, webhookConfigsItem := range r.WebhookConfigs { - authToken := new(string) - if !webhookConfigsItem.Name.IsUnknown() && !webhookConfigsItem.Name.IsNull() { - *authToken = webhookConfigsItem.Name.ValueString() - } else { - authToken = nil - } name1 := new(string) if !webhookConfigsItem.Name.IsUnknown() && !webhookConfigsItem.Name.IsNull() { *name1 = webhookConfigsItem.Name.ValueString() } else { name1 = nil } + authToken := new(string) + if !webhookConfigsItem.AuthToken.IsUnknown() && !webhookConfigsItem.AuthToken.IsNull() { + *authToken = webhookConfigsItem.AuthToken.ValueString() + } else { + authToken = nil + } + validationURL := new(string) + if !webhookConfigsItem.ValidationURL.IsUnknown() && !webhookConfigsItem.ValidationURL.IsNull() { + *validationURL = webhookConfigsItem.ValidationURL.ValueString() + } else { + validationURL = nil + } webhookConfigs = append(webhookConfigs, shared.WebhookConfigWrite{ - AuthToken: authToken, - Name: name1, + Name: name1, + AuthToken: authToken, + ValidationURL: validationURL, }) } out := shared.WorkspaceCreate{ - AnonymousDataCollection: anonymousDataCollection, - DefaultGeography: defaultGeography, - DisplaySetupWizard: displaySetupWizard, Email: email, + AnonymousDataCollection: anonymousDataCollection, Name: name, News: news, - Notifications: notifications, SecurityUpdates: securityUpdates, + Notifications: notifications, + NotificationSettings: notificationSettings, + DisplaySetupWizard: displaySetupWizard, + DefaultGeography: defaultGeography, WebhookConfigs: webhookConfigs, } return &out } func (r *WorkspaceResourceModel) ToUpdateSDKType() *shared.WorkspaceUpdate { - anonymousDataCollection := new(bool) - if !r.AnonymousDataCollection.IsUnknown() && !r.AnonymousDataCollection.IsNull() { - *anonymousDataCollection = r.AnonymousDataCollection.ValueBool() - } else { - anonymousDataCollection = nil - } - defaultGeography := new(shared.Geography) - if !r.DefaultGeography.IsUnknown() && !r.DefaultGeography.IsNull() { - *defaultGeography = shared.Geography(r.DefaultGeography.ValueString()) - } else { - defaultGeography = nil - } - displaySetupWizard := new(bool) - if !r.DisplaySetupWizard.IsUnknown() && !r.DisplaySetupWizard.IsNull() { - *displaySetupWizard = r.DisplaySetupWizard.ValueBool() - } else { - displaySetupWizard = nil - } + workspaceID := r.WorkspaceID.ValueString() email := new(string) if !r.Email.IsUnknown() && !r.Email.IsNull() { *email = r.Email.ValueString() @@ -133,21 +283,45 @@ func (r *WorkspaceResourceModel) ToUpdateSDKType() *shared.WorkspaceUpdate { } else { initialSetupComplete = nil } + displaySetupWizard := new(bool) + if !r.DisplaySetupWizard.IsUnknown() && !r.DisplaySetupWizard.IsNull() { + *displaySetupWizard = r.DisplaySetupWizard.ValueBool() + } else { + displaySetupWizard = nil + } + anonymousDataCollection := new(bool) + if !r.AnonymousDataCollection.IsUnknown() && !r.AnonymousDataCollection.IsNull() { + *anonymousDataCollection = r.AnonymousDataCollection.ValueBool() + } else { + anonymousDataCollection = nil + } news := new(bool) if !r.News.IsUnknown() && !r.News.IsNull() { *news = r.News.ValueBool() } else { news = nil } - notifications := make([]shared.Notification, 0) + securityUpdates := new(bool) + if !r.SecurityUpdates.IsUnknown() && !r.SecurityUpdates.IsNull() { + *securityUpdates = r.SecurityUpdates.ValueBool() + } else { + securityUpdates = nil + } + var notifications []shared.Notification = nil for _, notificationsItem := range r.Notifications { - var customerioConfiguration *shared.CustomerioNotificationConfiguration - if notificationsItem.CustomerioConfiguration != nil { - customerioConfiguration = &shared.CustomerioNotificationConfiguration{} - } notificationType := shared.NotificationType(notificationsItem.NotificationType.ValueString()) - sendOnFailure := notificationsItem.SendOnFailure.ValueBool() - sendOnSuccess := notificationsItem.SendOnSuccess.ValueBool() + sendOnSuccess := new(bool) + if !notificationsItem.SendOnSuccess.IsUnknown() && !notificationsItem.SendOnSuccess.IsNull() { + *sendOnSuccess = notificationsItem.SendOnSuccess.ValueBool() + } else { + sendOnSuccess = nil + } + sendOnFailure := new(bool) + if !notificationsItem.SendOnFailure.IsUnknown() && !notificationsItem.SendOnFailure.IsNull() { + *sendOnFailure = notificationsItem.SendOnFailure.ValueBool() + } else { + sendOnFailure = nil + } var slackConfiguration *shared.SlackNotificationConfiguration if notificationsItem.SlackConfiguration != nil { webhook := notificationsItem.SlackConfiguration.Webhook.ValueString() @@ -155,51 +329,211 @@ func (r *WorkspaceResourceModel) ToUpdateSDKType() *shared.WorkspaceUpdate { Webhook: webhook, } } + var customerioConfiguration *shared.CustomerioNotificationConfiguration + if notificationsItem.CustomerioConfiguration != nil { + customerioConfiguration = &shared.CustomerioNotificationConfiguration{} + } notifications = append(notifications, shared.Notification{ - CustomerioConfiguration: customerioConfiguration, NotificationType: notificationType, - SendOnFailure: sendOnFailure, SendOnSuccess: sendOnSuccess, + SendOnFailure: sendOnFailure, SlackConfiguration: slackConfiguration, + CustomerioConfiguration: customerioConfiguration, }) } - securityUpdates := new(bool) - if !r.SecurityUpdates.IsUnknown() && !r.SecurityUpdates.IsNull() { - *securityUpdates = r.SecurityUpdates.ValueBool() + var notificationSettings *shared.NotificationSettings + if r.NotificationSettings != nil { + var sendOnSuccess1 *shared.NotificationItem + if r.NotificationSettings.SendOnSuccess != nil { + var notificationType1 []shared.NotificationType = nil + for _, notificationTypeItem := range r.NotificationSettings.SendOnSuccess.NotificationType { + notificationType1 = append(notificationType1, shared.NotificationType(notificationTypeItem.ValueString())) + } + var slackConfiguration1 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnSuccess.SlackConfiguration != nil { + webhook1 := r.NotificationSettings.SendOnSuccess.SlackConfiguration.Webhook.ValueString() + slackConfiguration1 = &shared.SlackNotificationConfiguration{ + Webhook: webhook1, + } + } + var customerioConfiguration1 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnSuccess.CustomerioConfiguration != nil { + customerioConfiguration1 = &shared.CustomerioNotificationConfiguration{} + } + sendOnSuccess1 = &shared.NotificationItem{ + NotificationType: notificationType1, + SlackConfiguration: slackConfiguration1, + CustomerioConfiguration: customerioConfiguration1, + } + } + var sendOnFailure1 *shared.NotificationItem + if r.NotificationSettings.SendOnFailure != nil { + var notificationType2 []shared.NotificationType = nil + for _, notificationTypeItem1 := range r.NotificationSettings.SendOnFailure.NotificationType { + notificationType2 = append(notificationType2, shared.NotificationType(notificationTypeItem1.ValueString())) + } + var slackConfiguration2 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnFailure.SlackConfiguration != nil { + webhook2 := r.NotificationSettings.SendOnFailure.SlackConfiguration.Webhook.ValueString() + slackConfiguration2 = &shared.SlackNotificationConfiguration{ + Webhook: webhook2, + } + } + var customerioConfiguration2 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnFailure.CustomerioConfiguration != nil { + customerioConfiguration2 = &shared.CustomerioNotificationConfiguration{} + } + sendOnFailure1 = &shared.NotificationItem{ + NotificationType: notificationType2, + SlackConfiguration: slackConfiguration2, + CustomerioConfiguration: customerioConfiguration2, + } + } + var sendOnSyncDisabled *shared.NotificationItem + if r.NotificationSettings.SendOnSyncDisabled != nil { + var notificationType3 []shared.NotificationType = nil + for _, notificationTypeItem2 := range r.NotificationSettings.SendOnSyncDisabled.NotificationType { + notificationType3 = append(notificationType3, shared.NotificationType(notificationTypeItem2.ValueString())) + } + var slackConfiguration3 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnSyncDisabled.SlackConfiguration != nil { + webhook3 := r.NotificationSettings.SendOnSyncDisabled.SlackConfiguration.Webhook.ValueString() + slackConfiguration3 = &shared.SlackNotificationConfiguration{ + Webhook: webhook3, + } + } + var customerioConfiguration3 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnSyncDisabled.CustomerioConfiguration != nil { + customerioConfiguration3 = &shared.CustomerioNotificationConfiguration{} + } + sendOnSyncDisabled = &shared.NotificationItem{ + NotificationType: notificationType3, + SlackConfiguration: slackConfiguration3, + CustomerioConfiguration: customerioConfiguration3, + } + } + var sendOnSyncDisabledWarning *shared.NotificationItem + if r.NotificationSettings.SendOnSyncDisabledWarning != nil { + var notificationType4 []shared.NotificationType = nil + for _, notificationTypeItem3 := range r.NotificationSettings.SendOnSyncDisabledWarning.NotificationType { + notificationType4 = append(notificationType4, shared.NotificationType(notificationTypeItem3.ValueString())) + } + var slackConfiguration4 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration != nil { + webhook4 := r.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration.Webhook.ValueString() + slackConfiguration4 = &shared.SlackNotificationConfiguration{ + Webhook: webhook4, + } + } + var customerioConfiguration4 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnSyncDisabledWarning.CustomerioConfiguration != nil { + customerioConfiguration4 = &shared.CustomerioNotificationConfiguration{} + } + sendOnSyncDisabledWarning = &shared.NotificationItem{ + NotificationType: notificationType4, + SlackConfiguration: slackConfiguration4, + CustomerioConfiguration: customerioConfiguration4, + } + } + var sendOnConnectionUpdate *shared.NotificationItem + if r.NotificationSettings.SendOnConnectionUpdate != nil { + var notificationType5 []shared.NotificationType = nil + for _, notificationTypeItem4 := range r.NotificationSettings.SendOnConnectionUpdate.NotificationType { + notificationType5 = append(notificationType5, shared.NotificationType(notificationTypeItem4.ValueString())) + } + var slackConfiguration5 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration != nil { + webhook5 := r.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration.Webhook.ValueString() + slackConfiguration5 = &shared.SlackNotificationConfiguration{ + Webhook: webhook5, + } + } + var customerioConfiguration5 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnConnectionUpdate.CustomerioConfiguration != nil { + customerioConfiguration5 = &shared.CustomerioNotificationConfiguration{} + } + sendOnConnectionUpdate = &shared.NotificationItem{ + NotificationType: notificationType5, + SlackConfiguration: slackConfiguration5, + CustomerioConfiguration: customerioConfiguration5, + } + } + var sendOnConnectionUpdateActionRequired *shared.NotificationItem + if r.NotificationSettings.SendOnConnectionUpdateActionRequired != nil { + var notificationType6 []shared.NotificationType = nil + for _, notificationTypeItem5 := range r.NotificationSettings.SendOnConnectionUpdateActionRequired.NotificationType { + notificationType6 = append(notificationType6, shared.NotificationType(notificationTypeItem5.ValueString())) + } + var slackConfiguration6 *shared.SlackNotificationConfiguration + if r.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration != nil { + webhook6 := r.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration.Webhook.ValueString() + slackConfiguration6 = &shared.SlackNotificationConfiguration{ + Webhook: webhook6, + } + } + var customerioConfiguration6 *shared.CustomerioNotificationConfiguration + if r.NotificationSettings.SendOnConnectionUpdateActionRequired.CustomerioConfiguration != nil { + customerioConfiguration6 = &shared.CustomerioNotificationConfiguration{} + } + sendOnConnectionUpdateActionRequired = &shared.NotificationItem{ + NotificationType: notificationType6, + SlackConfiguration: slackConfiguration6, + CustomerioConfiguration: customerioConfiguration6, + } + } + notificationSettings = &shared.NotificationSettings{ + SendOnSuccess: sendOnSuccess1, + SendOnFailure: sendOnFailure1, + SendOnSyncDisabled: sendOnSyncDisabled, + SendOnSyncDisabledWarning: sendOnSyncDisabledWarning, + SendOnConnectionUpdate: sendOnConnectionUpdate, + SendOnConnectionUpdateActionRequired: sendOnConnectionUpdateActionRequired, + } + } + defaultGeography := new(shared.Geography) + if !r.DefaultGeography.IsUnknown() && !r.DefaultGeography.IsNull() { + *defaultGeography = shared.Geography(r.DefaultGeography.ValueString()) } else { - securityUpdates = nil + defaultGeography = nil } - webhookConfigs := make([]shared.WebhookConfigWrite, 0) + var webhookConfigs []shared.WebhookConfigWrite = nil for _, webhookConfigsItem := range r.WebhookConfigs { - authToken := new(string) - if !webhookConfigsItem.Name.IsUnknown() && !webhookConfigsItem.Name.IsNull() { - *authToken = webhookConfigsItem.Name.ValueString() - } else { - authToken = nil - } name := new(string) if !webhookConfigsItem.Name.IsUnknown() && !webhookConfigsItem.Name.IsNull() { *name = webhookConfigsItem.Name.ValueString() } else { name = nil } + authToken := new(string) + if !webhookConfigsItem.AuthToken.IsUnknown() && !webhookConfigsItem.AuthToken.IsNull() { + *authToken = webhookConfigsItem.AuthToken.ValueString() + } else { + authToken = nil + } + validationURL := new(string) + if !webhookConfigsItem.ValidationURL.IsUnknown() && !webhookConfigsItem.ValidationURL.IsNull() { + *validationURL = webhookConfigsItem.ValidationURL.ValueString() + } else { + validationURL = nil + } webhookConfigs = append(webhookConfigs, shared.WebhookConfigWrite{ - AuthToken: authToken, - Name: name, + Name: name, + AuthToken: authToken, + ValidationURL: validationURL, }) } - workspaceID := r.WorkspaceID.ValueString() out := shared.WorkspaceUpdate{ - AnonymousDataCollection: anonymousDataCollection, - DefaultGeography: defaultGeography, - DisplaySetupWizard: displaySetupWizard, + WorkspaceID: workspaceID, Email: email, InitialSetupComplete: initialSetupComplete, + DisplaySetupWizard: displaySetupWizard, + AnonymousDataCollection: anonymousDataCollection, News: news, - Notifications: notifications, SecurityUpdates: securityUpdates, + Notifications: notifications, + NotificationSettings: notificationSettings, + DefaultGeography: defaultGeography, WebhookConfigs: webhookConfigs, - WorkspaceID: workspaceID, } return &out } @@ -212,35 +546,234 @@ func (r *WorkspaceResourceModel) ToDeleteSDKType() *shared.WorkspaceIDRequestBod return &out } -func (r *WorkspaceResourceModel) RefreshFromCreateResponse(resp *shared.InvalidInputExceptionInfo) { - if resp.ExceptionClassName != nil { - r.ExceptionClassName = types.StringValue(*resp.ExceptionClassName) +func (r *WorkspaceResourceModel) RefreshFromCreateResponse(resp *shared.WorkspaceRead) { + if resp.AnonymousDataCollection != nil { + r.AnonymousDataCollection = types.BoolValue(*resp.AnonymousDataCollection) + } else { + r.AnonymousDataCollection = types.BoolNull() + } + r.CustomerID = types.StringValue(resp.CustomerID) + if resp.DefaultGeography != nil { + r.DefaultGeography = types.StringValue(string(*resp.DefaultGeography)) + } else { + r.DefaultGeography = types.StringNull() + } + if resp.DisplaySetupWizard != nil { + r.DisplaySetupWizard = types.BoolValue(*resp.DisplaySetupWizard) + } else { + r.DisplaySetupWizard = types.BoolNull() + } + if resp.Email != nil { + r.Email = types.StringValue(*resp.Email) + } else { + r.Email = types.StringNull() + } + if resp.FeedbackDone != nil { + r.FeedbackDone = types.BoolValue(*resp.FeedbackDone) + } else { + r.FeedbackDone = types.BoolNull() + } + if resp.FirstCompletedSync != nil { + r.FirstCompletedSync = types.BoolValue(*resp.FirstCompletedSync) + } else { + r.FirstCompletedSync = types.BoolNull() + } + r.InitialSetupComplete = types.BoolValue(resp.InitialSetupComplete) + r.Name = types.StringValue(resp.Name) + if resp.News != nil { + r.News = types.BoolValue(*resp.News) + } else { + r.News = types.BoolNull() + } + if len(r.Notifications) > len(resp.Notifications) { + r.Notifications = r.Notifications[:len(resp.Notifications)] + } + for notificationsCount, notificationsItem := range resp.Notifications { + var notifications1 Notification + if notificationsItem.CustomerioConfiguration == nil { + notifications1.CustomerioConfiguration = nil + } else { + notifications1.CustomerioConfiguration = &StreamJSONSchema{} + } + notifications1.NotificationType = types.StringValue(string(notificationsItem.NotificationType)) + if notificationsItem.SendOnFailure != nil { + notifications1.SendOnFailure = types.BoolValue(*notificationsItem.SendOnFailure) + } else { + notifications1.SendOnFailure = types.BoolNull() + } + if notificationsItem.SendOnSuccess != nil { + notifications1.SendOnSuccess = types.BoolValue(*notificationsItem.SendOnSuccess) + } else { + notifications1.SendOnSuccess = types.BoolNull() + } + if notificationsItem.SlackConfiguration == nil { + notifications1.SlackConfiguration = nil + } else { + notifications1.SlackConfiguration = &SlackNotificationConfiguration{} + notifications1.SlackConfiguration.Webhook = types.StringValue(notificationsItem.SlackConfiguration.Webhook) + } + if notificationsCount+1 > len(r.Notifications) { + r.Notifications = append(r.Notifications, notifications1) + } else { + r.Notifications[notificationsCount].CustomerioConfiguration = notifications1.CustomerioConfiguration + r.Notifications[notificationsCount].NotificationType = notifications1.NotificationType + r.Notifications[notificationsCount].SendOnFailure = notifications1.SendOnFailure + r.Notifications[notificationsCount].SendOnSuccess = notifications1.SendOnSuccess + r.Notifications[notificationsCount].SlackConfiguration = notifications1.SlackConfiguration + } + } + if resp.NotificationSettings == nil { + r.NotificationSettings = nil + } else { + r.NotificationSettings = &NotificationSettings{} + if resp.NotificationSettings.SendOnConnectionUpdate == nil { + r.NotificationSettings.SendOnConnectionUpdate = nil + } else { + r.NotificationSettings.SendOnConnectionUpdate = &NotificationItem{} + if resp.NotificationSettings.SendOnConnectionUpdate.CustomerioConfiguration == nil { + r.NotificationSettings.SendOnConnectionUpdate.CustomerioConfiguration = nil + } else { + r.NotificationSettings.SendOnConnectionUpdate.CustomerioConfiguration = &StreamJSONSchema{} + } + r.NotificationSettings.SendOnConnectionUpdate.NotificationType = nil + for _, v := range resp.NotificationSettings.SendOnConnectionUpdate.NotificationType { + r.NotificationSettings.SendOnConnectionUpdate.NotificationType = append(r.NotificationSettings.SendOnConnectionUpdate.NotificationType, types.StringValue(string(v))) + } + if resp.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration == nil { + r.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration = nil + } else { + r.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration = &SlackNotificationConfiguration{} + r.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration.Webhook = types.StringValue(resp.NotificationSettings.SendOnConnectionUpdate.SlackConfiguration.Webhook) + } + } + if resp.NotificationSettings.SendOnConnectionUpdateActionRequired == nil { + r.NotificationSettings.SendOnConnectionUpdateActionRequired = nil + } else { + r.NotificationSettings.SendOnConnectionUpdateActionRequired = &NotificationItem{} + if resp.NotificationSettings.SendOnConnectionUpdateActionRequired.CustomerioConfiguration == nil { + r.NotificationSettings.SendOnConnectionUpdateActionRequired.CustomerioConfiguration = nil + } else { + r.NotificationSettings.SendOnConnectionUpdateActionRequired.CustomerioConfiguration = &StreamJSONSchema{} + } + r.NotificationSettings.SendOnConnectionUpdateActionRequired.NotificationType = nil + for _, v := range resp.NotificationSettings.SendOnConnectionUpdateActionRequired.NotificationType { + r.NotificationSettings.SendOnConnectionUpdateActionRequired.NotificationType = append(r.NotificationSettings.SendOnConnectionUpdateActionRequired.NotificationType, types.StringValue(string(v))) + } + if resp.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration == nil { + r.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration = nil + } else { + r.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration = &SlackNotificationConfiguration{} + r.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration.Webhook = types.StringValue(resp.NotificationSettings.SendOnConnectionUpdateActionRequired.SlackConfiguration.Webhook) + } + } + if resp.NotificationSettings.SendOnFailure == nil { + r.NotificationSettings.SendOnFailure = nil + } else { + r.NotificationSettings.SendOnFailure = &NotificationItem{} + if resp.NotificationSettings.SendOnFailure.CustomerioConfiguration == nil { + r.NotificationSettings.SendOnFailure.CustomerioConfiguration = nil + } else { + r.NotificationSettings.SendOnFailure.CustomerioConfiguration = &StreamJSONSchema{} + } + r.NotificationSettings.SendOnFailure.NotificationType = nil + for _, v := range resp.NotificationSettings.SendOnFailure.NotificationType { + r.NotificationSettings.SendOnFailure.NotificationType = append(r.NotificationSettings.SendOnFailure.NotificationType, types.StringValue(string(v))) + } + if resp.NotificationSettings.SendOnFailure.SlackConfiguration == nil { + r.NotificationSettings.SendOnFailure.SlackConfiguration = nil + } else { + r.NotificationSettings.SendOnFailure.SlackConfiguration = &SlackNotificationConfiguration{} + r.NotificationSettings.SendOnFailure.SlackConfiguration.Webhook = types.StringValue(resp.NotificationSettings.SendOnFailure.SlackConfiguration.Webhook) + } + } + if resp.NotificationSettings.SendOnSuccess == nil { + r.NotificationSettings.SendOnSuccess = nil + } else { + r.NotificationSettings.SendOnSuccess = &NotificationItem{} + if resp.NotificationSettings.SendOnSuccess.CustomerioConfiguration == nil { + r.NotificationSettings.SendOnSuccess.CustomerioConfiguration = nil + } else { + r.NotificationSettings.SendOnSuccess.CustomerioConfiguration = &StreamJSONSchema{} + } + r.NotificationSettings.SendOnSuccess.NotificationType = nil + for _, v := range resp.NotificationSettings.SendOnSuccess.NotificationType { + r.NotificationSettings.SendOnSuccess.NotificationType = append(r.NotificationSettings.SendOnSuccess.NotificationType, types.StringValue(string(v))) + } + if resp.NotificationSettings.SendOnSuccess.SlackConfiguration == nil { + r.NotificationSettings.SendOnSuccess.SlackConfiguration = nil + } else { + r.NotificationSettings.SendOnSuccess.SlackConfiguration = &SlackNotificationConfiguration{} + r.NotificationSettings.SendOnSuccess.SlackConfiguration.Webhook = types.StringValue(resp.NotificationSettings.SendOnSuccess.SlackConfiguration.Webhook) + } + } + if resp.NotificationSettings.SendOnSyncDisabled == nil { + r.NotificationSettings.SendOnSyncDisabled = nil + } else { + r.NotificationSettings.SendOnSyncDisabled = &NotificationItem{} + if resp.NotificationSettings.SendOnSyncDisabled.CustomerioConfiguration == nil { + r.NotificationSettings.SendOnSyncDisabled.CustomerioConfiguration = nil + } else { + r.NotificationSettings.SendOnSyncDisabled.CustomerioConfiguration = &StreamJSONSchema{} + } + r.NotificationSettings.SendOnSyncDisabled.NotificationType = nil + for _, v := range resp.NotificationSettings.SendOnSyncDisabled.NotificationType { + r.NotificationSettings.SendOnSyncDisabled.NotificationType = append(r.NotificationSettings.SendOnSyncDisabled.NotificationType, types.StringValue(string(v))) + } + if resp.NotificationSettings.SendOnSyncDisabled.SlackConfiguration == nil { + r.NotificationSettings.SendOnSyncDisabled.SlackConfiguration = nil + } else { + r.NotificationSettings.SendOnSyncDisabled.SlackConfiguration = &SlackNotificationConfiguration{} + r.NotificationSettings.SendOnSyncDisabled.SlackConfiguration.Webhook = types.StringValue(resp.NotificationSettings.SendOnSyncDisabled.SlackConfiguration.Webhook) + } + } + if resp.NotificationSettings.SendOnSyncDisabledWarning == nil { + r.NotificationSettings.SendOnSyncDisabledWarning = nil + } else { + r.NotificationSettings.SendOnSyncDisabledWarning = &NotificationItem{} + if resp.NotificationSettings.SendOnSyncDisabledWarning.CustomerioConfiguration == nil { + r.NotificationSettings.SendOnSyncDisabledWarning.CustomerioConfiguration = nil + } else { + r.NotificationSettings.SendOnSyncDisabledWarning.CustomerioConfiguration = &StreamJSONSchema{} + } + r.NotificationSettings.SendOnSyncDisabledWarning.NotificationType = nil + for _, v := range resp.NotificationSettings.SendOnSyncDisabledWarning.NotificationType { + r.NotificationSettings.SendOnSyncDisabledWarning.NotificationType = append(r.NotificationSettings.SendOnSyncDisabledWarning.NotificationType, types.StringValue(string(v))) + } + if resp.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration == nil { + r.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration = nil + } else { + r.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration = &SlackNotificationConfiguration{} + r.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration.Webhook = types.StringValue(resp.NotificationSettings.SendOnSyncDisabledWarning.SlackConfiguration.Webhook) + } + } + } + if resp.SecurityUpdates != nil { + r.SecurityUpdates = types.BoolValue(*resp.SecurityUpdates) } else { - r.ExceptionClassName = types.StringNull() + r.SecurityUpdates = types.BoolNull() } - r.ExceptionStack = nil - for _, v := range resp.ExceptionStack { - r.ExceptionStack = append(r.ExceptionStack, types.StringValue(v)) + r.Slug = types.StringValue(resp.Slug) + if len(r.WebhookConfigs) > len(resp.WebhookConfigs) { + r.WebhookConfigs = r.WebhookConfigs[:len(resp.WebhookConfigs)] } - r.Message = types.StringValue(resp.Message) - r.ValidationErrors = nil - for _, validationErrorsItem := range resp.ValidationErrors { - var validationErrors1 InvalidInputProperty - if validationErrorsItem.InvalidValue != nil { - validationErrors1.InvalidValue = types.StringValue(*validationErrorsItem.InvalidValue) + for webhookConfigsCount, webhookConfigsItem := range resp.WebhookConfigs { + var webhookConfigs1 WebhookConfigRead + webhookConfigs1.ID = types.StringValue(webhookConfigsItem.ID) + if webhookConfigsItem.Name != nil { + webhookConfigs1.Name = types.StringValue(*webhookConfigsItem.Name) } else { - validationErrors1.InvalidValue = types.StringNull() + webhookConfigs1.Name = types.StringNull() } - if validationErrorsItem.Message != nil { - validationErrors1.Message = types.StringValue(*validationErrorsItem.Message) + if webhookConfigsCount+1 > len(r.WebhookConfigs) { + r.WebhookConfigs = append(r.WebhookConfigs, webhookConfigs1) } else { - validationErrors1.Message = types.StringNull() + r.WebhookConfigs[webhookConfigsCount].ID = webhookConfigs1.ID + r.WebhookConfigs[webhookConfigsCount].Name = webhookConfigs1.Name } - validationErrors1.PropertyPath = types.StringValue(validationErrorsItem.PropertyPath) - r.ValidationErrors = append(r.ValidationErrors, validationErrors1) } + r.WorkspaceID = types.StringValue(resp.WorkspaceID) } -func (r *WorkspaceResourceModel) RefreshFromUpdateResponse(resp *shared.InvalidInputExceptionInfo) { +func (r *WorkspaceResourceModel) RefreshFromUpdateResponse(resp *shared.WorkspaceRead) { r.RefreshFromCreateResponse(resp) } diff --git a/internal/sdk/attempt.go b/internal/sdk/attempt.go old mode 100755 new mode 100644 index 3501993..e2b6872 --- a/internal/sdk/attempt.go +++ b/internal/sdk/attempt.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// attempt - Interactions with attempt related resources. -type attempt struct { +// Attempt - Interactions with attempt related resources. +type Attempt struct { sdkConfiguration sdkConfiguration } -func newAttempt(sdkConfig sdkConfiguration) *attempt { - return &attempt{ +func newAttempt(sdkConfig sdkConfiguration) *Attempt { + return &Attempt{ sdkConfiguration: sdkConfig, } } -// SaveStats - For worker to set sync stats of a running attempt. -func (s *attempt) SaveStats(ctx context.Context, request shared.SaveStatsRequestBody) (*operations.SaveStatsResponse, error) { +// SetWorkflowInAttempt - For worker to register the workflow id in attempt. +func (s *Attempt) SetWorkflowInAttempt(ctx context.Context, request shared.SetWorkflowInAttemptRequestBody) (*operations.SetWorkflowInAttemptResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/save_stats" + url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/set_workflow_in_attempt" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *attempt) SaveStats(ctx context.Context, request shared.SaveStatsRequest return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,12 +65,13 @@ func (s *attempt) SaveStats(ctx context.Context, request shared.SaveStatsRequest if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SaveStatsResponse{ + res := &operations.SetWorkflowInAttemptResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -75,24 +80,26 @@ func (s *attempt) SaveStats(ctx context.Context, request shared.SaveStatsRequest case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InternalOperationResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InternalOperationResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InternalOperationResult = out + res.InternalOperationResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SaveSyncConfig - For worker to save the AttemptSyncConfig for an attempt. -func (s *attempt) SaveSyncConfig(ctx context.Context, request shared.SaveAttemptSyncConfigRequestBody) (*operations.SaveSyncConfigResponse, error) { +// SaveStats - For worker to set sync stats of a running attempt. +func (s *Attempt) SaveStats(ctx context.Context, request shared.SaveStatsRequestBody) (*operations.SaveStatsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/save_sync_config" + url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/save_stats" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -100,12 +107,15 @@ func (s *attempt) SaveSyncConfig(ctx context.Context, request shared.SaveAttempt return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -123,12 +133,13 @@ func (s *attempt) SaveSyncConfig(ctx context.Context, request shared.SaveAttempt if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SaveSyncConfigResponse{ + res := &operations.SaveStatsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -137,24 +148,26 @@ func (s *attempt) SaveSyncConfig(ctx context.Context, request shared.SaveAttempt case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InternalOperationResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InternalOperationResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InternalOperationResult = out + res.InternalOperationResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SetWorkflowInAttempt - For worker to register the workflow id in attempt. -func (s *attempt) SetWorkflowInAttempt(ctx context.Context, request shared.SetWorkflowInAttemptRequestBody) (*operations.SetWorkflowInAttemptResponse, error) { +// SaveSyncConfig - For worker to save the AttemptSyncConfig for an attempt. +func (s *Attempt) SaveSyncConfig(ctx context.Context, request shared.SaveAttemptSyncConfigRequestBody) (*operations.SaveSyncConfigResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/set_workflow_in_attempt" + url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/save_sync_config" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -162,12 +175,15 @@ func (s *attempt) SetWorkflowInAttempt(ctx context.Context, request shared.SetWo return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -185,12 +201,13 @@ func (s *attempt) SetWorkflowInAttempt(ctx context.Context, request shared.SetWo if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SetWorkflowInAttemptResponse{ + res := &operations.SaveSyncConfigResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -199,12 +216,14 @@ func (s *attempt) SetWorkflowInAttempt(ctx context.Context, request shared.SetWo case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InternalOperationResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InternalOperationResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InternalOperationResult = out + res.InternalOperationResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/connection.go b/internal/sdk/connection.go old mode 100755 new mode 100644 index c5f7459..6b2cc3b --- a/internal/sdk/connection.go +++ b/internal/sdk/connection.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// connection - Connection between sources and destinations. -type connection struct { +// Connection between sources and destinations. +type Connection struct { sdkConfiguration sdkConfiguration } -func newConnection(sdkConfig sdkConfiguration) *connection { - return &connection{ +func newConnection(sdkConfig sdkConfiguration) *Connection { + return &Connection{ sdkConfiguration: sdkConfig, } } // CreateConnection - Create a connection between a source and a destination -func (s *connection) CreateConnection(ctx context.Context, request shared.ConnectionCreate) (*operations.CreateConnectionResponse, error) { +func (s *Connection) CreateConnection(ctx context.Context, request shared.ConnectionCreate) (*operations.CreateConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *connection) CreateConnection(ctx context.Context, request shared.Connec return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,6 +65,7 @@ func (s *connection) CreateConnection(ctx context.Context, request shared.Connec if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -75,34 +80,42 @@ func (s *connection) CreateConnection(ctx context.Context, request shared.Connec case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionRead = out + res.ConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// DeleteConnection - Delete a connection -func (s *connection) DeleteConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.DeleteConnectionResponse, error) { +// UpdateConnection - Update a connection +// Apply a patch-style update to a connection. Only fields present on the update request body will be updated. +// Note that if a catalog is present in the request body, the connection's entire catalog will be replaced +// with the catalog from the request. This means that to modify a single stream, the entire new catalog +// containing the updated stream needs to be sent. +func (s *Connection) UpdateConnection(ctx context.Context, request shared.ConnectionUpdate) (*operations.UpdateConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/delete" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -110,12 +123,15 @@ func (s *connection) DeleteConnection(ctx context.Context, request shared.Connec return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -133,49 +149,54 @@ func (s *connection) DeleteConnection(ctx context.Context, request shared.Connec if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.DeleteConnectionResponse{ + res := &operations.UpdateConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: - case httpRes.StatusCode == 404: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.ConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetConnection - Get a connection -func (s *connection) GetConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetConnectionResponse, error) { +// ListConnectionsForWorkspace - Returns all connections for a workspace. +// List connections for workspace. Does not return deleted connections. +func (s *Connection) ListConnectionsForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListConnectionsForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/get" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/list" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -183,12 +204,15 @@ func (s *connection) GetConnection(ctx context.Context, request shared.Connectio return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -206,12 +230,13 @@ func (s *connection) GetConnection(ctx context.Context, request shared.Connectio if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetConnectionResponse{ + res := &operations.ListConnectionsForWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -220,32 +245,38 @@ func (s *connection) GetConnection(ctx context.Context, request shared.Connectio case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionRead = out + res.ConnectionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -254,11 +285,11 @@ func (s *connection) GetConnection(ctx context.Context, request shared.Connectio // ListAllConnectionsForWorkspace - Returns all connections for a workspace, including deleted connections. // List connections for workspace, including deleted connections. -func (s *connection) ListAllConnectionsForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListAllConnectionsForWorkspaceResponse, error) { +func (s *Connection) ListAllConnectionsForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListAllConnectionsForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/list_all" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -266,12 +297,15 @@ func (s *connection) ListAllConnectionsForWorkspace(ctx context.Context, request return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -289,6 +323,7 @@ func (s *connection) ListAllConnectionsForWorkspace(ctx context.Context, request if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -303,44 +338,50 @@ func (s *connection) ListAllConnectionsForWorkspace(ctx context.Context, request case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionReadList = out + res.ConnectionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListConnectionsByActorDefinition - List all connections that use the provided actor definition -func (s *connection) ListConnectionsByActorDefinition(ctx context.Context, request shared.ActorDefinitionRequestBody) (*operations.ListConnectionsByActorDefinitionResponse, error) { +// GetConnection - Get a connection +func (s *Connection) GetConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/list_by_actor_definition" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -348,12 +389,15 @@ func (s *connection) ListConnectionsByActorDefinition(ctx context.Context, reque return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -371,12 +415,13 @@ func (s *connection) ListConnectionsByActorDefinition(ctx context.Context, reque if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListConnectionsByActorDefinitionResponse{ + res := &operations.GetConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -385,45 +430,50 @@ func (s *connection) ListConnectionsByActorDefinition(ctx context.Context, reque case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionReadList = out + res.ConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListConnectionsForWorkspace - Returns all connections for a workspace. -// List connections for workspace. Does not return deleted connections. -func (s *connection) ListConnectionsForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListConnectionsForWorkspaceResponse, error) { +// ListConnectionsByActorDefinition - List all connections that use the provided actor definition +func (s *Connection) ListConnectionsByActorDefinition(ctx context.Context, request shared.ActorDefinitionRequestBody) (*operations.ListConnectionsByActorDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/list_by_actor_definition" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -431,12 +481,15 @@ func (s *connection) ListConnectionsForWorkspace(ctx context.Context, request sh return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -454,12 +507,13 @@ func (s *connection) ListConnectionsForWorkspace(ctx context.Context, request sh if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListConnectionsForWorkspaceResponse{ + res := &operations.ListConnectionsByActorDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -468,44 +522,50 @@ func (s *connection) ListConnectionsForWorkspace(ctx context.Context, request sh case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionReadList = out + res.ConnectionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ResetConnection - Reset the data for the connection. Deletes data generated by the connection in the destination. Resets any cursors back to initial state. -func (s *connection) ResetConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.ResetConnectionResponse, error) { +// SearchConnections - Search connections +func (s *Connection) SearchConnections(ctx context.Context, request shared.ConnectionSearch) (*operations.SearchConnectionsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/reset" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/search" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -513,12 +573,15 @@ func (s *connection) ResetConnection(ctx context.Context, request shared.Connect return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -536,12 +599,13 @@ func (s *connection) ResetConnection(ctx context.Context, request shared.Connect if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ResetConnectionResponse{ + res := &operations.SearchConnectionsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -550,44 +614,38 @@ func (s *connection) ResetConnection(ctx context.Context, request shared.Connect case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobInfoRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.JobInfoRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out + res.ConnectionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ResetConnectionStream - Reset the data for a specific stream in the connection. Deletes data generated by the stream in the destination. Resets any cursors back to initial state. -func (s *connection) ResetConnectionStream(ctx context.Context, request shared.ConnectionStreamRequestBody) (*operations.ResetConnectionStreamResponse, error) { +// DeleteConnection - Delete a connection +func (s *Connection) DeleteConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.DeleteConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/reset/stream" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/delete" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -595,12 +653,15 @@ func (s *connection) ResetConnectionStream(ctx context.Context, request shared.C return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -618,58 +679,54 @@ func (s *connection) ResetConnectionStream(ctx context.Context, request shared.C if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ResetConnectionStreamResponse{ + res := &operations.DeleteConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobInfoRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.JobInfoRead = out - } + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SearchConnections - Search connections -func (s *connection) SearchConnections(ctx context.Context, request shared.ConnectionSearch) (*operations.SearchConnectionsResponse, error) { +// SyncConnection - Trigger a manual sync of the connection +func (s *Connection) SyncConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.SyncConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/search" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/sync" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -677,12 +734,15 @@ func (s *connection) SearchConnections(ctx context.Context, request shared.Conne return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -700,12 +760,13 @@ func (s *connection) SearchConnections(ctx context.Context, request shared.Conne if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SearchConnectionsResponse{ + res := &operations.SyncConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -714,34 +775,50 @@ func (s *connection) SearchConnections(ctx context.Context, request shared.Conne case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobInfoRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionReadList = out + res.JobInfoRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SyncConnection - Trigger a manual sync of the connection -func (s *connection) SyncConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.SyncConnectionResponse, error) { +// ResetConnection - Reset the data for the connection. Deletes data generated by the connection in the destination. Resets any cursors back to initial state. +func (s *Connection) ResetConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.ResetConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/sync" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/reset" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -749,12 +826,15 @@ func (s *connection) SyncConnection(ctx context.Context, request shared.Connecti return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -772,12 +852,13 @@ func (s *connection) SyncConnection(ctx context.Context, request shared.Connecti if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SyncConnectionResponse{ + res := &operations.ResetConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -786,48 +867,50 @@ func (s *connection) SyncConnection(ctx context.Context, request shared.Connecti case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobInfoRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobInfoRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.JobInfoRead = out + res.JobInfoRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateConnection - Update a connection -// Apply a patch-style update to a connection. Only fields present on the update request body will be updated. -// Note that if a catalog is present in the request body, the connection's entire catalog will be replaced -// with the catalog from the request. This means that to modify a single stream, the entire new catalog -// containing the updated stream needs to be sent. -func (s *connection) UpdateConnection(ctx context.Context, request shared.ConnectionUpdate) (*operations.UpdateConnectionResponse, error) { +// ResetConnectionStream - Reset the data for a specific stream in the connection. Deletes data generated by the stream in the destination. Resets any cursors back to initial state. +func (s *Connection) ResetConnectionStream(ctx context.Context, request shared.ConnectionStreamRequestBody) (*operations.ResetConnectionStreamResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connections/reset/stream" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -835,12 +918,15 @@ func (s *connection) UpdateConnection(ctx context.Context, request shared.Connec return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -858,12 +944,13 @@ func (s *connection) UpdateConnection(ctx context.Context, request shared.Connec if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateConnectionResponse{ + res := &operations.ResetConnectionStreamResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -872,22 +959,38 @@ func (s *connection) UpdateConnection(ctx context.Context, request shared.Connec case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobInfoRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.JobInfoRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionRead = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/connectorbuilderproject.go b/internal/sdk/connectorbuilderproject.go old mode 100755 new mode 100644 index aa0d894..eb878e3 --- a/internal/sdk/connectorbuilderproject.go +++ b/internal/sdk/connectorbuilderproject.go @@ -3,33 +3,34 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type connectorBuilderProject struct { +type ConnectorBuilderProject struct { sdkConfiguration sdkConfiguration } -func newConnectorBuilderProject(sdkConfig sdkConfiguration) *connectorBuilderProject { - return &connectorBuilderProject{ +func newConnectorBuilderProject(sdkConfig sdkConfiguration) *ConnectorBuilderProject { + return &ConnectorBuilderProject{ sdkConfiguration: sdkConfig, } } // CreateConnectorBuilderProject - Create new connector builder project -func (s *connectorBuilderProject) CreateConnectorBuilderProject(ctx context.Context, request shared.ConnectorBuilderProjectWithWorkspaceID) (*operations.CreateConnectorBuilderProjectResponse, error) { +func (s *ConnectorBuilderProject) CreateConnectorBuilderProject(ctx context.Context, request shared.ConnectorBuilderProjectWithWorkspaceID) (*operations.CreateConnectorBuilderProjectResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -37,12 +38,15 @@ func (s *connectorBuilderProject) CreateConnectorBuilderProject(ctx context.Cont return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -60,6 +64,7 @@ func (s *connectorBuilderProject) CreateConnectorBuilderProject(ctx context.Cont if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -74,24 +79,26 @@ func (s *connectorBuilderProject) CreateConnectorBuilderProject(ctx context.Cont case httpRes.StatusCode == 201: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectorBuilderProjectIDWithWorkspaceID - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectorBuilderProjectIDWithWorkspaceID + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectorBuilderProjectIDWithWorkspaceID = out + res.ConnectorBuilderProjectIDWithWorkspaceID = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// DeleteConnectorBuilderProject - Deletes connector builder project -func (s *connectorBuilderProject) DeleteConnectorBuilderProject(ctx context.Context, request shared.ConnectorBuilderProjectIDWithWorkspaceID) (*operations.DeleteConnectorBuilderProjectResponse, error) { +// PublishConnectorBuilderProject - Publish a connector to the workspace +func (s *ConnectorBuilderProject) PublishConnectorBuilderProject(ctx context.Context, request shared.ConnectorBuilderPublishRequestBody) (*operations.PublishConnectorBuilderProjectResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/delete" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/publish" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -99,12 +106,15 @@ func (s *connectorBuilderProject) DeleteConnectorBuilderProject(ctx context.Cont return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "*/*") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("Accept", "application/json") + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -122,29 +132,41 @@ func (s *connectorBuilderProject) DeleteConnectorBuilderProject(ctx context.Cont if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.DeleteConnectorBuilderProjectResponse{ + res := &operations.PublishConnectorBuilderProjectResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.SourceDefinitionIDBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.SourceDefinitionIDBody = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } } return res, nil } -// GetConnectorBuilderProject - Get a connector builder project with draft manifest -func (s *connectorBuilderProject) GetConnectorBuilderProject(ctx context.Context, request shared.ConnectorBuilderProjectIDWithWorkspaceID) (*operations.GetConnectorBuilderProjectResponse, error) { +// UpdateConnectorBuilderProject - Update connector builder project +func (s *ConnectorBuilderProject) UpdateConnectorBuilderProject(ctx context.Context, request shared.ExistingConnectorBuilderProjectWithWorkspaceID) (*operations.UpdateConnectorBuilderProjectResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/get_with_manifest" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -152,12 +174,15 @@ func (s *connectorBuilderProject) GetConnectorBuilderProject(ctx context.Context return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("Accept", "*/*") + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -175,38 +200,30 @@ func (s *connectorBuilderProject) GetConnectorBuilderProject(ctx context.Context if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetConnectorBuilderProjectResponse{ + res := &operations.UpdateConnectorBuilderProjectResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectorBuilderProjectRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.ConnectorBuilderProjectRead = out - } + case httpRes.StatusCode == 204: } return res, nil } -// ListConnectorBuilderProjects - List connector builder projects for workspace -func (s *connectorBuilderProject) ListConnectorBuilderProjects(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListConnectorBuilderProjectsResponse, error) { +// DeleteConnectorBuilderProject - Deletes connector builder project +func (s *ConnectorBuilderProject) DeleteConnectorBuilderProject(ctx context.Context, request shared.ConnectorBuilderProjectIDWithWorkspaceID) (*operations.DeleteConnectorBuilderProjectResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/delete" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -214,12 +231,15 @@ func (s *connectorBuilderProject) ListConnectorBuilderProjects(ctx context.Conte return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("Accept", "*/*") + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -237,38 +257,30 @@ func (s *connectorBuilderProject) ListConnectorBuilderProjects(ctx context.Conte if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListConnectorBuilderProjectsResponse{ + res := &operations.DeleteConnectorBuilderProjectResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectorBuilderProjectReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.ConnectorBuilderProjectReadList = out - } + case httpRes.StatusCode == 204: } return res, nil } -// PublishConnectorBuilderProject - Publish a connector to the workspace -func (s *connectorBuilderProject) PublishConnectorBuilderProject(ctx context.Context, request shared.ConnectorBuilderPublishRequestBody) (*operations.PublishConnectorBuilderProjectResponse, error) { +// ListConnectorBuilderProjects - List connector builder projects for workspace +func (s *ConnectorBuilderProject) ListConnectorBuilderProjects(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListConnectorBuilderProjectsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/publish" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/list" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -276,12 +288,15 @@ func (s *connectorBuilderProject) PublishConnectorBuilderProject(ctx context.Con return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -299,12 +314,13 @@ func (s *connectorBuilderProject) PublishConnectorBuilderProject(ctx context.Con if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.PublishConnectorBuilderProjectResponse{ + res := &operations.ListConnectorBuilderProjectsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -313,24 +329,26 @@ func (s *connectorBuilderProject) PublishConnectorBuilderProject(ctx context.Con case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionIDBody - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectorBuilderProjectReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDefinitionIDBody = out + res.ConnectorBuilderProjectReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateConnectorBuilderProject - Update connector builder project -func (s *connectorBuilderProject) UpdateConnectorBuilderProject(ctx context.Context, request shared.ExistingConnectorBuilderProjectWithWorkspaceID) (*operations.UpdateConnectorBuilderProjectResponse, error) { +// GetConnectorBuilderProject - Get a connector builder project with draft manifest +func (s *ConnectorBuilderProject) GetConnectorBuilderProject(ctx context.Context, request shared.ConnectorBuilderProjectIDWithWorkspaceID) (*operations.GetConnectorBuilderProjectResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/connector_builder_projects/get_with_manifest" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -338,12 +356,15 @@ func (s *connectorBuilderProject) UpdateConnectorBuilderProject(ctx context.Cont return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "*/*") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("Accept", "application/json") + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -361,18 +382,30 @@ func (s *connectorBuilderProject) UpdateConnectorBuilderProject(ctx context.Cont if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateConnectorBuilderProjectResponse{ + res := &operations.GetConnectorBuilderProjectResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.ConnectorBuilderProjectRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ConnectorBuilderProjectRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } } return res, nil diff --git a/internal/sdk/declarativesourcedefinitions.go b/internal/sdk/declarativesourcedefinitions.go old mode 100755 new mode 100644 index 16b264c..405691e --- a/internal/sdk/declarativesourcedefinitions.go +++ b/internal/sdk/declarativesourcedefinitions.go @@ -3,33 +3,34 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type declarativeSourceDefinitions struct { +type DeclarativeSourceDefinitions struct { sdkConfiguration sdkConfiguration } -func newDeclarativeSourceDefinitions(sdkConfig sdkConfiguration) *declarativeSourceDefinitions { - return &declarativeSourceDefinitions{ +func newDeclarativeSourceDefinitions(sdkConfig sdkConfiguration) *DeclarativeSourceDefinitions { + return &DeclarativeSourceDefinitions{ sdkConfiguration: sdkConfig, } } // CreateDeclarativeSourceDefinitionManifest - Create a declarative manifest to be used by the specified source definition -func (s *declarativeSourceDefinitions) CreateDeclarativeSourceDefinitionManifest(ctx context.Context, request shared.DeclarativeSourceDefinitionCreateManifestRequestBody) (*operations.CreateDeclarativeSourceDefinitionManifestResponse, error) { +func (s *DeclarativeSourceDefinitions) CreateDeclarativeSourceDefinitionManifest(ctx context.Context, request shared.DeclarativeSourceDefinitionCreateManifestRequestBody) (*operations.CreateDeclarativeSourceDefinitionManifestResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/declarative_source_definitions/create_manifest" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -37,12 +38,15 @@ func (s *declarativeSourceDefinitions) CreateDeclarativeSourceDefinitionManifest return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -60,6 +64,7 @@ func (s *declarativeSourceDefinitions) CreateDeclarativeSourceDefinitionManifest if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -79,24 +84,26 @@ func (s *declarativeSourceDefinitions) CreateDeclarativeSourceDefinitionManifest case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListDeclarativeManifests - List all available declarative manifest versions of a declarative source definition -func (s *declarativeSourceDefinitions) ListDeclarativeManifests(ctx context.Context, request shared.ListDeclarativeManifestsRequestBody) (*operations.ListDeclarativeManifestsResponse, error) { +// UpdateDeclarativeManifestVersion - Update the declarative manifest version for a source +func (s *DeclarativeSourceDefinitions) UpdateDeclarativeManifestVersion(ctx context.Context, request shared.UpdateActiveManifestRequestBody) (*operations.UpdateDeclarativeManifestVersionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/declarative_source_definitions/list_manifests" + url := strings.TrimSuffix(baseURL, "/") + "/v1/declarative_source_definitions/update_active_manifest" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -104,12 +111,15 @@ func (s *declarativeSourceDefinitions) ListDeclarativeManifests(ctx context.Cont return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -127,49 +137,42 @@ func (s *declarativeSourceDefinitions) ListDeclarativeManifests(ctx context.Cont if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListDeclarativeManifestsResponse{ + res := &operations.UpdateDeclarativeManifestVersionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.DeclarativeManifestsReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.DeclarativeManifestsReadList = out - } - case httpRes.StatusCode == 400: + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateDeclarativeManifestVersion - Update the declarative manifest version for a source -func (s *declarativeSourceDefinitions) UpdateDeclarativeManifestVersion(ctx context.Context, request shared.UpdateActiveManifestRequestBody) (*operations.UpdateDeclarativeManifestVersionResponse, error) { +// ListDeclarativeManifests - List all available declarative manifest versions of a declarative source definition +func (s *DeclarativeSourceDefinitions) ListDeclarativeManifests(ctx context.Context, request shared.ListDeclarativeManifestsRequestBody) (*operations.ListDeclarativeManifestsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/declarative_source_definitions/update_active_manifest" + url := strings.TrimSuffix(baseURL, "/") + "/v1/declarative_source_definitions/list_manifests" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -177,12 +180,15 @@ func (s *declarativeSourceDefinitions) UpdateDeclarativeManifestVersion(ctx cont return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -200,27 +206,42 @@ func (s *declarativeSourceDefinitions) UpdateDeclarativeManifestVersion(ctx cont if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateDeclarativeManifestVersionResponse{ + res := &operations.ListDeclarativeManifestsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.DeclarativeManifestsReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.DeclarativeManifestsReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/destination.go b/internal/sdk/destination.go old mode 100755 new mode 100644 index 44c7595..70eb1e5 --- a/internal/sdk/destination.go +++ b/internal/sdk/destination.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// destination - Destination related resources. -type destination struct { +// Destination related resources. +type Destination struct { sdkConfiguration sdkConfiguration } -func newDestination(sdkConfig sdkConfiguration) *destination { - return &destination{ +func newDestination(sdkConfig sdkConfiguration) *Destination { + return &Destination{ sdkConfiguration: sdkConfig, } } -// CheckConnectionToDestination - Check connection to the destination -func (s *destination) CheckConnectionToDestination(ctx context.Context, request shared.DestinationIDRequestBody) (*operations.CheckConnectionToDestinationResponse, error) { +// CreateDestination - Create a destination +func (s *Destination) CreateDestination(ctx context.Context, request shared.DestinationCreate) (*operations.CreateDestinationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/check_connection" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *destination) CheckConnectionToDestination(ctx context.Context, request return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,12 +65,13 @@ func (s *destination) CheckConnectionToDestination(ctx context.Context, request if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CheckConnectionToDestinationResponse{ + res := &operations.CreateDestinationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -75,44 +80,38 @@ func (s *destination) CheckConnectionToDestination(ctx context.Context, request case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CheckConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CheckConnectionRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out + res.DestinationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// CheckConnectionToDestinationForUpdate - Check connection for a proposed update to a destination -func (s *destination) CheckConnectionToDestinationForUpdate(ctx context.Context, request shared.DestinationUpdate) (*operations.CheckConnectionToDestinationForUpdateResponse, error) { +// UpdateDestination - Update a destination +func (s *Destination) UpdateDestination(ctx context.Context, request shared.DestinationUpdate) (*operations.UpdateDestinationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/check_connection_for_update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -120,12 +119,15 @@ func (s *destination) CheckConnectionToDestinationForUpdate(ctx context.Context, return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -143,12 +145,13 @@ func (s *destination) CheckConnectionToDestinationForUpdate(ctx context.Context, if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CheckConnectionToDestinationForUpdateResponse{ + res := &operations.UpdateDestinationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -157,44 +160,38 @@ func (s *destination) CheckConnectionToDestinationForUpdate(ctx context.Context, case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CheckConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.CheckConnectionRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.DestinationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// CloneDestination - Clone destination -func (s *destination) CloneDestination(ctx context.Context, request shared.DestinationCloneRequestBody) (*operations.CloneDestinationResponse, error) { +// PartialUpdateDestination - Update a destination partially +func (s *Destination) PartialUpdateDestination(ctx context.Context, request shared.PartialDestinationUpdate) (*operations.PartialUpdateDestinationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/clone" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/partial_update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -202,12 +199,15 @@ func (s *destination) CloneDestination(ctx context.Context, request shared.Desti return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -225,12 +225,13 @@ func (s *destination) CloneDestination(ctx context.Context, request shared.Desti if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CloneDestinationResponse{ + res := &operations.PartialUpdateDestinationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -239,44 +240,38 @@ func (s *destination) CloneDestination(ctx context.Context, request shared.Desti case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.DestinationRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.DestinationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// CreateDestination - Create a destination -func (s *destination) CreateDestination(ctx context.Context, request shared.DestinationCreate) (*operations.CreateDestinationResponse, error) { +// ListDestinationsForWorkspace - List configured destinations for a workspace +func (s *Destination) ListDestinationsForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListDestinationsForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/create" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/list" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -284,12 +279,15 @@ func (s *destination) CreateDestination(ctx context.Context, request shared.Dest return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -307,12 +305,13 @@ func (s *destination) CreateDestination(ctx context.Context, request shared.Dest if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CreateDestinationResponse{ + res := &operations.ListDestinationsForWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -321,34 +320,50 @@ func (s *destination) CreateDestination(ctx context.Context, request shared.Dest case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationRead = out + res.DestinationReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// DeleteDestination - Delete the destination -func (s *destination) DeleteDestination(ctx context.Context, request shared.DestinationIDRequestBody) (*operations.DeleteDestinationResponse, error) { +// GetDestination - Get configured destination +func (s *Destination) GetDestination(ctx context.Context, request shared.DestinationIDRequestBody) (*operations.GetDestinationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/delete" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -356,12 +371,15 @@ func (s *destination) DeleteDestination(ctx context.Context, request shared.Dest return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -379,49 +397,65 @@ func (s *destination) DeleteDestination(ctx context.Context, request shared.Dest if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.DeleteDestinationResponse{ + res := &operations.GetDestinationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.DestinationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.DestinationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetDestination - Get configured destination -func (s *destination) GetDestination(ctx context.Context, request shared.DestinationIDRequestBody) (*operations.GetDestinationResponse, error) { +// SearchDestinations - Search destinations +func (s *Destination) SearchDestinations(ctx context.Context, request shared.DestinationSearch) (*operations.SearchDestinationsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/get" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/search" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -429,12 +463,15 @@ func (s *destination) GetDestination(ctx context.Context, request shared.Destina return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -452,12 +489,13 @@ func (s *destination) GetDestination(ctx context.Context, request shared.Destina if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetDestinationResponse{ + res := &operations.SearchDestinationsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -466,44 +504,38 @@ func (s *destination) GetDestination(ctx context.Context, request shared.Destina case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out + res.DestinationReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListDestinationsForWorkspace - List configured destinations for a workspace -func (s *destination) ListDestinationsForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListDestinationsForWorkspaceResponse, error) { +// CheckConnectionToDestination - Check connection to the destination +func (s *Destination) CheckConnectionToDestination(ctx context.Context, request shared.DestinationIDRequestBody) (*operations.CheckConnectionToDestinationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/check_connection" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -511,12 +543,15 @@ func (s *destination) ListDestinationsForWorkspace(ctx context.Context, request return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -534,12 +569,13 @@ func (s *destination) ListDestinationsForWorkspace(ctx context.Context, request if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListDestinationsForWorkspaceResponse{ + res := &operations.CheckConnectionToDestinationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -548,44 +584,50 @@ func (s *destination) ListDestinationsForWorkspace(ctx context.Context, request case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CheckConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationReadList = out + res.CheckConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// PartialUpdateDestination - Update a destination partially -func (s *destination) PartialUpdateDestination(ctx context.Context, request shared.PartialDestinationUpdate) (*operations.PartialUpdateDestinationResponse, error) { +// CheckConnectionToDestinationForUpdate - Check connection for a proposed update to a destination +func (s *Destination) CheckConnectionToDestinationForUpdate(ctx context.Context, request shared.DestinationUpdate) (*operations.CheckConnectionToDestinationForUpdateResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/partial_update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/check_connection_for_update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -593,12 +635,15 @@ func (s *destination) PartialUpdateDestination(ctx context.Context, request shar return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -616,12 +661,13 @@ func (s *destination) PartialUpdateDestination(ctx context.Context, request shar if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.PartialUpdateDestinationResponse{ + res := &operations.CheckConnectionToDestinationForUpdateResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -630,34 +676,50 @@ func (s *destination) PartialUpdateDestination(ctx context.Context, request shar case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CheckConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.CheckConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationRead = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SearchDestinations - Search destinations -func (s *destination) SearchDestinations(ctx context.Context, request shared.DestinationSearch) (*operations.SearchDestinationsResponse, error) { +// DeleteDestination - Delete the destination +func (s *Destination) DeleteDestination(ctx context.Context, request shared.DestinationIDRequestBody) (*operations.DeleteDestinationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/search" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/delete" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -665,12 +727,15 @@ func (s *destination) SearchDestinations(ctx context.Context, request shared.Des return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -688,48 +753,54 @@ func (s *destination) SearchDestinations(ctx context.Context, request shared.Des if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SearchDestinationsResponse{ + res := &operations.DeleteDestinationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 204: + case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationReadList = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateDestination - Update a destination -func (s *destination) UpdateDestination(ctx context.Context, request shared.DestinationUpdate) (*operations.UpdateDestinationResponse, error) { +// CloneDestination - Clone destination +func (s *Destination) CloneDestination(ctx context.Context, request shared.DestinationCloneRequestBody) (*operations.CloneDestinationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destinations/clone" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -737,12 +808,15 @@ func (s *destination) UpdateDestination(ctx context.Context, request shared.Dest return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -760,12 +834,13 @@ func (s *destination) UpdateDestination(ctx context.Context, request shared.Dest if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateDestinationResponse{ + res := &operations.CloneDestinationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -774,22 +849,38 @@ func (s *destination) UpdateDestination(ctx context.Context, request shared.Dest case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.DestinationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationRead = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/destinationdefinition.go b/internal/sdk/destinationdefinition.go old mode 100755 new mode 100644 index de63c79..f9e233e --- a/internal/sdk/destinationdefinition.go +++ b/internal/sdk/destinationdefinition.go @@ -3,44 +3,51 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// destinationDefinition - DestinationDefinition related resources. -type destinationDefinition struct { +// DestinationDefinition related resources. +type DestinationDefinition struct { sdkConfiguration sdkConfiguration } -func newDestinationDefinition(sdkConfig sdkConfiguration) *destinationDefinition { - return &destinationDefinition{ +func newDestinationDefinition(sdkConfig sdkConfiguration) *DestinationDefinition { + return &DestinationDefinition{ sdkConfiguration: sdkConfig, } } -// CreateCustomDestinationDefinition - Creates a custom destinationDefinition for the given workspace -func (s *destinationDefinition) CreateCustomDestinationDefinition(ctx context.Context, request shared.CustomDestinationDefinitionCreate) (*operations.CreateCustomDestinationDefinitionResponse, error) { +// UpdateDestinationDefinition - Update destinationDefinition +func (s *DestinationDefinition) UpdateDestinationDefinition(ctx context.Context, request shared.DestinationDefinitionUpdate) (*operations.UpdateDestinationDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/create_custom" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } + + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -58,12 +65,13 @@ func (s *destinationDefinition) CreateCustomDestinationDefinition(ctx context.Co if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CreateCustomDestinationDefinitionResponse{ + res := &operations.UpdateDestinationDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -72,49 +80,55 @@ func (s *destinationDefinition) CreateCustomDestinationDefinition(ctx context.Co case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationDefinitionRead = out + res.DestinationDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// DeleteDestinationDefinition - Delete a destination definition -func (s *destinationDefinition) DeleteDestinationDefinition(ctx context.Context, request shared.DestinationDefinitionIDRequestBody) (*operations.DeleteDestinationDefinitionResponse, error) { +// ListDestinationDefinitions - List all the destinationDefinitions the current Airbyte deployment is configured to use +func (s *DestinationDefinition) ListDestinationDefinitions(ctx context.Context) (*operations.ListDestinationDefinitionsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/delete" - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") - if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) - } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/list" - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) - - req.Header.Set("Content-Type", reqContentType) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -135,59 +149,41 @@ func (s *destinationDefinition) DeleteDestinationDefinition(ctx context.Context, contentType := httpRes.Header.Get("Content-Type") - res := &operations.DeleteDestinationDefinitionResponse{ + res := &operations.ListDestinationDefinitionsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.DestinationDefinitionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetDestinationDefinition - Get destinationDefinition -func (s *destinationDefinition) GetDestinationDefinition(ctx context.Context, request shared.DestinationDefinitionIDRequestBody) (*operations.GetDestinationDefinitionResponse, error) { +// ListLatestDestinationDefinitions - List the latest destinationDefinitions Airbyte supports +// Guaranteed to retrieve the latest information on supported destinations. +func (s *DestinationDefinition) ListLatestDestinationDefinitions(ctx context.Context) (*operations.ListLatestDestinationDefinitionsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/get" - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") - if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) - } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/list_latest" - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) - - req.Header.Set("Content-Type", reqContentType) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -208,7 +204,7 @@ func (s *destinationDefinition) GetDestinationDefinition(ctx context.Context, re contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetDestinationDefinitionResponse{ + res := &operations.ListLatestDestinationDefinitionsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -217,44 +213,26 @@ func (s *destinationDefinition) GetDestinationDefinition(ctx context.Context, re case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.DestinationDefinitionRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.DestinationDefinitionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetDestinationDefinitionForWorkspace - Get a destinationDefinition that is configured for the given workspace -func (s *destinationDefinition) GetDestinationDefinitionForWorkspace(ctx context.Context, request shared.DestinationDefinitionIDWithWorkspaceID) (*operations.GetDestinationDefinitionForWorkspaceResponse, error) { +// GetDestinationDefinition - Get destinationDefinition +func (s *DestinationDefinition) GetDestinationDefinition(ctx context.Context, request shared.DestinationDefinitionIDRequestBody) (*operations.GetDestinationDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/get_for_workspace" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -262,12 +240,15 @@ func (s *destinationDefinition) GetDestinationDefinitionForWorkspace(ctx context return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -285,12 +266,13 @@ func (s *destinationDefinition) GetDestinationDefinitionForWorkspace(ctx context if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetDestinationDefinitionForWorkspaceResponse{ + res := &operations.GetDestinationDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -299,44 +281,50 @@ func (s *destinationDefinition) GetDestinationDefinitionForWorkspace(ctx context case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationDefinitionRead = out + res.DestinationDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GrantDestinationDefinitionToWorkspace - grant a private, non-custom destinationDefinition to a given workspace -func (s *destinationDefinition) GrantDestinationDefinitionToWorkspace(ctx context.Context, request shared.DestinationDefinitionIDWithWorkspaceID) (*operations.GrantDestinationDefinitionToWorkspaceResponse, error) { +// DeleteDestinationDefinition - Delete a destination definition +func (s *DestinationDefinition) DeleteDestinationDefinition(ctx context.Context, request shared.DestinationDefinitionIDRequestBody) (*operations.DeleteDestinationDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/grant_definition" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/delete" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -344,12 +332,15 @@ func (s *destinationDefinition) GrantDestinationDefinitionToWorkspace(ctx contex return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -367,63 +358,68 @@ func (s *destinationDefinition) GrantDestinationDefinitionToWorkspace(ctx contex if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GrantDestinationDefinitionToWorkspaceResponse{ + res := &operations.DeleteDestinationDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.PrivateDestinationDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.PrivateDestinationDefinitionRead = out - } + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListDestinationDefinitions - List all the destinationDefinitions the current Airbyte deployment is configured to use -func (s *destinationDefinition) ListDestinationDefinitions(ctx context.Context) (*operations.ListDestinationDefinitionsResponse, error) { +// ListPrivateDestinationDefinitions - List all private, non-custom destinationDefinitions, and for each indicate whether the given workspace has a grant for using the definition. Used by admins to view and modify a given workspace's grants. +func (s *DestinationDefinition) ListPrivateDestinationDefinitions(ctx context.Context, request *shared.WorkspaceIDRequestBody) (*operations.ListPrivateDestinationDefinitionsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/list_private" - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, fmt.Errorf("error serializing request body: %w", err) + } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + + req.Header.Set("Content-Type", reqContentType) client := s.sdkConfiguration.SecurityClient @@ -439,12 +435,13 @@ func (s *destinationDefinition) ListDestinationDefinitions(ctx context.Context) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListDestinationDefinitionsResponse{ + res := &operations.ListPrivateDestinationDefinitionsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -453,12 +450,14 @@ func (s *destinationDefinition) ListDestinationDefinitions(ctx context.Context) case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.PrivateDestinationDefinitionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationDefinitionReadList = out + res.PrivateDestinationDefinitionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -466,21 +465,23 @@ func (s *destinationDefinition) ListDestinationDefinitions(ctx context.Context) } // ListDestinationDefinitionsForWorkspace - List all the destinationDefinitions the given workspace is configured to use -func (s *destinationDefinition) ListDestinationDefinitionsForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListDestinationDefinitionsForWorkspaceResponse, error) { +func (s *DestinationDefinition) ListDestinationDefinitionsForWorkspace(ctx context.Context, request *shared.WorkspaceIDRequestBody) (*operations.ListDestinationDefinitionsForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/list_for_workspace" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -498,6 +499,7 @@ func (s *destinationDefinition) ListDestinationDefinitionsForWorkspace(ctx conte if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -512,30 +514,40 @@ func (s *destinationDefinition) ListDestinationDefinitionsForWorkspace(ctx conte case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationDefinitionReadList = out + res.DestinationDefinitionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListLatestDestinationDefinitions - List the latest destinationDefinitions Airbyte supports -// Guaranteed to retrieve the latest information on supported destinations. -func (s *destinationDefinition) ListLatestDestinationDefinitions(ctx context.Context) (*operations.ListLatestDestinationDefinitionsResponse, error) { +// CreateCustomDestinationDefinition - Creates a custom destinationDefinition for the given workspace +func (s *DestinationDefinition) CreateCustomDestinationDefinition(ctx context.Context, request *shared.CustomDestinationDefinitionCreate) (*operations.CreateCustomDestinationDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/list_latest" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/create_custom" - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, fmt.Errorf("error serializing request body: %w", err) + } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + + req.Header.Set("Content-Type", reqContentType) client := s.sdkConfiguration.SecurityClient @@ -551,12 +563,13 @@ func (s *destinationDefinition) ListLatestDestinationDefinitions(ctx context.Con if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListLatestDestinationDefinitionsResponse{ + res := &operations.CreateCustomDestinationDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -565,34 +578,54 @@ func (s *destinationDefinition) ListLatestDestinationDefinitions(ctx context.Con case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationDefinitionReadList = out + res.DestinationDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListPrivateDestinationDefinitions - List all private, non-custom destinationDefinitions, and for each indicate whether the given workspace has a grant for using the definition. Used by admins to view and modify a given workspace's grants. -func (s *destinationDefinition) ListPrivateDestinationDefinitions(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListPrivateDestinationDefinitionsResponse, error) { +// GetDestinationDefinitionForWorkspace - Get a destinationDefinition that is configured for the given workspace +func (s *DestinationDefinition) GetDestinationDefinitionForWorkspace(ctx context.Context, request shared.DestinationDefinitionIDWithWorkspaceID) (*operations.GetDestinationDefinitionForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/list_private" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/get_for_workspace" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } + + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -610,12 +643,13 @@ func (s *destinationDefinition) ListPrivateDestinationDefinitions(ctx context.Co if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListPrivateDestinationDefinitionsResponse{ + res := &operations.GetDestinationDefinitionForWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -624,24 +658,50 @@ func (s *destinationDefinition) ListPrivateDestinationDefinitions(ctx context.Co case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.PrivateDestinationDefinitionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.DestinationDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.PrivateDestinationDefinitionReadList = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// RevokeDestinationDefinitionFromWorkspace - revoke a grant to a private, non-custom destinationDefinition from a given workspace -func (s *destinationDefinition) RevokeDestinationDefinitionFromWorkspace(ctx context.Context, request shared.DestinationDefinitionIDWithWorkspaceID) (*operations.RevokeDestinationDefinitionFromWorkspaceResponse, error) { +// GrantDestinationDefinitionToWorkspace - grant a private, non-custom destinationDefinition to a given workspace +func (s *DestinationDefinition) GrantDestinationDefinitionToWorkspace(ctx context.Context, request shared.DestinationDefinitionIDWithWorkspaceID) (*operations.GrantDestinationDefinitionToWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/revoke_definition" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/grant_definition" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -649,12 +709,15 @@ func (s *destinationDefinition) RevokeDestinationDefinitionFromWorkspace(ctx con return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -672,49 +735,65 @@ func (s *destinationDefinition) RevokeDestinationDefinitionFromWorkspace(ctx con if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.RevokeDestinationDefinitionFromWorkspaceResponse{ + res := &operations.GrantDestinationDefinitionToWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.PrivateDestinationDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.PrivateDestinationDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateDestinationDefinition - Update destinationDefinition -func (s *destinationDefinition) UpdateDestinationDefinition(ctx context.Context, request shared.DestinationDefinitionUpdate) (*operations.UpdateDestinationDefinitionResponse, error) { +// RevokeDestinationDefinitionFromWorkspace - revoke a grant to a private, non-custom destinationDefinition from a given workspace +func (s *DestinationDefinition) RevokeDestinationDefinitionFromWorkspace(ctx context.Context, request shared.DestinationDefinitionIDWithWorkspaceID) (*operations.RevokeDestinationDefinitionFromWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definitions/revoke_definition" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -722,12 +801,15 @@ func (s *destinationDefinition) UpdateDestinationDefinition(ctx context.Context, return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -745,46 +827,42 @@ func (s *destinationDefinition) UpdateDestinationDefinition(ctx context.Context, if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateDestinationDefinitionResponse{ + res := &operations.RevokeDestinationDefinitionFromWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.DestinationDefinitionRead = out - } + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/destinationdefinitionspecification.go b/internal/sdk/destinationdefinitionspecification.go old mode 100755 new mode 100644 index 1a6261b..399ef4b --- a/internal/sdk/destinationdefinitionspecification.go +++ b/internal/sdk/destinationdefinitionspecification.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// destinationDefinitionSpecification - DestinationDefinitionSpecification related resources. -type destinationDefinitionSpecification struct { +// DestinationDefinitionSpecification related resources. +type DestinationDefinitionSpecification struct { sdkConfiguration sdkConfiguration } -func newDestinationDefinitionSpecification(sdkConfig sdkConfiguration) *destinationDefinitionSpecification { - return &destinationDefinitionSpecification{ +func newDestinationDefinitionSpecification(sdkConfig sdkConfiguration) *DestinationDefinitionSpecification { + return &DestinationDefinitionSpecification{ sdkConfiguration: sdkConfig, } } // GetDestinationDefinitionSpecification - Get specification for a destinationDefinition -func (s *destinationDefinitionSpecification) GetDestinationDefinitionSpecification(ctx context.Context, request shared.DestinationDefinitionIDWithWorkspaceID) (*operations.GetDestinationDefinitionSpecificationResponse, error) { +func (s *DestinationDefinitionSpecification) GetDestinationDefinitionSpecification(ctx context.Context, request shared.DestinationDefinitionIDWithWorkspaceID) (*operations.GetDestinationDefinitionSpecificationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definition_specifications/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *destinationDefinitionSpecification) GetDestinationDefinitionSpecificati return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,6 +65,7 @@ func (s *destinationDefinitionSpecification) GetDestinationDefinitionSpecificati if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -75,32 +80,38 @@ func (s *destinationDefinitionSpecification) GetDestinationDefinitionSpecificati case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionSpecificationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionSpecificationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationDefinitionSpecificationRead = out + res.DestinationDefinitionSpecificationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -108,11 +119,11 @@ func (s *destinationDefinitionSpecification) GetDestinationDefinitionSpecificati } // GetSpecificationForDestinationID - Get specification for a destination -func (s *destinationDefinitionSpecification) GetSpecificationForDestinationID(ctx context.Context, request shared.DestinationIDRequestBody) (*operations.GetSpecificationForDestinationIDResponse, error) { +func (s *DestinationDefinitionSpecification) GetSpecificationForDestinationID(ctx context.Context, request shared.DestinationIDRequestBody) (*operations.GetSpecificationForDestinationIDResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_definition_specifications/get_for_destination" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -120,12 +131,15 @@ func (s *destinationDefinitionSpecification) GetSpecificationForDestinationID(ct return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -143,6 +157,7 @@ func (s *destinationDefinitionSpecification) GetSpecificationForDestinationID(ct if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -157,32 +172,38 @@ func (s *destinationDefinitionSpecification) GetSpecificationForDestinationID(ct case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DestinationDefinitionSpecificationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DestinationDefinitionSpecificationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DestinationDefinitionSpecificationRead = out + res.DestinationDefinitionSpecificationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/destinationoauth.go b/internal/sdk/destinationoauth.go old mode 100755 new mode 100644 index ceb6a55..015a907 --- a/internal/sdk/destinationoauth.go +++ b/internal/sdk/destinationoauth.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// destinationOauth - Source OAuth related resources to delegate access from user. -type destinationOauth struct { +// DestinationOauth - Source OAuth related resources to delegate access from user. +type DestinationOauth struct { sdkConfiguration sdkConfiguration } -func newDestinationOauth(sdkConfig sdkConfiguration) *destinationOauth { - return &destinationOauth{ +func newDestinationOauth(sdkConfig sdkConfiguration) *DestinationOauth { + return &DestinationOauth{ sdkConfiguration: sdkConfig, } } -// CompleteDestinationOAuth - Given a destination def ID generate an access/refresh token etc. -func (s *destinationOauth) CompleteDestinationOAuth(ctx context.Context, request shared.CompleteDestinationOAuthRequest) (*operations.CompleteDestinationOAuthResponse, error) { +// GetDestinationOAuthConsent - Given a destination connector definition ID, return the URL to the consent screen where to redirect the user to. +func (s *DestinationOauth) GetDestinationOAuthConsent(ctx context.Context, request shared.DestinationOauthConsentRequest) (*operations.GetDestinationOAuthConsentResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_oauths/complete_oauth" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_oauths/get_consent_url" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *destinationOauth) CompleteDestinationOAuth(ctx context.Context, request return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,12 +65,13 @@ func (s *destinationOauth) CompleteDestinationOAuth(ctx context.Context, request if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CompleteDestinationOAuthResponse{ + res := &operations.GetDestinationOAuthConsentResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -75,44 +80,50 @@ func (s *destinationOauth) CompleteDestinationOAuth(ctx context.Context, request case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CompleteOAuthResponse - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.OAuthConsentRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CompleteOAuthResponse = out + res.OAuthConsentRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetDestinationOAuthConsent - Given a destination connector definition ID, return the URL to the consent screen where to redirect the user to. -func (s *destinationOauth) GetDestinationOAuthConsent(ctx context.Context, request shared.DestinationOauthConsentRequest) (*operations.GetDestinationOAuthConsentResponse, error) { +// CompleteDestinationOAuth - Given a destination def ID generate an access/refresh token etc. +func (s *DestinationOauth) CompleteDestinationOAuth(ctx context.Context, request shared.CompleteDestinationOAuthRequest) (*operations.CompleteDestinationOAuthResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_oauths/get_consent_url" + url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_oauths/complete_oauth" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -120,12 +131,15 @@ func (s *destinationOauth) GetDestinationOAuthConsent(ctx context.Context, reque return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -143,12 +157,13 @@ func (s *destinationOauth) GetDestinationOAuthConsent(ctx context.Context, reque if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetDestinationOAuthConsentResponse{ + res := &operations.CompleteDestinationOAuthResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -157,32 +172,38 @@ func (s *destinationOauth) GetDestinationOAuthConsent(ctx context.Context, reque case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.OAuthConsentRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CompleteOAuthResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.OAuthConsentRead = out + res.CompleteOAuthResponse = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -190,11 +211,11 @@ func (s *destinationOauth) GetDestinationOAuthConsent(ctx context.Context, reque } // SetInstancewideDestinationOauthParams - Sets instancewide variables to be used for the oauth flow when creating this destination. When set, these variables will be injected into a connector's configuration before any interaction with the connector image itself. This enables running oauth flows with consistent variables e.g: the company's Google Ads developer_token, client_id, and client_secret without the user having to know about these variables. -func (s *destinationOauth) SetInstancewideDestinationOauthParams(ctx context.Context, request shared.SetInstancewideDestinationOauthParamsRequestBody) (*operations.SetInstancewideDestinationOauthParamsResponse, error) { +func (s *DestinationOauth) SetInstancewideDestinationOauthParams(ctx context.Context, request shared.SetInstancewideDestinationOauthParamsRequestBody) (*operations.SetInstancewideDestinationOauthParamsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/destination_oauths/oauth_params/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -202,12 +223,15 @@ func (s *destinationOauth) SetInstancewideDestinationOauthParams(ctx context.Con return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -225,6 +249,7 @@ func (s *destinationOauth) SetInstancewideDestinationOauthParams(ctx context.Con if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -240,22 +265,26 @@ func (s *destinationOauth) SetInstancewideDestinationOauthParams(ctx context.Con case httpRes.StatusCode == 400: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.KnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.KnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.KnownExceptionInfo = out + res.KnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/health.go b/internal/sdk/health.go old mode 100755 new mode 100644 index ca89312..72f3284 --- a/internal/sdk/health.go +++ b/internal/sdk/health.go @@ -3,30 +3,31 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// health - Healthchecks -type health struct { +// Health - Healthchecks +type Health struct { sdkConfiguration sdkConfiguration } -func newHealth(sdkConfig sdkConfiguration) *health { - return &health{ +func newHealth(sdkConfig sdkConfiguration) *Health { + return &Health{ sdkConfiguration: sdkConfig, } } // GetHealthCheck - Health Check -func (s *health) GetHealthCheck(ctx context.Context) (*operations.GetHealthCheckResponse, error) { +func (s *Health) GetHealthCheck(ctx context.Context) (*operations.GetHealthCheckResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/health" @@ -35,9 +36,9 @@ func (s *health) GetHealthCheck(ctx context.Context) (*operations.GetHealthCheck return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) - client := s.sdkConfiguration.DefaultClient + client := s.sdkConfiguration.SecurityClient httpRes, err := client.Do(req) if err != nil { @@ -65,12 +66,14 @@ func (s *health) GetHealthCheck(ctx context.Context) (*operations.GetHealthCheck case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.HealthCheckRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.HealthCheckRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.HealthCheckRead = out + res.HealthCheckRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/internal.go b/internal/sdk/internal.go old mode 100755 new mode 100644 index f24e833..4b6bff5 --- a/internal/sdk/internal.go +++ b/internal/sdk/internal.go @@ -3,33 +3,34 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type internal struct { +type Internal struct { sdkConfiguration sdkConfiguration } -func newInternal(sdkConfig sdkConfiguration) *internal { - return &internal{ +func newInternal(sdkConfig sdkConfiguration) *Internal { + return &Internal{ sdkConfiguration: sdkConfig, } } -// CreateOrUpdateState - Create or update the state for a connection. -func (s *internal) CreateOrUpdateState(ctx context.Context, request shared.ConnectionStateCreateOrUpdate) (*operations.CreateOrUpdateStateResponse, error) { +// WriteDiscoverCatalogResult - Should only called from worker, to write result from discover activity back to DB. +func (s *Internal) WriteDiscoverCatalogResult(ctx context.Context, request shared.SourceDiscoverSchemaWriteRequestBody) (*operations.WriteDiscoverCatalogResultResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/state/create_or_update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/write_discover_catalog_result" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -37,12 +38,15 @@ func (s *internal) CreateOrUpdateState(ctx context.Context, request shared.Conne return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -60,12 +64,13 @@ func (s *internal) CreateOrUpdateState(ctx context.Context, request shared.Conne if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CreateOrUpdateStateResponse{ + res := &operations.WriteDiscoverCatalogResultResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -74,54 +79,42 @@ func (s *internal) CreateOrUpdateState(ctx context.Context, request shared.Conne case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionState - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.ConnectionState = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DiscoverCatalogResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.DiscoverCatalogResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetAttemptNormalizationStatusesForJob - Get normalization status to determine if we can bypass normalization phase -func (s *internal) GetAttemptNormalizationStatusesForJob(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetAttemptNormalizationStatusesForJobResponse, error) { +// CreateOrUpdateState - Create or update the state for a connection. +func (s *Internal) CreateOrUpdateState(ctx context.Context, request shared.ConnectionStateCreateOrUpdate) (*operations.CreateOrUpdateStateResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_normalization_status" + url := strings.TrimSuffix(baseURL, "/") + "/v1/state/create_or_update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } + + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -139,12 +132,13 @@ func (s *internal) GetAttemptNormalizationStatusesForJob(ctx context.Context, re if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetAttemptNormalizationStatusesForJobResponse{ + res := &operations.CreateOrUpdateStateResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -153,37 +147,62 @@ func (s *internal) GetAttemptNormalizationStatusesForJob(ctx context.Context, re case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.AttemptNormalizationStatusReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionState + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ConnectionState = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.AttemptNormalizationStatusReadList = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SaveStats - For worker to set sync stats of a running attempt. -func (s *internal) SaveStats(ctx context.Context, request shared.SaveStatsRequestBody) (*operations.SaveStatsResponse, error) { +// GetAttemptNormalizationStatusesForJob - Get normalization status to determine if we can bypass normalization phase +func (s *Internal) GetAttemptNormalizationStatusesForJob(ctx context.Context, request *shared.JobIDRequestBody) (*operations.GetAttemptNormalizationStatusesForJobResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/save_stats" + url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_normalization_status" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -201,12 +220,13 @@ func (s *internal) SaveStats(ctx context.Context, request shared.SaveStatsReques if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SaveStatsResponse{ + res := &operations.GetAttemptNormalizationStatusesForJobResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -215,24 +235,26 @@ func (s *internal) SaveStats(ctx context.Context, request shared.SaveStatsReques case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InternalOperationResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.AttemptNormalizationStatusReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InternalOperationResult = out + res.AttemptNormalizationStatusReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SaveSyncConfig - For worker to save the AttemptSyncConfig for an attempt. -func (s *internal) SaveSyncConfig(ctx context.Context, request shared.SaveAttemptSyncConfigRequestBody) (*operations.SaveSyncConfigResponse, error) { +// SetWorkflowInAttempt - For worker to register the workflow id in attempt. +func (s *Internal) SetWorkflowInAttempt(ctx context.Context, request shared.SetWorkflowInAttemptRequestBody) (*operations.SetWorkflowInAttemptResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/save_sync_config" + url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/set_workflow_in_attempt" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -240,12 +262,15 @@ func (s *internal) SaveSyncConfig(ctx context.Context, request shared.SaveAttemp return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -263,12 +288,13 @@ func (s *internal) SaveSyncConfig(ctx context.Context, request shared.SaveAttemp if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SaveSyncConfigResponse{ + res := &operations.SetWorkflowInAttemptResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -277,24 +303,26 @@ func (s *internal) SaveSyncConfig(ctx context.Context, request shared.SaveAttemp case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InternalOperationResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InternalOperationResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InternalOperationResult = out + res.InternalOperationResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SetWorkflowInAttempt - For worker to register the workflow id in attempt. -func (s *internal) SetWorkflowInAttempt(ctx context.Context, request shared.SetWorkflowInAttemptRequestBody) (*operations.SetWorkflowInAttemptResponse, error) { +// SaveStats - For worker to set sync stats of a running attempt. +func (s *Internal) SaveStats(ctx context.Context, request shared.SaveStatsRequestBody) (*operations.SaveStatsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/set_workflow_in_attempt" + url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/save_stats" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -302,12 +330,15 @@ func (s *internal) SetWorkflowInAttempt(ctx context.Context, request shared.SetW return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -325,12 +356,13 @@ func (s *internal) SetWorkflowInAttempt(ctx context.Context, request shared.SetW if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SetWorkflowInAttemptResponse{ + res := &operations.SaveStatsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -339,24 +371,26 @@ func (s *internal) SetWorkflowInAttempt(ctx context.Context, request shared.SetW case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InternalOperationResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InternalOperationResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InternalOperationResult = out + res.InternalOperationResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// WriteDiscoverCatalogResult - Should only called from worker, to write result from discover activity back to DB. -func (s *internal) WriteDiscoverCatalogResult(ctx context.Context, request shared.SourceDiscoverSchemaWriteRequestBody) (*operations.WriteDiscoverCatalogResultResponse, error) { +// SaveSyncConfig - For worker to save the AttemptSyncConfig for an attempt. +func (s *Internal) SaveSyncConfig(ctx context.Context, request shared.SaveAttemptSyncConfigRequestBody) (*operations.SaveSyncConfigResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/write_discover_catalog_result" + url := strings.TrimSuffix(baseURL, "/") + "/v1/attempt/save_sync_config" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -364,12 +398,15 @@ func (s *internal) WriteDiscoverCatalogResult(ctx context.Context, request share return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -387,12 +424,13 @@ func (s *internal) WriteDiscoverCatalogResult(ctx context.Context, request share if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.WriteDiscoverCatalogResultResponse{ + res := &operations.SaveSyncConfigResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -401,12 +439,14 @@ func (s *internal) WriteDiscoverCatalogResult(ctx context.Context, request share case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DiscoverCatalogResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InternalOperationResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DiscoverCatalogResult = out + res.InternalOperationResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/jobs.go b/internal/sdk/jobs.go old mode 100755 new mode 100644 index 9f5f3da..c3e9def --- a/internal/sdk/jobs.go +++ b/internal/sdk/jobs.go @@ -3,33 +3,34 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type jobs struct { +type Jobs struct { sdkConfiguration sdkConfiguration } -func newJobs(sdkConfig sdkConfiguration) *jobs { - return &jobs{ +func newJobs(sdkConfig sdkConfiguration) *Jobs { + return &Jobs{ sdkConfiguration: sdkConfig, } } -// CancelJob - Cancels a job -func (s *jobs) CancelJob(ctx context.Context, request shared.JobIDRequestBody) (*operations.CancelJobResponse, error) { +// ListJobsFor - Returns recent jobs for a connection. Jobs are returned in descending order by createdAt. +func (s *Jobs) ListJobsFor(ctx context.Context, request shared.JobListRequestBody) (*operations.ListJobsForResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/cancel" + url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/list" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -37,12 +38,15 @@ func (s *jobs) CancelJob(ctx context.Context, request shared.JobIDRequestBody) ( return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -60,12 +64,13 @@ func (s *jobs) CancelJob(ctx context.Context, request shared.JobIDRequestBody) ( if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CancelJobResponse{ + res := &operations.ListJobsForResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -74,54 +79,66 @@ func (s *jobs) CancelJob(ctx context.Context, request shared.JobIDRequestBody) ( case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobInfoRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.JobInfoRead = out + res.JobReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetAttemptNormalizationStatusesForJob - Get normalization status to determine if we can bypass normalization phase -func (s *jobs) GetAttemptNormalizationStatusesForJob(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetAttemptNormalizationStatusesForJobResponse, error) { +// GetJobInfo - Get information about a job +func (s *Jobs) GetJobInfo(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetJobInfoResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_normalization_status" + url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -139,12 +156,13 @@ func (s *jobs) GetAttemptNormalizationStatusesForJob(ctx context.Context, reques if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetAttemptNormalizationStatusesForJobResponse{ + res := &operations.GetJobInfoResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -153,24 +171,49 @@ func (s *jobs) GetAttemptNormalizationStatusesForJob(ctx context.Context, reques case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.AttemptNormalizationStatusReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobInfoRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.AttemptNormalizationStatusReadList = out + res.JobInfoRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetJobDebugInfo - Gets all information needed to debug this job -func (s *jobs) GetJobDebugInfo(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetJobDebugInfoResponse, error) { +func (s *Jobs) GetLastReplicationJob(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetLastReplicationJobResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_debug_info" + url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_last_replication_job" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -178,12 +221,15 @@ func (s *jobs) GetJobDebugInfo(ctx context.Context, request shared.JobIDRequestB return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -201,12 +247,13 @@ func (s *jobs) GetJobDebugInfo(ctx context.Context, request shared.JobIDRequestB if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetJobDebugInfoResponse{ + res := &operations.GetLastReplicationJobResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -215,44 +262,50 @@ func (s *jobs) GetJobDebugInfo(ctx context.Context, request shared.JobIDRequestB case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobDebugInfoRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobOptionalRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.JobDebugInfoRead = out + res.JobOptionalRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetJobInfo - Get information about a job -func (s *jobs) GetJobInfo(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetJobInfoResponse, error) { +// GetJobInfoWithoutLogs - Get information about a job excluding logs +func (s *Jobs) GetJobInfoWithoutLogs(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetJobInfoWithoutLogsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get" + url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_without_logs" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -260,12 +313,15 @@ func (s *jobs) GetJobInfo(ctx context.Context, request shared.JobIDRequestBody) return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -283,12 +339,13 @@ func (s *jobs) GetJobInfo(ctx context.Context, request shared.JobIDRequestBody) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetJobInfoResponse{ + res := &operations.GetJobInfoWithoutLogsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -297,32 +354,38 @@ func (s *jobs) GetJobInfo(ctx context.Context, request shared.JobIDRequestBody) case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobInfoRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobInfoRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.JobInfoRead = out + res.JobInfoRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -330,11 +393,11 @@ func (s *jobs) GetJobInfo(ctx context.Context, request shared.JobIDRequestBody) } // GetJobInfoLight - Get information about a job excluding attempt info and logs -func (s *jobs) GetJobInfoLight(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetJobInfoLightResponse, error) { +func (s *Jobs) GetJobInfoLight(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetJobInfoLightResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_light" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -342,12 +405,15 @@ func (s *jobs) GetJobInfoLight(ctx context.Context, request shared.JobIDRequestB return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -365,6 +431,7 @@ func (s *jobs) GetJobInfoLight(ctx context.Context, request shared.JobIDRequestB if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -379,44 +446,50 @@ func (s *jobs) GetJobInfoLight(ctx context.Context, request shared.JobIDRequestB case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobInfoLightRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobInfoLightRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.JobInfoLightRead = out + res.JobInfoLightRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetJobInfoWithoutLogs - Get information about a job excluding logs -func (s *jobs) GetJobInfoWithoutLogs(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetJobInfoWithoutLogsResponse, error) { +// CancelJob - Cancels a job +func (s *Jobs) CancelJob(ctx context.Context, request shared.JobIDRequestBody) (*operations.CancelJobResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_without_logs" + url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/cancel" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -424,12 +497,15 @@ func (s *jobs) GetJobInfoWithoutLogs(ctx context.Context, request shared.JobIDRe return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -447,12 +523,13 @@ func (s *jobs) GetJobInfoWithoutLogs(ctx context.Context, request shared.JobIDRe if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetJobInfoWithoutLogsResponse{ + res := &operations.CancelJobResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -461,43 +538,50 @@ func (s *jobs) GetJobInfoWithoutLogs(ctx context.Context, request shared.JobIDRe case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobInfoRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobInfoRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.JobInfoRead = out + res.JobInfoRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -func (s *jobs) GetLastReplicationJob(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetLastReplicationJobResponse, error) { +// GetJobDebugInfo - Gets all information needed to debug this job +func (s *Jobs) GetJobDebugInfo(ctx context.Context, request shared.JobIDRequestBody) (*operations.GetJobDebugInfoResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_last_replication_job" + url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_debug_info" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -505,12 +589,15 @@ func (s *jobs) GetLastReplicationJob(ctx context.Context, request shared.Connect return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -528,12 +615,13 @@ func (s *jobs) GetLastReplicationJob(ctx context.Context, request shared.Connect if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetLastReplicationJobResponse{ + res := &operations.GetJobDebugInfoResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -542,57 +630,62 @@ func (s *jobs) GetLastReplicationJob(ctx context.Context, request shared.Connect case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobOptionalRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.JobDebugInfoRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.JobOptionalRead = out + res.JobDebugInfoRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListJobsFor - Returns recent jobs for a connection. Jobs are returned in descending order by createdAt. -func (s *jobs) ListJobsFor(ctx context.Context, request shared.JobListRequestBody) (*operations.ListJobsForResponse, error) { +// GetAttemptNormalizationStatusesForJob - Get normalization status to determine if we can bypass normalization phase +func (s *Jobs) GetAttemptNormalizationStatusesForJob(ctx context.Context, request *shared.JobIDRequestBody) (*operations.GetAttemptNormalizationStatusesForJobResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/jobs/get_normalization_status" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -610,12 +703,13 @@ func (s *jobs) ListJobsFor(ctx context.Context, request shared.JobListRequestBod if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListJobsForResponse{ + res := &operations.GetAttemptNormalizationStatusesForJobResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -624,32 +718,14 @@ func (s *jobs) ListJobsFor(ctx context.Context, request shared.JobListRequestBod case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.JobReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.JobReadList = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.AttemptNormalizationStatusReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.AttemptNormalizationStatusReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/logs.go b/internal/sdk/logs.go old mode 100755 new mode 100644 index 0e12377..9d227bc --- a/internal/sdk/logs.go +++ b/internal/sdk/logs.go @@ -3,33 +3,44 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type logs struct { +type Logs struct { sdkConfiguration sdkConfiguration } -func newLogs(sdkConfig sdkConfiguration) *logs { - return &logs{ +func newLogs(sdkConfig sdkConfiguration) *Logs { + return &Logs{ sdkConfiguration: sdkConfig, } } // GetLogs - Get logs -func (s *logs) GetLogs(ctx context.Context, request shared.LogsRequestBody) (*operations.GetLogsResponse, error) { +func (s *Logs) GetLogs(ctx context.Context, request shared.LogsRequestBody, opts ...operations.Option) (*operations.GetLogsResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionAcceptHeaderOverride, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/logs/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -37,12 +48,20 @@ func (s *logs) GetLogs(ctx context.Context, request shared.LogsRequestBody) (*op return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } - req.Header.Set("Accept", "application/json;q=1, text/plain;q=0") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + if o.AcceptHeaderOverride != nil { + req.Header.Set("Accept", string(*o.AcceptHeaderOverride)) + } else { + req.Header.Set("Accept", "application/json;q=1, text/plain;q=0") + } + + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -60,6 +79,7 @@ func (s *logs) GetLogs(ctx context.Context, request shared.LogsRequestBody) (*op if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -74,27 +94,33 @@ func (s *logs) GetLogs(ctx context.Context, request shared.LogsRequestBody) (*op case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `text/plain`): - res.GetLogs200TextPlainBinaryString = rawBody + res.Bytes = rawBody + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/notifications.go b/internal/sdk/notifications.go old mode 100755 new mode 100644 index 6542f2a..4bd5d84 --- a/internal/sdk/notifications.go +++ b/internal/sdk/notifications.go @@ -3,33 +3,34 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type notifications struct { +type Notifications struct { sdkConfiguration sdkConfiguration } -func newNotifications(sdkConfig sdkConfiguration) *notifications { - return ¬ifications{ +func newNotifications(sdkConfig sdkConfiguration) *Notifications { + return &Notifications{ sdkConfiguration: sdkConfig, } } // TryNotificationConfig - Try sending a notifications -func (s *notifications) TryNotificationConfig(ctx context.Context, request shared.Notification) (*operations.TryNotificationConfigResponse, error) { +func (s *Notifications) TryNotificationConfig(ctx context.Context, request shared.Notification) (*operations.TryNotificationConfigResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/notifications/try" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -37,12 +38,15 @@ func (s *notifications) TryNotificationConfig(ctx context.Context, request share return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -60,6 +64,7 @@ func (s *notifications) TryNotificationConfig(ctx context.Context, request share if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -74,32 +79,38 @@ func (s *notifications) TryNotificationConfig(ctx context.Context, request share case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotificationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotificationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotificationRead = out + res.NotificationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/openapi.go b/internal/sdk/openapi.go old mode 100755 new mode 100644 index c68c919..2cf7f82 --- a/internal/sdk/openapi.go +++ b/internal/sdk/openapi.go @@ -3,28 +3,29 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type openapi struct { +type Openapi struct { sdkConfiguration sdkConfiguration } -func newOpenapi(sdkConfig sdkConfiguration) *openapi { - return &openapi{ +func newOpenapi(sdkConfig sdkConfiguration) *Openapi { + return &Openapi{ sdkConfiguration: sdkConfig, } } // GetOpenAPISpec - Returns the openapi specification -func (s *openapi) GetOpenAPISpec(ctx context.Context) (*operations.GetOpenAPISpecResponse, error) { +func (s *Openapi) GetOpenAPISpec(ctx context.Context) (*operations.GetOpenAPISpecResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/openapi" @@ -33,7 +34,7 @@ func (s *openapi) GetOpenAPISpec(ctx context.Context) (*operations.GetOpenAPISpe return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "text/plain") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -63,7 +64,9 @@ func (s *openapi) GetOpenAPISpec(ctx context.Context) (*operations.GetOpenAPISpe case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `text/plain`): - res.GetOpenAPISpec200TextPlainBinaryString = rawBody + res.Bytes = rawBody + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/operation.go b/internal/sdk/operation.go old mode 100755 new mode 100644 index e4890f1..2b22ed6 --- a/internal/sdk/operation.go +++ b/internal/sdk/operation.go @@ -3,33 +3,34 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type operation struct { +type Operation struct { sdkConfiguration sdkConfiguration } -func newOperation(sdkConfig sdkConfiguration) *operation { - return &operation{ +func newOperation(sdkConfig sdkConfiguration) *Operation { + return &Operation{ sdkConfiguration: sdkConfig, } } // CheckOperation - Check if an operation to be created is valid -func (s *operation) CheckOperation(ctx context.Context, request shared.OperatorConfiguration) (*operations.CheckOperationResponse, error) { +func (s *Operation) CheckOperation(ctx context.Context, request shared.OperatorConfiguration) (*operations.CheckOperationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/check" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -37,12 +38,15 @@ func (s *operation) CheckOperation(ctx context.Context, request shared.OperatorC return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -60,6 +64,7 @@ func (s *operation) CheckOperation(ctx context.Context, request shared.OperatorC if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -74,22 +79,26 @@ func (s *operation) CheckOperation(ctx context.Context, request shared.OperatorC case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CheckOperationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CheckOperationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CheckOperationRead = out + res.CheckOperationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -97,11 +106,11 @@ func (s *operation) CheckOperation(ctx context.Context, request shared.OperatorC } // CreateOperation - Create an operation to be applied as part of a connection pipeline -func (s *operation) CreateOperation(ctx context.Context, request shared.OperationCreate) (*operations.CreateOperationResponse, error) { +func (s *Operation) CreateOperation(ctx context.Context, request shared.OperationCreate) (*operations.CreateOperationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -109,12 +118,15 @@ func (s *operation) CreateOperation(ctx context.Context, request shared.Operatio return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -132,6 +144,7 @@ func (s *operation) CreateOperation(ctx context.Context, request shared.Operatio if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -146,34 +159,38 @@ func (s *operation) CreateOperation(ctx context.Context, request shared.Operatio case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.OperationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.OperationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.OperationRead = out + res.OperationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// DeleteOperation - Delete an operation -func (s *operation) DeleteOperation(ctx context.Context, request shared.OperationIDRequestBody) (*operations.DeleteOperationResponse, error) { +// UpdateOperation - Update an operation +func (s *Operation) UpdateOperation(ctx context.Context, request shared.OperationUpdate) (*operations.UpdateOperationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/delete" + url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -181,12 +198,15 @@ func (s *operation) DeleteOperation(ctx context.Context, request shared.Operatio return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -204,49 +224,54 @@ func (s *operation) DeleteOperation(ctx context.Context, request shared.Operatio if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.DeleteOperationResponse{ + res := &operations.UpdateOperationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: - case httpRes.StatusCode == 404: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.OperationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.OperationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetOperation - Returns an operation -func (s *operation) GetOperation(ctx context.Context, request shared.OperationIDRequestBody) (*operations.GetOperationResponse, error) { +// ListOperationsForConnection - Returns all operations for a connection. +// List operations for connection. +func (s *Operation) ListOperationsForConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.ListOperationsForConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/get" + url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/list" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -254,12 +279,15 @@ func (s *operation) GetOperation(ctx context.Context, request shared.OperationID return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -277,12 +305,13 @@ func (s *operation) GetOperation(ctx context.Context, request shared.OperationID if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetOperationResponse{ + res := &operations.ListOperationsForConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -291,45 +320,50 @@ func (s *operation) GetOperation(ctx context.Context, request shared.OperationID case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.OperationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.OperationReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.OperationRead = out + res.OperationReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListOperationsForConnection - Returns all operations for a connection. -// List operations for connection. -func (s *operation) ListOperationsForConnection(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.ListOperationsForConnectionResponse, error) { +// GetOperation - Returns an operation +func (s *Operation) GetOperation(ctx context.Context, request shared.OperationIDRequestBody) (*operations.GetOperationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -337,12 +371,15 @@ func (s *operation) ListOperationsForConnection(ctx context.Context, request sha return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -360,12 +397,13 @@ func (s *operation) ListOperationsForConnection(ctx context.Context, request sha if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListOperationsForConnectionResponse{ + res := &operations.GetOperationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -374,44 +412,50 @@ func (s *operation) ListOperationsForConnection(ctx context.Context, request sha case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.OperationReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.OperationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.OperationReadList = out + res.OperationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateOperation - Update an operation -func (s *operation) UpdateOperation(ctx context.Context, request shared.OperationUpdate) (*operations.UpdateOperationResponse, error) { +// DeleteOperation - Delete an operation +func (s *Operation) DeleteOperation(ctx context.Context, request shared.OperationIDRequestBody) (*operations.DeleteOperationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/operations/delete" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -419,12 +463,15 @@ func (s *operation) UpdateOperation(ctx context.Context, request shared.Operatio return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -442,36 +489,42 @@ func (s *operation) UpdateOperation(ctx context.Context, request shared.Operatio if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateOperationResponse{ + res := &operations.DeleteOperationResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 204: + case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.OperationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.OperationRead = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/pkg/models/operations/applyschemachangeforsource.go b/internal/sdk/pkg/models/operations/applyschemachangeforsource.go old mode 100755 new mode 100644 index 09c36f6..646efce --- a/internal/sdk/pkg/models/operations/applyschemachangeforsource.go +++ b/internal/sdk/pkg/models/operations/applyschemachangeforsource.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ApplySchemaChangeForSourceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ApplySchemaChangeForSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ApplySchemaChangeForSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ApplySchemaChangeForSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ApplySchemaChangeForSourceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ApplySchemaChangeForSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/canceljob.go b/internal/sdk/pkg/models/operations/canceljob.go old mode 100755 new mode 100644 index a447d0f..21b0d67 --- a/internal/sdk/pkg/models/operations/canceljob.go +++ b/internal/sdk/pkg/models/operations/canceljob.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CancelJobResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobInfoRead *shared.JobInfoRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CancelJobResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CancelJobResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CancelJobResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CancelJobResponse) GetJobInfoRead() *shared.JobInfoRead { + if o == nil { + return nil + } + return o.JobInfoRead +} + +func (o *CancelJobResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CancelJobResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/checkconnectiontodestination.go b/internal/sdk/pkg/models/operations/checkconnectiontodestination.go old mode 100755 new mode 100644 index 565b91c..f975f0d --- a/internal/sdk/pkg/models/operations/checkconnectiontodestination.go +++ b/internal/sdk/pkg/models/operations/checkconnectiontodestination.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CheckConnectionToDestinationResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CheckConnectionRead *shared.CheckConnectionRead - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CheckConnectionToDestinationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CheckConnectionToDestinationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CheckConnectionToDestinationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CheckConnectionToDestinationResponse) GetCheckConnectionRead() *shared.CheckConnectionRead { + if o == nil { + return nil + } + return o.CheckConnectionRead +} + +func (o *CheckConnectionToDestinationResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CheckConnectionToDestinationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/checkconnectiontodestinationforupdate.go b/internal/sdk/pkg/models/operations/checkconnectiontodestinationforupdate.go old mode 100755 new mode 100644 index aa2c567..87973e0 --- a/internal/sdk/pkg/models/operations/checkconnectiontodestinationforupdate.go +++ b/internal/sdk/pkg/models/operations/checkconnectiontodestinationforupdate.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CheckConnectionToDestinationForUpdateResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CheckConnectionRead *shared.CheckConnectionRead - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CheckConnectionToDestinationForUpdateResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CheckConnectionToDestinationForUpdateResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CheckConnectionToDestinationForUpdateResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CheckConnectionToDestinationForUpdateResponse) GetCheckConnectionRead() *shared.CheckConnectionRead { + if o == nil { + return nil + } + return o.CheckConnectionRead +} + +func (o *CheckConnectionToDestinationForUpdateResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CheckConnectionToDestinationForUpdateResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/checkconnectiontosource.go b/internal/sdk/pkg/models/operations/checkconnectiontosource.go old mode 100755 new mode 100644 index 5f9d54f..02fb2d7 --- a/internal/sdk/pkg/models/operations/checkconnectiontosource.go +++ b/internal/sdk/pkg/models/operations/checkconnectiontosource.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CheckConnectionToSourceResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CheckConnectionRead *shared.CheckConnectionRead - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CheckConnectionToSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CheckConnectionToSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CheckConnectionToSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CheckConnectionToSourceResponse) GetCheckConnectionRead() *shared.CheckConnectionRead { + if o == nil { + return nil + } + return o.CheckConnectionRead +} + +func (o *CheckConnectionToSourceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CheckConnectionToSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/checkconnectiontosourceforupdate.go b/internal/sdk/pkg/models/operations/checkconnectiontosourceforupdate.go old mode 100755 new mode 100644 index 5791d6c..a43e9f9 --- a/internal/sdk/pkg/models/operations/checkconnectiontosourceforupdate.go +++ b/internal/sdk/pkg/models/operations/checkconnectiontosourceforupdate.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CheckConnectionToSourceForUpdateResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CheckConnectionRead *shared.CheckConnectionRead - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CheckConnectionToSourceForUpdateResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CheckConnectionToSourceForUpdateResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CheckConnectionToSourceForUpdateResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CheckConnectionToSourceForUpdateResponse) GetCheckConnectionRead() *shared.CheckConnectionRead { + if o == nil { + return nil + } + return o.CheckConnectionRead +} + +func (o *CheckConnectionToSourceForUpdateResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CheckConnectionToSourceForUpdateResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/checkoperation.go b/internal/sdk/pkg/models/operations/checkoperation.go old mode 100755 new mode 100644 index 57c5054..0346d37 --- a/internal/sdk/pkg/models/operations/checkoperation.go +++ b/internal/sdk/pkg/models/operations/checkoperation.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CheckOperationResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CheckOperationRead *shared.CheckOperationRead - ContentType string // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *CheckOperationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CheckOperationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CheckOperationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CheckOperationResponse) GetCheckOperationRead() *shared.CheckOperationRead { + if o == nil { + return nil + } + return o.CheckOperationRead +} + +func (o *CheckOperationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/clonedestination.go b/internal/sdk/pkg/models/operations/clonedestination.go old mode 100755 new mode 100644 index b77108f..36faa1f --- a/internal/sdk/pkg/models/operations/clonedestination.go +++ b/internal/sdk/pkg/models/operations/clonedestination.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CloneDestinationResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationRead *shared.DestinationRead - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CloneDestinationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CloneDestinationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CloneDestinationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CloneDestinationResponse) GetDestinationRead() *shared.DestinationRead { + if o == nil { + return nil + } + return o.DestinationRead +} + +func (o *CloneDestinationResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CloneDestinationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/clonesource.go b/internal/sdk/pkg/models/operations/clonesource.go old mode 100755 new mode 100644 index eb6869a..6013876 --- a/internal/sdk/pkg/models/operations/clonesource.go +++ b/internal/sdk/pkg/models/operations/clonesource.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CloneSourceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successful operation + SourceRead *shared.SourceRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - // Successful operation - SourceRead *shared.SourceRead - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CloneSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CloneSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CloneSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CloneSourceResponse) GetSourceRead() *shared.SourceRead { + if o == nil { + return nil + } + return o.SourceRead +} + +func (o *CloneSourceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CloneSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/completedestinationoauth.go b/internal/sdk/pkg/models/operations/completedestinationoauth.go old mode 100755 new mode 100644 index fc95ee0..d4c3836 --- a/internal/sdk/pkg/models/operations/completedestinationoauth.go +++ b/internal/sdk/pkg/models/operations/completedestinationoauth.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CompleteDestinationOAuthResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CompleteOAuthResponse *shared.CompleteOAuthResponse - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CompleteDestinationOAuthResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CompleteDestinationOAuthResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CompleteDestinationOAuthResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CompleteDestinationOAuthResponse) GetCompleteOAuthResponse() *shared.CompleteOAuthResponse { + if o == nil { + return nil + } + return o.CompleteOAuthResponse +} + +func (o *CompleteDestinationOAuthResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CompleteDestinationOAuthResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/completesourceoauth.go b/internal/sdk/pkg/models/operations/completesourceoauth.go old mode 100755 new mode 100644 index 6f61093..e6eb71e --- a/internal/sdk/pkg/models/operations/completesourceoauth.go +++ b/internal/sdk/pkg/models/operations/completesourceoauth.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CompleteSourceOAuthResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CompleteOAuthResponse *shared.CompleteOAuthResponse - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CompleteSourceOAuthResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CompleteSourceOAuthResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CompleteSourceOAuthResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CompleteSourceOAuthResponse) GetCompleteOAuthResponse() *shared.CompleteOAuthResponse { + if o == nil { + return nil + } + return o.CompleteOAuthResponse +} + +func (o *CompleteSourceOAuthResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CompleteSourceOAuthResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createconnection.go b/internal/sdk/pkg/models/operations/createconnection.go old mode 100755 new mode 100644 index cc81190..9409692 --- a/internal/sdk/pkg/models/operations/createconnection.go +++ b/internal/sdk/pkg/models/operations/createconnection.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateConnectionResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionRead *shared.ConnectionRead - ContentType string // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *CreateConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateConnectionResponse) GetConnectionRead() *shared.ConnectionRead { + if o == nil { + return nil + } + return o.ConnectionRead +} + +func (o *CreateConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createconnectorbuilderproject.go b/internal/sdk/pkg/models/operations/createconnectorbuilderproject.go old mode 100755 new mode 100644 index c3b65a0..2acaa83 --- a/internal/sdk/pkg/models/operations/createconnectorbuilderproject.go +++ b/internal/sdk/pkg/models/operations/createconnectorbuilderproject.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateConnectorBuilderProjectResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectorBuilderProjectIDWithWorkspaceID *shared.ConnectorBuilderProjectIDWithWorkspaceID - ContentType string - StatusCode int - RawResponse *http.Response +} + +func (o *CreateConnectorBuilderProjectResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateConnectorBuilderProjectResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateConnectorBuilderProjectResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateConnectorBuilderProjectResponse) GetConnectorBuilderProjectIDWithWorkspaceID() *shared.ConnectorBuilderProjectIDWithWorkspaceID { + if o == nil { + return nil + } + return o.ConnectorBuilderProjectIDWithWorkspaceID } diff --git a/internal/sdk/pkg/models/operations/createcustomdestinationdefinition.go b/internal/sdk/pkg/models/operations/createcustomdestinationdefinition.go old mode 100755 new mode 100644 index 9b9e3c6..d44dfd9 --- a/internal/sdk/pkg/models/operations/createcustomdestinationdefinition.go +++ b/internal/sdk/pkg/models/operations/createcustomdestinationdefinition.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateCustomDestinationDefinitionResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionRead *shared.DestinationDefinitionRead // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *CreateCustomDestinationDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateCustomDestinationDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateCustomDestinationDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateCustomDestinationDefinitionResponse) GetDestinationDefinitionRead() *shared.DestinationDefinitionRead { + if o == nil { + return nil + } + return o.DestinationDefinitionRead +} + +func (o *CreateCustomDestinationDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createcustomsourcedefinition.go b/internal/sdk/pkg/models/operations/createcustomsourcedefinition.go old mode 100755 new mode 100644 index 9026109..68ad5a9 --- a/internal/sdk/pkg/models/operations/createcustomsourcedefinition.go +++ b/internal/sdk/pkg/models/operations/createcustomsourcedefinition.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateCustomSourceDefinitionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionRead *shared.SourceDefinitionRead - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CreateCustomSourceDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateCustomSourceDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateCustomSourceDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateCustomSourceDefinitionResponse) GetSourceDefinitionRead() *shared.SourceDefinitionRead { + if o == nil { + return nil + } + return o.SourceDefinitionRead +} + +func (o *CreateCustomSourceDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createdeclarativesourcedefinitionmanifest.go b/internal/sdk/pkg/models/operations/createdeclarativesourcedefinitionmanifest.go old mode 100755 new mode 100644 index d8e3469..33c4daa --- a/internal/sdk/pkg/models/operations/createdeclarativesourcedefinitionmanifest.go +++ b/internal/sdk/pkg/models/operations/createdeclarativesourcedefinitionmanifest.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateDeclarativeSourceDefinitionManifestResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *CreateDeclarativeSourceDefinitionManifestResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateDeclarativeSourceDefinitionManifestResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateDeclarativeSourceDefinitionManifestResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateDeclarativeSourceDefinitionManifestResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createdestination.go b/internal/sdk/pkg/models/operations/createdestination.go old mode 100755 new mode 100644 index 3cadff8..657e426 --- a/internal/sdk/pkg/models/operations/createdestination.go +++ b/internal/sdk/pkg/models/operations/createdestination.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateDestinationResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationRead *shared.DestinationRead // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *CreateDestinationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateDestinationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateDestinationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateDestinationResponse) GetDestinationRead() *shared.DestinationRead { + if o == nil { + return nil + } + return o.DestinationRead +} + +func (o *CreateDestinationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createoperation.go b/internal/sdk/pkg/models/operations/createoperation.go old mode 100755 new mode 100644 index 973f36b..4200438 --- a/internal/sdk/pkg/models/operations/createoperation.go +++ b/internal/sdk/pkg/models/operations/createoperation.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateOperationResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation OperationRead *shared.OperationRead - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CreateOperationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateOperationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateOperationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateOperationResponse) GetOperationRead() *shared.OperationRead { + if o == nil { + return nil + } + return o.OperationRead +} + +func (o *CreateOperationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createorupdatestate.go b/internal/sdk/pkg/models/operations/createorupdatestate.go old mode 100755 new mode 100644 index d400ba5..7c1193a --- a/internal/sdk/pkg/models/operations/createorupdatestate.go +++ b/internal/sdk/pkg/models/operations/createorupdatestate.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateOrUpdateStateResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionState *shared.ConnectionState - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CreateOrUpdateStateResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateOrUpdateStateResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateOrUpdateStateResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateOrUpdateStateResponse) GetConnectionState() *shared.ConnectionState { + if o == nil { + return nil + } + return o.ConnectionState +} + +func (o *CreateOrUpdateStateResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *CreateOrUpdateStateResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createsource.go b/internal/sdk/pkg/models/operations/createsource.go old mode 100755 new mode 100644 index 09f196b..29aedcb --- a/internal/sdk/pkg/models/operations/createsource.go +++ b/internal/sdk/pkg/models/operations/createsource.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateSourceResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successful operation + SourceRead *shared.SourceRead // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Successful operation - SourceRead *shared.SourceRead - StatusCode int - RawResponse *http.Response +} + +func (o *CreateSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateSourceResponse) GetSourceRead() *shared.SourceRead { + if o == nil { + return nil + } + return o.SourceRead +} + +func (o *CreateSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/createstreamstatus.go b/internal/sdk/pkg/models/operations/createstreamstatus.go old mode 100755 new mode 100644 index 42345f9..bff06bf --- a/internal/sdk/pkg/models/operations/createstreamstatus.go +++ b/internal/sdk/pkg/models/operations/createstreamstatus.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateStreamStatusResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // Successfully created stream status. StreamStatusRead *shared.StreamStatusRead } + +func (o *CreateStreamStatusResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateStreamStatusResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateStreamStatusResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateStreamStatusResponse) GetStreamStatusRead() *shared.StreamStatusRead { + if o == nil { + return nil + } + return o.StreamStatusRead +} diff --git a/internal/sdk/pkg/models/operations/createworkspace.go b/internal/sdk/pkg/models/operations/createworkspace.go old mode 100755 new mode 100644 index ea8b5b7..0366518 --- a/internal/sdk/pkg/models/operations/createworkspace.go +++ b/internal/sdk/pkg/models/operations/createworkspace.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type CreateWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WorkspaceRead *shared.WorkspaceRead + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *CreateWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *CreateWorkspaceResponse) GetWorkspaceRead() *shared.WorkspaceRead { + if o == nil { + return nil + } + return o.WorkspaceRead +} + +func (o *CreateWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/deleteconnection.go b/internal/sdk/pkg/models/operations/deleteconnection.go old mode 100755 new mode 100644 index 038af5b..e221e8d --- a/internal/sdk/pkg/models/operations/deleteconnection.go +++ b/internal/sdk/pkg/models/operations/deleteconnection.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type DeleteConnectionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *DeleteConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *DeleteConnectionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *DeleteConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/deleteconnectorbuilderproject.go b/internal/sdk/pkg/models/operations/deleteconnectorbuilderproject.go old mode 100755 new mode 100644 index 00915ce..8237aa4 --- a/internal/sdk/pkg/models/operations/deleteconnectorbuilderproject.go +++ b/internal/sdk/pkg/models/operations/deleteconnectorbuilderproject.go @@ -7,7 +7,31 @@ import ( ) type DeleteConnectorBuilderProjectResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } + +func (o *DeleteConnectorBuilderProjectResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteConnectorBuilderProjectResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteConnectorBuilderProjectResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/internal/sdk/pkg/models/operations/deletedestination.go b/internal/sdk/pkg/models/operations/deletedestination.go old mode 100755 new mode 100644 index 477e680..2b8ddd1 --- a/internal/sdk/pkg/models/operations/deletedestination.go +++ b/internal/sdk/pkg/models/operations/deletedestination.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type DeleteDestinationResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *DeleteDestinationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteDestinationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteDestinationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *DeleteDestinationResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *DeleteDestinationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/deletedestinationdefinition.go b/internal/sdk/pkg/models/operations/deletedestinationdefinition.go old mode 100755 new mode 100644 index 16a87a1..2432556 --- a/internal/sdk/pkg/models/operations/deletedestinationdefinition.go +++ b/internal/sdk/pkg/models/operations/deletedestinationdefinition.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type DeleteDestinationDefinitionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *DeleteDestinationDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteDestinationDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteDestinationDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *DeleteDestinationDefinitionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *DeleteDestinationDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/deleteoperation.go b/internal/sdk/pkg/models/operations/deleteoperation.go old mode 100755 new mode 100644 index 4540ce2..888c6ee --- a/internal/sdk/pkg/models/operations/deleteoperation.go +++ b/internal/sdk/pkg/models/operations/deleteoperation.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type DeleteOperationResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *DeleteOperationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteOperationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteOperationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *DeleteOperationResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *DeleteOperationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/deletesource.go b/internal/sdk/pkg/models/operations/deletesource.go old mode 100755 new mode 100644 index d912308..b01762b --- a/internal/sdk/pkg/models/operations/deletesource.go +++ b/internal/sdk/pkg/models/operations/deletesource.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type DeleteSourceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *DeleteSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *DeleteSourceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *DeleteSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/deletesourcedefinition.go b/internal/sdk/pkg/models/operations/deletesourcedefinition.go old mode 100755 new mode 100644 index 2d93c4e..2555e43 --- a/internal/sdk/pkg/models/operations/deletesourcedefinition.go +++ b/internal/sdk/pkg/models/operations/deletesourcedefinition.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type DeleteSourceDefinitionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *DeleteSourceDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteSourceDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteSourceDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *DeleteSourceDefinitionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *DeleteSourceDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/deleteworkspace.go b/internal/sdk/pkg/models/operations/deleteworkspace.go old mode 100755 new mode 100644 index 3e71a8d..c5db560 --- a/internal/sdk/pkg/models/operations/deleteworkspace.go +++ b/internal/sdk/pkg/models/operations/deleteworkspace.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type DeleteWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *DeleteWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DeleteWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DeleteWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *DeleteWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *DeleteWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/discoverschemaforsource.go b/internal/sdk/pkg/models/operations/discoverschemaforsource.go old mode 100755 new mode 100644 index 1f2446d..c5a000e --- a/internal/sdk/pkg/models/operations/discoverschemaforsource.go +++ b/internal/sdk/pkg/models/operations/discoverschemaforsource.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type DiscoverSchemaForSourceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDiscoverSchemaRead *shared.SourceDiscoverSchemaRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *DiscoverSchemaForSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *DiscoverSchemaForSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *DiscoverSchemaForSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *DiscoverSchemaForSourceResponse) GetSourceDiscoverSchemaRead() *shared.SourceDiscoverSchemaRead { + if o == nil { + return nil + } + return o.SourceDiscoverSchemaRead +} + +func (o *DiscoverSchemaForSourceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *DiscoverSchemaForSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/executedestinationcheckconnection.go b/internal/sdk/pkg/models/operations/executedestinationcheckconnection.go old mode 100755 new mode 100644 index e415b19..1758061 --- a/internal/sdk/pkg/models/operations/executedestinationcheckconnection.go +++ b/internal/sdk/pkg/models/operations/executedestinationcheckconnection.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ExecuteDestinationCheckConnectionResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CheckConnectionRead *shared.CheckConnectionRead - ContentType string // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *ExecuteDestinationCheckConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ExecuteDestinationCheckConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ExecuteDestinationCheckConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ExecuteDestinationCheckConnectionResponse) GetCheckConnectionRead() *shared.CheckConnectionRead { + if o == nil { + return nil + } + return o.CheckConnectionRead +} + +func (o *ExecuteDestinationCheckConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/executesourcecheckconnection.go b/internal/sdk/pkg/models/operations/executesourcecheckconnection.go old mode 100755 new mode 100644 index a2d6176..ec196e2 --- a/internal/sdk/pkg/models/operations/executesourcecheckconnection.go +++ b/internal/sdk/pkg/models/operations/executesourcecheckconnection.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ExecuteSourceCheckConnectionResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation CheckConnectionRead *shared.CheckConnectionRead - ContentType string // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *ExecuteSourceCheckConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ExecuteSourceCheckConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ExecuteSourceCheckConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ExecuteSourceCheckConnectionResponse) GetCheckConnectionRead() *shared.CheckConnectionRead { + if o == nil { + return nil + } + return o.CheckConnectionRead +} + +func (o *ExecuteSourceCheckConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/executesourcediscoverschema.go b/internal/sdk/pkg/models/operations/executesourcediscoverschema.go old mode 100755 new mode 100644 index 2ce2e5c..78b35ba --- a/internal/sdk/pkg/models/operations/executesourcediscoverschema.go +++ b/internal/sdk/pkg/models/operations/executesourcediscoverschema.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ExecuteSourceDiscoverSchemaResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDiscoverSchemaRead *shared.SourceDiscoverSchemaRead - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ExecuteSourceDiscoverSchemaResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ExecuteSourceDiscoverSchemaResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ExecuteSourceDiscoverSchemaResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ExecuteSourceDiscoverSchemaResponse) GetSourceDiscoverSchemaRead() *shared.SourceDiscoverSchemaRead { + if o == nil { + return nil + } + return o.SourceDiscoverSchemaRead +} + +func (o *ExecuteSourceDiscoverSchemaResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getattemptnormalizationstatusesforjob.go b/internal/sdk/pkg/models/operations/getattemptnormalizationstatusesforjob.go old mode 100755 new mode 100644 index 4f8fb1d..921c9fe --- a/internal/sdk/pkg/models/operations/getattemptnormalizationstatusesforjob.go +++ b/internal/sdk/pkg/models/operations/getattemptnormalizationstatusesforjob.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetAttemptNormalizationStatusesForJobResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation AttemptNormalizationStatusReadList *shared.AttemptNormalizationStatusReadList - ContentType string - StatusCode int - RawResponse *http.Response +} + +func (o *GetAttemptNormalizationStatusesForJobResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetAttemptNormalizationStatusesForJobResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetAttemptNormalizationStatusesForJobResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetAttemptNormalizationStatusesForJobResponse) GetAttemptNormalizationStatusReadList() *shared.AttemptNormalizationStatusReadList { + if o == nil { + return nil + } + return o.AttemptNormalizationStatusReadList } diff --git a/internal/sdk/pkg/models/operations/getconnection.go b/internal/sdk/pkg/models/operations/getconnection.go old mode 100755 new mode 100644 index a844682..5983d14 --- a/internal/sdk/pkg/models/operations/getconnection.go +++ b/internal/sdk/pkg/models/operations/getconnection.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetConnectionResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionRead *shared.ConnectionRead - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetConnectionResponse) GetConnectionRead() *shared.ConnectionRead { + if o == nil { + return nil + } + return o.ConnectionRead +} + +func (o *GetConnectionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getconnectorbuilderproject.go b/internal/sdk/pkg/models/operations/getconnectorbuilderproject.go old mode 100755 new mode 100644 index f470af9..d616a32 --- a/internal/sdk/pkg/models/operations/getconnectorbuilderproject.go +++ b/internal/sdk/pkg/models/operations/getconnectorbuilderproject.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetConnectorBuilderProjectResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectorBuilderProjectRead *shared.ConnectorBuilderProjectRead - ContentType string - StatusCode int - RawResponse *http.Response +} + +func (o *GetConnectorBuilderProjectResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetConnectorBuilderProjectResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetConnectorBuilderProjectResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetConnectorBuilderProjectResponse) GetConnectorBuilderProjectRead() *shared.ConnectorBuilderProjectRead { + if o == nil { + return nil + } + return o.ConnectorBuilderProjectRead } diff --git a/internal/sdk/pkg/models/operations/getdestination.go b/internal/sdk/pkg/models/operations/getdestination.go old mode 100755 new mode 100644 index fc1f0b9..6306bcc --- a/internal/sdk/pkg/models/operations/getdestination.go +++ b/internal/sdk/pkg/models/operations/getdestination.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetDestinationResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationRead *shared.DestinationRead - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetDestinationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetDestinationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetDestinationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetDestinationResponse) GetDestinationRead() *shared.DestinationRead { + if o == nil { + return nil + } + return o.DestinationRead +} + +func (o *GetDestinationResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetDestinationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getdestinationdefinition.go b/internal/sdk/pkg/models/operations/getdestinationdefinition.go old mode 100755 new mode 100644 index 5e08a5d..22a210b --- a/internal/sdk/pkg/models/operations/getdestinationdefinition.go +++ b/internal/sdk/pkg/models/operations/getdestinationdefinition.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetDestinationDefinitionResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionRead *shared.DestinationDefinitionRead - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetDestinationDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetDestinationDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetDestinationDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetDestinationDefinitionResponse) GetDestinationDefinitionRead() *shared.DestinationDefinitionRead { + if o == nil { + return nil + } + return o.DestinationDefinitionRead +} + +func (o *GetDestinationDefinitionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetDestinationDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getdestinationdefinitionforworkspace.go b/internal/sdk/pkg/models/operations/getdestinationdefinitionforworkspace.go old mode 100755 new mode 100644 index 2247992..cd3cf47 --- a/internal/sdk/pkg/models/operations/getdestinationdefinitionforworkspace.go +++ b/internal/sdk/pkg/models/operations/getdestinationdefinitionforworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetDestinationDefinitionForWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionRead *shared.DestinationDefinitionRead - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetDestinationDefinitionForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetDestinationDefinitionForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetDestinationDefinitionForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetDestinationDefinitionForWorkspaceResponse) GetDestinationDefinitionRead() *shared.DestinationDefinitionRead { + if o == nil { + return nil + } + return o.DestinationDefinitionRead +} + +func (o *GetDestinationDefinitionForWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetDestinationDefinitionForWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getdestinationdefinitionspecification.go b/internal/sdk/pkg/models/operations/getdestinationdefinitionspecification.go old mode 100755 new mode 100644 index cea7d33..a7f6267 --- a/internal/sdk/pkg/models/operations/getdestinationdefinitionspecification.go +++ b/internal/sdk/pkg/models/operations/getdestinationdefinitionspecification.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetDestinationDefinitionSpecificationResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionSpecificationRead *shared.DestinationDefinitionSpecificationRead - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetDestinationDefinitionSpecificationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetDestinationDefinitionSpecificationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetDestinationDefinitionSpecificationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetDestinationDefinitionSpecificationResponse) GetDestinationDefinitionSpecificationRead() *shared.DestinationDefinitionSpecificationRead { + if o == nil { + return nil + } + return o.DestinationDefinitionSpecificationRead +} + +func (o *GetDestinationDefinitionSpecificationResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetDestinationDefinitionSpecificationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getdestinationoauthconsent.go b/internal/sdk/pkg/models/operations/getdestinationoauthconsent.go old mode 100755 new mode 100644 index df18c4b..c812ef1 --- a/internal/sdk/pkg/models/operations/getdestinationoauthconsent.go +++ b/internal/sdk/pkg/models/operations/getdestinationoauthconsent.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetDestinationOAuthConsentResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation OAuthConsentRead *shared.OAuthConsentRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetDestinationOAuthConsentResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetDestinationOAuthConsentResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetDestinationOAuthConsentResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetDestinationOAuthConsentResponse) GetOAuthConsentRead() *shared.OAuthConsentRead { + if o == nil { + return nil + } + return o.OAuthConsentRead +} + +func (o *GetDestinationOAuthConsentResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetDestinationOAuthConsentResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/gethealthcheck.go b/internal/sdk/pkg/models/operations/gethealthcheck.go old mode 100755 new mode 100644 index a283a0a..6178d8e --- a/internal/sdk/pkg/models/operations/gethealthcheck.go +++ b/internal/sdk/pkg/models/operations/gethealthcheck.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetHealthCheckResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation HealthCheckRead *shared.HealthCheckRead - StatusCode int - RawResponse *http.Response +} + +func (o *GetHealthCheckResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetHealthCheckResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetHealthCheckResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetHealthCheckResponse) GetHealthCheckRead() *shared.HealthCheckRead { + if o == nil { + return nil + } + return o.HealthCheckRead } diff --git a/internal/sdk/pkg/models/operations/getjobdebuginfo.go b/internal/sdk/pkg/models/operations/getjobdebuginfo.go old mode 100755 new mode 100644 index 664dbae..764590c --- a/internal/sdk/pkg/models/operations/getjobdebuginfo.go +++ b/internal/sdk/pkg/models/operations/getjobdebuginfo.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetJobDebugInfoResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobDebugInfoRead *shared.JobDebugInfoRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetJobDebugInfoResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetJobDebugInfoResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetJobDebugInfoResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetJobDebugInfoResponse) GetJobDebugInfoRead() *shared.JobDebugInfoRead { + if o == nil { + return nil + } + return o.JobDebugInfoRead +} + +func (o *GetJobDebugInfoResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetJobDebugInfoResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getjobinfo.go b/internal/sdk/pkg/models/operations/getjobinfo.go old mode 100755 new mode 100644 index d758543..3430a08 --- a/internal/sdk/pkg/models/operations/getjobinfo.go +++ b/internal/sdk/pkg/models/operations/getjobinfo.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetJobInfoResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobInfoRead *shared.JobInfoRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetJobInfoResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetJobInfoResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetJobInfoResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetJobInfoResponse) GetJobInfoRead() *shared.JobInfoRead { + if o == nil { + return nil + } + return o.JobInfoRead +} + +func (o *GetJobInfoResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetJobInfoResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getjobinfolight.go b/internal/sdk/pkg/models/operations/getjobinfolight.go old mode 100755 new mode 100644 index 7275ec2..81694da --- a/internal/sdk/pkg/models/operations/getjobinfolight.go +++ b/internal/sdk/pkg/models/operations/getjobinfolight.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetJobInfoLightResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobInfoLightRead *shared.JobInfoLightRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetJobInfoLightResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetJobInfoLightResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetJobInfoLightResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetJobInfoLightResponse) GetJobInfoLightRead() *shared.JobInfoLightRead { + if o == nil { + return nil + } + return o.JobInfoLightRead +} + +func (o *GetJobInfoLightResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetJobInfoLightResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getjobinfowithoutlogs.go b/internal/sdk/pkg/models/operations/getjobinfowithoutlogs.go old mode 100755 new mode 100644 index d8f3aef..99b9a3c --- a/internal/sdk/pkg/models/operations/getjobinfowithoutlogs.go +++ b/internal/sdk/pkg/models/operations/getjobinfowithoutlogs.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetJobInfoWithoutLogsResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobInfoRead *shared.JobInfoRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetJobInfoWithoutLogsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetJobInfoWithoutLogsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetJobInfoWithoutLogsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetJobInfoWithoutLogsResponse) GetJobInfoRead() *shared.JobInfoRead { + if o == nil { + return nil + } + return o.JobInfoRead +} + +func (o *GetJobInfoWithoutLogsResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetJobInfoWithoutLogsResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getlastreplicationjob.go b/internal/sdk/pkg/models/operations/getlastreplicationjob.go old mode 100755 new mode 100644 index 19f63e6..40c7f47 --- a/internal/sdk/pkg/models/operations/getlastreplicationjob.go +++ b/internal/sdk/pkg/models/operations/getlastreplicationjob.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetLastReplicationJobResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobOptionalRead *shared.JobOptionalRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetLastReplicationJobResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetLastReplicationJobResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetLastReplicationJobResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetLastReplicationJobResponse) GetJobOptionalRead() *shared.JobOptionalRead { + if o == nil { + return nil + } + return o.JobOptionalRead +} + +func (o *GetLastReplicationJobResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetLastReplicationJobResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getlogs.go b/internal/sdk/pkg/models/operations/getlogs.go old mode 100755 new mode 100644 index 78ef3ce..8fbd1d0 --- a/internal/sdk/pkg/models/operations/getlogs.go +++ b/internal/sdk/pkg/models/operations/getlogs.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetLogsResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Returns the log file + Bytes []byte // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response - // Returns the log file - GetLogs200TextPlainBinaryString []byte + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetLogsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetLogsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetLogsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetLogsResponse) GetBytes() []byte { + if o == nil { + return nil + } + return o.Bytes +} + +func (o *GetLogsResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetLogsResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getmostrecentsourceactorcatalog.go b/internal/sdk/pkg/models/operations/getmostrecentsourceactorcatalog.go old mode 100755 new mode 100644 index 825ba2e..0b5069b --- a/internal/sdk/pkg/models/operations/getmostrecentsourceactorcatalog.go +++ b/internal/sdk/pkg/models/operations/getmostrecentsourceactorcatalog.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetMostRecentSourceActorCatalogResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ActorCatalogWithUpdatedAt *shared.ActorCatalogWithUpdatedAt - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetMostRecentSourceActorCatalogResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetMostRecentSourceActorCatalogResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetMostRecentSourceActorCatalogResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetMostRecentSourceActorCatalogResponse) GetActorCatalogWithUpdatedAt() *shared.ActorCatalogWithUpdatedAt { + if o == nil { + return nil + } + return o.ActorCatalogWithUpdatedAt +} + +func (o *GetMostRecentSourceActorCatalogResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetMostRecentSourceActorCatalogResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getopenapispec.go b/internal/sdk/pkg/models/operations/getopenapispec.go old mode 100755 new mode 100644 index 3d744fb..b9ccc0d --- a/internal/sdk/pkg/models/operations/getopenapispec.go +++ b/internal/sdk/pkg/models/operations/getopenapispec.go @@ -7,9 +7,40 @@ import ( ) type GetOpenAPISpecResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // Returns the openapi specification file - GetOpenAPISpec200TextPlainBinaryString []byte + Bytes []byte +} + +func (o *GetOpenAPISpecResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetOpenAPISpecResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetOpenAPISpecResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetOpenAPISpecResponse) GetBytes() []byte { + if o == nil { + return nil + } + return o.Bytes } diff --git a/internal/sdk/pkg/models/operations/getoperation.go b/internal/sdk/pkg/models/operations/getoperation.go old mode 100755 new mode 100644 index 2d97fc3..ce24480 --- a/internal/sdk/pkg/models/operations/getoperation.go +++ b/internal/sdk/pkg/models/operations/getoperation.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetOperationResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation OperationRead *shared.OperationRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetOperationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetOperationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetOperationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetOperationResponse) GetOperationRead() *shared.OperationRead { + if o == nil { + return nil + } + return o.OperationRead +} + +func (o *GetOperationResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetOperationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getsource.go b/internal/sdk/pkg/models/operations/getsource.go old mode 100755 new mode 100644 index dd20c82..6f21c0e --- a/internal/sdk/pkg/models/operations/getsource.go +++ b/internal/sdk/pkg/models/operations/getsource.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetSourceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successful operation + SourceRead *shared.SourceRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - // Successful operation - SourceRead *shared.SourceRead - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetSourceResponse) GetSourceRead() *shared.SourceRead { + if o == nil { + return nil + } + return o.SourceRead +} + +func (o *GetSourceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getsourcedefinition.go b/internal/sdk/pkg/models/operations/getsourcedefinition.go old mode 100755 new mode 100644 index 551ec82..a03a19b --- a/internal/sdk/pkg/models/operations/getsourcedefinition.go +++ b/internal/sdk/pkg/models/operations/getsourcedefinition.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetSourceDefinitionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionRead *shared.SourceDefinitionRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetSourceDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetSourceDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetSourceDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetSourceDefinitionResponse) GetSourceDefinitionRead() *shared.SourceDefinitionRead { + if o == nil { + return nil + } + return o.SourceDefinitionRead +} + +func (o *GetSourceDefinitionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetSourceDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getsourcedefinitionforworkspace.go b/internal/sdk/pkg/models/operations/getsourcedefinitionforworkspace.go old mode 100755 new mode 100644 index 1607352..6332732 --- a/internal/sdk/pkg/models/operations/getsourcedefinitionforworkspace.go +++ b/internal/sdk/pkg/models/operations/getsourcedefinitionforworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetSourceDefinitionForWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionRead *shared.SourceDefinitionRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetSourceDefinitionForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetSourceDefinitionForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetSourceDefinitionForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetSourceDefinitionForWorkspaceResponse) GetSourceDefinitionRead() *shared.SourceDefinitionRead { + if o == nil { + return nil + } + return o.SourceDefinitionRead +} + +func (o *GetSourceDefinitionForWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetSourceDefinitionForWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getsourcedefinitionspecification.go b/internal/sdk/pkg/models/operations/getsourcedefinitionspecification.go old mode 100755 new mode 100644 index 695c267..3e2358e --- a/internal/sdk/pkg/models/operations/getsourcedefinitionspecification.go +++ b/internal/sdk/pkg/models/operations/getsourcedefinitionspecification.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetSourceDefinitionSpecificationResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionSpecificationRead *shared.SourceDefinitionSpecificationRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetSourceDefinitionSpecificationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetSourceDefinitionSpecificationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetSourceDefinitionSpecificationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetSourceDefinitionSpecificationResponse) GetSourceDefinitionSpecificationRead() *shared.SourceDefinitionSpecificationRead { + if o == nil { + return nil + } + return o.SourceDefinitionSpecificationRead +} + +func (o *GetSourceDefinitionSpecificationResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetSourceDefinitionSpecificationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getsourceoauthconsent.go b/internal/sdk/pkg/models/operations/getsourceoauthconsent.go old mode 100755 new mode 100644 index 0e75a1d..e7dd8f5 --- a/internal/sdk/pkg/models/operations/getsourceoauthconsent.go +++ b/internal/sdk/pkg/models/operations/getsourceoauthconsent.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetSourceOAuthConsentResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation OAuthConsentRead *shared.OAuthConsentRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetSourceOAuthConsentResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetSourceOAuthConsentResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetSourceOAuthConsentResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetSourceOAuthConsentResponse) GetOAuthConsentRead() *shared.OAuthConsentRead { + if o == nil { + return nil + } + return o.OAuthConsentRead +} + +func (o *GetSourceOAuthConsentResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetSourceOAuthConsentResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getspecificationfordestinationid.go b/internal/sdk/pkg/models/operations/getspecificationfordestinationid.go old mode 100755 new mode 100644 index e8b2338..52ef23b --- a/internal/sdk/pkg/models/operations/getspecificationfordestinationid.go +++ b/internal/sdk/pkg/models/operations/getspecificationfordestinationid.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetSpecificationForDestinationIDResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionSpecificationRead *shared.DestinationDefinitionSpecificationRead - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetSpecificationForDestinationIDResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetSpecificationForDestinationIDResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetSpecificationForDestinationIDResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetSpecificationForDestinationIDResponse) GetDestinationDefinitionSpecificationRead() *shared.DestinationDefinitionSpecificationRead { + if o == nil { + return nil + } + return o.DestinationDefinitionSpecificationRead +} + +func (o *GetSpecificationForDestinationIDResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetSpecificationForDestinationIDResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getspecificationforsourceid.go b/internal/sdk/pkg/models/operations/getspecificationforsourceid.go old mode 100755 new mode 100644 index d6e0348..684bbc5 --- a/internal/sdk/pkg/models/operations/getspecificationforsourceid.go +++ b/internal/sdk/pkg/models/operations/getspecificationforsourceid.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetSpecificationForSourceIDResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionSpecificationRead *shared.SourceDefinitionSpecificationRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetSpecificationForSourceIDResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetSpecificationForSourceIDResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetSpecificationForSourceIDResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetSpecificationForSourceIDResponse) GetSourceDefinitionSpecificationRead() *shared.SourceDefinitionSpecificationRead { + if o == nil { + return nil + } + return o.SourceDefinitionSpecificationRead +} + +func (o *GetSpecificationForSourceIDResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetSpecificationForSourceIDResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getstate.go b/internal/sdk/pkg/models/operations/getstate.go old mode 100755 new mode 100644 index 3dc1f7d..69f622c --- a/internal/sdk/pkg/models/operations/getstate.go +++ b/internal/sdk/pkg/models/operations/getstate.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetStateResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionState *shared.ConnectionState - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetStateResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetStateResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetStateResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetStateResponse) GetConnectionState() *shared.ConnectionState { + if o == nil { + return nil + } + return o.ConnectionState +} + +func (o *GetStateResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetStateResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getstatetype.go b/internal/sdk/pkg/models/operations/getstatetype.go old mode 100755 new mode 100644 index c9535a2..269dc36 --- a/internal/sdk/pkg/models/operations/getstatetype.go +++ b/internal/sdk/pkg/models/operations/getstatetype.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetStateTypeResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionStateType *shared.ConnectionStateType - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetStateTypeResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetStateTypeResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetStateTypeResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetStateTypeResponse) GetConnectionStateType() *shared.ConnectionStateType { + if o == nil { + return nil + } + return o.ConnectionStateType +} + +func (o *GetStateTypeResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetStateTypeResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getstreamstatuses.go b/internal/sdk/pkg/models/operations/getstreamstatuses.go old mode 100755 new mode 100644 index b7ba6c3..c41a344 --- a/internal/sdk/pkg/models/operations/getstreamstatuses.go +++ b/internal/sdk/pkg/models/operations/getstreamstatuses.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetStreamStatusesResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // Successfully queried stream statuses. StreamStatusReadList *shared.StreamStatusReadList } + +func (o *GetStreamStatusesResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetStreamStatusesResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetStreamStatusesResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetStreamStatusesResponse) GetStreamStatusReadList() *shared.StreamStatusReadList { + if o == nil { + return nil + } + return o.StreamStatusReadList +} diff --git a/internal/sdk/pkg/models/operations/getworkspace.go b/internal/sdk/pkg/models/operations/getworkspace.go old mode 100755 new mode 100644 index 09f0fe0..dcd4d85 --- a/internal/sdk/pkg/models/operations/getworkspace.go +++ b/internal/sdk/pkg/models/operations/getworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WorkspaceRead *shared.WorkspaceRead + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetWorkspaceResponse) GetWorkspaceRead() *shared.WorkspaceRead { + if o == nil { + return nil + } + return o.WorkspaceRead +} + +func (o *GetWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getworkspacebyconnectionid.go b/internal/sdk/pkg/models/operations/getworkspacebyconnectionid.go old mode 100755 new mode 100644 index 808e3b4..b7e59f8 --- a/internal/sdk/pkg/models/operations/getworkspacebyconnectionid.go +++ b/internal/sdk/pkg/models/operations/getworkspacebyconnectionid.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetWorkspaceByConnectionIDResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WorkspaceRead *shared.WorkspaceRead + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetWorkspaceByConnectionIDResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetWorkspaceByConnectionIDResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetWorkspaceByConnectionIDResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetWorkspaceByConnectionIDResponse) GetWorkspaceRead() *shared.WorkspaceRead { + if o == nil { + return nil + } + return o.WorkspaceRead +} + +func (o *GetWorkspaceByConnectionIDResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetWorkspaceByConnectionIDResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/getworkspacebyslug.go b/internal/sdk/pkg/models/operations/getworkspacebyslug.go old mode 100755 new mode 100644 index e642ea9..883df8b --- a/internal/sdk/pkg/models/operations/getworkspacebyslug.go +++ b/internal/sdk/pkg/models/operations/getworkspacebyslug.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GetWorkspaceBySlugResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WorkspaceRead *shared.WorkspaceRead + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GetWorkspaceBySlugResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetWorkspaceBySlugResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetWorkspaceBySlugResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetWorkspaceBySlugResponse) GetWorkspaceRead() *shared.WorkspaceRead { + if o == nil { + return nil + } + return o.WorkspaceRead +} + +func (o *GetWorkspaceBySlugResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GetWorkspaceBySlugResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/grantdestinationdefinitiontoworkspace.go b/internal/sdk/pkg/models/operations/grantdestinationdefinitiontoworkspace.go old mode 100755 new mode 100644 index 6d6f2e9..8dd8d8e --- a/internal/sdk/pkg/models/operations/grantdestinationdefinitiontoworkspace.go +++ b/internal/sdk/pkg/models/operations/grantdestinationdefinitiontoworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GrantDestinationDefinitionToWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation PrivateDestinationDefinitionRead *shared.PrivateDestinationDefinitionRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GrantDestinationDefinitionToWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GrantDestinationDefinitionToWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GrantDestinationDefinitionToWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GrantDestinationDefinitionToWorkspaceResponse) GetPrivateDestinationDefinitionRead() *shared.PrivateDestinationDefinitionRead { + if o == nil { + return nil + } + return o.PrivateDestinationDefinitionRead +} + +func (o *GrantDestinationDefinitionToWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GrantDestinationDefinitionToWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/grantsourcedefinitiontoworkspace.go b/internal/sdk/pkg/models/operations/grantsourcedefinitiontoworkspace.go old mode 100755 new mode 100644 index 5f5049b..9c985c8 --- a/internal/sdk/pkg/models/operations/grantsourcedefinitiontoworkspace.go +++ b/internal/sdk/pkg/models/operations/grantsourcedefinitiontoworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type GrantSourceDefinitionToWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation PrivateSourceDefinitionRead *shared.PrivateSourceDefinitionRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *GrantSourceDefinitionToWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GrantSourceDefinitionToWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GrantSourceDefinitionToWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GrantSourceDefinitionToWorkspaceResponse) GetPrivateSourceDefinitionRead() *shared.PrivateSourceDefinitionRead { + if o == nil { + return nil + } + return o.PrivateSourceDefinitionRead +} + +func (o *GrantSourceDefinitionToWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *GrantSourceDefinitionToWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listallconnectionsforworkspace.go b/internal/sdk/pkg/models/operations/listallconnectionsforworkspace.go old mode 100755 new mode 100644 index 637bffa..cde02b9 --- a/internal/sdk/pkg/models/operations/listallconnectionsforworkspace.go +++ b/internal/sdk/pkg/models/operations/listallconnectionsforworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListAllConnectionsForWorkspaceResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionReadList *shared.ConnectionReadList - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ListAllConnectionsForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListAllConnectionsForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListAllConnectionsForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListAllConnectionsForWorkspaceResponse) GetConnectionReadList() *shared.ConnectionReadList { + if o == nil { + return nil + } + return o.ConnectionReadList +} + +func (o *ListAllConnectionsForWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ListAllConnectionsForWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listconnectionsbyactordefinition.go b/internal/sdk/pkg/models/operations/listconnectionsbyactordefinition.go old mode 100755 new mode 100644 index c41d6ca..50987ca --- a/internal/sdk/pkg/models/operations/listconnectionsbyactordefinition.go +++ b/internal/sdk/pkg/models/operations/listconnectionsbyactordefinition.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListConnectionsByActorDefinitionResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionReadList *shared.ConnectionReadList - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ListConnectionsByActorDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListConnectionsByActorDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListConnectionsByActorDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListConnectionsByActorDefinitionResponse) GetConnectionReadList() *shared.ConnectionReadList { + if o == nil { + return nil + } + return o.ConnectionReadList +} + +func (o *ListConnectionsByActorDefinitionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ListConnectionsByActorDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listconnectionsforworkspace.go b/internal/sdk/pkg/models/operations/listconnectionsforworkspace.go old mode 100755 new mode 100644 index 800147f..440a2aa --- a/internal/sdk/pkg/models/operations/listconnectionsforworkspace.go +++ b/internal/sdk/pkg/models/operations/listconnectionsforworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListConnectionsForWorkspaceResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionReadList *shared.ConnectionReadList - ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ListConnectionsForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListConnectionsForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListConnectionsForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListConnectionsForWorkspaceResponse) GetConnectionReadList() *shared.ConnectionReadList { + if o == nil { + return nil + } + return o.ConnectionReadList +} + +func (o *ListConnectionsForWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ListConnectionsForWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listconnectorbuilderprojects.go b/internal/sdk/pkg/models/operations/listconnectorbuilderprojects.go old mode 100755 new mode 100644 index 637ec81..12a0689 --- a/internal/sdk/pkg/models/operations/listconnectorbuilderprojects.go +++ b/internal/sdk/pkg/models/operations/listconnectorbuilderprojects.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListConnectorBuilderProjectsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectorBuilderProjectReadList *shared.ConnectorBuilderProjectReadList - ContentType string - StatusCode int - RawResponse *http.Response +} + +func (o *ListConnectorBuilderProjectsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListConnectorBuilderProjectsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListConnectorBuilderProjectsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListConnectorBuilderProjectsResponse) GetConnectorBuilderProjectReadList() *shared.ConnectorBuilderProjectReadList { + if o == nil { + return nil + } + return o.ConnectorBuilderProjectReadList } diff --git a/internal/sdk/pkg/models/operations/listdeclarativemanifests.go b/internal/sdk/pkg/models/operations/listdeclarativemanifests.go old mode 100755 new mode 100644 index d13f06d..dfd9195 --- a/internal/sdk/pkg/models/operations/listdeclarativemanifests.go +++ b/internal/sdk/pkg/models/operations/listdeclarativemanifests.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListDeclarativeManifestsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DeclarativeManifestsReadList *shared.DeclarativeManifestsReadList // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *ListDeclarativeManifestsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListDeclarativeManifestsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListDeclarativeManifestsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListDeclarativeManifestsResponse) GetDeclarativeManifestsReadList() *shared.DeclarativeManifestsReadList { + if o == nil { + return nil + } + return o.DeclarativeManifestsReadList +} + +func (o *ListDeclarativeManifestsResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listdestinationdefinitions.go b/internal/sdk/pkg/models/operations/listdestinationdefinitions.go old mode 100755 new mode 100644 index cd7bba1..b7db31d --- a/internal/sdk/pkg/models/operations/listdestinationdefinitions.go +++ b/internal/sdk/pkg/models/operations/listdestinationdefinitions.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListDestinationDefinitionsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionReadList *shared.DestinationDefinitionReadList - StatusCode int - RawResponse *http.Response +} + +func (o *ListDestinationDefinitionsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListDestinationDefinitionsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListDestinationDefinitionsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListDestinationDefinitionsResponse) GetDestinationDefinitionReadList() *shared.DestinationDefinitionReadList { + if o == nil { + return nil + } + return o.DestinationDefinitionReadList } diff --git a/internal/sdk/pkg/models/operations/listdestinationdefinitionsforworkspace.go b/internal/sdk/pkg/models/operations/listdestinationdefinitionsforworkspace.go old mode 100755 new mode 100644 index 37b48f9..2f1af80 --- a/internal/sdk/pkg/models/operations/listdestinationdefinitionsforworkspace.go +++ b/internal/sdk/pkg/models/operations/listdestinationdefinitionsforworkspace.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListDestinationDefinitionsForWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionReadList *shared.DestinationDefinitionReadList - StatusCode int - RawResponse *http.Response +} + +func (o *ListDestinationDefinitionsForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListDestinationDefinitionsForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListDestinationDefinitionsForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListDestinationDefinitionsForWorkspaceResponse) GetDestinationDefinitionReadList() *shared.DestinationDefinitionReadList { + if o == nil { + return nil + } + return o.DestinationDefinitionReadList } diff --git a/internal/sdk/pkg/models/operations/listdestinationsforworkspace.go b/internal/sdk/pkg/models/operations/listdestinationsforworkspace.go old mode 100755 new mode 100644 index 72ee1a7..f85dc86 --- a/internal/sdk/pkg/models/operations/listdestinationsforworkspace.go +++ b/internal/sdk/pkg/models/operations/listdestinationsforworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListDestinationsForWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationReadList *shared.DestinationReadList - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ListDestinationsForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListDestinationsForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListDestinationsForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListDestinationsForWorkspaceResponse) GetDestinationReadList() *shared.DestinationReadList { + if o == nil { + return nil + } + return o.DestinationReadList +} + +func (o *ListDestinationsForWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ListDestinationsForWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listjobsfor.go b/internal/sdk/pkg/models/operations/listjobsfor.go old mode 100755 new mode 100644 index a548938..7d54e1f --- a/internal/sdk/pkg/models/operations/listjobsfor.go +++ b/internal/sdk/pkg/models/operations/listjobsfor.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListJobsForResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobReadList *shared.JobReadList // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ListJobsForResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListJobsForResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListJobsForResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListJobsForResponse) GetJobReadList() *shared.JobReadList { + if o == nil { + return nil + } + return o.JobReadList +} + +func (o *ListJobsForResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ListJobsForResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listlatestdestinationdefinitions.go b/internal/sdk/pkg/models/operations/listlatestdestinationdefinitions.go old mode 100755 new mode 100644 index dc0c905..d2aea0a --- a/internal/sdk/pkg/models/operations/listlatestdestinationdefinitions.go +++ b/internal/sdk/pkg/models/operations/listlatestdestinationdefinitions.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListLatestDestinationDefinitionsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionReadList *shared.DestinationDefinitionReadList - StatusCode int - RawResponse *http.Response +} + +func (o *ListLatestDestinationDefinitionsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListLatestDestinationDefinitionsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListLatestDestinationDefinitionsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListLatestDestinationDefinitionsResponse) GetDestinationDefinitionReadList() *shared.DestinationDefinitionReadList { + if o == nil { + return nil + } + return o.DestinationDefinitionReadList } diff --git a/internal/sdk/pkg/models/operations/listlatestsourcedefinitions.go b/internal/sdk/pkg/models/operations/listlatestsourcedefinitions.go old mode 100755 new mode 100644 index 73f6560..d7536fc --- a/internal/sdk/pkg/models/operations/listlatestsourcedefinitions.go +++ b/internal/sdk/pkg/models/operations/listlatestsourcedefinitions.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListLatestSourceDefinitionsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionReadList *shared.SourceDefinitionReadList - StatusCode int - RawResponse *http.Response +} + +func (o *ListLatestSourceDefinitionsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListLatestSourceDefinitionsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListLatestSourceDefinitionsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListLatestSourceDefinitionsResponse) GetSourceDefinitionReadList() *shared.SourceDefinitionReadList { + if o == nil { + return nil + } + return o.SourceDefinitionReadList } diff --git a/internal/sdk/pkg/models/operations/listoperationsforconnection.go b/internal/sdk/pkg/models/operations/listoperationsforconnection.go old mode 100755 new mode 100644 index 08ee234..7e3d58e --- a/internal/sdk/pkg/models/operations/listoperationsforconnection.go +++ b/internal/sdk/pkg/models/operations/listoperationsforconnection.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListOperationsForConnectionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation OperationReadList *shared.OperationReadList - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ListOperationsForConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListOperationsForConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListOperationsForConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListOperationsForConnectionResponse) GetOperationReadList() *shared.OperationReadList { + if o == nil { + return nil + } + return o.OperationReadList +} + +func (o *ListOperationsForConnectionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ListOperationsForConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listprivatedestinationdefinitions.go b/internal/sdk/pkg/models/operations/listprivatedestinationdefinitions.go old mode 100755 new mode 100644 index 25fc7ec..76670a0 --- a/internal/sdk/pkg/models/operations/listprivatedestinationdefinitions.go +++ b/internal/sdk/pkg/models/operations/listprivatedestinationdefinitions.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListPrivateDestinationDefinitionsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation PrivateDestinationDefinitionReadList *shared.PrivateDestinationDefinitionReadList - StatusCode int - RawResponse *http.Response +} + +func (o *ListPrivateDestinationDefinitionsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListPrivateDestinationDefinitionsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListPrivateDestinationDefinitionsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListPrivateDestinationDefinitionsResponse) GetPrivateDestinationDefinitionReadList() *shared.PrivateDestinationDefinitionReadList { + if o == nil { + return nil + } + return o.PrivateDestinationDefinitionReadList } diff --git a/internal/sdk/pkg/models/operations/listprivatesourcedefinitions.go b/internal/sdk/pkg/models/operations/listprivatesourcedefinitions.go old mode 100755 new mode 100644 index f85b704..347b03e --- a/internal/sdk/pkg/models/operations/listprivatesourcedefinitions.go +++ b/internal/sdk/pkg/models/operations/listprivatesourcedefinitions.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListPrivateSourceDefinitionsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation PrivateSourceDefinitionReadList *shared.PrivateSourceDefinitionReadList - StatusCode int - RawResponse *http.Response +} + +func (o *ListPrivateSourceDefinitionsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListPrivateSourceDefinitionsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListPrivateSourceDefinitionsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListPrivateSourceDefinitionsResponse) GetPrivateSourceDefinitionReadList() *shared.PrivateSourceDefinitionReadList { + if o == nil { + return nil + } + return o.PrivateSourceDefinitionReadList } diff --git a/internal/sdk/pkg/models/operations/listsourcedefinitions.go b/internal/sdk/pkg/models/operations/listsourcedefinitions.go old mode 100755 new mode 100644 index dc1fbb3..c504ede --- a/internal/sdk/pkg/models/operations/listsourcedefinitions.go +++ b/internal/sdk/pkg/models/operations/listsourcedefinitions.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListSourceDefinitionsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionReadList *shared.SourceDefinitionReadList - StatusCode int - RawResponse *http.Response +} + +func (o *ListSourceDefinitionsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListSourceDefinitionsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListSourceDefinitionsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListSourceDefinitionsResponse) GetSourceDefinitionReadList() *shared.SourceDefinitionReadList { + if o == nil { + return nil + } + return o.SourceDefinitionReadList } diff --git a/internal/sdk/pkg/models/operations/listsourcedefinitionsforworkspace.go b/internal/sdk/pkg/models/operations/listsourcedefinitionsforworkspace.go old mode 100755 new mode 100644 index a7365e6..77d5fc3 --- a/internal/sdk/pkg/models/operations/listsourcedefinitionsforworkspace.go +++ b/internal/sdk/pkg/models/operations/listsourcedefinitionsforworkspace.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListSourceDefinitionsForWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionReadList *shared.SourceDefinitionReadList - StatusCode int - RawResponse *http.Response +} + +func (o *ListSourceDefinitionsForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListSourceDefinitionsForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListSourceDefinitionsForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListSourceDefinitionsForWorkspaceResponse) GetSourceDefinitionReadList() *shared.SourceDefinitionReadList { + if o == nil { + return nil + } + return o.SourceDefinitionReadList } diff --git a/internal/sdk/pkg/models/operations/listsourcesforworkspace.go b/internal/sdk/pkg/models/operations/listsourcesforworkspace.go old mode 100755 new mode 100644 index e1c20ba..06b8125 --- a/internal/sdk/pkg/models/operations/listsourcesforworkspace.go +++ b/internal/sdk/pkg/models/operations/listsourcesforworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListSourcesForWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceReadList *shared.SourceReadList - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ListSourcesForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListSourcesForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListSourcesForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListSourcesForWorkspaceResponse) GetSourceReadList() *shared.SourceReadList { + if o == nil { + return nil + } + return o.SourceReadList +} + +func (o *ListSourcesForWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ListSourcesForWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/listworkspaces.go b/internal/sdk/pkg/models/operations/listworkspaces.go old mode 100755 new mode 100644 index 3dace00..8058a13 --- a/internal/sdk/pkg/models/operations/listworkspaces.go +++ b/internal/sdk/pkg/models/operations/listworkspaces.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ListWorkspacesResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // Successful operation WorkspaceReadList *shared.WorkspaceReadList } + +func (o *ListWorkspacesResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ListWorkspacesResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ListWorkspacesResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ListWorkspacesResponse) GetWorkspaceReadList() *shared.WorkspaceReadList { + if o == nil { + return nil + } + return o.WorkspaceReadList +} diff --git a/internal/sdk/pkg/models/operations/options.go b/internal/sdk/pkg/models/operations/options.go new file mode 100644 index 0000000..1f8d84a --- /dev/null +++ b/internal/sdk/pkg/models/operations/options.go @@ -0,0 +1,87 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package operations + +import ( + "errors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + +var ErrUnsupportedOption = errors.New("unsupported option") + +const ( + SupportedOptionServerURL = "serverURL" + SupportedOptionRetries = "retries" + SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" +) + +type AcceptHeaderEnum string + +const ( + AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" + AcceptHeaderEnumWildcardWildcard AcceptHeaderEnum = "*/*" + AcceptHeaderEnumTextPlain AcceptHeaderEnum = "text/plain" +) + +func (e AcceptHeaderEnum) ToPointer() *AcceptHeaderEnum { + return &e +} + +type Options struct { + ServerURL *string + Retries *utils.RetryConfig + AcceptHeaderOverride *AcceptHeaderEnum +} + +type Option func(*Options, ...string) error + +// WithServerURL allows providing an alternative server URL. +func WithServerURL(serverURL string) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionServerURL) { + return ErrUnsupportedOption + } + + opts.ServerURL = &serverURL + return nil + } +} + +// WithTemplatedServerURL allows providing an alternative server URL with templated parameters. +func WithTemplatedServerURL(serverURL string, params map[string]string) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionServerURL) { + return ErrUnsupportedOption + } + + if params != nil { + serverURL = utils.ReplaceParameters(serverURL, params) + } + + opts.ServerURL = &serverURL + return nil + } +} + +// WithRetries allows customizing the default retry configuration. +func WithRetries(config utils.RetryConfig) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionRetries) { + return ErrUnsupportedOption + } + + opts.Retries = &config + return nil + } +} + +func WithAcceptHeaderOverride(acceptHeaderOverride AcceptHeaderEnum) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionAcceptHeaderOverride) { + return ErrUnsupportedOption + } + + opts.AcceptHeaderOverride = &acceptHeaderOverride + return nil + } +} diff --git a/internal/sdk/pkg/models/operations/partialupdatedestination.go b/internal/sdk/pkg/models/operations/partialupdatedestination.go old mode 100755 new mode 100644 index 5c12c83..ca735fa --- a/internal/sdk/pkg/models/operations/partialupdatedestination.go +++ b/internal/sdk/pkg/models/operations/partialupdatedestination.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type PartialUpdateDestinationResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationRead *shared.DestinationRead // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *PartialUpdateDestinationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *PartialUpdateDestinationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *PartialUpdateDestinationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *PartialUpdateDestinationResponse) GetDestinationRead() *shared.DestinationRead { + if o == nil { + return nil + } + return o.DestinationRead +} + +func (o *PartialUpdateDestinationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/partialupdatesource.go b/internal/sdk/pkg/models/operations/partialupdatesource.go old mode 100755 new mode 100644 index 4641c62..e524f5b --- a/internal/sdk/pkg/models/operations/partialupdatesource.go +++ b/internal/sdk/pkg/models/operations/partialupdatesource.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type PartialUpdateSourceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successful operation + SourceRead *shared.SourceRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - // Successful operation - SourceRead *shared.SourceRead - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *PartialUpdateSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *PartialUpdateSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *PartialUpdateSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *PartialUpdateSourceResponse) GetSourceRead() *shared.SourceRead { + if o == nil { + return nil + } + return o.SourceRead +} + +func (o *PartialUpdateSourceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *PartialUpdateSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/publishconnectorbuilderproject.go b/internal/sdk/pkg/models/operations/publishconnectorbuilderproject.go old mode 100755 new mode 100644 index c71aafd..a454c94 --- a/internal/sdk/pkg/models/operations/publishconnectorbuilderproject.go +++ b/internal/sdk/pkg/models/operations/publishconnectorbuilderproject.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type PublishConnectorBuilderProjectResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionIDBody *shared.SourceDefinitionIDBody - StatusCode int - RawResponse *http.Response +} + +func (o *PublishConnectorBuilderProjectResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *PublishConnectorBuilderProjectResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *PublishConnectorBuilderProjectResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *PublishConnectorBuilderProjectResponse) GetSourceDefinitionIDBody() *shared.SourceDefinitionIDBody { + if o == nil { + return nil + } + return o.SourceDefinitionIDBody } diff --git a/internal/sdk/pkg/models/operations/resetconnection.go b/internal/sdk/pkg/models/operations/resetconnection.go old mode 100755 new mode 100644 index 7d6beec..9aa5b63 --- a/internal/sdk/pkg/models/operations/resetconnection.go +++ b/internal/sdk/pkg/models/operations/resetconnection.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ResetConnectionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobInfoRead *shared.JobInfoRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ResetConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ResetConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ResetConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ResetConnectionResponse) GetJobInfoRead() *shared.JobInfoRead { + if o == nil { + return nil + } + return o.JobInfoRead +} + +func (o *ResetConnectionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ResetConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/resetconnectionstream.go b/internal/sdk/pkg/models/operations/resetconnectionstream.go old mode 100755 new mode 100644 index f7b1a5e..4442df5 --- a/internal/sdk/pkg/models/operations/resetconnectionstream.go +++ b/internal/sdk/pkg/models/operations/resetconnectionstream.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type ResetConnectionStreamResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobInfoRead *shared.JobInfoRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *ResetConnectionStreamResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *ResetConnectionStreamResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *ResetConnectionStreamResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *ResetConnectionStreamResponse) GetJobInfoRead() *shared.JobInfoRead { + if o == nil { + return nil + } + return o.JobInfoRead +} + +func (o *ResetConnectionStreamResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *ResetConnectionStreamResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/revokedestinationdefinitionfromworkspace.go b/internal/sdk/pkg/models/operations/revokedestinationdefinitionfromworkspace.go old mode 100755 new mode 100644 index 3cd1d6a..b6a96fb --- a/internal/sdk/pkg/models/operations/revokedestinationdefinitionfromworkspace.go +++ b/internal/sdk/pkg/models/operations/revokedestinationdefinitionfromworkspace.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type RevokeDestinationDefinitionFromWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *RevokeDestinationDefinitionFromWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *RevokeDestinationDefinitionFromWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *RevokeDestinationDefinitionFromWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *RevokeDestinationDefinitionFromWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *RevokeDestinationDefinitionFromWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/revokesourcedefinitionfromworkspace.go b/internal/sdk/pkg/models/operations/revokesourcedefinitionfromworkspace.go old mode 100755 new mode 100644 index 3c6046e..30c376a --- a/internal/sdk/pkg/models/operations/revokesourcedefinitionfromworkspace.go +++ b/internal/sdk/pkg/models/operations/revokesourcedefinitionfromworkspace.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type RevokeSourceDefinitionFromWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *RevokeSourceDefinitionFromWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *RevokeSourceDefinitionFromWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *RevokeSourceDefinitionFromWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *RevokeSourceDefinitionFromWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *RevokeSourceDefinitionFromWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/revokesourceoauthtokens.go b/internal/sdk/pkg/models/operations/revokesourceoauthtokens.go old mode 100755 new mode 100644 index 33723e0..05428ec --- a/internal/sdk/pkg/models/operations/revokesourceoauthtokens.go +++ b/internal/sdk/pkg/models/operations/revokesourceoauthtokens.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type RevokeSourceOAuthTokensResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Exception occurred; see message for details. KnownExceptionInfo *shared.KnownExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *RevokeSourceOAuthTokensResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *RevokeSourceOAuthTokensResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *RevokeSourceOAuthTokensResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *RevokeSourceOAuthTokensResponse) GetKnownExceptionInfo() *shared.KnownExceptionInfo { + if o == nil { + return nil + } + return o.KnownExceptionInfo +} + +func (o *RevokeSourceOAuthTokensResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/savestats.go b/internal/sdk/pkg/models/operations/savestats.go old mode 100755 new mode 100644 index 5459bae..4037542 --- a/internal/sdk/pkg/models/operations/savestats.go +++ b/internal/sdk/pkg/models/operations/savestats.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SaveStatsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful Operation InternalOperationResult *shared.InternalOperationResult - StatusCode int - RawResponse *http.Response +} + +func (o *SaveStatsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SaveStatsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SaveStatsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SaveStatsResponse) GetInternalOperationResult() *shared.InternalOperationResult { + if o == nil { + return nil + } + return o.InternalOperationResult } diff --git a/internal/sdk/pkg/models/operations/savesyncconfig.go b/internal/sdk/pkg/models/operations/savesyncconfig.go old mode 100755 new mode 100644 index b269661..b9e66e5 --- a/internal/sdk/pkg/models/operations/savesyncconfig.go +++ b/internal/sdk/pkg/models/operations/savesyncconfig.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SaveSyncConfigResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful Operation InternalOperationResult *shared.InternalOperationResult - StatusCode int - RawResponse *http.Response +} + +func (o *SaveSyncConfigResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SaveSyncConfigResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SaveSyncConfigResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SaveSyncConfigResponse) GetInternalOperationResult() *shared.InternalOperationResult { + if o == nil { + return nil + } + return o.InternalOperationResult } diff --git a/internal/sdk/pkg/models/operations/searchconnections.go b/internal/sdk/pkg/models/operations/searchconnections.go old mode 100755 new mode 100644 index 6eac5c1..ef139e2 --- a/internal/sdk/pkg/models/operations/searchconnections.go +++ b/internal/sdk/pkg/models/operations/searchconnections.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SearchConnectionsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionReadList *shared.ConnectionReadList - ContentType string // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *SearchConnectionsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SearchConnectionsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SearchConnectionsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SearchConnectionsResponse) GetConnectionReadList() *shared.ConnectionReadList { + if o == nil { + return nil + } + return o.ConnectionReadList +} + +func (o *SearchConnectionsResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/searchdestinations.go b/internal/sdk/pkg/models/operations/searchdestinations.go old mode 100755 new mode 100644 index ac4eb9d..ac0873f --- a/internal/sdk/pkg/models/operations/searchdestinations.go +++ b/internal/sdk/pkg/models/operations/searchdestinations.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SearchDestinationsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationReadList *shared.DestinationReadList // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *SearchDestinationsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SearchDestinationsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SearchDestinationsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SearchDestinationsResponse) GetDestinationReadList() *shared.DestinationReadList { + if o == nil { + return nil + } + return o.DestinationReadList +} + +func (o *SearchDestinationsResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/searchsources.go b/internal/sdk/pkg/models/operations/searchsources.go old mode 100755 new mode 100644 index bd3b84d..6888a0b --- a/internal/sdk/pkg/models/operations/searchsources.go +++ b/internal/sdk/pkg/models/operations/searchsources.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SearchSourcesResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceReadList *shared.SourceReadList - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *SearchSourcesResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SearchSourcesResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SearchSourcesResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SearchSourcesResponse) GetSourceReadList() *shared.SourceReadList { + if o == nil { + return nil + } + return o.SourceReadList +} + +func (o *SearchSourcesResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/setinstancewidedestinationoauthparams.go b/internal/sdk/pkg/models/operations/setinstancewidedestinationoauthparams.go old mode 100755 new mode 100644 index 62a8881..9bd5873 --- a/internal/sdk/pkg/models/operations/setinstancewidedestinationoauthparams.go +++ b/internal/sdk/pkg/models/operations/setinstancewidedestinationoauthparams.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SetInstancewideDestinationOauthParamsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Exception occurred; see message for details. KnownExceptionInfo *shared.KnownExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *SetInstancewideDestinationOauthParamsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SetInstancewideDestinationOauthParamsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SetInstancewideDestinationOauthParamsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SetInstancewideDestinationOauthParamsResponse) GetKnownExceptionInfo() *shared.KnownExceptionInfo { + if o == nil { + return nil + } + return o.KnownExceptionInfo +} + +func (o *SetInstancewideDestinationOauthParamsResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/setinstancewidesourceoauthparams.go b/internal/sdk/pkg/models/operations/setinstancewidesourceoauthparams.go old mode 100755 new mode 100644 index 2cdf9cd..b0452ee --- a/internal/sdk/pkg/models/operations/setinstancewidesourceoauthparams.go +++ b/internal/sdk/pkg/models/operations/setinstancewidesourceoauthparams.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SetInstancewideSourceOauthParamsResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Exception occurred; see message for details. KnownExceptionInfo *shared.KnownExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *SetInstancewideSourceOauthParamsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SetInstancewideSourceOauthParamsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SetInstancewideSourceOauthParamsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SetInstancewideSourceOauthParamsResponse) GetKnownExceptionInfo() *shared.KnownExceptionInfo { + if o == nil { + return nil + } + return o.KnownExceptionInfo +} + +func (o *SetInstancewideSourceOauthParamsResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/setworkflowinattempt.go b/internal/sdk/pkg/models/operations/setworkflowinattempt.go old mode 100755 new mode 100644 index 940547e..84eeb14 --- a/internal/sdk/pkg/models/operations/setworkflowinattempt.go +++ b/internal/sdk/pkg/models/operations/setworkflowinattempt.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SetWorkflowInAttemptResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful Operation InternalOperationResult *shared.InternalOperationResult - StatusCode int - RawResponse *http.Response +} + +func (o *SetWorkflowInAttemptResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SetWorkflowInAttemptResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SetWorkflowInAttemptResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SetWorkflowInAttemptResponse) GetInternalOperationResult() *shared.InternalOperationResult { + if o == nil { + return nil + } + return o.InternalOperationResult } diff --git a/internal/sdk/pkg/models/operations/syncconnection.go b/internal/sdk/pkg/models/operations/syncconnection.go old mode 100755 new mode 100644 index 002197a..8ff14b5 --- a/internal/sdk/pkg/models/operations/syncconnection.go +++ b/internal/sdk/pkg/models/operations/syncconnection.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type SyncConnectionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation JobInfoRead *shared.JobInfoRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *SyncConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *SyncConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *SyncConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *SyncConnectionResponse) GetJobInfoRead() *shared.JobInfoRead { + if o == nil { + return nil + } + return o.JobInfoRead +} + +func (o *SyncConnectionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *SyncConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/trynotificationconfig.go b/internal/sdk/pkg/models/operations/trynotificationconfig.go old mode 100755 new mode 100644 index 404aef4..5611487 --- a/internal/sdk/pkg/models/operations/trynotificationconfig.go +++ b/internal/sdk/pkg/models/operations/trynotificationconfig.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type TryNotificationConfigResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation NotificationRead *shared.NotificationRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *TryNotificationConfigResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *TryNotificationConfigResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *TryNotificationConfigResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *TryNotificationConfigResponse) GetNotificationRead() *shared.NotificationRead { + if o == nil { + return nil + } + return o.NotificationRead +} + +func (o *TryNotificationConfigResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *TryNotificationConfigResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updateconnection.go b/internal/sdk/pkg/models/operations/updateconnection.go old mode 100755 new mode 100644 index 821b9b9..2f338a4 --- a/internal/sdk/pkg/models/operations/updateconnection.go +++ b/internal/sdk/pkg/models/operations/updateconnection.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateConnectionResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation ConnectionRead *shared.ConnectionRead - ContentType string // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *UpdateConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateConnectionResponse) GetConnectionRead() *shared.ConnectionRead { + if o == nil { + return nil + } + return o.ConnectionRead +} + +func (o *UpdateConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updateconnectorbuilderproject.go b/internal/sdk/pkg/models/operations/updateconnectorbuilderproject.go old mode 100755 new mode 100644 index 25e7072..10f8128 --- a/internal/sdk/pkg/models/operations/updateconnectorbuilderproject.go +++ b/internal/sdk/pkg/models/operations/updateconnectorbuilderproject.go @@ -7,7 +7,31 @@ import ( ) type UpdateConnectorBuilderProjectResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response } + +func (o *UpdateConnectorBuilderProjectResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateConnectorBuilderProjectResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateConnectorBuilderProjectResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/internal/sdk/pkg/models/operations/updatedeclarativemanifestversion.go b/internal/sdk/pkg/models/operations/updatedeclarativemanifestversion.go old mode 100755 new mode 100644 index bbd2c90..0ebce1f --- a/internal/sdk/pkg/models/operations/updatedeclarativemanifestversion.go +++ b/internal/sdk/pkg/models/operations/updatedeclarativemanifestversion.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateDeclarativeManifestVersionResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *UpdateDeclarativeManifestVersionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateDeclarativeManifestVersionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateDeclarativeManifestVersionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateDeclarativeManifestVersionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updatedestination.go b/internal/sdk/pkg/models/operations/updatedestination.go old mode 100755 new mode 100644 index 91de2fc..330f78b --- a/internal/sdk/pkg/models/operations/updatedestination.go +++ b/internal/sdk/pkg/models/operations/updatedestination.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateDestinationResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationRead *shared.DestinationRead // Input failed validation InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *UpdateDestinationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateDestinationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateDestinationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateDestinationResponse) GetDestinationRead() *shared.DestinationRead { + if o == nil { + return nil + } + return o.DestinationRead +} + +func (o *UpdateDestinationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updatedestinationdefinition.go b/internal/sdk/pkg/models/operations/updatedestinationdefinition.go old mode 100755 new mode 100644 index ee3cbab..6e4fdac --- a/internal/sdk/pkg/models/operations/updatedestinationdefinition.go +++ b/internal/sdk/pkg/models/operations/updatedestinationdefinition.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateDestinationDefinitionResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation DestinationDefinitionRead *shared.DestinationDefinitionRead - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *UpdateDestinationDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateDestinationDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateDestinationDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateDestinationDefinitionResponse) GetDestinationDefinitionRead() *shared.DestinationDefinitionRead { + if o == nil { + return nil + } + return o.DestinationDefinitionRead +} + +func (o *UpdateDestinationDefinitionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *UpdateDestinationDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updateoperation.go b/internal/sdk/pkg/models/operations/updateoperation.go old mode 100755 new mode 100644 index 83eda0a..59b44c5 --- a/internal/sdk/pkg/models/operations/updateoperation.go +++ b/internal/sdk/pkg/models/operations/updateoperation.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateOperationResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation OperationRead *shared.OperationRead - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *UpdateOperationResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateOperationResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateOperationResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateOperationResponse) GetOperationRead() *shared.OperationRead { + if o == nil { + return nil + } + return o.OperationRead +} + +func (o *UpdateOperationResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updatesource.go b/internal/sdk/pkg/models/operations/updatesource.go old mode 100755 new mode 100644 index bdfb424..eefff50 --- a/internal/sdk/pkg/models/operations/updatesource.go +++ b/internal/sdk/pkg/models/operations/updatesource.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateSourceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successful operation + SourceRead *shared.SourceRead // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - // Successful operation - SourceRead *shared.SourceRead - StatusCode int - RawResponse *http.Response + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *UpdateSourceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateSourceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateSourceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateSourceResponse) GetSourceRead() *shared.SourceRead { + if o == nil { + return nil + } + return o.SourceRead +} + +func (o *UpdateSourceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *UpdateSourceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updatesourcedefinition.go b/internal/sdk/pkg/models/operations/updatesourcedefinition.go old mode 100755 new mode 100644 index e953d67..446a1ff --- a/internal/sdk/pkg/models/operations/updatesourcedefinition.go +++ b/internal/sdk/pkg/models/operations/updatesourcedefinition.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateSourceDefinitionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation SourceDefinitionRead *shared.SourceDefinitionRead - StatusCode int - RawResponse *http.Response + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *UpdateSourceDefinitionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateSourceDefinitionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateSourceDefinitionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateSourceDefinitionResponse) GetSourceDefinitionRead() *shared.SourceDefinitionRead { + if o == nil { + return nil + } + return o.SourceDefinitionRead +} + +func (o *UpdateSourceDefinitionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *UpdateSourceDefinitionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updatestreamstatus.go b/internal/sdk/pkg/models/operations/updatestreamstatus.go old mode 100755 new mode 100644 index 6d8d003..64937da --- a/internal/sdk/pkg/models/operations/updatestreamstatus.go +++ b/internal/sdk/pkg/models/operations/updatestreamstatus.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateStreamStatusResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response - // Successfully updated stream status. + // Successfully created stream status. StreamStatusRead *shared.StreamStatusRead } + +func (o *UpdateStreamStatusResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateStreamStatusResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateStreamStatusResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateStreamStatusResponse) GetStreamStatusRead() *shared.StreamStatusRead { + if o == nil { + return nil + } + return o.StreamStatusRead +} diff --git a/internal/sdk/pkg/models/operations/updateworkspace.go b/internal/sdk/pkg/models/operations/updateworkspace.go old mode 100755 new mode 100644 index b2018d6..b682e05 --- a/internal/sdk/pkg/models/operations/updateworkspace.go +++ b/internal/sdk/pkg/models/operations/updateworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WorkspaceRead *shared.WorkspaceRead + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *UpdateWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateWorkspaceResponse) GetWorkspaceRead() *shared.WorkspaceRead { + if o == nil { + return nil + } + return o.WorkspaceRead +} + +func (o *UpdateWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *UpdateWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updateworkspacefeedback.go b/internal/sdk/pkg/models/operations/updateworkspacefeedback.go old mode 100755 new mode 100644 index 3a48f83..c1774c1 --- a/internal/sdk/pkg/models/operations/updateworkspacefeedback.go +++ b/internal/sdk/pkg/models/operations/updateworkspacefeedback.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateWorkspaceFeedbackResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Object with given id was not found. NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response +} + +func (o *UpdateWorkspaceFeedbackResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateWorkspaceFeedbackResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateWorkspaceFeedbackResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateWorkspaceFeedbackResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/updateworkspacename.go b/internal/sdk/pkg/models/operations/updateworkspacename.go old mode 100755 new mode 100644 index 814422d..4e7302e --- a/internal/sdk/pkg/models/operations/updateworkspacename.go +++ b/internal/sdk/pkg/models/operations/updateworkspacename.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type UpdateWorkspaceNameResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WorkspaceRead *shared.WorkspaceRead + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *UpdateWorkspaceNameResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *UpdateWorkspaceNameResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *UpdateWorkspaceNameResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *UpdateWorkspaceNameResponse) GetWorkspaceRead() *shared.WorkspaceRead { + if o == nil { + return nil + } + return o.WorkspaceRead +} + +func (o *UpdateWorkspaceNameResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *UpdateWorkspaceNameResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/webbackendcheckupdates.go b/internal/sdk/pkg/models/operations/webbackendcheckupdates.go old mode 100755 new mode 100644 index 709533a..cc4b1ac --- a/internal/sdk/pkg/models/operations/webbackendcheckupdates.go +++ b/internal/sdk/pkg/models/operations/webbackendcheckupdates.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type WebBackendCheckUpdatesResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // Successful operation WebBackendCheckUpdatesRead *shared.WebBackendCheckUpdatesRead } + +func (o *WebBackendCheckUpdatesResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *WebBackendCheckUpdatesResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *WebBackendCheckUpdatesResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *WebBackendCheckUpdatesResponse) GetWebBackendCheckUpdatesRead() *shared.WebBackendCheckUpdatesRead { + if o == nil { + return nil + } + return o.WebBackendCheckUpdatesRead +} diff --git a/internal/sdk/pkg/models/operations/webbackendcreateconnection.go b/internal/sdk/pkg/models/operations/webbackendcreateconnection.go old mode 100755 new mode 100644 index cfba63a..6153d94 --- a/internal/sdk/pkg/models/operations/webbackendcreateconnection.go +++ b/internal/sdk/pkg/models/operations/webbackendcreateconnection.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type WebBackendCreateConnectionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WebBackendConnectionRead *shared.WebBackendConnectionRead + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *WebBackendCreateConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *WebBackendCreateConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *WebBackendCreateConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *WebBackendCreateConnectionResponse) GetWebBackendConnectionRead() *shared.WebBackendConnectionRead { + if o == nil { + return nil + } + return o.WebBackendConnectionRead +} + +func (o *WebBackendCreateConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/webbackendgetconnection.go b/internal/sdk/pkg/models/operations/webbackendgetconnection.go old mode 100755 new mode 100644 index 98b5ee2..21b674c --- a/internal/sdk/pkg/models/operations/webbackendgetconnection.go +++ b/internal/sdk/pkg/models/operations/webbackendgetconnection.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type WebBackendGetConnectionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WebBackendConnectionRead *shared.WebBackendConnectionRead + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *WebBackendGetConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *WebBackendGetConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *WebBackendGetConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *WebBackendGetConnectionResponse) GetWebBackendConnectionRead() *shared.WebBackendConnectionRead { + if o == nil { + return nil + } + return o.WebBackendConnectionRead +} + +func (o *WebBackendGetConnectionResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *WebBackendGetConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/webbackendgetworkspacestate.go b/internal/sdk/pkg/models/operations/webbackendgetworkspacestate.go old mode 100755 new mode 100644 index b53f82c..25fee44 --- a/internal/sdk/pkg/models/operations/webbackendgetworkspacestate.go +++ b/internal/sdk/pkg/models/operations/webbackendgetworkspacestate.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type WebBackendGetWorkspaceStateResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WebBackendWorkspaceStateResult *shared.WebBackendWorkspaceStateResult + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *WebBackendGetWorkspaceStateResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *WebBackendGetWorkspaceStateResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *WebBackendGetWorkspaceStateResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *WebBackendGetWorkspaceStateResponse) GetWebBackendWorkspaceStateResult() *shared.WebBackendWorkspaceStateResult { + if o == nil { + return nil + } + return o.WebBackendWorkspaceStateResult +} + +func (o *WebBackendGetWorkspaceStateResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *WebBackendGetWorkspaceStateResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/webbackendlistconnectionsforworkspace.go b/internal/sdk/pkg/models/operations/webbackendlistconnectionsforworkspace.go old mode 100755 new mode 100644 index b037e3e..497d86e --- a/internal/sdk/pkg/models/operations/webbackendlistconnectionsforworkspace.go +++ b/internal/sdk/pkg/models/operations/webbackendlistconnectionsforworkspace.go @@ -3,18 +3,63 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type WebBackendListConnectionsForWorkspaceResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - // Object with given id was not found. - NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WebBackendConnectionReadList *shared.WebBackendConnectionReadList + // Object with given id was not found. + NotFoundKnownExceptionInfo *shared.NotFoundKnownExceptionInfo + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *WebBackendListConnectionsForWorkspaceResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *WebBackendListConnectionsForWorkspaceResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *WebBackendListConnectionsForWorkspaceResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *WebBackendListConnectionsForWorkspaceResponse) GetWebBackendConnectionReadList() *shared.WebBackendConnectionReadList { + if o == nil { + return nil + } + return o.WebBackendConnectionReadList +} + +func (o *WebBackendListConnectionsForWorkspaceResponse) GetNotFoundKnownExceptionInfo() *shared.NotFoundKnownExceptionInfo { + if o == nil { + return nil + } + return o.NotFoundKnownExceptionInfo +} + +func (o *WebBackendListConnectionsForWorkspaceResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/webbackendlistgeographies.go b/internal/sdk/pkg/models/operations/webbackendlistgeographies.go old mode 100755 new mode 100644 index e1bf98a..28aa7fb --- a/internal/sdk/pkg/models/operations/webbackendlistgeographies.go +++ b/internal/sdk/pkg/models/operations/webbackendlistgeographies.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type WebBackendListGeographiesResponse struct { + // HTTP response content type for this operation ContentType string - StatusCode int + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // Successful operation WebBackendGeographiesListResult *shared.WebBackendGeographiesListResult } + +func (o *WebBackendListGeographiesResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *WebBackendListGeographiesResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *WebBackendListGeographiesResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *WebBackendListGeographiesResponse) GetWebBackendGeographiesListResult() *shared.WebBackendGeographiesListResult { + if o == nil { + return nil + } + return o.WebBackendGeographiesListResult +} diff --git a/internal/sdk/pkg/models/operations/webbackendupdateconnection.go b/internal/sdk/pkg/models/operations/webbackendupdateconnection.go old mode 100755 new mode 100644 index d912929..3ab726f --- a/internal/sdk/pkg/models/operations/webbackendupdateconnection.go +++ b/internal/sdk/pkg/models/operations/webbackendupdateconnection.go @@ -3,16 +3,54 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type WebBackendUpdateConnectionResponse struct { + // HTTP response content type for this operation ContentType string - // Input failed validation - InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo - StatusCode int - RawResponse *http.Response + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful operation WebBackendConnectionRead *shared.WebBackendConnectionRead + // Input failed validation + InvalidInputExceptionInfo *shared.InvalidInputExceptionInfo +} + +func (o *WebBackendUpdateConnectionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *WebBackendUpdateConnectionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *WebBackendUpdateConnectionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *WebBackendUpdateConnectionResponse) GetWebBackendConnectionRead() *shared.WebBackendConnectionRead { + if o == nil { + return nil + } + return o.WebBackendConnectionRead +} + +func (o *WebBackendUpdateConnectionResponse) GetInvalidInputExceptionInfo() *shared.InvalidInputExceptionInfo { + if o == nil { + return nil + } + return o.InvalidInputExceptionInfo } diff --git a/internal/sdk/pkg/models/operations/writediscovercatalogresult.go b/internal/sdk/pkg/models/operations/writediscovercatalogresult.go old mode 100755 new mode 100644 index e809b27..af8f7e4 --- a/internal/sdk/pkg/models/operations/writediscovercatalogresult.go +++ b/internal/sdk/pkg/models/operations/writediscovercatalogresult.go @@ -3,14 +3,45 @@ package operations import ( - "airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" "net/http" ) type WriteDiscoverCatalogResultResponse struct { + // HTTP response content type for this operation ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response // Successful Operation DiscoverCatalogResult *shared.DiscoverCatalogResult - StatusCode int - RawResponse *http.Response +} + +func (o *WriteDiscoverCatalogResultResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *WriteDiscoverCatalogResultResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *WriteDiscoverCatalogResultResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *WriteDiscoverCatalogResultResponse) GetDiscoverCatalogResult() *shared.DiscoverCatalogResult { + if o == nil { + return nil + } + return o.DiscoverCatalogResult } diff --git a/internal/sdk/pkg/models/sdkerrors/sdkerror.go b/internal/sdk/pkg/models/sdkerrors/sdkerror.go new file mode 100644 index 0000000..5c1affd --- /dev/null +++ b/internal/sdk/pkg/models/sdkerrors/sdkerror.go @@ -0,0 +1,35 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package sdkerrors + +import ( + "fmt" + "net/http" +) + +type SDKError struct { + Message string + StatusCode int + Body string + RawResponse *http.Response +} + +var _ error = &SDKError{} + +func NewSDKError(message string, statusCode int, body string, httpRes *http.Response) *SDKError { + return &SDKError{ + Message: message, + StatusCode: statusCode, + Body: body, + RawResponse: httpRes, + } +} + +func (e *SDKError) Error() string { + body := "" + if len(e.Body) > 0 { + body = fmt.Sprintf("\n%s", e.Body) + } + + return fmt.Sprintf("%s: Status %d%s", e.Message, e.StatusCode, body) +} diff --git a/internal/sdk/pkg/models/shared/actorcatalogwithupdatedat.go b/internal/sdk/pkg/models/shared/actorcatalogwithupdatedat.go old mode 100755 new mode 100644 index 29e78a1..42049d7 --- a/internal/sdk/pkg/models/shared/actorcatalogwithupdatedat.go +++ b/internal/sdk/pkg/models/shared/actorcatalogwithupdatedat.go @@ -2,11 +2,25 @@ package shared -type ActorCatalogWithUpdatedAtCatalog struct { +type Catalog struct { } // ActorCatalogWithUpdatedAt - A source actor catalog with the timestamp it was mostly recently updated type ActorCatalogWithUpdatedAt struct { - Catalog *ActorCatalogWithUpdatedAtCatalog `json:"catalog,omitempty"` - UpdatedAt *int64 `json:"updatedAt,omitempty"` + UpdatedAt *int64 `json:"updatedAt,omitempty"` + Catalog *Catalog `json:"catalog,omitempty"` +} + +func (o *ActorCatalogWithUpdatedAt) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *ActorCatalogWithUpdatedAt) GetCatalog() *Catalog { + if o == nil { + return nil + } + return o.Catalog } diff --git a/internal/sdk/pkg/models/shared/actordefinitionrequestbody.go b/internal/sdk/pkg/models/shared/actordefinitionrequestbody.go old mode 100755 new mode 100644 index a7bb988..8c6754e --- a/internal/sdk/pkg/models/shared/actordefinitionrequestbody.go +++ b/internal/sdk/pkg/models/shared/actordefinitionrequestbody.go @@ -6,3 +6,17 @@ type ActorDefinitionRequestBody struct { ActorDefinitionID string `json:"actorDefinitionId"` ActorType ActorType `json:"actorType"` } + +func (o *ActorDefinitionRequestBody) GetActorDefinitionID() string { + if o == nil { + return "" + } + return o.ActorDefinitionID +} + +func (o *ActorDefinitionRequestBody) GetActorType() ActorType { + if o == nil { + return ActorType("") + } + return o.ActorType +} diff --git a/internal/sdk/pkg/models/shared/actordefinitionresourcerequirements.go b/internal/sdk/pkg/models/shared/actordefinitionresourcerequirements.go old mode 100755 new mode 100644 index 98a69fd..f270d68 --- a/internal/sdk/pkg/models/shared/actordefinitionresourcerequirements.go +++ b/internal/sdk/pkg/models/shared/actordefinitionresourcerequirements.go @@ -8,3 +8,17 @@ type ActorDefinitionResourceRequirements struct { Default *ResourceRequirements `json:"default,omitempty"` JobSpecific []JobTypeResourceLimit `json:"jobSpecific,omitempty"` } + +func (o *ActorDefinitionResourceRequirements) GetDefault() *ResourceRequirements { + if o == nil { + return nil + } + return o.Default +} + +func (o *ActorDefinitionResourceRequirements) GetJobSpecific() []JobTypeResourceLimit { + if o == nil { + return nil + } + return o.JobSpecific +} diff --git a/internal/sdk/pkg/models/shared/actortype.go b/internal/sdk/pkg/models/shared/actortype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/advancedauth.go b/internal/sdk/pkg/models/shared/advancedauth.go old mode 100755 new mode 100644 index ea7e4fe..5dc6969 --- a/internal/sdk/pkg/models/shared/advancedauth.go +++ b/internal/sdk/pkg/models/shared/advancedauth.go @@ -7,18 +7,18 @@ import ( "fmt" ) -type AdvancedAuthAuthFlowType string +type AuthFlowType string const ( - AdvancedAuthAuthFlowTypeOauth20 AdvancedAuthAuthFlowType = "oauth2.0" - AdvancedAuthAuthFlowTypeOauth10 AdvancedAuthAuthFlowType = "oauth1.0" + AuthFlowTypeOauth20 AuthFlowType = "oauth2.0" + AuthFlowTypeOauth10 AuthFlowType = "oauth1.0" ) -func (e AdvancedAuthAuthFlowType) ToPointer() *AdvancedAuthAuthFlowType { +func (e AuthFlowType) ToPointer() *AuthFlowType { return &e } -func (e *AdvancedAuthAuthFlowType) UnmarshalJSON(data []byte) error { +func (e *AuthFlowType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -27,18 +27,46 @@ func (e *AdvancedAuthAuthFlowType) UnmarshalJSON(data []byte) error { case "oauth2.0": fallthrough case "oauth1.0": - *e = AdvancedAuthAuthFlowType(v) + *e = AuthFlowType(v) return nil default: - return fmt.Errorf("invalid value for AdvancedAuthAuthFlowType: %v", v) + return fmt.Errorf("invalid value for AuthFlowType: %v", v) } } type AdvancedAuth struct { - AuthFlowType *AdvancedAuthAuthFlowType `json:"authFlowType,omitempty"` - OauthConfigSpecification *OAuthConfigSpecification `json:"oauthConfigSpecification,omitempty"` + AuthFlowType *AuthFlowType `json:"authFlowType,omitempty"` // Json Path to a field in the connectorSpecification that should exist for the advanced auth to be applicable. PredicateKey []string `json:"predicateKey,omitempty"` // Value of the predicate_key fields for the advanced auth to be applicable. - PredicateValue *string `json:"predicateValue,omitempty"` + PredicateValue *string `json:"predicateValue,omitempty"` + OauthConfigSpecification *OAuthConfigSpecification `json:"oauthConfigSpecification,omitempty"` +} + +func (o *AdvancedAuth) GetAuthFlowType() *AuthFlowType { + if o == nil { + return nil + } + return o.AuthFlowType +} + +func (o *AdvancedAuth) GetPredicateKey() []string { + if o == nil { + return nil + } + return o.PredicateKey +} + +func (o *AdvancedAuth) GetPredicateValue() *string { + if o == nil { + return nil + } + return o.PredicateValue +} + +func (o *AdvancedAuth) GetOauthConfigSpecification() *OAuthConfigSpecification { + if o == nil { + return nil + } + return o.OauthConfigSpecification } diff --git a/internal/sdk/pkg/models/shared/airbytecatalog.go b/internal/sdk/pkg/models/shared/airbytecatalog.go old mode 100755 new mode 100644 index 084c37b..f7d5080 --- a/internal/sdk/pkg/models/shared/airbytecatalog.go +++ b/internal/sdk/pkg/models/shared/airbytecatalog.go @@ -6,3 +6,10 @@ package shared type AirbyteCatalog struct { Streams []AirbyteStreamAndConfiguration `json:"streams"` } + +func (o *AirbyteCatalog) GetStreams() []AirbyteStreamAndConfiguration { + if o == nil { + return []AirbyteStreamAndConfiguration{} + } + return o.Streams +} diff --git a/internal/sdk/pkg/models/shared/airbytestream.go b/internal/sdk/pkg/models/shared/airbytestream.go old mode 100755 new mode 100644 index db9c10e..b1e4c9a --- a/internal/sdk/pkg/models/shared/airbytestream.go +++ b/internal/sdk/pkg/models/shared/airbytestream.go @@ -4,17 +4,66 @@ package shared // AirbyteStream - the immutable schema defined by the source type AirbyteStream struct { - // Path to the field that will be used to determine if a record is new or modified since the last sync. If not provided by the source, the end user will have to specify the comparable themselves. - DefaultCursorField []string `json:"defaultCursorField,omitempty"` - // Stream schema using Json Schema specs. - JSONSchema *StreamJSONSchema `json:"jsonSchema,omitempty"` // Stream's name. Name string `json:"name"` - // Optional Source-defined namespace. Airbyte streams from the same sources should have the same namespace. Currently only used by JDBC destinations to determine what schema to write to. - Namespace *string `json:"namespace,omitempty"` + // Stream schema using Json Schema specs. + JSONSchema *StreamJSONSchema `json:"jsonSchema,omitempty"` + SupportedSyncModes []SyncMode `json:"supportedSyncModes,omitempty"` // If the source defines the cursor field, then any other cursor field inputs will be ignored. If it does not, either the user_provided one is used, or the default one is used as a backup. SourceDefinedCursor *bool `json:"sourceDefinedCursor,omitempty"` + // Path to the field that will be used to determine if a record is new or modified since the last sync. If not provided by the source, the end user will have to specify the comparable themselves. + DefaultCursorField []string `json:"defaultCursorField,omitempty"` // If the source defines the primary key, paths to the fields that will be used as a primary key. If not provided by the source, the end user will have to specify the primary key themselves. SourceDefinedPrimaryKey [][]string `json:"sourceDefinedPrimaryKey,omitempty"` - SupportedSyncModes []SyncMode `json:"supportedSyncModes,omitempty"` + // Optional Source-defined namespace. Airbyte streams from the same sources should have the same namespace. Currently only used by JDBC destinations to determine what schema to write to. + Namespace *string `json:"namespace,omitempty"` +} + +func (o *AirbyteStream) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *AirbyteStream) GetJSONSchema() *StreamJSONSchema { + if o == nil { + return nil + } + return o.JSONSchema +} + +func (o *AirbyteStream) GetSupportedSyncModes() []SyncMode { + if o == nil { + return nil + } + return o.SupportedSyncModes +} + +func (o *AirbyteStream) GetSourceDefinedCursor() *bool { + if o == nil { + return nil + } + return o.SourceDefinedCursor +} + +func (o *AirbyteStream) GetDefaultCursorField() []string { + if o == nil { + return nil + } + return o.DefaultCursorField +} + +func (o *AirbyteStream) GetSourceDefinedPrimaryKey() [][]string { + if o == nil { + return nil + } + return o.SourceDefinedPrimaryKey +} + +func (o *AirbyteStream) GetNamespace() *string { + if o == nil { + return nil + } + return o.Namespace } diff --git a/internal/sdk/pkg/models/shared/airbytestreamandconfiguration.go b/internal/sdk/pkg/models/shared/airbytestreamandconfiguration.go old mode 100755 new mode 100644 index f41de3a..82ebb80 --- a/internal/sdk/pkg/models/shared/airbytestreamandconfiguration.go +++ b/internal/sdk/pkg/models/shared/airbytestreamandconfiguration.go @@ -4,8 +4,22 @@ package shared // AirbyteStreamAndConfiguration - each stream is split in two parts; the immutable schema from source and mutable configuration for destination type AirbyteStreamAndConfiguration struct { - // the mutable part of the stream to configure the destination - Config *AirbyteStreamConfiguration `json:"config,omitempty"` // the immutable schema defined by the source Stream *AirbyteStream `json:"stream,omitempty"` + // the mutable part of the stream to configure the destination + Config *AirbyteStreamConfiguration `json:"config,omitempty"` +} + +func (o *AirbyteStreamAndConfiguration) GetStream() *AirbyteStream { + if o == nil { + return nil + } + return o.Stream +} + +func (o *AirbyteStreamAndConfiguration) GetConfig() *AirbyteStreamConfiguration { + if o == nil { + return nil + } + return o.Config } diff --git a/internal/sdk/pkg/models/shared/airbytestreamconfiguration.go b/internal/sdk/pkg/models/shared/airbytestreamconfiguration.go old mode 100755 new mode 100644 index 037cd97..343f342 --- a/internal/sdk/pkg/models/shared/airbytestreamconfiguration.go +++ b/internal/sdk/pkg/models/shared/airbytestreamconfiguration.go @@ -4,20 +4,83 @@ package shared // AirbyteStreamConfiguration - the mutable part of the stream to configure the destination type AirbyteStreamConfiguration struct { - // Alias name to the stream to be used in the destination - AliasName *string `json:"aliasName,omitempty"` + SyncMode SyncMode `json:"syncMode"` // Path to the field that will be used to determine if a record is new or modified since the last sync. This field is REQUIRED if `sync_mode` is `incremental`. Otherwise it is ignored. CursorField []string `json:"cursorField,omitempty"` DestinationSyncMode DestinationSyncMode `json:"destinationSyncMode"` - // Whether field selection should be enabled. If this is true, only the properties in `selectedFields` will be included. - FieldSelectionEnabled *bool `json:"fieldSelectionEnabled,omitempty"` // Paths to the fields that will be used as primary key. This field is REQUIRED if `destination_sync_mode` is `*_dedup`. Otherwise it is ignored. PrimaryKey [][]string `json:"primaryKey,omitempty"` + // Alias name to the stream to be used in the destination + AliasName *string `json:"aliasName,omitempty"` // If this is true, the stream is selected with all of its properties. For new connections, this considers if the stream is suggested or not Selected *bool `json:"selected,omitempty"` + // Does the connector suggest that this stream be enabled by default? + Suggested *bool `json:"suggested,omitempty"` + // Whether field selection should be enabled. If this is true, only the properties in `selectedFields` will be included. + FieldSelectionEnabled *bool `json:"fieldSelectionEnabled,omitempty"` // Paths to the fields that will be included in the configured catalog. This must be set if `fieldSelectedEnabled` is set. An empty list indicates that no properties will be included. SelectedFields []SelectedFieldInfo `json:"selectedFields,omitempty"` - // Does the connector suggest that this stream be enabled by default? - Suggested *bool `json:"suggested,omitempty"` - SyncMode SyncMode `json:"syncMode"` +} + +func (o *AirbyteStreamConfiguration) GetSyncMode() SyncMode { + if o == nil { + return SyncMode("") + } + return o.SyncMode +} + +func (o *AirbyteStreamConfiguration) GetCursorField() []string { + if o == nil { + return nil + } + return o.CursorField +} + +func (o *AirbyteStreamConfiguration) GetDestinationSyncMode() DestinationSyncMode { + if o == nil { + return DestinationSyncMode("") + } + return o.DestinationSyncMode +} + +func (o *AirbyteStreamConfiguration) GetPrimaryKey() [][]string { + if o == nil { + return nil + } + return o.PrimaryKey +} + +func (o *AirbyteStreamConfiguration) GetAliasName() *string { + if o == nil { + return nil + } + return o.AliasName +} + +func (o *AirbyteStreamConfiguration) GetSelected() *bool { + if o == nil { + return nil + } + return o.Selected +} + +func (o *AirbyteStreamConfiguration) GetSuggested() *bool { + if o == nil { + return nil + } + return o.Suggested +} + +func (o *AirbyteStreamConfiguration) GetFieldSelectionEnabled() *bool { + if o == nil { + return nil + } + return o.FieldSelectionEnabled +} + +func (o *AirbyteStreamConfiguration) GetSelectedFields() []SelectedFieldInfo { + if o == nil { + return nil + } + return o.SelectedFields } diff --git a/internal/sdk/pkg/models/shared/attemptfailuresummary.go b/internal/sdk/pkg/models/shared/attemptfailuresummary.go old mode 100755 new mode 100644 index 9c3cdfa..9f2bdda --- a/internal/sdk/pkg/models/shared/attemptfailuresummary.go +++ b/internal/sdk/pkg/models/shared/attemptfailuresummary.go @@ -7,3 +7,17 @@ type AttemptFailureSummary struct { // True if the number of committed records for this attempt was greater than 0. False if 0 records were committed. If not set, the number of committed records is unknown. PartialSuccess *bool `json:"partialSuccess,omitempty"` } + +func (o *AttemptFailureSummary) GetFailures() []FailureReason { + if o == nil { + return []FailureReason{} + } + return o.Failures +} + +func (o *AttemptFailureSummary) GetPartialSuccess() *bool { + if o == nil { + return nil + } + return o.PartialSuccess +} diff --git a/internal/sdk/pkg/models/shared/attemptinforead.go b/internal/sdk/pkg/models/shared/attemptinforead.go old mode 100755 new mode 100644 index 05b169b..f6256dc --- a/internal/sdk/pkg/models/shared/attemptinforead.go +++ b/internal/sdk/pkg/models/shared/attemptinforead.go @@ -6,3 +6,17 @@ type AttemptInfoRead struct { Attempt AttemptRead `json:"attempt"` Logs LogRead `json:"logs"` } + +func (o *AttemptInfoRead) GetAttempt() AttemptRead { + if o == nil { + return AttemptRead{} + } + return o.Attempt +} + +func (o *AttemptInfoRead) GetLogs() LogRead { + if o == nil { + return LogRead{} + } + return o.Logs +} diff --git a/internal/sdk/pkg/models/shared/attemptnormalizationstatusread.go b/internal/sdk/pkg/models/shared/attemptnormalizationstatusread.go old mode 100755 new mode 100644 index e5dc141..4d8dfe3 --- a/internal/sdk/pkg/models/shared/attemptnormalizationstatusread.go +++ b/internal/sdk/pkg/models/shared/attemptnormalizationstatusread.go @@ -4,7 +4,35 @@ package shared type AttemptNormalizationStatusRead struct { AttemptNumber *int `json:"attemptNumber,omitempty"` - HasNormalizationFailed *bool `json:"hasNormalizationFailed,omitempty"` HasRecordsCommitted *bool `json:"hasRecordsCommitted,omitempty"` RecordsCommitted *int64 `json:"recordsCommitted,omitempty"` + HasNormalizationFailed *bool `json:"hasNormalizationFailed,omitempty"` +} + +func (o *AttemptNormalizationStatusRead) GetAttemptNumber() *int { + if o == nil { + return nil + } + return o.AttemptNumber +} + +func (o *AttemptNormalizationStatusRead) GetHasRecordsCommitted() *bool { + if o == nil { + return nil + } + return o.HasRecordsCommitted +} + +func (o *AttemptNormalizationStatusRead) GetRecordsCommitted() *int64 { + if o == nil { + return nil + } + return o.RecordsCommitted +} + +func (o *AttemptNormalizationStatusRead) GetHasNormalizationFailed() *bool { + if o == nil { + return nil + } + return o.HasNormalizationFailed } diff --git a/internal/sdk/pkg/models/shared/attemptnormalizationstatusreadlist.go b/internal/sdk/pkg/models/shared/attemptnormalizationstatusreadlist.go old mode 100755 new mode 100644 index e27232a..10cc18f --- a/internal/sdk/pkg/models/shared/attemptnormalizationstatusreadlist.go +++ b/internal/sdk/pkg/models/shared/attemptnormalizationstatusreadlist.go @@ -2,7 +2,13 @@ package shared -// AttemptNormalizationStatusReadList - Successful operation type AttemptNormalizationStatusReadList struct { AttemptNormalizationStatuses []AttemptNormalizationStatusRead `json:"attemptNormalizationStatuses,omitempty"` } + +func (o *AttemptNormalizationStatusReadList) GetAttemptNormalizationStatuses() []AttemptNormalizationStatusRead { + if o == nil { + return nil + } + return o.AttemptNormalizationStatuses +} diff --git a/internal/sdk/pkg/models/shared/attemptread.go b/internal/sdk/pkg/models/shared/attemptread.go old mode 100755 new mode 100644 index d260588..bd4e5d4 --- a/internal/sdk/pkg/models/shared/attemptread.go +++ b/internal/sdk/pkg/models/shared/attemptread.go @@ -3,14 +3,84 @@ package shared type AttemptRead struct { - BytesSynced *int64 `json:"bytesSynced,omitempty"` + ID int64 `json:"id"` + Status AttemptStatus `json:"status"` CreatedAt int64 `json:"createdAt"` + UpdatedAt int64 `json:"updatedAt"` EndedAt *int64 `json:"endedAt,omitempty"` - FailureSummary *AttemptFailureSummary `json:"failureSummary,omitempty"` - ID int64 `json:"id"` + BytesSynced *int64 `json:"bytesSynced,omitempty"` RecordsSynced *int64 `json:"recordsSynced,omitempty"` - Status AttemptStatus `json:"status"` - StreamStats []AttemptStreamStats `json:"streamStats,omitempty"` TotalStats *AttemptStats `json:"totalStats,omitempty"` - UpdatedAt int64 `json:"updatedAt"` + StreamStats []AttemptStreamStats `json:"streamStats,omitempty"` + FailureSummary *AttemptFailureSummary `json:"failureSummary,omitempty"` +} + +func (o *AttemptRead) GetID() int64 { + if o == nil { + return 0 + } + return o.ID +} + +func (o *AttemptRead) GetStatus() AttemptStatus { + if o == nil { + return AttemptStatus("") + } + return o.Status +} + +func (o *AttemptRead) GetCreatedAt() int64 { + if o == nil { + return 0 + } + return o.CreatedAt +} + +func (o *AttemptRead) GetUpdatedAt() int64 { + if o == nil { + return 0 + } + return o.UpdatedAt +} + +func (o *AttemptRead) GetEndedAt() *int64 { + if o == nil { + return nil + } + return o.EndedAt +} + +func (o *AttemptRead) GetBytesSynced() *int64 { + if o == nil { + return nil + } + return o.BytesSynced +} + +func (o *AttemptRead) GetRecordsSynced() *int64 { + if o == nil { + return nil + } + return o.RecordsSynced +} + +func (o *AttemptRead) GetTotalStats() *AttemptStats { + if o == nil { + return nil + } + return o.TotalStats +} + +func (o *AttemptRead) GetStreamStats() []AttemptStreamStats { + if o == nil { + return nil + } + return o.StreamStats +} + +func (o *AttemptRead) GetFailureSummary() *AttemptFailureSummary { + if o == nil { + return nil + } + return o.FailureSummary } diff --git a/internal/sdk/pkg/models/shared/attemptstats.go b/internal/sdk/pkg/models/shared/attemptstats.go old mode 100755 new mode 100644 index ceafcbe..39e08f8 --- a/internal/sdk/pkg/models/shared/attemptstats.go +++ b/internal/sdk/pkg/models/shared/attemptstats.go @@ -3,11 +3,60 @@ package shared type AttemptStats struct { - BytesCommitted *int64 `json:"bytesCommitted,omitempty"` - BytesEmitted *int64 `json:"bytesEmitted,omitempty"` - EstimatedBytes *int64 `json:"estimatedBytes,omitempty"` - EstimatedRecords *int64 `json:"estimatedRecords,omitempty"` - RecordsCommitted *int64 `json:"recordsCommitted,omitempty"` RecordsEmitted *int64 `json:"recordsEmitted,omitempty"` + BytesEmitted *int64 `json:"bytesEmitted,omitempty"` StateMessagesEmitted *int64 `json:"stateMessagesEmitted,omitempty"` + BytesCommitted *int64 `json:"bytesCommitted,omitempty"` + RecordsCommitted *int64 `json:"recordsCommitted,omitempty"` + EstimatedRecords *int64 `json:"estimatedRecords,omitempty"` + EstimatedBytes *int64 `json:"estimatedBytes,omitempty"` +} + +func (o *AttemptStats) GetRecordsEmitted() *int64 { + if o == nil { + return nil + } + return o.RecordsEmitted +} + +func (o *AttemptStats) GetBytesEmitted() *int64 { + if o == nil { + return nil + } + return o.BytesEmitted +} + +func (o *AttemptStats) GetStateMessagesEmitted() *int64 { + if o == nil { + return nil + } + return o.StateMessagesEmitted +} + +func (o *AttemptStats) GetBytesCommitted() *int64 { + if o == nil { + return nil + } + return o.BytesCommitted +} + +func (o *AttemptStats) GetRecordsCommitted() *int64 { + if o == nil { + return nil + } + return o.RecordsCommitted +} + +func (o *AttemptStats) GetEstimatedRecords() *int64 { + if o == nil { + return nil + } + return o.EstimatedRecords +} + +func (o *AttemptStats) GetEstimatedBytes() *int64 { + if o == nil { + return nil + } + return o.EstimatedBytes } diff --git a/internal/sdk/pkg/models/shared/attemptstatus.go b/internal/sdk/pkg/models/shared/attemptstatus.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/attemptstreamstats.go b/internal/sdk/pkg/models/shared/attemptstreamstats.go old mode 100755 new mode 100644 index 49b7878..df5d366 --- a/internal/sdk/pkg/models/shared/attemptstreamstats.go +++ b/internal/sdk/pkg/models/shared/attemptstreamstats.go @@ -3,7 +3,28 @@ package shared type AttemptStreamStats struct { - Stats AttemptStats `json:"stats"` StreamName string `json:"streamName"` StreamNamespace *string `json:"streamNamespace,omitempty"` + Stats AttemptStats `json:"stats"` +} + +func (o *AttemptStreamStats) GetStreamName() string { + if o == nil { + return "" + } + return o.StreamName +} + +func (o *AttemptStreamStats) GetStreamNamespace() *string { + if o == nil { + return nil + } + return o.StreamNamespace +} + +func (o *AttemptStreamStats) GetStats() AttemptStats { + if o == nil { + return AttemptStats{} + } + return o.Stats } diff --git a/internal/sdk/pkg/models/shared/attemptsyncconfig.go b/internal/sdk/pkg/models/shared/attemptsyncconfig.go old mode 100755 new mode 100644 index 1bbc14c..e6a5edd --- a/internal/sdk/pkg/models/shared/attemptsyncconfig.go +++ b/internal/sdk/pkg/models/shared/attemptsyncconfig.go @@ -3,10 +3,31 @@ package shared type AttemptSyncConfig struct { - // The values required to configure the destination. The schema for this must match the schema return by destination_definition_specifications/get for the destinationDefinition. - DestinationConfiguration interface{} `json:"destinationConfiguration"` // The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source. SourceConfiguration interface{} `json:"sourceConfiguration"` + // The values required to configure the destination. The schema for this must match the schema return by destination_definition_specifications/get for the destinationDefinition. + DestinationConfiguration interface{} `json:"destinationConfiguration"` // Contains the state for a connection. The stateType field identifies what type of state it is. Only the field corresponding to that type will be set, the rest will be null. If stateType=not_set, then none of the fields will be set. State *ConnectionState `json:"state,omitempty"` } + +func (o *AttemptSyncConfig) GetSourceConfiguration() interface{} { + if o == nil { + return nil + } + return o.SourceConfiguration +} + +func (o *AttemptSyncConfig) GetDestinationConfiguration() interface{} { + if o == nil { + return nil + } + return o.DestinationConfiguration +} + +func (o *AttemptSyncConfig) GetState() *ConnectionState { + if o == nil { + return nil + } + return o.State +} diff --git a/internal/sdk/pkg/models/shared/catalogdiff.go b/internal/sdk/pkg/models/shared/catalogdiff.go old mode 100755 new mode 100644 index f97fcb3..bea5983 --- a/internal/sdk/pkg/models/shared/catalogdiff.go +++ b/internal/sdk/pkg/models/shared/catalogdiff.go @@ -7,3 +7,10 @@ type CatalogDiff struct { // list of stream transformations. order does not matter. Transforms []StreamTransform `json:"transforms"` } + +func (o *CatalogDiff) GetTransforms() []StreamTransform { + if o == nil { + return []StreamTransform{} + } + return o.Transforms +} diff --git a/internal/sdk/pkg/models/shared/checkconnectionread.go b/internal/sdk/pkg/models/shared/checkconnectionread.go old mode 100755 new mode 100644 index fdbc561..c47ef0a --- a/internal/sdk/pkg/models/shared/checkconnectionread.go +++ b/internal/sdk/pkg/models/shared/checkconnectionread.go @@ -34,9 +34,29 @@ func (e *CheckConnectionReadStatus) UnmarshalJSON(data []byte) error { } } -// CheckConnectionRead - Successful operation type CheckConnectionRead struct { - JobInfo SynchronousJobRead `json:"jobInfo"` - Message *string `json:"message,omitempty"` Status *CheckConnectionReadStatus `json:"status,omitempty"` + Message *string `json:"message,omitempty"` + JobInfo SynchronousJobRead `json:"jobInfo"` +} + +func (o *CheckConnectionRead) GetStatus() *CheckConnectionReadStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *CheckConnectionRead) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *CheckConnectionRead) GetJobInfo() SynchronousJobRead { + if o == nil { + return SynchronousJobRead{} + } + return o.JobInfo } diff --git a/internal/sdk/pkg/models/shared/checkoperationread.go b/internal/sdk/pkg/models/shared/checkoperationread.go old mode 100755 new mode 100644 index 1a8edc2..b76338f --- a/internal/sdk/pkg/models/shared/checkoperationread.go +++ b/internal/sdk/pkg/models/shared/checkoperationread.go @@ -34,8 +34,21 @@ func (e *CheckOperationReadStatus) UnmarshalJSON(data []byte) error { } } -// CheckOperationRead - Successful operation type CheckOperationRead struct { - Message *string `json:"message,omitempty"` Status CheckOperationReadStatus `json:"status"` + Message *string `json:"message,omitempty"` +} + +func (o *CheckOperationRead) GetStatus() CheckOperationReadStatus { + if o == nil { + return CheckOperationReadStatus("") + } + return o.Status +} + +func (o *CheckOperationRead) GetMessage() *string { + if o == nil { + return nil + } + return o.Message } diff --git a/internal/sdk/pkg/models/shared/completedestinationoauthrequest.go b/internal/sdk/pkg/models/shared/completedestinationoauthrequest.go old mode 100755 new mode 100644 index 4ef8572..5168816 --- a/internal/sdk/pkg/models/shared/completedestinationoauthrequest.go +++ b/internal/sdk/pkg/models/shared/completedestinationoauthrequest.go @@ -3,13 +3,55 @@ package shared type CompleteDestinationOAuthRequest struct { - DestinationDefinitionID string `json:"destinationDefinitionId"` - DestinationID *string `json:"destinationId,omitempty"` - // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. - OAuthInputConfiguration interface{} `json:"oAuthInputConfiguration,omitempty"` - // The query parameters present in the redirect URL after a user granted consent e.g auth code - QueryParams map[string]interface{} `json:"queryParams,omitempty"` + DestinationDefinitionID string `json:"destinationDefinitionId"` + WorkspaceID string `json:"workspaceId"` // When completing OAuth flow to gain an access token, some API sometimes requires to verify that the app re-send the redirectUrl that was used when consent was given. RedirectURL *string `json:"redirectUrl,omitempty"` - WorkspaceID string `json:"workspaceId"` + // The query parameters present in the redirect URL after a user granted consent e.g auth code + QueryParams map[string]interface{} `json:"queryParams,omitempty"` + // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. + OAuthInputConfiguration interface{} `json:"oAuthInputConfiguration,omitempty"` + DestinationID *string `json:"destinationId,omitempty"` +} + +func (o *CompleteDestinationOAuthRequest) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *CompleteDestinationOAuthRequest) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *CompleteDestinationOAuthRequest) GetRedirectURL() *string { + if o == nil { + return nil + } + return o.RedirectURL +} + +func (o *CompleteDestinationOAuthRequest) GetQueryParams() map[string]interface{} { + if o == nil { + return nil + } + return o.QueryParams +} + +func (o *CompleteDestinationOAuthRequest) GetOAuthInputConfiguration() interface{} { + if o == nil { + return nil + } + return o.OAuthInputConfiguration +} + +func (o *CompleteDestinationOAuthRequest) GetDestinationID() *string { + if o == nil { + return nil + } + return o.DestinationID } diff --git a/internal/sdk/pkg/models/shared/completeoauthresponse.go b/internal/sdk/pkg/models/shared/completeoauthresponse.go old mode 100755 new mode 100644 index c632c87..3d55799 --- a/internal/sdk/pkg/models/shared/completeoauthresponse.go +++ b/internal/sdk/pkg/models/shared/completeoauthresponse.go @@ -2,9 +2,29 @@ package shared -// CompleteOAuthResponse - Successful operation type CompleteOAuthResponse struct { - AuthPayload map[string]interface{} `json:"auth_payload"` - RequestError *string `json:"request_error,omitempty"` RequestSucceeded bool `json:"request_succeeded"` + RequestError *string `json:"request_error,omitempty"` + AuthPayload map[string]interface{} `json:"auth_payload"` +} + +func (o *CompleteOAuthResponse) GetRequestSucceeded() bool { + if o == nil { + return false + } + return o.RequestSucceeded +} + +func (o *CompleteOAuthResponse) GetRequestError() *string { + if o == nil { + return nil + } + return o.RequestError +} + +func (o *CompleteOAuthResponse) GetAuthPayload() map[string]interface{} { + if o == nil { + return map[string]interface{}{} + } + return o.AuthPayload } diff --git a/internal/sdk/pkg/models/shared/completesourceoauthrequest.go b/internal/sdk/pkg/models/shared/completesourceoauthrequest.go old mode 100755 new mode 100644 index 0fa5af8..2db7ae9 --- a/internal/sdk/pkg/models/shared/completesourceoauthrequest.go +++ b/internal/sdk/pkg/models/shared/completesourceoauthrequest.go @@ -2,16 +2,80 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type CompleteSourceOauthRequest struct { - // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. - OAuthInputConfiguration interface{} `json:"oAuthInputConfiguration,omitempty"` - // The query parameters present in the redirect URL after a user granted consent e.g auth code - QueryParams map[string]interface{} `json:"queryParams,omitempty"` + SourceDefinitionID string `json:"sourceDefinitionId"` + WorkspaceID string `json:"workspaceId"` // When completing OAuth flow to gain an access token, some API sometimes requires to verify that the app re-send the redirectUrl that was used when consent was given. RedirectURL *string `json:"redirectUrl,omitempty"` + // The query parameters present in the redirect URL after a user granted consent e.g auth code + QueryParams map[string]interface{} `json:"queryParams,omitempty"` + // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. + OAuthInputConfiguration interface{} `json:"oAuthInputConfiguration,omitempty"` // If set to true, returns a secret coordinate which references the stored tokens. By default, returns raw tokens. - ReturnSecretCoordinate *bool `json:"returnSecretCoordinate,omitempty"` - SourceDefinitionID string `json:"sourceDefinitionId"` + ReturnSecretCoordinate *bool `default:"false" json:"returnSecretCoordinate"` SourceID *string `json:"sourceId,omitempty"` - WorkspaceID string `json:"workspaceId"` +} + +func (c CompleteSourceOauthRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CompleteSourceOauthRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CompleteSourceOauthRequest) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *CompleteSourceOauthRequest) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *CompleteSourceOauthRequest) GetRedirectURL() *string { + if o == nil { + return nil + } + return o.RedirectURL +} + +func (o *CompleteSourceOauthRequest) GetQueryParams() map[string]interface{} { + if o == nil { + return nil + } + return o.QueryParams +} + +func (o *CompleteSourceOauthRequest) GetOAuthInputConfiguration() interface{} { + if o == nil { + return nil + } + return o.OAuthInputConfiguration +} + +func (o *CompleteSourceOauthRequest) GetReturnSecretCoordinate() *bool { + if o == nil { + return nil + } + return o.ReturnSecretCoordinate +} + +func (o *CompleteSourceOauthRequest) GetSourceID() *string { + if o == nil { + return nil + } + return o.SourceID } diff --git a/internal/sdk/pkg/models/shared/connectioncreate.go b/internal/sdk/pkg/models/shared/connectioncreate.go old mode 100755 new mode 100644 index d601332..27249d2 --- a/internal/sdk/pkg/models/shared/connectioncreate.go +++ b/internal/sdk/pkg/models/shared/connectioncreate.go @@ -2,33 +2,174 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type ConnectionCreate struct { - DestinationID string `json:"destinationId"` - Geography *Geography `json:"geography,omitempty"` // Optional name of the connection Name *string `json:"name,omitempty"` // Method used for computing final namespace in destination NamespaceDefinition *NamespaceDefinitionType `json:"namespaceDefinition,omitempty"` // Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'. - NamespaceFormat *string `json:"namespaceFormat,omitempty"` - NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` - NotifySchemaChanges *bool `json:"notifySchemaChanges,omitempty"` - NotifySchemaChangesByEmail *bool `json:"notifySchemaChangesByEmail,omitempty"` - OperationIds []string `json:"operationIds,omitempty"` + NamespaceFormat *string `default:"null" json:"namespaceFormat"` // Prefix that will be prepended to the name of each stream when it is written to the destination. - Prefix *string `json:"prefix,omitempty"` - // optional resource requirements to run workers (blank for unbounded allocations) - ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + Prefix *string `json:"prefix,omitempty"` + SourceID string `json:"sourceId"` + DestinationID string `json:"destinationId"` + OperationIds []string `json:"operationIds,omitempty"` + // describes the available schema (catalog). + SyncCatalog *AirbyteCatalog `json:"syncCatalog,omitempty"` // if null, then no schedule is set. Schedule *ConnectionSchedule `json:"schedule,omitempty"` + // determine how the schedule data should be interpreted + ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` // schedule for when the the connection should run, per the schedule type ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` - // determine how the schedule data should be interpreted - ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` - SourceCatalogID *string `json:"sourceCatalogId,omitempty"` - SourceID string `json:"sourceId"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. Status ConnectionStatus `json:"status"` - // describes the available schema (catalog). - SyncCatalog *AirbyteCatalog `json:"syncCatalog,omitempty"` + // optional resource requirements to run workers (blank for unbounded allocations) + ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + SourceCatalogID *string `json:"sourceCatalogId,omitempty"` + Geography *Geography `json:"geography,omitempty"` + NotifySchemaChanges *bool `json:"notifySchemaChanges,omitempty"` + NotifySchemaChangesByEmail *bool `json:"notifySchemaChangesByEmail,omitempty"` + NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` +} + +func (c ConnectionCreate) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ConnectionCreate) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ConnectionCreate) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *ConnectionCreate) GetNamespaceDefinition() *NamespaceDefinitionType { + if o == nil { + return nil + } + return o.NamespaceDefinition +} + +func (o *ConnectionCreate) GetNamespaceFormat() *string { + if o == nil { + return nil + } + return o.NamespaceFormat +} + +func (o *ConnectionCreate) GetPrefix() *string { + if o == nil { + return nil + } + return o.Prefix +} + +func (o *ConnectionCreate) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *ConnectionCreate) GetDestinationID() string { + if o == nil { + return "" + } + return o.DestinationID +} + +func (o *ConnectionCreate) GetOperationIds() []string { + if o == nil { + return nil + } + return o.OperationIds +} + +func (o *ConnectionCreate) GetSyncCatalog() *AirbyteCatalog { + if o == nil { + return nil + } + return o.SyncCatalog +} + +func (o *ConnectionCreate) GetSchedule() *ConnectionSchedule { + if o == nil { + return nil + } + return o.Schedule +} + +func (o *ConnectionCreate) GetScheduleType() *ConnectionScheduleType { + if o == nil { + return nil + } + return o.ScheduleType +} + +func (o *ConnectionCreate) GetScheduleData() *ConnectionScheduleData { + if o == nil { + return nil + } + return o.ScheduleData +} + +func (o *ConnectionCreate) GetStatus() ConnectionStatus { + if o == nil { + return ConnectionStatus("") + } + return o.Status +} + +func (o *ConnectionCreate) GetResourceRequirements() *ResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} + +func (o *ConnectionCreate) GetSourceCatalogID() *string { + if o == nil { + return nil + } + return o.SourceCatalogID +} + +func (o *ConnectionCreate) GetGeography() *Geography { + if o == nil { + return nil + } + return o.Geography +} + +func (o *ConnectionCreate) GetNotifySchemaChanges() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChanges +} + +func (o *ConnectionCreate) GetNotifySchemaChangesByEmail() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChangesByEmail +} + +func (o *ConnectionCreate) GetNonBreakingChangesPreference() *NonBreakingChangesPreference { + if o == nil { + return nil + } + return o.NonBreakingChangesPreference } diff --git a/internal/sdk/pkg/models/shared/connectionidrequestbody.go b/internal/sdk/pkg/models/shared/connectionidrequestbody.go old mode 100755 new mode 100644 index b09e671..6951ed2 --- a/internal/sdk/pkg/models/shared/connectionidrequestbody.go +++ b/internal/sdk/pkg/models/shared/connectionidrequestbody.go @@ -5,3 +5,10 @@ package shared type ConnectionIDRequestBody struct { ConnectionID string `json:"connectionId"` } + +func (o *ConnectionIDRequestBody) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} diff --git a/internal/sdk/pkg/models/shared/connectionread.go b/internal/sdk/pkg/models/shared/connectionread.go old mode 100755 new mode 100644 index 08fadb6..239697f --- a/internal/sdk/pkg/models/shared/connectionread.go +++ b/internal/sdk/pkg/models/shared/connectionread.go @@ -2,36 +2,197 @@ package shared -// ConnectionRead - Successful operation +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type ConnectionRead struct { - BreakingChange bool `json:"breakingChange"` - ConnectionID string `json:"connectionId"` - DestinationID string `json:"destinationId"` - Geography *Geography `json:"geography,omitempty"` - Name string `json:"name"` + ConnectionID string `json:"connectionId"` + Name string `json:"name"` // Method used for computing final namespace in destination NamespaceDefinition *NamespaceDefinitionType `json:"namespaceDefinition,omitempty"` // Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'. - NamespaceFormat *string `json:"namespaceFormat,omitempty"` - NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` - NotifySchemaChanges *bool `json:"notifySchemaChanges,omitempty"` - NotifySchemaChangesByEmail *bool `json:"notifySchemaChangesByEmail,omitempty"` - OperationIds []string `json:"operationIds,omitempty"` + NamespaceFormat *string `default:"null" json:"namespaceFormat"` // Prefix that will be prepended to the name of each stream when it is written to the destination. - Prefix *string `json:"prefix,omitempty"` - // optional resource requirements to run workers (blank for unbounded allocations) - ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + Prefix *string `json:"prefix,omitempty"` + SourceID string `json:"sourceId"` + DestinationID string `json:"destinationId"` + OperationIds []string `json:"operationIds,omitempty"` + // describes the available schema (catalog). + SyncCatalog AirbyteCatalog `json:"syncCatalog"` // if null, then no schedule is set. Schedule *ConnectionSchedule `json:"schedule,omitempty"` + // determine how the schedule data should be interpreted + ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` // schedule for when the the connection should run, per the schedule type ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` - // determine how the schedule data should be interpreted - ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` - SourceCatalogID *string `json:"sourceCatalogId,omitempty"` - SourceID string `json:"sourceId"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. Status ConnectionStatus `json:"status"` - // describes the available schema (catalog). - SyncCatalog AirbyteCatalog `json:"syncCatalog"` - WorkspaceID *string `json:"workspaceId,omitempty"` + // optional resource requirements to run workers (blank for unbounded allocations) + ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + SourceCatalogID *string `json:"sourceCatalogId,omitempty"` + Geography *Geography `json:"geography,omitempty"` + BreakingChange bool `json:"breakingChange"` + NotifySchemaChanges *bool `json:"notifySchemaChanges,omitempty"` + NotifySchemaChangesByEmail *bool `json:"notifySchemaChangesByEmail,omitempty"` + NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` + WorkspaceID *string `json:"workspaceId,omitempty"` +} + +func (c ConnectionRead) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ConnectionRead) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ConnectionRead) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *ConnectionRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ConnectionRead) GetNamespaceDefinition() *NamespaceDefinitionType { + if o == nil { + return nil + } + return o.NamespaceDefinition +} + +func (o *ConnectionRead) GetNamespaceFormat() *string { + if o == nil { + return nil + } + return o.NamespaceFormat +} + +func (o *ConnectionRead) GetPrefix() *string { + if o == nil { + return nil + } + return o.Prefix +} + +func (o *ConnectionRead) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *ConnectionRead) GetDestinationID() string { + if o == nil { + return "" + } + return o.DestinationID +} + +func (o *ConnectionRead) GetOperationIds() []string { + if o == nil { + return nil + } + return o.OperationIds +} + +func (o *ConnectionRead) GetSyncCatalog() AirbyteCatalog { + if o == nil { + return AirbyteCatalog{} + } + return o.SyncCatalog +} + +func (o *ConnectionRead) GetSchedule() *ConnectionSchedule { + if o == nil { + return nil + } + return o.Schedule +} + +func (o *ConnectionRead) GetScheduleType() *ConnectionScheduleType { + if o == nil { + return nil + } + return o.ScheduleType +} + +func (o *ConnectionRead) GetScheduleData() *ConnectionScheduleData { + if o == nil { + return nil + } + return o.ScheduleData +} + +func (o *ConnectionRead) GetStatus() ConnectionStatus { + if o == nil { + return ConnectionStatus("") + } + return o.Status +} + +func (o *ConnectionRead) GetResourceRequirements() *ResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} + +func (o *ConnectionRead) GetSourceCatalogID() *string { + if o == nil { + return nil + } + return o.SourceCatalogID +} + +func (o *ConnectionRead) GetGeography() *Geography { + if o == nil { + return nil + } + return o.Geography +} + +func (o *ConnectionRead) GetBreakingChange() bool { + if o == nil { + return false + } + return o.BreakingChange +} + +func (o *ConnectionRead) GetNotifySchemaChanges() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChanges +} + +func (o *ConnectionRead) GetNotifySchemaChangesByEmail() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChangesByEmail +} + +func (o *ConnectionRead) GetNonBreakingChangesPreference() *NonBreakingChangesPreference { + if o == nil { + return nil + } + return o.NonBreakingChangesPreference +} + +func (o *ConnectionRead) GetWorkspaceID() *string { + if o == nil { + return nil + } + return o.WorkspaceID } diff --git a/internal/sdk/pkg/models/shared/connectionreadlist.go b/internal/sdk/pkg/models/shared/connectionreadlist.go old mode 100755 new mode 100644 index 9822468..435cb7d --- a/internal/sdk/pkg/models/shared/connectionreadlist.go +++ b/internal/sdk/pkg/models/shared/connectionreadlist.go @@ -2,7 +2,13 @@ package shared -// ConnectionReadList - Successful operation type ConnectionReadList struct { Connections []ConnectionRead `json:"connections"` } + +func (o *ConnectionReadList) GetConnections() []ConnectionRead { + if o == nil { + return []ConnectionRead{} + } + return o.Connections +} diff --git a/internal/sdk/pkg/models/shared/connectionschedule.go b/internal/sdk/pkg/models/shared/connectionschedule.go old mode 100755 new mode 100644 index fe56df1..23ce536 --- a/internal/sdk/pkg/models/shared/connectionschedule.go +++ b/internal/sdk/pkg/models/shared/connectionschedule.go @@ -7,21 +7,21 @@ import ( "fmt" ) -type ConnectionScheduleTimeUnit string +type TimeUnit string const ( - ConnectionScheduleTimeUnitMinutes ConnectionScheduleTimeUnit = "minutes" - ConnectionScheduleTimeUnitHours ConnectionScheduleTimeUnit = "hours" - ConnectionScheduleTimeUnitDays ConnectionScheduleTimeUnit = "days" - ConnectionScheduleTimeUnitWeeks ConnectionScheduleTimeUnit = "weeks" - ConnectionScheduleTimeUnitMonths ConnectionScheduleTimeUnit = "months" + TimeUnitMinutes TimeUnit = "minutes" + TimeUnitHours TimeUnit = "hours" + TimeUnitDays TimeUnit = "days" + TimeUnitWeeks TimeUnit = "weeks" + TimeUnitMonths TimeUnit = "months" ) -func (e ConnectionScheduleTimeUnit) ToPointer() *ConnectionScheduleTimeUnit { +func (e TimeUnit) ToPointer() *TimeUnit { return &e } -func (e *ConnectionScheduleTimeUnit) UnmarshalJSON(data []byte) error { +func (e *TimeUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -36,15 +36,29 @@ func (e *ConnectionScheduleTimeUnit) UnmarshalJSON(data []byte) error { case "weeks": fallthrough case "months": - *e = ConnectionScheduleTimeUnit(v) + *e = TimeUnit(v) return nil default: - return fmt.Errorf("invalid value for ConnectionScheduleTimeUnit: %v", v) + return fmt.Errorf("invalid value for TimeUnit: %v", v) } } // ConnectionSchedule - if null, then no schedule is set. type ConnectionSchedule struct { - TimeUnit ConnectionScheduleTimeUnit `json:"timeUnit"` - Units int64 `json:"units"` + Units int64 `json:"units"` + TimeUnit TimeUnit `json:"timeUnit"` +} + +func (o *ConnectionSchedule) GetUnits() int64 { + if o == nil { + return 0 + } + return o.Units +} + +func (o *ConnectionSchedule) GetTimeUnit() TimeUnit { + if o == nil { + return TimeUnit("") + } + return o.TimeUnit } diff --git a/internal/sdk/pkg/models/shared/connectionscheduledata.go b/internal/sdk/pkg/models/shared/connectionscheduledata.go old mode 100755 new mode 100644 index 1247df7..c34f8ca --- a/internal/sdk/pkg/models/shared/connectionscheduledata.go +++ b/internal/sdk/pkg/models/shared/connectionscheduledata.go @@ -7,21 +7,21 @@ import ( "fmt" ) -type ConnectionScheduleDataBasicScheduleTimeUnit string +type ConnectionScheduleDataTimeUnit string const ( - ConnectionScheduleDataBasicScheduleTimeUnitMinutes ConnectionScheduleDataBasicScheduleTimeUnit = "minutes" - ConnectionScheduleDataBasicScheduleTimeUnitHours ConnectionScheduleDataBasicScheduleTimeUnit = "hours" - ConnectionScheduleDataBasicScheduleTimeUnitDays ConnectionScheduleDataBasicScheduleTimeUnit = "days" - ConnectionScheduleDataBasicScheduleTimeUnitWeeks ConnectionScheduleDataBasicScheduleTimeUnit = "weeks" - ConnectionScheduleDataBasicScheduleTimeUnitMonths ConnectionScheduleDataBasicScheduleTimeUnit = "months" + ConnectionScheduleDataTimeUnitMinutes ConnectionScheduleDataTimeUnit = "minutes" + ConnectionScheduleDataTimeUnitHours ConnectionScheduleDataTimeUnit = "hours" + ConnectionScheduleDataTimeUnitDays ConnectionScheduleDataTimeUnit = "days" + ConnectionScheduleDataTimeUnitWeeks ConnectionScheduleDataTimeUnit = "weeks" + ConnectionScheduleDataTimeUnitMonths ConnectionScheduleDataTimeUnit = "months" ) -func (e ConnectionScheduleDataBasicScheduleTimeUnit) ToPointer() *ConnectionScheduleDataBasicScheduleTimeUnit { +func (e ConnectionScheduleDataTimeUnit) ToPointer() *ConnectionScheduleDataTimeUnit { return &e } -func (e *ConnectionScheduleDataBasicScheduleTimeUnit) UnmarshalJSON(data []byte) error { +func (e *ConnectionScheduleDataTimeUnit) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -36,25 +36,67 @@ func (e *ConnectionScheduleDataBasicScheduleTimeUnit) UnmarshalJSON(data []byte) case "weeks": fallthrough case "months": - *e = ConnectionScheduleDataBasicScheduleTimeUnit(v) + *e = ConnectionScheduleDataTimeUnit(v) return nil default: - return fmt.Errorf("invalid value for ConnectionScheduleDataBasicScheduleTimeUnit: %v", v) + return fmt.Errorf("invalid value for ConnectionScheduleDataTimeUnit: %v", v) } } -type ConnectionScheduleDataBasicSchedule struct { - TimeUnit ConnectionScheduleDataBasicScheduleTimeUnit `json:"timeUnit"` - Units int64 `json:"units"` +type BasicSchedule struct { + TimeUnit ConnectionScheduleDataTimeUnit `json:"timeUnit"` + Units int64 `json:"units"` } -type ConnectionScheduleDataCron struct { +func (o *BasicSchedule) GetTimeUnit() ConnectionScheduleDataTimeUnit { + if o == nil { + return ConnectionScheduleDataTimeUnit("") + } + return o.TimeUnit +} + +func (o *BasicSchedule) GetUnits() int64 { + if o == nil { + return 0 + } + return o.Units +} + +type Cron struct { CronExpression string `json:"cronExpression"` CronTimeZone string `json:"cronTimeZone"` } +func (o *Cron) GetCronExpression() string { + if o == nil { + return "" + } + return o.CronExpression +} + +func (o *Cron) GetCronTimeZone() string { + if o == nil { + return "" + } + return o.CronTimeZone +} + // ConnectionScheduleData - schedule for when the the connection should run, per the schedule type type ConnectionScheduleData struct { - BasicSchedule *ConnectionScheduleDataBasicSchedule `json:"basicSchedule,omitempty"` - Cron *ConnectionScheduleDataCron `json:"cron,omitempty"` + BasicSchedule *BasicSchedule `json:"basicSchedule,omitempty"` + Cron *Cron `json:"cron,omitempty"` +} + +func (o *ConnectionScheduleData) GetBasicSchedule() *BasicSchedule { + if o == nil { + return nil + } + return o.BasicSchedule +} + +func (o *ConnectionScheduleData) GetCron() *Cron { + if o == nil { + return nil + } + return o.Cron } diff --git a/internal/sdk/pkg/models/shared/connectionscheduletype.go b/internal/sdk/pkg/models/shared/connectionscheduletype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/connectionsearch.go b/internal/sdk/pkg/models/shared/connectionsearch.go old mode 100755 new mode 100644 index a66ed74..15ff92b --- a/internal/sdk/pkg/models/shared/connectionsearch.go +++ b/internal/sdk/pkg/models/shared/connectionsearch.go @@ -2,25 +2,131 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type ConnectionSearch struct { - ConnectionID *string `json:"connectionId,omitempty"` - Destination *DestinationSearch `json:"destination,omitempty"` - DestinationID *string `json:"destinationId,omitempty"` - Name *string `json:"name,omitempty"` + ConnectionID *string `json:"connectionId,omitempty"` + Name *string `json:"name,omitempty"` // Method used for computing final namespace in destination NamespaceDefinition *NamespaceDefinitionType `json:"namespaceDefinition,omitempty"` // Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'. - NamespaceFormat *string `json:"namespaceFormat,omitempty"` + NamespaceFormat *string `default:"null" json:"namespaceFormat"` // Prefix that will be prepended to the name of each stream when it is written to the destination. - Prefix *string `json:"prefix,omitempty"` + Prefix *string `json:"prefix,omitempty"` + SourceID *string `json:"sourceId,omitempty"` + DestinationID *string `json:"destinationId,omitempty"` // if null, then no schedule is set. Schedule *ConnectionSchedule `json:"schedule,omitempty"` - // schedule for when the the connection should run, per the schedule type - ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` // determine how the schedule data should be interpreted ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` - Source *SourceSearch `json:"source,omitempty"` - SourceID *string `json:"sourceId,omitempty"` + // schedule for when the the connection should run, per the schedule type + ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. - Status *ConnectionStatus `json:"status,omitempty"` + Status *ConnectionStatus `json:"status,omitempty"` + Source *SourceSearch `json:"source,omitempty"` + Destination *DestinationSearch `json:"destination,omitempty"` +} + +func (c ConnectionSearch) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ConnectionSearch) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ConnectionSearch) GetConnectionID() *string { + if o == nil { + return nil + } + return o.ConnectionID +} + +func (o *ConnectionSearch) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *ConnectionSearch) GetNamespaceDefinition() *NamespaceDefinitionType { + if o == nil { + return nil + } + return o.NamespaceDefinition +} + +func (o *ConnectionSearch) GetNamespaceFormat() *string { + if o == nil { + return nil + } + return o.NamespaceFormat +} + +func (o *ConnectionSearch) GetPrefix() *string { + if o == nil { + return nil + } + return o.Prefix +} + +func (o *ConnectionSearch) GetSourceID() *string { + if o == nil { + return nil + } + return o.SourceID +} + +func (o *ConnectionSearch) GetDestinationID() *string { + if o == nil { + return nil + } + return o.DestinationID +} + +func (o *ConnectionSearch) GetSchedule() *ConnectionSchedule { + if o == nil { + return nil + } + return o.Schedule +} + +func (o *ConnectionSearch) GetScheduleType() *ConnectionScheduleType { + if o == nil { + return nil + } + return o.ScheduleType +} + +func (o *ConnectionSearch) GetScheduleData() *ConnectionScheduleData { + if o == nil { + return nil + } + return o.ScheduleData +} + +func (o *ConnectionSearch) GetStatus() *ConnectionStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *ConnectionSearch) GetSource() *SourceSearch { + if o == nil { + return nil + } + return o.Source +} + +func (o *ConnectionSearch) GetDestination() *DestinationSearch { + if o == nil { + return nil + } + return o.Destination } diff --git a/internal/sdk/pkg/models/shared/connectionstate.go b/internal/sdk/pkg/models/shared/connectionstate.go old mode 100755 new mode 100644 index 45eae6c..0d55efc --- a/internal/sdk/pkg/models/shared/connectionstate.go +++ b/internal/sdk/pkg/models/shared/connectionstate.go @@ -4,9 +4,44 @@ package shared // ConnectionState - Contains the state for a connection. The stateType field identifies what type of state it is. Only the field corresponding to that type will be set, the rest will be null. If stateType=not_set, then none of the fields will be set. type ConnectionState struct { + StateType ConnectionStateType `json:"stateType"` ConnectionID string `json:"connectionId"` - GlobalState *GlobalState `json:"globalState,omitempty"` State *StateBlob `json:"state,omitempty"` - StateType ConnectionStateType `json:"stateType"` StreamState []StreamState `json:"streamState,omitempty"` + GlobalState *GlobalState `json:"globalState,omitempty"` +} + +func (o *ConnectionState) GetStateType() ConnectionStateType { + if o == nil { + return ConnectionStateType("") + } + return o.StateType +} + +func (o *ConnectionState) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *ConnectionState) GetState() *StateBlob { + if o == nil { + return nil + } + return o.State +} + +func (o *ConnectionState) GetStreamState() []StreamState { + if o == nil { + return nil + } + return o.StreamState +} + +func (o *ConnectionState) GetGlobalState() *GlobalState { + if o == nil { + return nil + } + return o.GlobalState } diff --git a/internal/sdk/pkg/models/shared/connectionstatecreateorupdate.go b/internal/sdk/pkg/models/shared/connectionstatecreateorupdate.go old mode 100755 new mode 100644 index 5eb903a..2a85f47 --- a/internal/sdk/pkg/models/shared/connectionstatecreateorupdate.go +++ b/internal/sdk/pkg/models/shared/connectionstatecreateorupdate.go @@ -7,3 +7,17 @@ type ConnectionStateCreateOrUpdate struct { // Contains the state for a connection. The stateType field identifies what type of state it is. Only the field corresponding to that type will be set, the rest will be null. If stateType=not_set, then none of the fields will be set. ConnectionState ConnectionState `json:"connectionState"` } + +func (o *ConnectionStateCreateOrUpdate) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *ConnectionStateCreateOrUpdate) GetConnectionState() ConnectionState { + if o == nil { + return ConnectionState{} + } + return o.ConnectionState +} diff --git a/internal/sdk/pkg/models/shared/connectionstatetype.go b/internal/sdk/pkg/models/shared/connectionstatetype.go old mode 100755 new mode 100644 index 1b519c3..9136631 --- a/internal/sdk/pkg/models/shared/connectionstatetype.go +++ b/internal/sdk/pkg/models/shared/connectionstatetype.go @@ -7,7 +7,6 @@ import ( "fmt" ) -// ConnectionStateType - Successful operation type ConnectionStateType string const ( diff --git a/internal/sdk/pkg/models/shared/connectionstatus.go b/internal/sdk/pkg/models/shared/connectionstatus.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/connectionstream.go b/internal/sdk/pkg/models/shared/connectionstream.go old mode 100755 new mode 100644 index 8226e1a..a840223 --- a/internal/sdk/pkg/models/shared/connectionstream.go +++ b/internal/sdk/pkg/models/shared/connectionstream.go @@ -6,3 +6,17 @@ type ConnectionStream struct { StreamName string `json:"streamName"` StreamNamespace string `json:"streamNamespace"` } + +func (o *ConnectionStream) GetStreamName() string { + if o == nil { + return "" + } + return o.StreamName +} + +func (o *ConnectionStream) GetStreamNamespace() string { + if o == nil { + return "" + } + return o.StreamNamespace +} diff --git a/internal/sdk/pkg/models/shared/connectionstreamrequestbody.go b/internal/sdk/pkg/models/shared/connectionstreamrequestbody.go old mode 100755 new mode 100644 index c6bdb8a..8defa29 --- a/internal/sdk/pkg/models/shared/connectionstreamrequestbody.go +++ b/internal/sdk/pkg/models/shared/connectionstreamrequestbody.go @@ -6,3 +6,17 @@ type ConnectionStreamRequestBody struct { ConnectionID string `json:"connectionId"` Streams []ConnectionStream `json:"streams"` } + +func (o *ConnectionStreamRequestBody) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *ConnectionStreamRequestBody) GetStreams() []ConnectionStream { + if o == nil { + return []ConnectionStream{} + } + return o.Streams +} diff --git a/internal/sdk/pkg/models/shared/connectionupdate.go b/internal/sdk/pkg/models/shared/connectionupdate.go old mode 100755 new mode 100644 index a3eb576..759df10 --- a/internal/sdk/pkg/models/shared/connectionupdate.go +++ b/internal/sdk/pkg/models/shared/connectionupdate.go @@ -2,34 +2,175 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + // ConnectionUpdate - Used to apply a patch-style update to a connection, which means that null properties remain unchanged type ConnectionUpdate struct { - BreakingChange *bool `json:"breakingChange,omitempty"` - ConnectionID string `json:"connectionId"` - Geography *Geography `json:"geography,omitempty"` - // Name that will be set to this connection - Name *string `json:"name,omitempty"` + ConnectionID string `json:"connectionId"` // Method used for computing final namespace in destination NamespaceDefinition *NamespaceDefinitionType `json:"namespaceDefinition,omitempty"` // Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'. - NamespaceFormat *string `json:"namespaceFormat,omitempty"` - NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` - NotifySchemaChanges *bool `json:"notifySchemaChanges,omitempty"` - NotifySchemaChangesByEmail *bool `json:"notifySchemaChangesByEmail,omitempty"` - OperationIds []string `json:"operationIds,omitempty"` + NamespaceFormat *string `default:"null" json:"namespaceFormat"` + // Name that will be set to this connection + Name *string `json:"name,omitempty"` // Prefix that will be prepended to the name of each stream when it is written to the destination. - Prefix *string `json:"prefix,omitempty"` - // optional resource requirements to run workers (blank for unbounded allocations) - ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + Prefix *string `json:"prefix,omitempty"` + OperationIds []string `json:"operationIds,omitempty"` + // describes the available schema (catalog). + SyncCatalog *AirbyteCatalog `json:"syncCatalog,omitempty"` // if null, then no schedule is set. Schedule *ConnectionSchedule `json:"schedule,omitempty"` + // determine how the schedule data should be interpreted + ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` // schedule for when the the connection should run, per the schedule type ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` - // determine how the schedule data should be interpreted - ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` - SourceCatalogID *string `json:"sourceCatalogId,omitempty"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. Status *ConnectionStatus `json:"status,omitempty"` - // describes the available schema (catalog). - SyncCatalog *AirbyteCatalog `json:"syncCatalog,omitempty"` + // optional resource requirements to run workers (blank for unbounded allocations) + ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + SourceCatalogID *string `json:"sourceCatalogId,omitempty"` + Geography *Geography `json:"geography,omitempty"` + NotifySchemaChanges *bool `json:"notifySchemaChanges,omitempty"` + NotifySchemaChangesByEmail *bool `json:"notifySchemaChangesByEmail,omitempty"` + NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` + BreakingChange *bool `json:"breakingChange,omitempty"` +} + +func (c ConnectionUpdate) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ConnectionUpdate) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *ConnectionUpdate) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *ConnectionUpdate) GetNamespaceDefinition() *NamespaceDefinitionType { + if o == nil { + return nil + } + return o.NamespaceDefinition +} + +func (o *ConnectionUpdate) GetNamespaceFormat() *string { + if o == nil { + return nil + } + return o.NamespaceFormat +} + +func (o *ConnectionUpdate) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *ConnectionUpdate) GetPrefix() *string { + if o == nil { + return nil + } + return o.Prefix +} + +func (o *ConnectionUpdate) GetOperationIds() []string { + if o == nil { + return nil + } + return o.OperationIds +} + +func (o *ConnectionUpdate) GetSyncCatalog() *AirbyteCatalog { + if o == nil { + return nil + } + return o.SyncCatalog +} + +func (o *ConnectionUpdate) GetSchedule() *ConnectionSchedule { + if o == nil { + return nil + } + return o.Schedule +} + +func (o *ConnectionUpdate) GetScheduleType() *ConnectionScheduleType { + if o == nil { + return nil + } + return o.ScheduleType +} + +func (o *ConnectionUpdate) GetScheduleData() *ConnectionScheduleData { + if o == nil { + return nil + } + return o.ScheduleData +} + +func (o *ConnectionUpdate) GetStatus() *ConnectionStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *ConnectionUpdate) GetResourceRequirements() *ResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} + +func (o *ConnectionUpdate) GetSourceCatalogID() *string { + if o == nil { + return nil + } + return o.SourceCatalogID +} + +func (o *ConnectionUpdate) GetGeography() *Geography { + if o == nil { + return nil + } + return o.Geography +} + +func (o *ConnectionUpdate) GetNotifySchemaChanges() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChanges +} + +func (o *ConnectionUpdate) GetNotifySchemaChangesByEmail() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChangesByEmail +} + +func (o *ConnectionUpdate) GetNonBreakingChangesPreference() *NonBreakingChangesPreference { + if o == nil { + return nil + } + return o.NonBreakingChangesPreference +} + +func (o *ConnectionUpdate) GetBreakingChange() *bool { + if o == nil { + return nil + } + return o.BreakingChange } diff --git a/internal/sdk/pkg/models/shared/connectorbuilderprojectdetails.go b/internal/sdk/pkg/models/shared/connectorbuilderprojectdetails.go old mode 100755 new mode 100644 index e89a550..d8a74d4 --- a/internal/sdk/pkg/models/shared/connectorbuilderprojectdetails.go +++ b/internal/sdk/pkg/models/shared/connectorbuilderprojectdetails.go @@ -3,7 +3,21 @@ package shared type ConnectorBuilderProjectDetails struct { + Name string `json:"name"` // Low code CDK manifest JSON object DraftManifest *DeclarativeManifest `json:"draftManifest,omitempty"` - Name string `json:"name"` +} + +func (o *ConnectorBuilderProjectDetails) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ConnectorBuilderProjectDetails) GetDraftManifest() *DeclarativeManifest { + if o == nil { + return nil + } + return o.DraftManifest } diff --git a/internal/sdk/pkg/models/shared/connectorbuilderprojectdetailsread.go b/internal/sdk/pkg/models/shared/connectorbuilderprojectdetailsread.go old mode 100755 new mode 100644 index dcd0b24..9166cd2 --- a/internal/sdk/pkg/models/shared/connectorbuilderprojectdetailsread.go +++ b/internal/sdk/pkg/models/shared/connectorbuilderprojectdetailsread.go @@ -3,9 +3,44 @@ package shared type ConnectorBuilderProjectDetailsRead struct { - ActiveDeclarativeManifestVersion *int64 `json:"activeDeclarativeManifestVersion,omitempty"` - BuilderProjectID string `json:"builderProjectId"` - HasDraft bool `json:"hasDraft"` Name string `json:"name"` + BuilderProjectID string `json:"builderProjectId"` SourceDefinitionID *string `json:"sourceDefinitionId,omitempty"` + ActiveDeclarativeManifestVersion *int64 `json:"activeDeclarativeManifestVersion,omitempty"` + HasDraft bool `json:"hasDraft"` +} + +func (o *ConnectorBuilderProjectDetailsRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ConnectorBuilderProjectDetailsRead) GetBuilderProjectID() string { + if o == nil { + return "" + } + return o.BuilderProjectID +} + +func (o *ConnectorBuilderProjectDetailsRead) GetSourceDefinitionID() *string { + if o == nil { + return nil + } + return o.SourceDefinitionID +} + +func (o *ConnectorBuilderProjectDetailsRead) GetActiveDeclarativeManifestVersion() *int64 { + if o == nil { + return nil + } + return o.ActiveDeclarativeManifestVersion +} + +func (o *ConnectorBuilderProjectDetailsRead) GetHasDraft() bool { + if o == nil { + return false + } + return o.HasDraft } diff --git a/internal/sdk/pkg/models/shared/connectorbuilderprojectidwithworkspaceid.go b/internal/sdk/pkg/models/shared/connectorbuilderprojectidwithworkspaceid.go old mode 100755 new mode 100644 index dcfa7ea..4af400e --- a/internal/sdk/pkg/models/shared/connectorbuilderprojectidwithworkspaceid.go +++ b/internal/sdk/pkg/models/shared/connectorbuilderprojectidwithworkspaceid.go @@ -2,9 +2,29 @@ package shared -// ConnectorBuilderProjectIDWithWorkspaceID - Successful operation type ConnectorBuilderProjectIDWithWorkspaceID struct { + WorkspaceID string `json:"workspaceId"` BuilderProjectID string `json:"builderProjectId"` Version *int64 `json:"version,omitempty"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *ConnectorBuilderProjectIDWithWorkspaceID) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *ConnectorBuilderProjectIDWithWorkspaceID) GetBuilderProjectID() string { + if o == nil { + return "" + } + return o.BuilderProjectID +} + +func (o *ConnectorBuilderProjectIDWithWorkspaceID) GetVersion() *int64 { + if o == nil { + return nil + } + return o.Version } diff --git a/internal/sdk/pkg/models/shared/connectorbuilderprojectread.go b/internal/sdk/pkg/models/shared/connectorbuilderprojectread.go old mode 100755 new mode 100644 index 51e0cba..5cf318d --- a/internal/sdk/pkg/models/shared/connectorbuilderprojectread.go +++ b/internal/sdk/pkg/models/shared/connectorbuilderprojectread.go @@ -2,8 +2,21 @@ package shared -// ConnectorBuilderProjectRead - Successful operation type ConnectorBuilderProjectRead struct { BuilderProject ConnectorBuilderProjectDetailsRead `json:"builderProject"` DeclarativeManifest *DeclarativeManifestRead `json:"declarativeManifest,omitempty"` } + +func (o *ConnectorBuilderProjectRead) GetBuilderProject() ConnectorBuilderProjectDetailsRead { + if o == nil { + return ConnectorBuilderProjectDetailsRead{} + } + return o.BuilderProject +} + +func (o *ConnectorBuilderProjectRead) GetDeclarativeManifest() *DeclarativeManifestRead { + if o == nil { + return nil + } + return o.DeclarativeManifest +} diff --git a/internal/sdk/pkg/models/shared/connectorbuilderprojectreadlist.go b/internal/sdk/pkg/models/shared/connectorbuilderprojectreadlist.go old mode 100755 new mode 100644 index 132cb6e..b747c9f --- a/internal/sdk/pkg/models/shared/connectorbuilderprojectreadlist.go +++ b/internal/sdk/pkg/models/shared/connectorbuilderprojectreadlist.go @@ -2,7 +2,13 @@ package shared -// ConnectorBuilderProjectReadList - Successful operation type ConnectorBuilderProjectReadList struct { Projects []ConnectorBuilderProjectDetailsRead `json:"projects"` } + +func (o *ConnectorBuilderProjectReadList) GetProjects() []ConnectorBuilderProjectDetailsRead { + if o == nil { + return []ConnectorBuilderProjectDetailsRead{} + } + return o.Projects +} diff --git a/internal/sdk/pkg/models/shared/connectorbuilderprojectwithworkspaceid.go b/internal/sdk/pkg/models/shared/connectorbuilderprojectwithworkspaceid.go old mode 100755 new mode 100644 index 8529466..537c325 --- a/internal/sdk/pkg/models/shared/connectorbuilderprojectwithworkspaceid.go +++ b/internal/sdk/pkg/models/shared/connectorbuilderprojectwithworkspaceid.go @@ -3,6 +3,20 @@ package shared type ConnectorBuilderProjectWithWorkspaceID struct { - BuilderProject ConnectorBuilderProjectDetails `json:"builderProject"` WorkspaceID string `json:"workspaceId"` + BuilderProject ConnectorBuilderProjectDetails `json:"builderProject"` +} + +func (o *ConnectorBuilderProjectWithWorkspaceID) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *ConnectorBuilderProjectWithWorkspaceID) GetBuilderProject() ConnectorBuilderProjectDetails { + if o == nil { + return ConnectorBuilderProjectDetails{} + } + return o.BuilderProject } diff --git a/internal/sdk/pkg/models/shared/connectorbuilderpublishrequestbody.go b/internal/sdk/pkg/models/shared/connectorbuilderpublishrequestbody.go old mode 100755 new mode 100644 index 2c271ee..a50c63f --- a/internal/sdk/pkg/models/shared/connectorbuilderpublishrequestbody.go +++ b/internal/sdk/pkg/models/shared/connectorbuilderpublishrequestbody.go @@ -3,8 +3,36 @@ package shared type ConnectorBuilderPublishRequestBody struct { + WorkspaceID string `json:"workspaceId"` BuilderProjectID string `json:"builderProjectId"` - InitialDeclarativeManifest DeclarativeSourceManifest `json:"initialDeclarativeManifest"` Name string `json:"name"` - WorkspaceID string `json:"workspaceId"` + InitialDeclarativeManifest DeclarativeSourceManifest `json:"initialDeclarativeManifest"` +} + +func (o *ConnectorBuilderPublishRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *ConnectorBuilderPublishRequestBody) GetBuilderProjectID() string { + if o == nil { + return "" + } + return o.BuilderProjectID +} + +func (o *ConnectorBuilderPublishRequestBody) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *ConnectorBuilderPublishRequestBody) GetInitialDeclarativeManifest() DeclarativeSourceManifest { + if o == nil { + return DeclarativeSourceManifest{} + } + return o.InitialDeclarativeManifest } diff --git a/internal/sdk/pkg/models/shared/customdestinationdefinitioncreate.go b/internal/sdk/pkg/models/shared/customdestinationdefinitioncreate.go old mode 100755 new mode 100644 index 3d1845a..ef237d4 --- a/internal/sdk/pkg/models/shared/customdestinationdefinitioncreate.go +++ b/internal/sdk/pkg/models/shared/customdestinationdefinitioncreate.go @@ -3,6 +3,20 @@ package shared type CustomDestinationDefinitionCreate struct { - DestinationDefinition DestinationDefinitionCreate `json:"destinationDefinition"` WorkspaceID string `json:"workspaceId"` + DestinationDefinition DestinationDefinitionCreate `json:"destinationDefinition"` +} + +func (o *CustomDestinationDefinitionCreate) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *CustomDestinationDefinitionCreate) GetDestinationDefinition() DestinationDefinitionCreate { + if o == nil { + return DestinationDefinitionCreate{} + } + return o.DestinationDefinition } diff --git a/internal/sdk/pkg/models/shared/customerionotificationconfiguration.go b/internal/sdk/pkg/models/shared/customerionotificationconfiguration.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/customsourcedefinitioncreate.go b/internal/sdk/pkg/models/shared/customsourcedefinitioncreate.go old mode 100755 new mode 100644 index d400f60..e3bcb6a --- a/internal/sdk/pkg/models/shared/customsourcedefinitioncreate.go +++ b/internal/sdk/pkg/models/shared/customsourcedefinitioncreate.go @@ -3,6 +3,20 @@ package shared type CustomSourceDefinitionCreate struct { - SourceDefinition SourceDefinitionCreate `json:"sourceDefinition"` WorkspaceID string `json:"workspaceId"` + SourceDefinition SourceDefinitionCreate `json:"sourceDefinition"` +} + +func (o *CustomSourceDefinitionCreate) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *CustomSourceDefinitionCreate) GetSourceDefinition() SourceDefinitionCreate { + if o == nil { + return SourceDefinitionCreate{} + } + return o.SourceDefinition } diff --git a/internal/sdk/pkg/models/shared/declarativemanifest.go b/internal/sdk/pkg/models/shared/declarativemanifest.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/declarativemanifestread.go b/internal/sdk/pkg/models/shared/declarativemanifestread.go old mode 100755 new mode 100644 index 157cbc3..fae2bd9 --- a/internal/sdk/pkg/models/shared/declarativemanifestread.go +++ b/internal/sdk/pkg/models/shared/declarativemanifestread.go @@ -3,9 +3,37 @@ package shared type DeclarativeManifestRead struct { - Description *string `json:"description,omitempty"` - IsDraft *bool `json:"isDraft,omitempty"` // Low code CDK manifest JSON object - Manifest *DeclarativeManifest `json:"manifest,omitempty"` - Version *int64 `json:"version,omitempty"` + Manifest *DeclarativeManifest `json:"manifest,omitempty"` + IsDraft *bool `json:"isDraft,omitempty"` + Version *int64 `json:"version,omitempty"` + Description *string `json:"description,omitempty"` +} + +func (o *DeclarativeManifestRead) GetManifest() *DeclarativeManifest { + if o == nil { + return nil + } + return o.Manifest +} + +func (o *DeclarativeManifestRead) GetIsDraft() *bool { + if o == nil { + return nil + } + return o.IsDraft +} + +func (o *DeclarativeManifestRead) GetVersion() *int64 { + if o == nil { + return nil + } + return o.Version +} + +func (o *DeclarativeManifestRead) GetDescription() *string { + if o == nil { + return nil + } + return o.Description } diff --git a/internal/sdk/pkg/models/shared/declarativemanifestsreadlist.go b/internal/sdk/pkg/models/shared/declarativemanifestsreadlist.go old mode 100755 new mode 100644 index 14ed303..d929628 --- a/internal/sdk/pkg/models/shared/declarativemanifestsreadlist.go +++ b/internal/sdk/pkg/models/shared/declarativemanifestsreadlist.go @@ -2,7 +2,13 @@ package shared -// DeclarativeManifestsReadList - Successful operation type DeclarativeManifestsReadList struct { ManifestVersions []DeclarativeManifestVersionRead `json:"manifestVersions"` } + +func (o *DeclarativeManifestsReadList) GetManifestVersions() []DeclarativeManifestVersionRead { + if o == nil { + return []DeclarativeManifestVersionRead{} + } + return o.ManifestVersions +} diff --git a/internal/sdk/pkg/models/shared/declarativemanifestversionread.go b/internal/sdk/pkg/models/shared/declarativemanifestversionread.go old mode 100755 new mode 100644 index 8fece4e..d946299 --- a/internal/sdk/pkg/models/shared/declarativemanifestversionread.go +++ b/internal/sdk/pkg/models/shared/declarativemanifestversionread.go @@ -3,7 +3,28 @@ package shared type DeclarativeManifestVersionRead struct { - Description string `json:"description"` - IsActive bool `json:"isActive"` Version int64 `json:"version"` + IsActive bool `json:"isActive"` + Description string `json:"description"` +} + +func (o *DeclarativeManifestVersionRead) GetVersion() int64 { + if o == nil { + return 0 + } + return o.Version +} + +func (o *DeclarativeManifestVersionRead) GetIsActive() bool { + if o == nil { + return false + } + return o.IsActive +} + +func (o *DeclarativeManifestVersionRead) GetDescription() string { + if o == nil { + return "" + } + return o.Description } diff --git a/internal/sdk/pkg/models/shared/declarativesourcedefinitioncreatemanifestrequestbody.go b/internal/sdk/pkg/models/shared/declarativesourcedefinitioncreatemanifestrequestbody.go old mode 100755 new mode 100644 index f8ce2fa..a8fa30f --- a/internal/sdk/pkg/models/shared/declarativesourcedefinitioncreatemanifestrequestbody.go +++ b/internal/sdk/pkg/models/shared/declarativesourcedefinitioncreatemanifestrequestbody.go @@ -3,8 +3,36 @@ package shared type DeclarativeSourceDefinitionCreateManifestRequestBody struct { - DeclarativeManifest DeclarativeSourceManifest `json:"declarativeManifest"` - SetAsActiveManifest bool `json:"setAsActiveManifest"` - SourceDefinitionID string `json:"sourceDefinitionId"` WorkspaceID string `json:"workspaceId"` + SourceDefinitionID string `json:"sourceDefinitionId"` + SetAsActiveManifest bool `json:"setAsActiveManifest"` + DeclarativeManifest DeclarativeSourceManifest `json:"declarativeManifest"` +} + +func (o *DeclarativeSourceDefinitionCreateManifestRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *DeclarativeSourceDefinitionCreateManifestRequestBody) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *DeclarativeSourceDefinitionCreateManifestRequestBody) GetSetAsActiveManifest() bool { + if o == nil { + return false + } + return o.SetAsActiveManifest +} + +func (o *DeclarativeSourceDefinitionCreateManifestRequestBody) GetDeclarativeManifest() DeclarativeSourceManifest { + if o == nil { + return DeclarativeSourceManifest{} + } + return o.DeclarativeManifest } diff --git a/internal/sdk/pkg/models/shared/declarativesourcemanifest.go b/internal/sdk/pkg/models/shared/declarativesourcemanifest.go old mode 100755 new mode 100644 index 0c5416f..316a495 --- a/internal/sdk/pkg/models/shared/declarativesourcemanifest.go +++ b/internal/sdk/pkg/models/shared/declarativesourcemanifest.go @@ -10,3 +10,31 @@ type DeclarativeSourceManifest struct { Spec SourceDefinitionSpecification `json:"spec"` Version int64 `json:"version"` } + +func (o *DeclarativeSourceManifest) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *DeclarativeSourceManifest) GetManifest() DeclarativeManifest { + if o == nil { + return DeclarativeManifest{} + } + return o.Manifest +} + +func (o *DeclarativeSourceManifest) GetSpec() SourceDefinitionSpecification { + if o == nil { + return SourceDefinitionSpecification{} + } + return o.Spec +} + +func (o *DeclarativeSourceManifest) GetVersion() int64 { + if o == nil { + return 0 + } + return o.Version +} diff --git a/internal/sdk/pkg/models/shared/destinationcloneconfiguration.go b/internal/sdk/pkg/models/shared/destinationcloneconfiguration.go old mode 100755 new mode 100644 index 5c350ea..d46908e --- a/internal/sdk/pkg/models/shared/destinationcloneconfiguration.go +++ b/internal/sdk/pkg/models/shared/destinationcloneconfiguration.go @@ -7,3 +7,17 @@ type DestinationCloneConfiguration struct { ConnectionConfiguration interface{} `json:"connectionConfiguration,omitempty"` Name *string `json:"name,omitempty"` } + +func (o *DestinationCloneConfiguration) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *DestinationCloneConfiguration) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/internal/sdk/pkg/models/shared/destinationclonerequestbody.go b/internal/sdk/pkg/models/shared/destinationclonerequestbody.go old mode 100755 new mode 100644 index 3531a5f..5e2854f --- a/internal/sdk/pkg/models/shared/destinationclonerequestbody.go +++ b/internal/sdk/pkg/models/shared/destinationclonerequestbody.go @@ -7,3 +7,17 @@ type DestinationCloneRequestBody struct { DestinationCloneID string `json:"destinationCloneId"` DestinationConfiguration *DestinationCloneConfiguration `json:"destinationConfiguration,omitempty"` } + +func (o *DestinationCloneRequestBody) GetDestinationCloneID() string { + if o == nil { + return "" + } + return o.DestinationCloneID +} + +func (o *DestinationCloneRequestBody) GetDestinationConfiguration() *DestinationCloneConfiguration { + if o == nil { + return nil + } + return o.DestinationConfiguration +} diff --git a/internal/sdk/pkg/models/shared/destinationcoreconfig.go b/internal/sdk/pkg/models/shared/destinationcoreconfig.go old mode 100755 new mode 100644 index d760b2d..822b680 --- a/internal/sdk/pkg/models/shared/destinationcoreconfig.go +++ b/internal/sdk/pkg/models/shared/destinationcoreconfig.go @@ -3,9 +3,37 @@ package shared type DestinationCoreConfig struct { + DestinationID *string `json:"destinationId,omitempty"` + DestinationDefinitionID string `json:"destinationDefinitionId"` // The values required to configure the destination. The schema for this must match the schema return by destination_definition_specifications/get for the destinationDefinition. ConnectionConfiguration interface{} `json:"connectionConfiguration"` - DestinationDefinitionID string `json:"destinationDefinitionId"` - DestinationID *string `json:"destinationId,omitempty"` WorkspaceID string `json:"workspaceId"` } + +func (o *DestinationCoreConfig) GetDestinationID() *string { + if o == nil { + return nil + } + return o.DestinationID +} + +func (o *DestinationCoreConfig) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationCoreConfig) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *DestinationCoreConfig) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/destinationcreate.go b/internal/sdk/pkg/models/shared/destinationcreate.go old mode 100755 new mode 100644 index 50a9fff..29121f5 --- a/internal/sdk/pkg/models/shared/destinationcreate.go +++ b/internal/sdk/pkg/models/shared/destinationcreate.go @@ -3,9 +3,37 @@ package shared type DestinationCreate struct { + WorkspaceID string `json:"workspaceId"` + Name string `json:"name"` + DestinationDefinitionID string `json:"destinationDefinitionId"` // The values required to configure the destination. The schema for this must match the schema return by destination_definition_specifications/get for the destinationDefinition. ConnectionConfiguration interface{} `json:"connectionConfiguration"` - DestinationDefinitionID string `json:"destinationDefinitionId"` - Name string `json:"name"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *DestinationCreate) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *DestinationCreate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DestinationCreate) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationCreate) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration } diff --git a/internal/sdk/pkg/models/shared/destinationdefinitioncreate.go b/internal/sdk/pkg/models/shared/destinationdefinitioncreate.go old mode 100755 new mode 100644 index 89b83b5..98234bf --- a/internal/sdk/pkg/models/shared/destinationdefinitioncreate.go +++ b/internal/sdk/pkg/models/shared/destinationdefinitioncreate.go @@ -3,11 +3,53 @@ package shared type DestinationDefinitionCreate struct { - DockerImageTag string `json:"dockerImageTag"` + Name string `json:"name"` DockerRepository string `json:"dockerRepository"` + DockerImageTag string `json:"dockerImageTag"` DocumentationURL string `json:"documentationUrl"` Icon *string `json:"icon,omitempty"` - Name string `json:"name"` // actor definition specific resource requirements. if default is set, these are the requirements that should be set for ALL jobs run for this actor definition. it is overriden by the job type specific configurations. if not set, the platform will use defaults. these values will be overriden by configuration at the connection level. ResourceRequirements *ActorDefinitionResourceRequirements `json:"resourceRequirements,omitempty"` } + +func (o *DestinationDefinitionCreate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DestinationDefinitionCreate) GetDockerRepository() string { + if o == nil { + return "" + } + return o.DockerRepository +} + +func (o *DestinationDefinitionCreate) GetDockerImageTag() string { + if o == nil { + return "" + } + return o.DockerImageTag +} + +func (o *DestinationDefinitionCreate) GetDocumentationURL() string { + if o == nil { + return "" + } + return o.DocumentationURL +} + +func (o *DestinationDefinitionCreate) GetIcon() *string { + if o == nil { + return nil + } + return o.Icon +} + +func (o *DestinationDefinitionCreate) GetResourceRequirements() *ActorDefinitionResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} diff --git a/internal/sdk/pkg/models/shared/destinationdefinitionidrequestbody.go b/internal/sdk/pkg/models/shared/destinationdefinitionidrequestbody.go old mode 100755 new mode 100644 index 3106bf9..ad4c88c --- a/internal/sdk/pkg/models/shared/destinationdefinitionidrequestbody.go +++ b/internal/sdk/pkg/models/shared/destinationdefinitionidrequestbody.go @@ -5,3 +5,10 @@ package shared type DestinationDefinitionIDRequestBody struct { DestinationDefinitionID string `json:"destinationDefinitionId"` } + +func (o *DestinationDefinitionIDRequestBody) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} diff --git a/internal/sdk/pkg/models/shared/destinationdefinitionidwithworkspaceid.go b/internal/sdk/pkg/models/shared/destinationdefinitionidwithworkspaceid.go old mode 100755 new mode 100644 index 68ef192..b1e8a73 --- a/internal/sdk/pkg/models/shared/destinationdefinitionidwithworkspaceid.go +++ b/internal/sdk/pkg/models/shared/destinationdefinitionidwithworkspaceid.go @@ -6,3 +6,17 @@ type DestinationDefinitionIDWithWorkspaceID struct { DestinationDefinitionID string `json:"destinationDefinitionId"` WorkspaceID string `json:"workspaceId"` } + +func (o *DestinationDefinitionIDWithWorkspaceID) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationDefinitionIDWithWorkspaceID) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/destinationdefinitionread.go b/internal/sdk/pkg/models/shared/destinationdefinitionread.go old mode 100755 new mode 100644 index dad522d..e3d6253 --- a/internal/sdk/pkg/models/shared/destinationdefinitionread.go +++ b/internal/sdk/pkg/models/shared/destinationdefinitionread.go @@ -3,26 +3,121 @@ package shared import ( - "airbyte/internal/sdk/pkg/types" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/types" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" ) -// DestinationDefinitionRead - Successful operation type DestinationDefinitionRead struct { DestinationDefinitionID string `json:"destinationDefinitionId"` - DockerImageTag string `json:"dockerImageTag"` + Name string `json:"name"` DockerRepository string `json:"dockerRepository"` + DockerImageTag string `json:"dockerImageTag"` DocumentationURL string `json:"documentationUrl"` Icon *string `json:"icon,omitempty"` - Name string `json:"name"` - // describes a normalization config for destination definition - NormalizationConfig NormalizationDestinationDefinitionConfig `json:"normalizationConfig"` // The Airbyte Protocol version supported by the connector - ProtocolVersion *string `json:"protocolVersion,omitempty"` + ProtocolVersion *string `json:"protocolVersion,omitempty"` + ReleaseStage *ReleaseStage `json:"releaseStage,omitempty"` // The date when this connector was first released, in yyyy-mm-dd format. - ReleaseDate *types.Date `json:"releaseDate,omitempty"` - ReleaseStage *ReleaseStage `json:"releaseStage,omitempty"` + ReleaseDate *types.Date `json:"releaseDate,omitempty"` // actor definition specific resource requirements. if default is set, these are the requirements that should be set for ALL jobs run for this actor definition. it is overriden by the job type specific configurations. if not set, the platform will use defaults. these values will be overriden by configuration at the connection level. ResourceRequirements *ActorDefinitionResourceRequirements `json:"resourceRequirements,omitempty"` // an optional flag indicating whether DBT is used in the normalization. If the flag value is NULL - DBT is not used. SupportsDbt bool `json:"supportsDbt"` + // describes a normalization config for destination definition + NormalizationConfig NormalizationDestinationDefinitionConfig `json:"normalizationConfig"` +} + +func (d DestinationDefinitionRead) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(d, "", false) +} + +func (d *DestinationDefinitionRead) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil { + return err + } + return nil +} + +func (o *DestinationDefinitionRead) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationDefinitionRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DestinationDefinitionRead) GetDockerRepository() string { + if o == nil { + return "" + } + return o.DockerRepository +} + +func (o *DestinationDefinitionRead) GetDockerImageTag() string { + if o == nil { + return "" + } + return o.DockerImageTag +} + +func (o *DestinationDefinitionRead) GetDocumentationURL() string { + if o == nil { + return "" + } + return o.DocumentationURL +} + +func (o *DestinationDefinitionRead) GetIcon() *string { + if o == nil { + return nil + } + return o.Icon +} + +func (o *DestinationDefinitionRead) GetProtocolVersion() *string { + if o == nil { + return nil + } + return o.ProtocolVersion +} + +func (o *DestinationDefinitionRead) GetReleaseStage() *ReleaseStage { + if o == nil { + return nil + } + return o.ReleaseStage +} + +func (o *DestinationDefinitionRead) GetReleaseDate() *types.Date { + if o == nil { + return nil + } + return o.ReleaseDate +} + +func (o *DestinationDefinitionRead) GetResourceRequirements() *ActorDefinitionResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} + +func (o *DestinationDefinitionRead) GetSupportsDbt() bool { + if o == nil { + return false + } + return o.SupportsDbt +} + +func (o *DestinationDefinitionRead) GetNormalizationConfig() NormalizationDestinationDefinitionConfig { + if o == nil { + return NormalizationDestinationDefinitionConfig{} + } + return o.NormalizationConfig } diff --git a/internal/sdk/pkg/models/shared/destinationdefinitionreadlist.go b/internal/sdk/pkg/models/shared/destinationdefinitionreadlist.go old mode 100755 new mode 100644 index cda8c22..c38b64c --- a/internal/sdk/pkg/models/shared/destinationdefinitionreadlist.go +++ b/internal/sdk/pkg/models/shared/destinationdefinitionreadlist.go @@ -2,7 +2,13 @@ package shared -// DestinationDefinitionReadList - Successful operation type DestinationDefinitionReadList struct { DestinationDefinitions []DestinationDefinitionRead `json:"destinationDefinitions"` } + +func (o *DestinationDefinitionReadList) GetDestinationDefinitions() []DestinationDefinitionRead { + if o == nil { + return []DestinationDefinitionRead{} + } + return o.DestinationDefinitions +} diff --git a/internal/sdk/pkg/models/shared/destinationdefinitionspecification.go b/internal/sdk/pkg/models/shared/destinationdefinitionspecification.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/destinationdefinitionspecificationread.go b/internal/sdk/pkg/models/shared/destinationdefinitionspecificationread.go old mode 100755 new mode 100644 index 5a29112..8d758be --- a/internal/sdk/pkg/models/shared/destinationdefinitionspecificationread.go +++ b/internal/sdk/pkg/models/shared/destinationdefinitionspecificationread.go @@ -2,13 +2,54 @@ package shared -// DestinationDefinitionSpecificationRead - Successful operation type DestinationDefinitionSpecificationRead struct { - AdvancedAuth *AdvancedAuth `json:"advancedAuth,omitempty"` + DestinationDefinitionID string `json:"destinationDefinitionId"` + DocumentationURL *string `json:"documentationUrl,omitempty"` // The specification for what values are required to configure the destinationDefinition. ConnectionSpecification *DestinationDefinitionSpecification `json:"connectionSpecification,omitempty"` - DestinationDefinitionID string `json:"destinationDefinitionId"` - DocumentationURL *string `json:"documentationUrl,omitempty"` + AdvancedAuth *AdvancedAuth `json:"advancedAuth,omitempty"` JobInfo SynchronousJobRead `json:"jobInfo"` SupportedDestinationSyncModes []DestinationSyncMode `json:"supportedDestinationSyncModes,omitempty"` } + +func (o *DestinationDefinitionSpecificationRead) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationDefinitionSpecificationRead) GetDocumentationURL() *string { + if o == nil { + return nil + } + return o.DocumentationURL +} + +func (o *DestinationDefinitionSpecificationRead) GetConnectionSpecification() *DestinationDefinitionSpecification { + if o == nil { + return nil + } + return o.ConnectionSpecification +} + +func (o *DestinationDefinitionSpecificationRead) GetAdvancedAuth() *AdvancedAuth { + if o == nil { + return nil + } + return o.AdvancedAuth +} + +func (o *DestinationDefinitionSpecificationRead) GetJobInfo() SynchronousJobRead { + if o == nil { + return SynchronousJobRead{} + } + return o.JobInfo +} + +func (o *DestinationDefinitionSpecificationRead) GetSupportedDestinationSyncModes() []DestinationSyncMode { + if o == nil { + return nil + } + return o.SupportedDestinationSyncModes +} diff --git a/internal/sdk/pkg/models/shared/destinationdefinitionupdate.go b/internal/sdk/pkg/models/shared/destinationdefinitionupdate.go old mode 100755 new mode 100644 index 0ce78b5..9fae94f --- a/internal/sdk/pkg/models/shared/destinationdefinitionupdate.go +++ b/internal/sdk/pkg/models/shared/destinationdefinitionupdate.go @@ -8,3 +8,24 @@ type DestinationDefinitionUpdate struct { // actor definition specific resource requirements. if default is set, these are the requirements that should be set for ALL jobs run for this actor definition. it is overriden by the job type specific configurations. if not set, the platform will use defaults. these values will be overriden by configuration at the connection level. ResourceRequirements *ActorDefinitionResourceRequirements `json:"resourceRequirements,omitempty"` } + +func (o *DestinationDefinitionUpdate) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationDefinitionUpdate) GetDockerImageTag() *string { + if o == nil { + return nil + } + return o.DockerImageTag +} + +func (o *DestinationDefinitionUpdate) GetResourceRequirements() *ActorDefinitionResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} diff --git a/internal/sdk/pkg/models/shared/destinationidrequestbody.go b/internal/sdk/pkg/models/shared/destinationidrequestbody.go old mode 100755 new mode 100644 index 3019cdd..7d14700 --- a/internal/sdk/pkg/models/shared/destinationidrequestbody.go +++ b/internal/sdk/pkg/models/shared/destinationidrequestbody.go @@ -5,3 +5,10 @@ package shared type DestinationIDRequestBody struct { DestinationID string `json:"destinationId"` } + +func (o *DestinationIDRequestBody) GetDestinationID() string { + if o == nil { + return "" + } + return o.DestinationID +} diff --git a/internal/sdk/pkg/models/shared/destinationoauthconsentrequest.go b/internal/sdk/pkg/models/shared/destinationoauthconsentrequest.go old mode 100755 new mode 100644 index 06ea8ef..57fa0d8 --- a/internal/sdk/pkg/models/shared/destinationoauthconsentrequest.go +++ b/internal/sdk/pkg/models/shared/destinationoauthconsentrequest.go @@ -3,11 +3,46 @@ package shared type DestinationOauthConsentRequest struct { - DestinationDefinitionID string `json:"destinationDefinitionId"` - DestinationID *string `json:"destinationId,omitempty"` - // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. - OAuthInputConfiguration interface{} `json:"oAuthInputConfiguration,omitempty"` + DestinationDefinitionID string `json:"destinationDefinitionId"` + WorkspaceID string `json:"workspaceId"` // The url to redirect to after getting the user consent RedirectURL string `json:"redirectUrl"` - WorkspaceID string `json:"workspaceId"` + // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. + OAuthInputConfiguration interface{} `json:"oAuthInputConfiguration,omitempty"` + DestinationID *string `json:"destinationId,omitempty"` +} + +func (o *DestinationOauthConsentRequest) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationOauthConsentRequest) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *DestinationOauthConsentRequest) GetRedirectURL() string { + if o == nil { + return "" + } + return o.RedirectURL +} + +func (o *DestinationOauthConsentRequest) GetOAuthInputConfiguration() interface{} { + if o == nil { + return nil + } + return o.OAuthInputConfiguration +} + +func (o *DestinationOauthConsentRequest) GetDestinationID() *string { + if o == nil { + return nil + } + return o.DestinationID } diff --git a/internal/sdk/pkg/models/shared/destinationread.go b/internal/sdk/pkg/models/shared/destinationread.go old mode 100755 new mode 100644 index 9637491..7f89bf7 --- a/internal/sdk/pkg/models/shared/destinationread.go +++ b/internal/sdk/pkg/models/shared/destinationread.go @@ -2,14 +2,62 @@ package shared -// DestinationRead - Successful operation type DestinationRead struct { + DestinationDefinitionID string `json:"destinationDefinitionId"` + DestinationID string `json:"destinationId"` + WorkspaceID string `json:"workspaceId"` // The values required to configure the destination. The schema for this must match the schema return by destination_definition_specifications/get for the destinationDefinition. ConnectionConfiguration interface{} `json:"connectionConfiguration"` - DestinationDefinitionID string `json:"destinationDefinitionId"` - DestinationID string `json:"destinationId"` + Name string `json:"name"` DestinationName string `json:"destinationName"` Icon *string `json:"icon,omitempty"` - Name string `json:"name"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *DestinationRead) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationRead) GetDestinationID() string { + if o == nil { + return "" + } + return o.DestinationID +} + +func (o *DestinationRead) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *DestinationRead) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *DestinationRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DestinationRead) GetDestinationName() string { + if o == nil { + return "" + } + return o.DestinationName +} + +func (o *DestinationRead) GetIcon() *string { + if o == nil { + return nil + } + return o.Icon } diff --git a/internal/sdk/pkg/models/shared/destinationreadlist.go b/internal/sdk/pkg/models/shared/destinationreadlist.go old mode 100755 new mode 100644 index e4b2212..316278b --- a/internal/sdk/pkg/models/shared/destinationreadlist.go +++ b/internal/sdk/pkg/models/shared/destinationreadlist.go @@ -2,7 +2,13 @@ package shared -// DestinationReadList - Successful operation type DestinationReadList struct { Destinations []DestinationRead `json:"destinations"` } + +func (o *DestinationReadList) GetDestinations() []DestinationRead { + if o == nil { + return []DestinationRead{} + } + return o.Destinations +} diff --git a/internal/sdk/pkg/models/shared/destinationsearch.go b/internal/sdk/pkg/models/shared/destinationsearch.go old mode 100755 new mode 100644 index 34e386e..55a1da2 --- a/internal/sdk/pkg/models/shared/destinationsearch.go +++ b/internal/sdk/pkg/models/shared/destinationsearch.go @@ -3,11 +3,53 @@ package shared type DestinationSearch struct { + DestinationDefinitionID *string `json:"destinationDefinitionId,omitempty"` + DestinationID *string `json:"destinationId,omitempty"` + WorkspaceID *string `json:"workspaceId,omitempty"` // The values required to configure the destination. The schema for this must match the schema return by destination_definition_specifications/get for the destinationDefinition. ConnectionConfiguration interface{} `json:"connectionConfiguration,omitempty"` - DestinationDefinitionID *string `json:"destinationDefinitionId,omitempty"` - DestinationID *string `json:"destinationId,omitempty"` - DestinationName *string `json:"destinationName,omitempty"` Name *string `json:"name,omitempty"` - WorkspaceID *string `json:"workspaceId,omitempty"` + DestinationName *string `json:"destinationName,omitempty"` +} + +func (o *DestinationSearch) GetDestinationDefinitionID() *string { + if o == nil { + return nil + } + return o.DestinationDefinitionID +} + +func (o *DestinationSearch) GetDestinationID() *string { + if o == nil { + return nil + } + return o.DestinationID +} + +func (o *DestinationSearch) GetWorkspaceID() *string { + if o == nil { + return nil + } + return o.WorkspaceID +} + +func (o *DestinationSearch) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *DestinationSearch) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *DestinationSearch) GetDestinationName() *string { + if o == nil { + return nil + } + return o.DestinationName } diff --git a/internal/sdk/pkg/models/shared/destinationsnippetread.go b/internal/sdk/pkg/models/shared/destinationsnippetread.go old mode 100755 new mode 100644 index 935f9d9..a1faa31 --- a/internal/sdk/pkg/models/shared/destinationsnippetread.go +++ b/internal/sdk/pkg/models/shared/destinationsnippetread.go @@ -3,9 +3,44 @@ package shared type DestinationSnippetRead struct { - DestinationDefinitionID string `json:"destinationDefinitionId"` DestinationID string `json:"destinationId"` + Name string `json:"name"` + DestinationDefinitionID string `json:"destinationDefinitionId"` DestinationName string `json:"destinationName"` Icon *string `json:"icon,omitempty"` - Name string `json:"name"` +} + +func (o *DestinationSnippetRead) GetDestinationID() string { + if o == nil { + return "" + } + return o.DestinationID +} + +func (o *DestinationSnippetRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *DestinationSnippetRead) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *DestinationSnippetRead) GetDestinationName() string { + if o == nil { + return "" + } + return o.DestinationName +} + +func (o *DestinationSnippetRead) GetIcon() *string { + if o == nil { + return nil + } + return o.Icon } diff --git a/internal/sdk/pkg/models/shared/destinationsyncmode.go b/internal/sdk/pkg/models/shared/destinationsyncmode.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/destinationupdate.go b/internal/sdk/pkg/models/shared/destinationupdate.go old mode 100755 new mode 100644 index d62dd0e..8c3c31f --- a/internal/sdk/pkg/models/shared/destinationupdate.go +++ b/internal/sdk/pkg/models/shared/destinationupdate.go @@ -3,8 +3,29 @@ package shared type DestinationUpdate struct { + DestinationID string `json:"destinationId"` // The values required to configure the destination. The schema for this must match the schema return by destination_definition_specifications/get for the destinationDefinition. ConnectionConfiguration interface{} `json:"connectionConfiguration"` - DestinationID string `json:"destinationId"` Name string `json:"name"` } + +func (o *DestinationUpdate) GetDestinationID() string { + if o == nil { + return "" + } + return o.DestinationID +} + +func (o *DestinationUpdate) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *DestinationUpdate) GetName() string { + if o == nil { + return "" + } + return o.Name +} diff --git a/internal/sdk/pkg/models/shared/discovercatalogresult.go b/internal/sdk/pkg/models/shared/discovercatalogresult.go old mode 100755 new mode 100644 index 463e437..72cfdb2 --- a/internal/sdk/pkg/models/shared/discovercatalogresult.go +++ b/internal/sdk/pkg/models/shared/discovercatalogresult.go @@ -2,7 +2,13 @@ package shared -// DiscoverCatalogResult - Successful Operation type DiscoverCatalogResult struct { CatalogID string `json:"catalogId"` } + +func (o *DiscoverCatalogResult) GetCatalogID() string { + if o == nil { + return "" + } + return o.CatalogID +} diff --git a/internal/sdk/pkg/models/shared/existingconnectorbuilderprojectwithworkspaceid.go b/internal/sdk/pkg/models/shared/existingconnectorbuilderprojectwithworkspaceid.go old mode 100755 new mode 100644 index 0626fa3..33e0662 --- a/internal/sdk/pkg/models/shared/existingconnectorbuilderprojectwithworkspaceid.go +++ b/internal/sdk/pkg/models/shared/existingconnectorbuilderprojectwithworkspaceid.go @@ -3,7 +3,28 @@ package shared type ExistingConnectorBuilderProjectWithWorkspaceID struct { - BuilderProject ConnectorBuilderProjectDetails `json:"builderProject"` - BuilderProjectID string `json:"builderProjectId"` WorkspaceID string `json:"workspaceId"` + BuilderProjectID string `json:"builderProjectId"` + BuilderProject ConnectorBuilderProjectDetails `json:"builderProject"` +} + +func (o *ExistingConnectorBuilderProjectWithWorkspaceID) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *ExistingConnectorBuilderProjectWithWorkspaceID) GetBuilderProjectID() string { + if o == nil { + return "" + } + return o.BuilderProjectID +} + +func (o *ExistingConnectorBuilderProjectWithWorkspaceID) GetBuilderProject() ConnectorBuilderProjectDetails { + if o == nil { + return ConnectorBuilderProjectDetails{} + } + return o.BuilderProject } diff --git a/internal/sdk/pkg/models/shared/failureorigin.go b/internal/sdk/pkg/models/shared/failureorigin.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/failurereason.go b/internal/sdk/pkg/models/shared/failurereason.go old mode 100755 new mode 100644 index c701590..81bec4e --- a/internal/sdk/pkg/models/shared/failurereason.go +++ b/internal/sdk/pkg/models/shared/failurereason.go @@ -3,14 +3,63 @@ package shared type FailureReason struct { - ExternalMessage *string `json:"externalMessage,omitempty"` // Indicates where the error originated. If not set, the origin of error is not well known. FailureOrigin *FailureOrigin `json:"failureOrigin,omitempty"` // Categorizes well known errors into types for programmatic handling. If not set, the type of error is not well known. FailureType *FailureType `json:"failureType,omitempty"` + ExternalMessage *string `json:"externalMessage,omitempty"` InternalMessage *string `json:"internalMessage,omitempty"` + Stacktrace *string `json:"stacktrace,omitempty"` // True if it is known that retrying may succeed, e.g. for a transient failure. False if it is known that a retry will not succeed, e.g. for a configuration issue. If not set, retryable status is not well known. - Retryable *bool `json:"retryable,omitempty"` - Stacktrace *string `json:"stacktrace,omitempty"` - Timestamp int64 `json:"timestamp"` + Retryable *bool `json:"retryable,omitempty"` + Timestamp int64 `json:"timestamp"` +} + +func (o *FailureReason) GetFailureOrigin() *FailureOrigin { + if o == nil { + return nil + } + return o.FailureOrigin +} + +func (o *FailureReason) GetFailureType() *FailureType { + if o == nil { + return nil + } + return o.FailureType +} + +func (o *FailureReason) GetExternalMessage() *string { + if o == nil { + return nil + } + return o.ExternalMessage +} + +func (o *FailureReason) GetInternalMessage() *string { + if o == nil { + return nil + } + return o.InternalMessage +} + +func (o *FailureReason) GetStacktrace() *string { + if o == nil { + return nil + } + return o.Stacktrace +} + +func (o *FailureReason) GetRetryable() *bool { + if o == nil { + return nil + } + return o.Retryable +} + +func (o *FailureReason) GetTimestamp() int64 { + if o == nil { + return 0 + } + return o.Timestamp } diff --git a/internal/sdk/pkg/models/shared/failuretype.go b/internal/sdk/pkg/models/shared/failuretype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/fieldadd.go b/internal/sdk/pkg/models/shared/fieldadd.go old mode 100755 new mode 100644 index cc635cf..a7d46a1 --- a/internal/sdk/pkg/models/shared/fieldadd.go +++ b/internal/sdk/pkg/models/shared/fieldadd.go @@ -6,3 +6,10 @@ type FieldAdd struct { // JSONSchema representation of the field Schema *FieldSchema `json:"schema,omitempty"` } + +func (o *FieldAdd) GetSchema() *FieldSchema { + if o == nil { + return nil + } + return o.Schema +} diff --git a/internal/sdk/pkg/models/shared/fieldremove.go b/internal/sdk/pkg/models/shared/fieldremove.go old mode 100755 new mode 100644 index e8ac11e..8b63a75 --- a/internal/sdk/pkg/models/shared/fieldremove.go +++ b/internal/sdk/pkg/models/shared/fieldremove.go @@ -6,3 +6,10 @@ type FieldRemove struct { // JSONSchema representation of the field Schema *FieldSchema `json:"schema,omitempty"` } + +func (o *FieldRemove) GetSchema() *FieldSchema { + if o == nil { + return nil + } + return o.Schema +} diff --git a/internal/sdk/pkg/models/shared/fieldschema.go b/internal/sdk/pkg/models/shared/fieldschema.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/fieldschemaupdate.go b/internal/sdk/pkg/models/shared/fieldschemaupdate.go old mode 100755 new mode 100644 index e0f968d..ce960fc --- a/internal/sdk/pkg/models/shared/fieldschemaupdate.go +++ b/internal/sdk/pkg/models/shared/fieldschemaupdate.go @@ -3,8 +3,22 @@ package shared type FieldSchemaUpdate struct { - // JSONSchema representation of the field - NewSchema FieldSchema `json:"newSchema"` // JSONSchema representation of the field OldSchema FieldSchema `json:"oldSchema"` + // JSONSchema representation of the field + NewSchema FieldSchema `json:"newSchema"` +} + +func (o *FieldSchemaUpdate) GetOldSchema() FieldSchema { + if o == nil { + return FieldSchema{} + } + return o.OldSchema +} + +func (o *FieldSchemaUpdate) GetNewSchema() FieldSchema { + if o == nil { + return FieldSchema{} + } + return o.NewSchema } diff --git a/internal/sdk/pkg/models/shared/fieldtransform.go b/internal/sdk/pkg/models/shared/fieldtransform.go old mode 100755 new mode 100644 index 07f8f0e..9317c1f --- a/internal/sdk/pkg/models/shared/fieldtransform.go +++ b/internal/sdk/pkg/models/shared/fieldtransform.go @@ -39,11 +39,53 @@ func (e *FieldTransformTransformType) UnmarshalJSON(data []byte) error { // FieldTransform - Describes the difference between two Streams. type FieldTransform struct { - AddField *FieldAdd `json:"addField,omitempty"` - Breaking bool `json:"breaking"` + TransformType FieldTransformTransformType `json:"transformType"` // A field name is a list of strings that form the path to the field. - FieldName []string `json:"fieldName"` - RemoveField *FieldRemove `json:"removeField,omitempty"` - TransformType FieldTransformTransformType `json:"transformType"` - UpdateFieldSchema *FieldSchemaUpdate `json:"updateFieldSchema,omitempty"` + FieldName []string `json:"fieldName"` + Breaking bool `json:"breaking"` + AddField *FieldAdd `json:"addField,omitempty"` + RemoveField *FieldRemove `json:"removeField,omitempty"` + UpdateFieldSchema *FieldSchemaUpdate `json:"updateFieldSchema,omitempty"` +} + +func (o *FieldTransform) GetTransformType() FieldTransformTransformType { + if o == nil { + return FieldTransformTransformType("") + } + return o.TransformType +} + +func (o *FieldTransform) GetFieldName() []string { + if o == nil { + return []string{} + } + return o.FieldName +} + +func (o *FieldTransform) GetBreaking() bool { + if o == nil { + return false + } + return o.Breaking +} + +func (o *FieldTransform) GetAddField() *FieldAdd { + if o == nil { + return nil + } + return o.AddField +} + +func (o *FieldTransform) GetRemoveField() *FieldRemove { + if o == nil { + return nil + } + return o.RemoveField +} + +func (o *FieldTransform) GetUpdateFieldSchema() *FieldSchemaUpdate { + if o == nil { + return nil + } + return o.UpdateFieldSchema } diff --git a/internal/sdk/pkg/models/shared/geography.go b/internal/sdk/pkg/models/shared/geography.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/globalstate.go b/internal/sdk/pkg/models/shared/globalstate.go old mode 100755 new mode 100644 index a7e72b3..37a123c --- a/internal/sdk/pkg/models/shared/globalstate.go +++ b/internal/sdk/pkg/models/shared/globalstate.go @@ -6,3 +6,17 @@ type GlobalState struct { SharedState *StateBlob `json:"shared_state,omitempty"` StreamStates []StreamState `json:"streamStates"` } + +func (o *GlobalState) GetSharedState() *StateBlob { + if o == nil { + return nil + } + return o.SharedState +} + +func (o *GlobalState) GetStreamStates() []StreamState { + if o == nil { + return []StreamState{} + } + return o.StreamStates +} diff --git a/internal/sdk/pkg/models/shared/healthcheckread.go b/internal/sdk/pkg/models/shared/healthcheckread.go old mode 100755 new mode 100644 index 67411c5..514142a --- a/internal/sdk/pkg/models/shared/healthcheckread.go +++ b/internal/sdk/pkg/models/shared/healthcheckread.go @@ -2,7 +2,13 @@ package shared -// HealthCheckRead - Successful operation type HealthCheckRead struct { Available bool `json:"available"` } + +func (o *HealthCheckRead) GetAvailable() bool { + if o == nil { + return false + } + return o.Available +} diff --git a/internal/sdk/pkg/models/shared/internaloperationresult.go b/internal/sdk/pkg/models/shared/internaloperationresult.go old mode 100755 new mode 100644 index 97bb007..6be2cab --- a/internal/sdk/pkg/models/shared/internaloperationresult.go +++ b/internal/sdk/pkg/models/shared/internaloperationresult.go @@ -2,7 +2,13 @@ package shared -// InternalOperationResult - Successful Operation type InternalOperationResult struct { Succeeded bool `json:"succeeded"` } + +func (o *InternalOperationResult) GetSucceeded() bool { + if o == nil { + return false + } + return o.Succeeded +} diff --git a/internal/sdk/pkg/models/shared/invalidinputexceptioninfo.go b/internal/sdk/pkg/models/shared/invalidinputexceptioninfo.go old mode 100755 new mode 100644 index 2f9f541..df561d3 --- a/internal/sdk/pkg/models/shared/invalidinputexceptioninfo.go +++ b/internal/sdk/pkg/models/shared/invalidinputexceptioninfo.go @@ -2,10 +2,37 @@ package shared -// InvalidInputExceptionInfo - Input failed validation type InvalidInputExceptionInfo struct { + Message string `json:"message"` ExceptionClassName *string `json:"exceptionClassName,omitempty"` ExceptionStack []string `json:"exceptionStack,omitempty"` - Message string `json:"message"` ValidationErrors []InvalidInputProperty `json:"validationErrors"` } + +func (o *InvalidInputExceptionInfo) GetMessage() string { + if o == nil { + return "" + } + return o.Message +} + +func (o *InvalidInputExceptionInfo) GetExceptionClassName() *string { + if o == nil { + return nil + } + return o.ExceptionClassName +} + +func (o *InvalidInputExceptionInfo) GetExceptionStack() []string { + if o == nil { + return nil + } + return o.ExceptionStack +} + +func (o *InvalidInputExceptionInfo) GetValidationErrors() []InvalidInputProperty { + if o == nil { + return []InvalidInputProperty{} + } + return o.ValidationErrors +} diff --git a/internal/sdk/pkg/models/shared/invalidinputproperty.go b/internal/sdk/pkg/models/shared/invalidinputproperty.go old mode 100755 new mode 100644 index 6caa8f5..11ac26a --- a/internal/sdk/pkg/models/shared/invalidinputproperty.go +++ b/internal/sdk/pkg/models/shared/invalidinputproperty.go @@ -3,7 +3,28 @@ package shared type InvalidInputProperty struct { + PropertyPath string `json:"propertyPath"` InvalidValue *string `json:"invalidValue,omitempty"` Message *string `json:"message,omitempty"` - PropertyPath string `json:"propertyPath"` +} + +func (o *InvalidInputProperty) GetPropertyPath() string { + if o == nil { + return "" + } + return o.PropertyPath +} + +func (o *InvalidInputProperty) GetInvalidValue() *string { + if o == nil { + return nil + } + return o.InvalidValue +} + +func (o *InvalidInputProperty) GetMessage() *string { + if o == nil { + return nil + } + return o.Message } diff --git a/internal/sdk/pkg/models/shared/jobconfigtype.go b/internal/sdk/pkg/models/shared/jobconfigtype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/jobdebuginforead.go b/internal/sdk/pkg/models/shared/jobdebuginforead.go old mode 100755 new mode 100644 index 2eb3acc..73f2082 --- a/internal/sdk/pkg/models/shared/jobdebuginforead.go +++ b/internal/sdk/pkg/models/shared/jobdebuginforead.go @@ -2,9 +2,29 @@ package shared -// JobDebugInfoRead - Successful operation type JobDebugInfoRead struct { - Attempts []AttemptInfoRead `json:"attempts"` Job JobDebugRead `json:"job"` + Attempts []AttemptInfoRead `json:"attempts"` WorkflowState *WorkflowStateRead `json:"workflowState,omitempty"` } + +func (o *JobDebugInfoRead) GetJob() JobDebugRead { + if o == nil { + return JobDebugRead{} + } + return o.Job +} + +func (o *JobDebugInfoRead) GetAttempts() []AttemptInfoRead { + if o == nil { + return []AttemptInfoRead{} + } + return o.Attempts +} + +func (o *JobDebugInfoRead) GetWorkflowState() *WorkflowStateRead { + if o == nil { + return nil + } + return o.WorkflowState +} diff --git a/internal/sdk/pkg/models/shared/jobdebugread.go b/internal/sdk/pkg/models/shared/jobdebugread.go old mode 100755 new mode 100644 index a569eac..e79c5f7 --- a/internal/sdk/pkg/models/shared/jobdebugread.go +++ b/internal/sdk/pkg/models/shared/jobdebugread.go @@ -3,11 +3,60 @@ package shared type JobDebugRead struct { - AirbyteVersion string `json:"airbyteVersion"` - ConfigID string `json:"configId"` - ConfigType JobConfigType `json:"configType"` - DestinationDefinition DestinationDefinitionRead `json:"destinationDefinition"` ID int64 `json:"id"` - SourceDefinition SourceDefinitionRead `json:"sourceDefinition"` + ConfigType JobConfigType `json:"configType"` + ConfigID string `json:"configId"` Status JobStatus `json:"status"` + AirbyteVersion string `json:"airbyteVersion"` + SourceDefinition SourceDefinitionRead `json:"sourceDefinition"` + DestinationDefinition DestinationDefinitionRead `json:"destinationDefinition"` +} + +func (o *JobDebugRead) GetID() int64 { + if o == nil { + return 0 + } + return o.ID +} + +func (o *JobDebugRead) GetConfigType() JobConfigType { + if o == nil { + return JobConfigType("") + } + return o.ConfigType +} + +func (o *JobDebugRead) GetConfigID() string { + if o == nil { + return "" + } + return o.ConfigID +} + +func (o *JobDebugRead) GetStatus() JobStatus { + if o == nil { + return JobStatus("") + } + return o.Status +} + +func (o *JobDebugRead) GetAirbyteVersion() string { + if o == nil { + return "" + } + return o.AirbyteVersion +} + +func (o *JobDebugRead) GetSourceDefinition() SourceDefinitionRead { + if o == nil { + return SourceDefinitionRead{} + } + return o.SourceDefinition +} + +func (o *JobDebugRead) GetDestinationDefinition() DestinationDefinitionRead { + if o == nil { + return DestinationDefinitionRead{} + } + return o.DestinationDefinition } diff --git a/internal/sdk/pkg/models/shared/jobidrequestbody.go b/internal/sdk/pkg/models/shared/jobidrequestbody.go old mode 100755 new mode 100644 index 4d46930..7cd956b --- a/internal/sdk/pkg/models/shared/jobidrequestbody.go +++ b/internal/sdk/pkg/models/shared/jobidrequestbody.go @@ -5,3 +5,10 @@ package shared type JobIDRequestBody struct { ID int64 `json:"id"` } + +func (o *JobIDRequestBody) GetID() int64 { + if o == nil { + return 0 + } + return o.ID +} diff --git a/internal/sdk/pkg/models/shared/jobinfolightread.go b/internal/sdk/pkg/models/shared/jobinfolightread.go old mode 100755 new mode 100644 index 3bbe780..4024c11 --- a/internal/sdk/pkg/models/shared/jobinfolightread.go +++ b/internal/sdk/pkg/models/shared/jobinfolightread.go @@ -2,7 +2,13 @@ package shared -// JobInfoLightRead - Successful operation type JobInfoLightRead struct { Job JobRead `json:"job"` } + +func (o *JobInfoLightRead) GetJob() JobRead { + if o == nil { + return JobRead{} + } + return o.Job +} diff --git a/internal/sdk/pkg/models/shared/jobinforead.go b/internal/sdk/pkg/models/shared/jobinforead.go old mode 100755 new mode 100644 index f7688dd..2824407 --- a/internal/sdk/pkg/models/shared/jobinforead.go +++ b/internal/sdk/pkg/models/shared/jobinforead.go @@ -2,8 +2,21 @@ package shared -// JobInfoRead - Successful operation type JobInfoRead struct { - Attempts []AttemptInfoRead `json:"attempts"` Job JobRead `json:"job"` + Attempts []AttemptInfoRead `json:"attempts"` +} + +func (o *JobInfoRead) GetJob() JobRead { + if o == nil { + return JobRead{} + } + return o.Job +} + +func (o *JobInfoRead) GetAttempts() []AttemptInfoRead { + if o == nil { + return []AttemptInfoRead{} + } + return o.Attempts } diff --git a/internal/sdk/pkg/models/shared/joblistrequestbody.go b/internal/sdk/pkg/models/shared/joblistrequestbody.go old mode 100755 new mode 100644 index 4414307..2b5ad85 --- a/internal/sdk/pkg/models/shared/joblistrequestbody.go +++ b/internal/sdk/pkg/models/shared/joblistrequestbody.go @@ -3,8 +3,36 @@ package shared type JobListRequestBody struct { - ConfigID string `json:"configId"` ConfigTypes []JobConfigType `json:"configTypes"` + ConfigID string `json:"configId"` IncludingJobID *int64 `json:"includingJobId,omitempty"` Pagination *Pagination `json:"pagination,omitempty"` } + +func (o *JobListRequestBody) GetConfigTypes() []JobConfigType { + if o == nil { + return []JobConfigType{} + } + return o.ConfigTypes +} + +func (o *JobListRequestBody) GetConfigID() string { + if o == nil { + return "" + } + return o.ConfigID +} + +func (o *JobListRequestBody) GetIncludingJobID() *int64 { + if o == nil { + return nil + } + return o.IncludingJobID +} + +func (o *JobListRequestBody) GetPagination() *Pagination { + if o == nil { + return nil + } + return o.Pagination +} diff --git a/internal/sdk/pkg/models/shared/joboptionalread.go b/internal/sdk/pkg/models/shared/joboptionalread.go old mode 100755 new mode 100644 index 8811159..9e6e00b --- a/internal/sdk/pkg/models/shared/joboptionalread.go +++ b/internal/sdk/pkg/models/shared/joboptionalread.go @@ -2,7 +2,13 @@ package shared -// JobOptionalRead - Successful operation type JobOptionalRead struct { Job *JobRead `json:"job,omitempty"` } + +func (o *JobOptionalRead) GetJob() *JobRead { + if o == nil { + return nil + } + return o.Job +} diff --git a/internal/sdk/pkg/models/shared/jobread.go b/internal/sdk/pkg/models/shared/jobread.go old mode 100755 new mode 100644 index 5452ad7..257a67e --- a/internal/sdk/pkg/models/shared/jobread.go +++ b/internal/sdk/pkg/models/shared/jobread.go @@ -3,14 +3,77 @@ package shared type JobRead struct { - ConfigID string `json:"configId"` + ID int64 `json:"id"` ConfigType JobConfigType `json:"configType"` - CreatedAt int64 `json:"createdAt"` + ConfigID string `json:"configId"` EnabledStreams []StreamDescriptor `json:"enabledStreams,omitempty"` - ID int64 `json:"id"` + CreatedAt int64 `json:"createdAt"` + UpdatedAt int64 `json:"updatedAt"` + StartedAt *int64 `json:"startedAt,omitempty"` + Status JobStatus `json:"status"` // contains information about how a reset was configured. only populated if the job was a reset. ResetConfig *ResetConfig `json:"resetConfig,omitempty"` - StartedAt *int64 `json:"startedAt,omitempty"` - Status JobStatus `json:"status"` - UpdatedAt int64 `json:"updatedAt"` +} + +func (o *JobRead) GetID() int64 { + if o == nil { + return 0 + } + return o.ID +} + +func (o *JobRead) GetConfigType() JobConfigType { + if o == nil { + return JobConfigType("") + } + return o.ConfigType +} + +func (o *JobRead) GetConfigID() string { + if o == nil { + return "" + } + return o.ConfigID +} + +func (o *JobRead) GetEnabledStreams() []StreamDescriptor { + if o == nil { + return nil + } + return o.EnabledStreams +} + +func (o *JobRead) GetCreatedAt() int64 { + if o == nil { + return 0 + } + return o.CreatedAt +} + +func (o *JobRead) GetUpdatedAt() int64 { + if o == nil { + return 0 + } + return o.UpdatedAt +} + +func (o *JobRead) GetStartedAt() *int64 { + if o == nil { + return nil + } + return o.StartedAt +} + +func (o *JobRead) GetStatus() JobStatus { + if o == nil { + return JobStatus("") + } + return o.Status +} + +func (o *JobRead) GetResetConfig() *ResetConfig { + if o == nil { + return nil + } + return o.ResetConfig } diff --git a/internal/sdk/pkg/models/shared/jobreadlist.go b/internal/sdk/pkg/models/shared/jobreadlist.go old mode 100755 new mode 100644 index 9951245..0a7e0de --- a/internal/sdk/pkg/models/shared/jobreadlist.go +++ b/internal/sdk/pkg/models/shared/jobreadlist.go @@ -2,9 +2,22 @@ package shared -// JobReadList - Successful operation type JobReadList struct { Jobs []JobWithAttemptsRead `json:"jobs"` // the total count of jobs for the specified connection TotalJobCount int64 `json:"totalJobCount"` } + +func (o *JobReadList) GetJobs() []JobWithAttemptsRead { + if o == nil { + return []JobWithAttemptsRead{} + } + return o.Jobs +} + +func (o *JobReadList) GetTotalJobCount() int64 { + if o == nil { + return 0 + } + return o.TotalJobCount +} diff --git a/internal/sdk/pkg/models/shared/jobstatus.go b/internal/sdk/pkg/models/shared/jobstatus.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/jobtype.go b/internal/sdk/pkg/models/shared/jobtype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/jobtyperesourcelimit.go b/internal/sdk/pkg/models/shared/jobtyperesourcelimit.go old mode 100755 new mode 100644 index 0b2f2c7..c0d1753 --- a/internal/sdk/pkg/models/shared/jobtyperesourcelimit.go +++ b/internal/sdk/pkg/models/shared/jobtyperesourcelimit.go @@ -9,3 +9,17 @@ type JobTypeResourceLimit struct { // optional resource requirements to run workers (blank for unbounded allocations) ResourceRequirements ResourceRequirements `json:"resourceRequirements"` } + +func (o *JobTypeResourceLimit) GetJobType() JobType { + if o == nil { + return JobType("") + } + return o.JobType +} + +func (o *JobTypeResourceLimit) GetResourceRequirements() ResourceRequirements { + if o == nil { + return ResourceRequirements{} + } + return o.ResourceRequirements +} diff --git a/internal/sdk/pkg/models/shared/jobwithattemptsread.go b/internal/sdk/pkg/models/shared/jobwithattemptsread.go old mode 100755 new mode 100644 index fc995a8..d605a06 --- a/internal/sdk/pkg/models/shared/jobwithattemptsread.go +++ b/internal/sdk/pkg/models/shared/jobwithattemptsread.go @@ -3,6 +3,20 @@ package shared type JobWithAttemptsRead struct { - Attempts []AttemptRead `json:"attempts,omitempty"` Job *JobRead `json:"job,omitempty"` + Attempts []AttemptRead `json:"attempts,omitempty"` +} + +func (o *JobWithAttemptsRead) GetJob() *JobRead { + if o == nil { + return nil + } + return o.Job +} + +func (o *JobWithAttemptsRead) GetAttempts() []AttemptRead { + if o == nil { + return nil + } + return o.Attempts } diff --git a/internal/sdk/pkg/models/shared/knownexceptioninfo.go b/internal/sdk/pkg/models/shared/knownexceptioninfo.go old mode 100755 new mode 100644 index c67979c..4c5373f --- a/internal/sdk/pkg/models/shared/knownexceptioninfo.go +++ b/internal/sdk/pkg/models/shared/knownexceptioninfo.go @@ -2,11 +2,45 @@ package shared -// KnownExceptionInfo - Exception occurred; see message for details. type KnownExceptionInfo struct { + Message string `json:"message"` ExceptionClassName *string `json:"exceptionClassName,omitempty"` ExceptionStack []string `json:"exceptionStack,omitempty"` - Message string `json:"message"` RootCauseExceptionClassName *string `json:"rootCauseExceptionClassName,omitempty"` RootCauseExceptionStack []string `json:"rootCauseExceptionStack,omitempty"` } + +func (o *KnownExceptionInfo) GetMessage() string { + if o == nil { + return "" + } + return o.Message +} + +func (o *KnownExceptionInfo) GetExceptionClassName() *string { + if o == nil { + return nil + } + return o.ExceptionClassName +} + +func (o *KnownExceptionInfo) GetExceptionStack() []string { + if o == nil { + return nil + } + return o.ExceptionStack +} + +func (o *KnownExceptionInfo) GetRootCauseExceptionClassName() *string { + if o == nil { + return nil + } + return o.RootCauseExceptionClassName +} + +func (o *KnownExceptionInfo) GetRootCauseExceptionStack() []string { + if o == nil { + return nil + } + return o.RootCauseExceptionStack +} diff --git a/internal/sdk/pkg/models/shared/listdeclarativemanifestsrequestbody.go b/internal/sdk/pkg/models/shared/listdeclarativemanifestsrequestbody.go old mode 100755 new mode 100644 index 8e11607..848346d --- a/internal/sdk/pkg/models/shared/listdeclarativemanifestsrequestbody.go +++ b/internal/sdk/pkg/models/shared/listdeclarativemanifestsrequestbody.go @@ -3,6 +3,20 @@ package shared type ListDeclarativeManifestsRequestBody struct { - SourceDefinitionID string `json:"sourceDefinitionId"` WorkspaceID string `json:"workspaceId"` + SourceDefinitionID string `json:"sourceDefinitionId"` +} + +func (o *ListDeclarativeManifestsRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *ListDeclarativeManifestsRequestBody) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID } diff --git a/internal/sdk/pkg/models/shared/logread.go b/internal/sdk/pkg/models/shared/logread.go old mode 100755 new mode 100644 index f6b5a9b..114d3f9 --- a/internal/sdk/pkg/models/shared/logread.go +++ b/internal/sdk/pkg/models/shared/logread.go @@ -5,3 +5,10 @@ package shared type LogRead struct { LogLines []string `json:"logLines"` } + +func (o *LogRead) GetLogLines() []string { + if o == nil { + return []string{} + } + return o.LogLines +} diff --git a/internal/sdk/pkg/models/shared/logsrequestbody.go b/internal/sdk/pkg/models/shared/logsrequestbody.go old mode 100755 new mode 100644 index 4e21559..8695791 --- a/internal/sdk/pkg/models/shared/logsrequestbody.go +++ b/internal/sdk/pkg/models/shared/logsrequestbody.go @@ -6,3 +6,10 @@ type LogsRequestBody struct { // type/source of logs produced LogType LogType `json:"logType"` } + +func (o *LogsRequestBody) GetLogType() LogType { + if o == nil { + return LogType("") + } + return o.LogType +} diff --git a/internal/sdk/pkg/models/shared/logtype.go b/internal/sdk/pkg/models/shared/logtype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/namespacedefinitiontype.go b/internal/sdk/pkg/models/shared/namespacedefinitiontype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/nonbreakingchangespreference.go b/internal/sdk/pkg/models/shared/nonbreakingchangespreference.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/normalizationdestinationdefinitionconfig.go b/internal/sdk/pkg/models/shared/normalizationdestinationdefinitionconfig.go old mode 100755 new mode 100644 index f2f61af..b206ffc --- a/internal/sdk/pkg/models/shared/normalizationdestinationdefinitionconfig.go +++ b/internal/sdk/pkg/models/shared/normalizationdestinationdefinitionconfig.go @@ -2,14 +2,57 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + // NormalizationDestinationDefinitionConfig - describes a normalization config for destination definition type NormalizationDestinationDefinitionConfig struct { - // a field indicating the type of integration dialect to use for normalization. - NormalizationIntegrationType *string `json:"normalizationIntegrationType,omitempty"` + // whether the destination definition supports normalization. + Supported *bool `default:"false" json:"supported"` // a field indicating the name of the repository to be used for normalization. If the value of the flag is NULL - normalization is not used. NormalizationRepository *string `json:"normalizationRepository,omitempty"` // a field indicating the tag of the docker repository to be used for normalization. NormalizationTag *string `json:"normalizationTag,omitempty"` - // whether the destination definition supports normalization. - Supported bool `json:"supported"` + // a field indicating the type of integration dialect to use for normalization. + NormalizationIntegrationType *string `json:"normalizationIntegrationType,omitempty"` +} + +func (n NormalizationDestinationDefinitionConfig) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(n, "", false) +} + +func (n *NormalizationDestinationDefinitionConfig) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &n, "", false, false); err != nil { + return err + } + return nil +} + +func (o *NormalizationDestinationDefinitionConfig) GetSupported() *bool { + if o == nil { + return nil + } + return o.Supported +} + +func (o *NormalizationDestinationDefinitionConfig) GetNormalizationRepository() *string { + if o == nil { + return nil + } + return o.NormalizationRepository +} + +func (o *NormalizationDestinationDefinitionConfig) GetNormalizationTag() *string { + if o == nil { + return nil + } + return o.NormalizationTag +} + +func (o *NormalizationDestinationDefinitionConfig) GetNormalizationIntegrationType() *string { + if o == nil { + return nil + } + return o.NormalizationIntegrationType } diff --git a/internal/sdk/pkg/models/shared/notfoundknownexceptioninfo.go b/internal/sdk/pkg/models/shared/notfoundknownexceptioninfo.go old mode 100755 new mode 100644 index 7f98d8b..4e8b957 --- a/internal/sdk/pkg/models/shared/notfoundknownexceptioninfo.go +++ b/internal/sdk/pkg/models/shared/notfoundknownexceptioninfo.go @@ -2,12 +2,53 @@ package shared -// NotFoundKnownExceptionInfo - Object with given id was not found. type NotFoundKnownExceptionInfo struct { - ExceptionClassName *string `json:"exceptionClassName,omitempty"` - ExceptionStack []string `json:"exceptionStack,omitempty"` ID *string `json:"id,omitempty"` Message string `json:"message"` + ExceptionClassName *string `json:"exceptionClassName,omitempty"` + ExceptionStack []string `json:"exceptionStack,omitempty"` RootCauseExceptionClassName *string `json:"rootCauseExceptionClassName,omitempty"` RootCauseExceptionStack []string `json:"rootCauseExceptionStack,omitempty"` } + +func (o *NotFoundKnownExceptionInfo) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *NotFoundKnownExceptionInfo) GetMessage() string { + if o == nil { + return "" + } + return o.Message +} + +func (o *NotFoundKnownExceptionInfo) GetExceptionClassName() *string { + if o == nil { + return nil + } + return o.ExceptionClassName +} + +func (o *NotFoundKnownExceptionInfo) GetExceptionStack() []string { + if o == nil { + return nil + } + return o.ExceptionStack +} + +func (o *NotFoundKnownExceptionInfo) GetRootCauseExceptionClassName() *string { + if o == nil { + return nil + } + return o.RootCauseExceptionClassName +} + +func (o *NotFoundKnownExceptionInfo) GetRootCauseExceptionStack() []string { + if o == nil { + return nil + } + return o.RootCauseExceptionStack +} diff --git a/internal/sdk/pkg/models/shared/notification.go b/internal/sdk/pkg/models/shared/notification.go old mode 100755 new mode 100644 index 447582e..efef461 --- a/internal/sdk/pkg/models/shared/notification.go +++ b/internal/sdk/pkg/models/shared/notification.go @@ -2,10 +2,60 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type Notification struct { - CustomerioConfiguration *CustomerioNotificationConfiguration `json:"customerioConfiguration,omitempty"` NotificationType NotificationType `json:"notificationType"` - SendOnFailure bool `json:"sendOnFailure"` - SendOnSuccess bool `json:"sendOnSuccess"` + SendOnSuccess *bool `default:"false" json:"sendOnSuccess"` + SendOnFailure *bool `default:"true" json:"sendOnFailure"` SlackConfiguration *SlackNotificationConfiguration `json:"slackConfiguration,omitempty"` + CustomerioConfiguration *CustomerioNotificationConfiguration `json:"customerioConfiguration,omitempty"` +} + +func (n Notification) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(n, "", false) +} + +func (n *Notification) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &n, "", false, false); err != nil { + return err + } + return nil +} + +func (o *Notification) GetNotificationType() NotificationType { + if o == nil { + return NotificationType("") + } + return o.NotificationType +} + +func (o *Notification) GetSendOnSuccess() *bool { + if o == nil { + return nil + } + return o.SendOnSuccess +} + +func (o *Notification) GetSendOnFailure() *bool { + if o == nil { + return nil + } + return o.SendOnFailure +} + +func (o *Notification) GetSlackConfiguration() *SlackNotificationConfiguration { + if o == nil { + return nil + } + return o.SlackConfiguration +} + +func (o *Notification) GetCustomerioConfiguration() *CustomerioNotificationConfiguration { + if o == nil { + return nil + } + return o.CustomerioConfiguration } diff --git a/internal/sdk/pkg/models/shared/notificationitem.go b/internal/sdk/pkg/models/shared/notificationitem.go old mode 100755 new mode 100644 index 863f32e..0cbe26f --- a/internal/sdk/pkg/models/shared/notificationitem.go +++ b/internal/sdk/pkg/models/shared/notificationitem.go @@ -3,7 +3,28 @@ package shared type NotificationItem struct { - CustomerioConfiguration *CustomerioNotificationConfiguration `json:"customerioConfiguration,omitempty"` NotificationType []NotificationType `json:"notificationType,omitempty"` SlackConfiguration *SlackNotificationConfiguration `json:"slackConfiguration,omitempty"` + CustomerioConfiguration *CustomerioNotificationConfiguration `json:"customerioConfiguration,omitempty"` +} + +func (o *NotificationItem) GetNotificationType() []NotificationType { + if o == nil { + return nil + } + return o.NotificationType +} + +func (o *NotificationItem) GetSlackConfiguration() *SlackNotificationConfiguration { + if o == nil { + return nil + } + return o.SlackConfiguration +} + +func (o *NotificationItem) GetCustomerioConfiguration() *CustomerioNotificationConfiguration { + if o == nil { + return nil + } + return o.CustomerioConfiguration } diff --git a/internal/sdk/pkg/models/shared/notificationread.go b/internal/sdk/pkg/models/shared/notificationread.go old mode 100755 new mode 100644 index bcf4e23..bd2fb91 --- a/internal/sdk/pkg/models/shared/notificationread.go +++ b/internal/sdk/pkg/models/shared/notificationread.go @@ -7,18 +7,18 @@ import ( "fmt" ) -type NotificationReadStatus string +type Status string const ( - NotificationReadStatusSucceeded NotificationReadStatus = "succeeded" - NotificationReadStatusFailed NotificationReadStatus = "failed" + StatusSucceeded Status = "succeeded" + StatusFailed Status = "failed" ) -func (e NotificationReadStatus) ToPointer() *NotificationReadStatus { +func (e Status) ToPointer() *Status { return &e } -func (e *NotificationReadStatus) UnmarshalJSON(data []byte) error { +func (e *Status) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -27,15 +27,28 @@ func (e *NotificationReadStatus) UnmarshalJSON(data []byte) error { case "succeeded": fallthrough case "failed": - *e = NotificationReadStatus(v) + *e = Status(v) return nil default: - return fmt.Errorf("invalid value for NotificationReadStatus: %v", v) + return fmt.Errorf("invalid value for Status: %v", v) } } -// NotificationRead - Successful operation type NotificationRead struct { - Message *string `json:"message,omitempty"` - Status NotificationReadStatus `json:"status"` + Status Status `json:"status"` + Message *string `json:"message,omitempty"` +} + +func (o *NotificationRead) GetStatus() Status { + if o == nil { + return Status("") + } + return o.Status +} + +func (o *NotificationRead) GetMessage() *string { + if o == nil { + return nil + } + return o.Message } diff --git a/internal/sdk/pkg/models/shared/notificationsettings.go b/internal/sdk/pkg/models/shared/notificationsettings.go old mode 100755 new mode 100644 index 43d05fc..cda872b --- a/internal/sdk/pkg/models/shared/notificationsettings.go +++ b/internal/sdk/pkg/models/shared/notificationsettings.go @@ -3,10 +3,52 @@ package shared type NotificationSettings struct { - SendOnConnectionUpdate *NotificationItem `json:"sendOnConnectionUpdate,omitempty"` - SendOnConnectionUpdateActionRequired *NotificationItem `json:"sendOnConnectionUpdateActionRequired,omitempty"` - SendOnFailure *NotificationItem `json:"sendOnFailure,omitempty"` SendOnSuccess *NotificationItem `json:"sendOnSuccess,omitempty"` + SendOnFailure *NotificationItem `json:"sendOnFailure,omitempty"` SendOnSyncDisabled *NotificationItem `json:"sendOnSyncDisabled,omitempty"` SendOnSyncDisabledWarning *NotificationItem `json:"sendOnSyncDisabledWarning,omitempty"` + SendOnConnectionUpdate *NotificationItem `json:"sendOnConnectionUpdate,omitempty"` + SendOnConnectionUpdateActionRequired *NotificationItem `json:"sendOnConnectionUpdateActionRequired,omitempty"` +} + +func (o *NotificationSettings) GetSendOnSuccess() *NotificationItem { + if o == nil { + return nil + } + return o.SendOnSuccess +} + +func (o *NotificationSettings) GetSendOnFailure() *NotificationItem { + if o == nil { + return nil + } + return o.SendOnFailure +} + +func (o *NotificationSettings) GetSendOnSyncDisabled() *NotificationItem { + if o == nil { + return nil + } + return o.SendOnSyncDisabled +} + +func (o *NotificationSettings) GetSendOnSyncDisabledWarning() *NotificationItem { + if o == nil { + return nil + } + return o.SendOnSyncDisabledWarning +} + +func (o *NotificationSettings) GetSendOnConnectionUpdate() *NotificationItem { + if o == nil { + return nil + } + return o.SendOnConnectionUpdate +} + +func (o *NotificationSettings) GetSendOnConnectionUpdateActionRequired() *NotificationItem { + if o == nil { + return nil + } + return o.SendOnConnectionUpdateActionRequired } diff --git a/internal/sdk/pkg/models/shared/notificationtype.go b/internal/sdk/pkg/models/shared/notificationtype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/oauthconfigspecification.go b/internal/sdk/pkg/models/shared/oauthconfigspecification.go old mode 100755 new mode 100644 index 037c32d..30bece1 --- a/internal/sdk/pkg/models/shared/oauthconfigspecification.go +++ b/internal/sdk/pkg/models/shared/oauthconfigspecification.go @@ -3,12 +3,40 @@ package shared type OAuthConfigSpecification struct { + // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. + OauthUserInputFromConnectorConfigSpecification interface{} `json:"oauthUserInputFromConnectorConfigSpecification,omitempty"` // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. CompleteOAuthOutputSpecification interface{} `json:"completeOAuthOutputSpecification,omitempty"` // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. CompleteOAuthServerInputSpecification interface{} `json:"completeOAuthServerInputSpecification,omitempty"` // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. CompleteOAuthServerOutputSpecification interface{} `json:"completeOAuthServerOutputSpecification,omitempty"` - // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. - OauthUserInputFromConnectorConfigSpecification interface{} `json:"oauthUserInputFromConnectorConfigSpecification,omitempty"` +} + +func (o *OAuthConfigSpecification) GetOauthUserInputFromConnectorConfigSpecification() interface{} { + if o == nil { + return nil + } + return o.OauthUserInputFromConnectorConfigSpecification +} + +func (o *OAuthConfigSpecification) GetCompleteOAuthOutputSpecification() interface{} { + if o == nil { + return nil + } + return o.CompleteOAuthOutputSpecification +} + +func (o *OAuthConfigSpecification) GetCompleteOAuthServerInputSpecification() interface{} { + if o == nil { + return nil + } + return o.CompleteOAuthServerInputSpecification +} + +func (o *OAuthConfigSpecification) GetCompleteOAuthServerOutputSpecification() interface{} { + if o == nil { + return nil + } + return o.CompleteOAuthServerOutputSpecification } diff --git a/internal/sdk/pkg/models/shared/oauthconsentread.go b/internal/sdk/pkg/models/shared/oauthconsentread.go old mode 100755 new mode 100644 index facd6b8..1917124 --- a/internal/sdk/pkg/models/shared/oauthconsentread.go +++ b/internal/sdk/pkg/models/shared/oauthconsentread.go @@ -2,7 +2,13 @@ package shared -// OAuthConsentRead - Successful operation type OAuthConsentRead struct { ConsentURL string `json:"consentUrl"` } + +func (o *OAuthConsentRead) GetConsentURL() string { + if o == nil { + return "" + } + return o.ConsentURL +} diff --git a/internal/sdk/pkg/models/shared/operationcreate.go b/internal/sdk/pkg/models/shared/operationcreate.go old mode 100755 new mode 100644 index cdd33ea..252d351 --- a/internal/sdk/pkg/models/shared/operationcreate.go +++ b/internal/sdk/pkg/models/shared/operationcreate.go @@ -3,7 +3,28 @@ package shared type OperationCreate struct { + WorkspaceID string `json:"workspaceId"` Name string `json:"name"` OperatorConfiguration OperatorConfiguration `json:"operatorConfiguration"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *OperationCreate) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *OperationCreate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *OperationCreate) GetOperatorConfiguration() OperatorConfiguration { + if o == nil { + return OperatorConfiguration{} + } + return o.OperatorConfiguration } diff --git a/internal/sdk/pkg/models/shared/operationidrequestbody.go b/internal/sdk/pkg/models/shared/operationidrequestbody.go old mode 100755 new mode 100644 index baad778..b90b5e3 --- a/internal/sdk/pkg/models/shared/operationidrequestbody.go +++ b/internal/sdk/pkg/models/shared/operationidrequestbody.go @@ -5,3 +5,10 @@ package shared type OperationIDRequestBody struct { OperationID string `json:"operationId"` } + +func (o *OperationIDRequestBody) GetOperationID() string { + if o == nil { + return "" + } + return o.OperationID +} diff --git a/internal/sdk/pkg/models/shared/operationread.go b/internal/sdk/pkg/models/shared/operationread.go old mode 100755 new mode 100644 index d918e43..1ac2cef --- a/internal/sdk/pkg/models/shared/operationread.go +++ b/internal/sdk/pkg/models/shared/operationread.go @@ -2,10 +2,37 @@ package shared -// OperationRead - Successful operation type OperationRead struct { - Name string `json:"name"` + WorkspaceID string `json:"workspaceId"` OperationID string `json:"operationId"` + Name string `json:"name"` OperatorConfiguration OperatorConfiguration `json:"operatorConfiguration"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *OperationRead) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *OperationRead) GetOperationID() string { + if o == nil { + return "" + } + return o.OperationID +} + +func (o *OperationRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *OperationRead) GetOperatorConfiguration() OperatorConfiguration { + if o == nil { + return OperatorConfiguration{} + } + return o.OperatorConfiguration } diff --git a/internal/sdk/pkg/models/shared/operationreadlist.go b/internal/sdk/pkg/models/shared/operationreadlist.go old mode 100755 new mode 100644 index 1b3f2c8..6b85801 --- a/internal/sdk/pkg/models/shared/operationreadlist.go +++ b/internal/sdk/pkg/models/shared/operationreadlist.go @@ -2,7 +2,13 @@ package shared -// OperationReadList - Successful operation type OperationReadList struct { Operations []OperationRead `json:"operations"` } + +func (o *OperationReadList) GetOperations() []OperationRead { + if o == nil { + return []OperationRead{} + } + return o.Operations +} diff --git a/internal/sdk/pkg/models/shared/operationupdate.go b/internal/sdk/pkg/models/shared/operationupdate.go old mode 100755 new mode 100644 index 3857209..a714441 --- a/internal/sdk/pkg/models/shared/operationupdate.go +++ b/internal/sdk/pkg/models/shared/operationupdate.go @@ -3,7 +3,28 @@ package shared type OperationUpdate struct { - Name string `json:"name"` OperationID string `json:"operationId"` + Name string `json:"name"` OperatorConfiguration OperatorConfiguration `json:"operatorConfiguration"` } + +func (o *OperationUpdate) GetOperationID() string { + if o == nil { + return "" + } + return o.OperationID +} + +func (o *OperationUpdate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *OperationUpdate) GetOperatorConfiguration() OperatorConfiguration { + if o == nil { + return OperatorConfiguration{} + } + return o.OperatorConfiguration +} diff --git a/internal/sdk/pkg/models/shared/operatorconfiguration.go b/internal/sdk/pkg/models/shared/operatorconfiguration.go old mode 100755 new mode 100644 index 626cc06..328ab2a --- a/internal/sdk/pkg/models/shared/operatorconfiguration.go +++ b/internal/sdk/pkg/models/shared/operatorconfiguration.go @@ -3,8 +3,36 @@ package shared type OperatorConfiguration struct { - Dbt *OperatorDbt `json:"dbt,omitempty"` - Normalization *OperatorNormalization `json:"normalization,omitempty"` OperatorType OperatorType `json:"operatorType"` + Normalization *OperatorNormalization `json:"normalization,omitempty"` + Dbt *OperatorDbt `json:"dbt,omitempty"` Webhook *OperatorWebhook `json:"webhook,omitempty"` } + +func (o *OperatorConfiguration) GetOperatorType() OperatorType { + if o == nil { + return OperatorType("") + } + return o.OperatorType +} + +func (o *OperatorConfiguration) GetNormalization() *OperatorNormalization { + if o == nil { + return nil + } + return o.Normalization +} + +func (o *OperatorConfiguration) GetDbt() *OperatorDbt { + if o == nil { + return nil + } + return o.Dbt +} + +func (o *OperatorConfiguration) GetWebhook() *OperatorWebhook { + if o == nil { + return nil + } + return o.Webhook +} diff --git a/internal/sdk/pkg/models/shared/operatordbt.go b/internal/sdk/pkg/models/shared/operatordbt.go old mode 100755 new mode 100644 index 5ee1431..c13a6ee --- a/internal/sdk/pkg/models/shared/operatordbt.go +++ b/internal/sdk/pkg/models/shared/operatordbt.go @@ -3,8 +3,36 @@ package shared type OperatorDbt struct { - DbtArguments *string `json:"dbtArguments,omitempty"` - DockerImage *string `json:"dockerImage,omitempty"` - GitRepoBranch *string `json:"gitRepoBranch,omitempty"` GitRepoURL string `json:"gitRepoUrl"` + GitRepoBranch *string `json:"gitRepoBranch,omitempty"` + DockerImage *string `json:"dockerImage,omitempty"` + DbtArguments *string `json:"dbtArguments,omitempty"` +} + +func (o *OperatorDbt) GetGitRepoURL() string { + if o == nil { + return "" + } + return o.GitRepoURL +} + +func (o *OperatorDbt) GetGitRepoBranch() *string { + if o == nil { + return nil + } + return o.GitRepoBranch +} + +func (o *OperatorDbt) GetDockerImage() *string { + if o == nil { + return nil + } + return o.DockerImage +} + +func (o *OperatorDbt) GetDbtArguments() *string { + if o == nil { + return nil + } + return o.DbtArguments } diff --git a/internal/sdk/pkg/models/shared/operatornormalization.go b/internal/sdk/pkg/models/shared/operatornormalization.go old mode 100755 new mode 100644 index 393e3f5..a581109 --- a/internal/sdk/pkg/models/shared/operatornormalization.go +++ b/internal/sdk/pkg/models/shared/operatornormalization.go @@ -7,30 +7,37 @@ import ( "fmt" ) -type OperatorNormalizationOption string +type Option string const ( - OperatorNormalizationOptionBasic OperatorNormalizationOption = "basic" + OptionBasic Option = "basic" ) -func (e OperatorNormalizationOption) ToPointer() *OperatorNormalizationOption { +func (e Option) ToPointer() *Option { return &e } -func (e *OperatorNormalizationOption) UnmarshalJSON(data []byte) error { +func (e *Option) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case "basic": - *e = OperatorNormalizationOption(v) + *e = Option(v) return nil default: - return fmt.Errorf("invalid value for OperatorNormalizationOption: %v", v) + return fmt.Errorf("invalid value for Option: %v", v) } } type OperatorNormalization struct { - Option *OperatorNormalizationOption `json:"option,omitempty"` + Option *Option `json:"option,omitempty"` +} + +func (o *OperatorNormalization) GetOption() *Option { + if o == nil { + return nil + } + return o.Option } diff --git a/internal/sdk/pkg/models/shared/operatortype.go b/internal/sdk/pkg/models/shared/operatortype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/operatorwebhook.go b/internal/sdk/pkg/models/shared/operatorwebhook.go old mode 100755 new mode 100644 index 6ff7258..59d1285 --- a/internal/sdk/pkg/models/shared/operatorwebhook.go +++ b/internal/sdk/pkg/models/shared/operatorwebhook.go @@ -7,48 +7,97 @@ import ( "fmt" ) -type OperatorWebhookDbtCloud struct { - // The account id associated with the job - AccountID int64 `json:"accountId"` - // The job id associated with the job - JobID int64 `json:"jobId"` -} - -type OperatorWebhookWebhookType string +type WebhookType string const ( - OperatorWebhookWebhookTypeDbtCloud OperatorWebhookWebhookType = "dbtCloud" + WebhookTypeDbtCloud WebhookType = "dbtCloud" ) -func (e OperatorWebhookWebhookType) ToPointer() *OperatorWebhookWebhookType { +func (e WebhookType) ToPointer() *WebhookType { return &e } -func (e *OperatorWebhookWebhookType) UnmarshalJSON(data []byte) error { +func (e *WebhookType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err } switch v { case "dbtCloud": - *e = OperatorWebhookWebhookType(v) + *e = WebhookType(v) return nil default: - return fmt.Errorf("invalid value for OperatorWebhookWebhookType: %v", v) + return fmt.Errorf("invalid value for WebhookType: %v", v) + } +} + +type DbtCloud struct { + // The account id associated with the job + AccountID int64 `json:"accountId"` + // The job id associated with the job + JobID int64 `json:"jobId"` +} + +func (o *DbtCloud) GetAccountID() int64 { + if o == nil { + return 0 } + return o.AccountID +} + +func (o *DbtCloud) GetJobID() int64 { + if o == nil { + return 0 + } + return o.JobID } type OperatorWebhook struct { - DbtCloud *OperatorWebhookDbtCloud `json:"dbtCloud,omitempty"` + // The id of the webhook configs to use from the workspace. + WebhookConfigID *string `json:"webhookConfigId,omitempty"` + WebhookType *WebhookType `json:"webhookType,omitempty"` + DbtCloud *DbtCloud `json:"dbtCloud,omitempty"` // DEPRECATED. Populate dbtCloud instead. // - // Deprecated: this field will be removed in a future release, please migrate away from it as soon as possible. - ExecutionBody *string `json:"executionBody,omitempty"` + // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + ExecutionURL *string `json:"executionUrl,omitempty"` // DEPRECATED. Populate dbtCloud instead. // - // Deprecated: this field will be removed in a future release, please migrate away from it as soon as possible. - ExecutionURL *string `json:"executionUrl,omitempty"` - // The id of the webhook configs to use from the workspace. - WebhookConfigID *string `json:"webhookConfigId,omitempty"` - WebhookType *OperatorWebhookWebhookType `json:"webhookType,omitempty"` + // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + ExecutionBody *string `json:"executionBody,omitempty"` +} + +func (o *OperatorWebhook) GetWebhookConfigID() *string { + if o == nil { + return nil + } + return o.WebhookConfigID +} + +func (o *OperatorWebhook) GetWebhookType() *WebhookType { + if o == nil { + return nil + } + return o.WebhookType +} + +func (o *OperatorWebhook) GetDbtCloud() *DbtCloud { + if o == nil { + return nil + } + return o.DbtCloud +} + +func (o *OperatorWebhook) GetExecutionURL() *string { + if o == nil { + return nil + } + return o.ExecutionURL +} + +func (o *OperatorWebhook) GetExecutionBody() *string { + if o == nil { + return nil + } + return o.ExecutionBody } diff --git a/internal/sdk/pkg/models/shared/pagination.go b/internal/sdk/pkg/models/shared/pagination.go old mode 100755 new mode 100644 index a60d7a9..df28c4a --- a/internal/sdk/pkg/models/shared/pagination.go +++ b/internal/sdk/pkg/models/shared/pagination.go @@ -6,3 +6,17 @@ type Pagination struct { PageSize *int64 `json:"pageSize,omitempty"` RowOffset *int64 `json:"rowOffset,omitempty"` } + +func (o *Pagination) GetPageSize() *int64 { + if o == nil { + return nil + } + return o.PageSize +} + +func (o *Pagination) GetRowOffset() *int64 { + if o == nil { + return nil + } + return o.RowOffset +} diff --git a/internal/sdk/pkg/models/shared/partialdestinationupdate.go b/internal/sdk/pkg/models/shared/partialdestinationupdate.go old mode 100755 new mode 100644 index 6b0a9fb..effa9f9 --- a/internal/sdk/pkg/models/shared/partialdestinationupdate.go +++ b/internal/sdk/pkg/models/shared/partialdestinationupdate.go @@ -3,8 +3,29 @@ package shared type PartialDestinationUpdate struct { + DestinationID *string `json:"destinationId,omitempty"` // The values required to configure the destination. The schema for this must match the schema return by destination_definition_specifications/get for the destinationDefinition. ConnectionConfiguration interface{} `json:"connectionConfiguration,omitempty"` - DestinationID *string `json:"destinationId,omitempty"` Name *string `json:"name,omitempty"` } + +func (o *PartialDestinationUpdate) GetDestinationID() *string { + if o == nil { + return nil + } + return o.DestinationID +} + +func (o *PartialDestinationUpdate) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *PartialDestinationUpdate) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/internal/sdk/pkg/models/shared/partialsourceupdate.go b/internal/sdk/pkg/models/shared/partialsourceupdate.go old mode 100755 new mode 100644 index 8adad72..a22a409 --- a/internal/sdk/pkg/models/shared/partialsourceupdate.go +++ b/internal/sdk/pkg/models/shared/partialsourceupdate.go @@ -3,9 +3,37 @@ package shared type PartialSourceUpdate struct { + SourceID string `json:"sourceId"` // The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source. ConnectionConfiguration interface{} `json:"connectionConfiguration,omitempty"` Name *string `json:"name,omitempty"` SecretID *string `json:"secretId,omitempty"` - SourceID string `json:"sourceId"` +} + +func (o *PartialSourceUpdate) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *PartialSourceUpdate) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *PartialSourceUpdate) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *PartialSourceUpdate) GetSecretID() *string { + if o == nil { + return nil + } + return o.SecretID } diff --git a/internal/sdk/pkg/models/shared/privatedestinationdefinitionread.go b/internal/sdk/pkg/models/shared/privatedestinationdefinitionread.go old mode 100755 new mode 100644 index a753df0..c6a83a7 --- a/internal/sdk/pkg/models/shared/privatedestinationdefinitionread.go +++ b/internal/sdk/pkg/models/shared/privatedestinationdefinitionread.go @@ -2,8 +2,21 @@ package shared -// PrivateDestinationDefinitionRead - Successful operation type PrivateDestinationDefinitionRead struct { DestinationDefinition DestinationDefinitionRead `json:"destinationDefinition"` Granted bool `json:"granted"` } + +func (o *PrivateDestinationDefinitionRead) GetDestinationDefinition() DestinationDefinitionRead { + if o == nil { + return DestinationDefinitionRead{} + } + return o.DestinationDefinition +} + +func (o *PrivateDestinationDefinitionRead) GetGranted() bool { + if o == nil { + return false + } + return o.Granted +} diff --git a/internal/sdk/pkg/models/shared/privatedestinationdefinitionreadlist.go b/internal/sdk/pkg/models/shared/privatedestinationdefinitionreadlist.go old mode 100755 new mode 100644 index 4ff9a53..b9721e0 --- a/internal/sdk/pkg/models/shared/privatedestinationdefinitionreadlist.go +++ b/internal/sdk/pkg/models/shared/privatedestinationdefinitionreadlist.go @@ -2,7 +2,13 @@ package shared -// PrivateDestinationDefinitionReadList - Successful operation type PrivateDestinationDefinitionReadList struct { DestinationDefinitions []PrivateDestinationDefinitionRead `json:"destinationDefinitions"` } + +func (o *PrivateDestinationDefinitionReadList) GetDestinationDefinitions() []PrivateDestinationDefinitionRead { + if o == nil { + return []PrivateDestinationDefinitionRead{} + } + return o.DestinationDefinitions +} diff --git a/internal/sdk/pkg/models/shared/privatesourcedefinitionread.go b/internal/sdk/pkg/models/shared/privatesourcedefinitionread.go old mode 100755 new mode 100644 index 2f442b5..29e5f13 --- a/internal/sdk/pkg/models/shared/privatesourcedefinitionread.go +++ b/internal/sdk/pkg/models/shared/privatesourcedefinitionread.go @@ -2,8 +2,21 @@ package shared -// PrivateSourceDefinitionRead - Successful operation type PrivateSourceDefinitionRead struct { - Granted bool `json:"granted"` SourceDefinition SourceDefinitionRead `json:"sourceDefinition"` + Granted bool `json:"granted"` +} + +func (o *PrivateSourceDefinitionRead) GetSourceDefinition() SourceDefinitionRead { + if o == nil { + return SourceDefinitionRead{} + } + return o.SourceDefinition +} + +func (o *PrivateSourceDefinitionRead) GetGranted() bool { + if o == nil { + return false + } + return o.Granted } diff --git a/internal/sdk/pkg/models/shared/privatesourcedefinitionreadlist.go b/internal/sdk/pkg/models/shared/privatesourcedefinitionreadlist.go old mode 100755 new mode 100644 index 422c35c..8e03d26 --- a/internal/sdk/pkg/models/shared/privatesourcedefinitionreadlist.go +++ b/internal/sdk/pkg/models/shared/privatesourcedefinitionreadlist.go @@ -2,7 +2,13 @@ package shared -// PrivateSourceDefinitionReadList - Successful operation type PrivateSourceDefinitionReadList struct { SourceDefinitions []PrivateSourceDefinitionRead `json:"sourceDefinitions"` } + +func (o *PrivateSourceDefinitionReadList) GetSourceDefinitions() []PrivateSourceDefinitionRead { + if o == nil { + return []PrivateSourceDefinitionRead{} + } + return o.SourceDefinitions +} diff --git a/internal/sdk/pkg/models/shared/releasestage.go b/internal/sdk/pkg/models/shared/releasestage.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/resetconfig.go b/internal/sdk/pkg/models/shared/resetconfig.go old mode 100755 new mode 100644 index 3ec69da..233182b --- a/internal/sdk/pkg/models/shared/resetconfig.go +++ b/internal/sdk/pkg/models/shared/resetconfig.go @@ -6,3 +6,10 @@ package shared type ResetConfig struct { StreamsToReset []StreamDescriptor `json:"streamsToReset,omitempty"` } + +func (o *ResetConfig) GetStreamsToReset() []StreamDescriptor { + if o == nil { + return nil + } + return o.StreamsToReset +} diff --git a/internal/sdk/pkg/models/shared/resourcerequirements.go b/internal/sdk/pkg/models/shared/resourcerequirements.go old mode 100755 new mode 100644 index c88a6bb..4f80ba2 --- a/internal/sdk/pkg/models/shared/resourcerequirements.go +++ b/internal/sdk/pkg/models/shared/resourcerequirements.go @@ -4,8 +4,36 @@ package shared // ResourceRequirements - optional resource requirements to run workers (blank for unbounded allocations) type ResourceRequirements struct { - CPULimit *string `json:"cpu_limit,omitempty"` CPURequest *string `json:"cpu_request,omitempty"` - MemoryLimit *string `json:"memory_limit,omitempty"` + CPULimit *string `json:"cpu_limit,omitempty"` MemoryRequest *string `json:"memory_request,omitempty"` + MemoryLimit *string `json:"memory_limit,omitempty"` +} + +func (o *ResourceRequirements) GetCPURequest() *string { + if o == nil { + return nil + } + return o.CPURequest +} + +func (o *ResourceRequirements) GetCPULimit() *string { + if o == nil { + return nil + } + return o.CPULimit +} + +func (o *ResourceRequirements) GetMemoryRequest() *string { + if o == nil { + return nil + } + return o.MemoryRequest +} + +func (o *ResourceRequirements) GetMemoryLimit() *string { + if o == nil { + return nil + } + return o.MemoryLimit } diff --git a/internal/sdk/pkg/models/shared/revokesourceoauthtokensrequest.go b/internal/sdk/pkg/models/shared/revokesourceoauthtokensrequest.go old mode 100755 new mode 100644 index 34c8fe4..5c3db5a --- a/internal/sdk/pkg/models/shared/revokesourceoauthtokensrequest.go +++ b/internal/sdk/pkg/models/shared/revokesourceoauthtokensrequest.go @@ -3,7 +3,28 @@ package shared type RevokeSourceOauthTokensRequest struct { - SourceDefinitionID string `json:"sourceDefinitionId"` - SourceID string `json:"sourceId"` WorkspaceID string `json:"workspaceId"` + SourceID string `json:"sourceId"` + SourceDefinitionID string `json:"sourceDefinitionId"` +} + +func (o *RevokeSourceOauthTokensRequest) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *RevokeSourceOauthTokensRequest) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *RevokeSourceOauthTokensRequest) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID } diff --git a/internal/sdk/pkg/models/shared/saveattemptsyncconfigrequestbody.go b/internal/sdk/pkg/models/shared/saveattemptsyncconfigrequestbody.go old mode 100755 new mode 100644 index 3d5b8e5..e17d824 --- a/internal/sdk/pkg/models/shared/saveattemptsyncconfigrequestbody.go +++ b/internal/sdk/pkg/models/shared/saveattemptsyncconfigrequestbody.go @@ -3,7 +3,28 @@ package shared type SaveAttemptSyncConfigRequestBody struct { - AttemptNumber int `json:"attemptNumber"` JobID int64 `json:"jobId"` + AttemptNumber int `json:"attemptNumber"` SyncConfig AttemptSyncConfig `json:"syncConfig"` } + +func (o *SaveAttemptSyncConfigRequestBody) GetJobID() int64 { + if o == nil { + return 0 + } + return o.JobID +} + +func (o *SaveAttemptSyncConfigRequestBody) GetAttemptNumber() int { + if o == nil { + return 0 + } + return o.AttemptNumber +} + +func (o *SaveAttemptSyncConfigRequestBody) GetSyncConfig() AttemptSyncConfig { + if o == nil { + return AttemptSyncConfig{} + } + return o.SyncConfig +} diff --git a/internal/sdk/pkg/models/shared/savestatsrequestbody.go b/internal/sdk/pkg/models/shared/savestatsrequestbody.go old mode 100755 new mode 100644 index 2ff6eff..e3798da --- a/internal/sdk/pkg/models/shared/savestatsrequestbody.go +++ b/internal/sdk/pkg/models/shared/savestatsrequestbody.go @@ -3,8 +3,36 @@ package shared type SaveStatsRequestBody struct { - AttemptNumber int `json:"attemptNumber"` JobID int64 `json:"jobId"` + AttemptNumber int `json:"attemptNumber"` Stats AttemptStats `json:"stats"` StreamStats []AttemptStreamStats `json:"streamStats,omitempty"` } + +func (o *SaveStatsRequestBody) GetJobID() int64 { + if o == nil { + return 0 + } + return o.JobID +} + +func (o *SaveStatsRequestBody) GetAttemptNumber() int { + if o == nil { + return 0 + } + return o.AttemptNumber +} + +func (o *SaveStatsRequestBody) GetStats() AttemptStats { + if o == nil { + return AttemptStats{} + } + return o.Stats +} + +func (o *SaveStatsRequestBody) GetStreamStats() []AttemptStreamStats { + if o == nil { + return nil + } + return o.StreamStats +} diff --git a/internal/sdk/pkg/models/shared/schemachange.go b/internal/sdk/pkg/models/shared/schemachange.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/security.go b/internal/sdk/pkg/models/shared/security.go old mode 100755 new mode 100644 index e17529b..8f83468 --- a/internal/sdk/pkg/models/shared/security.go +++ b/internal/sdk/pkg/models/shared/security.go @@ -3,6 +3,20 @@ package shared type Security struct { - Password string `security:"scheme,type=http,subtype=basic,name=password"` Username string `security:"scheme,type=http,subtype=basic,name=username"` + Password string `security:"scheme,type=http,subtype=basic,name=password"` +} + +func (o *Security) GetUsername() string { + if o == nil { + return "" + } + return o.Username +} + +func (o *Security) GetPassword() string { + if o == nil { + return "" + } + return o.Password } diff --git a/internal/sdk/pkg/models/shared/selectedfieldinfo.go b/internal/sdk/pkg/models/shared/selectedfieldinfo.go old mode 100755 new mode 100644 index 0ded696..b83839d --- a/internal/sdk/pkg/models/shared/selectedfieldinfo.go +++ b/internal/sdk/pkg/models/shared/selectedfieldinfo.go @@ -6,3 +6,10 @@ package shared type SelectedFieldInfo struct { FieldPath []string `json:"fieldPath,omitempty"` } + +func (o *SelectedFieldInfo) GetFieldPath() []string { + if o == nil { + return nil + } + return o.FieldPath +} diff --git a/internal/sdk/pkg/models/shared/setinstancewidedestinationoauthparamsrequestbody.go b/internal/sdk/pkg/models/shared/setinstancewidedestinationoauthparamsrequestbody.go old mode 100755 new mode 100644 index 96ad9c0..0392bd0 --- a/internal/sdk/pkg/models/shared/setinstancewidedestinationoauthparamsrequestbody.go +++ b/internal/sdk/pkg/models/shared/setinstancewidedestinationoauthparamsrequestbody.go @@ -6,3 +6,17 @@ type SetInstancewideDestinationOauthParamsRequestBody struct { DestinationDefinitionID string `json:"destinationDefinitionId"` Params map[string]interface{} `json:"params"` } + +func (o *SetInstancewideDestinationOauthParamsRequestBody) GetDestinationDefinitionID() string { + if o == nil { + return "" + } + return o.DestinationDefinitionID +} + +func (o *SetInstancewideDestinationOauthParamsRequestBody) GetParams() map[string]interface{} { + if o == nil { + return map[string]interface{}{} + } + return o.Params +} diff --git a/internal/sdk/pkg/models/shared/setinstancewidesourceoauthparamsrequestbody.go b/internal/sdk/pkg/models/shared/setinstancewidesourceoauthparamsrequestbody.go old mode 100755 new mode 100644 index 03f82f6..b97e3d7 --- a/internal/sdk/pkg/models/shared/setinstancewidesourceoauthparamsrequestbody.go +++ b/internal/sdk/pkg/models/shared/setinstancewidesourceoauthparamsrequestbody.go @@ -3,6 +3,20 @@ package shared type SetInstancewideSourceOauthParamsRequestBody struct { - Params map[string]interface{} `json:"params"` SourceDefinitionID string `json:"sourceDefinitionId"` + Params map[string]interface{} `json:"params"` +} + +func (o *SetInstancewideSourceOauthParamsRequestBody) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SetInstancewideSourceOauthParamsRequestBody) GetParams() map[string]interface{} { + if o == nil { + return map[string]interface{}{} + } + return o.Params } diff --git a/internal/sdk/pkg/models/shared/setworkflowinattemptrequestbody.go b/internal/sdk/pkg/models/shared/setworkflowinattemptrequestbody.go old mode 100755 new mode 100644 index fd80b85..f78677b --- a/internal/sdk/pkg/models/shared/setworkflowinattemptrequestbody.go +++ b/internal/sdk/pkg/models/shared/setworkflowinattemptrequestbody.go @@ -2,9 +2,52 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type SetWorkflowInAttemptRequestBody struct { - AttemptNumber int `json:"attemptNumber"` JobID int64 `json:"jobId"` - ProcessingTaskQueue *string `json:"processingTaskQueue,omitempty"` + AttemptNumber int `json:"attemptNumber"` WorkflowID string `json:"workflowId"` + ProcessingTaskQueue *string `default:"" json:"processingTaskQueue"` +} + +func (s SetWorkflowInAttemptRequestBody) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *SetWorkflowInAttemptRequestBody) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + return err + } + return nil +} + +func (o *SetWorkflowInAttemptRequestBody) GetJobID() int64 { + if o == nil { + return 0 + } + return o.JobID +} + +func (o *SetWorkflowInAttemptRequestBody) GetAttemptNumber() int { + if o == nil { + return 0 + } + return o.AttemptNumber +} + +func (o *SetWorkflowInAttemptRequestBody) GetWorkflowID() string { + if o == nil { + return "" + } + return o.WorkflowID +} + +func (o *SetWorkflowInAttemptRequestBody) GetProcessingTaskQueue() *string { + if o == nil { + return nil + } + return o.ProcessingTaskQueue } diff --git a/internal/sdk/pkg/models/shared/slacknotificationconfiguration.go b/internal/sdk/pkg/models/shared/slacknotificationconfiguration.go old mode 100755 new mode 100644 index 477bad1..6eb5a92 --- a/internal/sdk/pkg/models/shared/slacknotificationconfiguration.go +++ b/internal/sdk/pkg/models/shared/slacknotificationconfiguration.go @@ -5,3 +5,10 @@ package shared type SlackNotificationConfiguration struct { Webhook string `json:"webhook"` } + +func (o *SlackNotificationConfiguration) GetWebhook() string { + if o == nil { + return "" + } + return o.Webhook +} diff --git a/internal/sdk/pkg/models/shared/slugrequestbody.go b/internal/sdk/pkg/models/shared/slugrequestbody.go old mode 100755 new mode 100644 index 343a9f5..d7d7f62 --- a/internal/sdk/pkg/models/shared/slugrequestbody.go +++ b/internal/sdk/pkg/models/shared/slugrequestbody.go @@ -5,3 +5,10 @@ package shared type SlugRequestBody struct { Slug string `json:"slug"` } + +func (o *SlugRequestBody) GetSlug() string { + if o == nil { + return "" + } + return o.Slug +} diff --git a/internal/sdk/pkg/models/shared/sourceautopropagatechange.go b/internal/sdk/pkg/models/shared/sourceautopropagatechange.go old mode 100755 new mode 100644 index 9b80b63..85f0645 --- a/internal/sdk/pkg/models/shared/sourceautopropagatechange.go +++ b/internal/sdk/pkg/models/shared/sourceautopropagatechange.go @@ -10,3 +10,31 @@ type SourceAutoPropagateChange struct { SourceID string `json:"sourceId"` WorkspaceID string `json:"workspaceId"` } + +func (o *SourceAutoPropagateChange) GetCatalog() AirbyteCatalog { + if o == nil { + return AirbyteCatalog{} + } + return o.Catalog +} + +func (o *SourceAutoPropagateChange) GetCatalogID() string { + if o == nil { + return "" + } + return o.CatalogID +} + +func (o *SourceAutoPropagateChange) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *SourceAutoPropagateChange) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/sourcecloneconfiguration.go b/internal/sdk/pkg/models/shared/sourcecloneconfiguration.go old mode 100755 new mode 100644 index 1447190..6662110 --- a/internal/sdk/pkg/models/shared/sourcecloneconfiguration.go +++ b/internal/sdk/pkg/models/shared/sourcecloneconfiguration.go @@ -7,3 +7,17 @@ type SourceCloneConfiguration struct { ConnectionConfiguration interface{} `json:"connectionConfiguration,omitempty"` Name *string `json:"name,omitempty"` } + +func (o *SourceCloneConfiguration) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *SourceCloneConfiguration) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/internal/sdk/pkg/models/shared/sourceclonerequestbody.go b/internal/sdk/pkg/models/shared/sourceclonerequestbody.go old mode 100755 new mode 100644 index e85b77c..b2f37fa --- a/internal/sdk/pkg/models/shared/sourceclonerequestbody.go +++ b/internal/sdk/pkg/models/shared/sourceclonerequestbody.go @@ -7,3 +7,17 @@ type SourceCloneRequestBody struct { SourceCloneID string `json:"sourceCloneId"` SourceConfiguration *SourceCloneConfiguration `json:"sourceConfiguration,omitempty"` } + +func (o *SourceCloneRequestBody) GetSourceCloneID() string { + if o == nil { + return "" + } + return o.SourceCloneID +} + +func (o *SourceCloneRequestBody) GetSourceConfiguration() *SourceCloneConfiguration { + if o == nil { + return nil + } + return o.SourceConfiguration +} diff --git a/internal/sdk/pkg/models/shared/sourcecoreconfig.go b/internal/sdk/pkg/models/shared/sourcecoreconfig.go old mode 100755 new mode 100644 index eb6e0f2..5541ca2 --- a/internal/sdk/pkg/models/shared/sourcecoreconfig.go +++ b/internal/sdk/pkg/models/shared/sourcecoreconfig.go @@ -3,9 +3,37 @@ package shared type SourceCoreConfig struct { + SourceID *string `json:"sourceId,omitempty"` + SourceDefinitionID string `json:"sourceDefinitionId"` // The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source. ConnectionConfiguration interface{} `json:"connectionConfiguration"` - SourceDefinitionID string `json:"sourceDefinitionId"` - SourceID *string `json:"sourceId,omitempty"` WorkspaceID string `json:"workspaceId"` } + +func (o *SourceCoreConfig) GetSourceID() *string { + if o == nil { + return nil + } + return o.SourceID +} + +func (o *SourceCoreConfig) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceCoreConfig) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *SourceCoreConfig) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/sourcecreate.go b/internal/sdk/pkg/models/shared/sourcecreate.go old mode 100755 new mode 100644 index 280ae89..28f5015 --- a/internal/sdk/pkg/models/shared/sourcecreate.go +++ b/internal/sdk/pkg/models/shared/sourcecreate.go @@ -3,10 +3,45 @@ package shared type SourceCreate struct { + SourceDefinitionID string `json:"sourceDefinitionId"` // The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source. ConnectionConfiguration interface{} `json:"connectionConfiguration"` + WorkspaceID string `json:"workspaceId"` Name string `json:"name"` SecretID *string `json:"secretId,omitempty"` - SourceDefinitionID string `json:"sourceDefinitionId"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *SourceCreate) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceCreate) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *SourceCreate) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *SourceCreate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *SourceCreate) GetSecretID() *string { + if o == nil { + return nil + } + return o.SecretID } diff --git a/internal/sdk/pkg/models/shared/sourcedefinitioncreate.go b/internal/sdk/pkg/models/shared/sourcedefinitioncreate.go old mode 100755 new mode 100644 index 248248f..1d3c01e --- a/internal/sdk/pkg/models/shared/sourcedefinitioncreate.go +++ b/internal/sdk/pkg/models/shared/sourcedefinitioncreate.go @@ -3,11 +3,53 @@ package shared type SourceDefinitionCreate struct { - DockerImageTag string `json:"dockerImageTag"` + Name string `json:"name"` DockerRepository string `json:"dockerRepository"` + DockerImageTag string `json:"dockerImageTag"` DocumentationURL string `json:"documentationUrl"` Icon *string `json:"icon,omitempty"` - Name string `json:"name"` // actor definition specific resource requirements. if default is set, these are the requirements that should be set for ALL jobs run for this actor definition. it is overriden by the job type specific configurations. if not set, the platform will use defaults. these values will be overriden by configuration at the connection level. ResourceRequirements *ActorDefinitionResourceRequirements `json:"resourceRequirements,omitempty"` } + +func (o *SourceDefinitionCreate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *SourceDefinitionCreate) GetDockerRepository() string { + if o == nil { + return "" + } + return o.DockerRepository +} + +func (o *SourceDefinitionCreate) GetDockerImageTag() string { + if o == nil { + return "" + } + return o.DockerImageTag +} + +func (o *SourceDefinitionCreate) GetDocumentationURL() string { + if o == nil { + return "" + } + return o.DocumentationURL +} + +func (o *SourceDefinitionCreate) GetIcon() *string { + if o == nil { + return nil + } + return o.Icon +} + +func (o *SourceDefinitionCreate) GetResourceRequirements() *ActorDefinitionResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} diff --git a/internal/sdk/pkg/models/shared/sourcedefinitionidbody.go b/internal/sdk/pkg/models/shared/sourcedefinitionidbody.go old mode 100755 new mode 100644 index 3b5747c..fc5144e --- a/internal/sdk/pkg/models/shared/sourcedefinitionidbody.go +++ b/internal/sdk/pkg/models/shared/sourcedefinitionidbody.go @@ -2,7 +2,13 @@ package shared -// SourceDefinitionIDBody - Successful operation type SourceDefinitionIDBody struct { SourceDefinitionID string `json:"sourceDefinitionId"` } + +func (o *SourceDefinitionIDBody) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} diff --git a/internal/sdk/pkg/models/shared/sourcedefinitionidrequestbody.go b/internal/sdk/pkg/models/shared/sourcedefinitionidrequestbody.go old mode 100755 new mode 100644 index 3fd44a5..69487dd --- a/internal/sdk/pkg/models/shared/sourcedefinitionidrequestbody.go +++ b/internal/sdk/pkg/models/shared/sourcedefinitionidrequestbody.go @@ -5,3 +5,10 @@ package shared type SourceDefinitionIDRequestBody struct { SourceDefinitionID string `json:"sourceDefinitionId"` } + +func (o *SourceDefinitionIDRequestBody) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} diff --git a/internal/sdk/pkg/models/shared/sourcedefinitionidwithworkspaceid.go b/internal/sdk/pkg/models/shared/sourcedefinitionidwithworkspaceid.go old mode 100755 new mode 100644 index fb8e49f..5e46104 --- a/internal/sdk/pkg/models/shared/sourcedefinitionidwithworkspaceid.go +++ b/internal/sdk/pkg/models/shared/sourcedefinitionidwithworkspaceid.go @@ -6,3 +6,17 @@ type SourceDefinitionIDWithWorkspaceID struct { SourceDefinitionID string `json:"sourceDefinitionId"` WorkspaceID string `json:"workspaceId"` } + +func (o *SourceDefinitionIDWithWorkspaceID) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceDefinitionIDWithWorkspaceID) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/sourcedefinitionread.go b/internal/sdk/pkg/models/shared/sourcedefinitionread.go old mode 100755 new mode 100644 index 88c0d40..3cbf5c2 --- a/internal/sdk/pkg/models/shared/sourcedefinitionread.go +++ b/internal/sdk/pkg/models/shared/sourcedefinitionread.go @@ -3,25 +3,26 @@ package shared import ( - "airbyte/internal/sdk/pkg/types" "encoding/json" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/types" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" ) -type SourceDefinitionReadSourceType string +type SourceType string const ( - SourceDefinitionReadSourceTypeAPI SourceDefinitionReadSourceType = "api" - SourceDefinitionReadSourceTypeFile SourceDefinitionReadSourceType = "file" - SourceDefinitionReadSourceTypeDatabase SourceDefinitionReadSourceType = "database" - SourceDefinitionReadSourceTypeCustom SourceDefinitionReadSourceType = "custom" + SourceTypeAPI SourceType = "api" + SourceTypeFile SourceType = "file" + SourceTypeDatabase SourceType = "database" + SourceTypeCustom SourceType = "custom" ) -func (e SourceDefinitionReadSourceType) ToPointer() *SourceDefinitionReadSourceType { +func (e SourceType) ToPointer() *SourceType { return &e } -func (e *SourceDefinitionReadSourceType) UnmarshalJSON(data []byte) error { +func (e *SourceType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -34,29 +35,123 @@ func (e *SourceDefinitionReadSourceType) UnmarshalJSON(data []byte) error { case "database": fallthrough case "custom": - *e = SourceDefinitionReadSourceType(v) + *e = SourceType(v) return nil default: - return fmt.Errorf("invalid value for SourceDefinitionReadSourceType: %v", v) + return fmt.Errorf("invalid value for SourceType: %v", v) } } -// SourceDefinitionRead - Successful operation type SourceDefinitionRead struct { - DockerImageTag string `json:"dockerImageTag"` - DockerRepository string `json:"dockerRepository"` - DocumentationURL *string `json:"documentationUrl,omitempty"` - Icon *string `json:"icon,omitempty"` - // Number of seconds allowed between 2 airbyte protocol messages. The source will timeout if this delay is reach - MaxSecondsBetweenMessages *int64 `json:"maxSecondsBetweenMessages,omitempty"` - Name string `json:"name"` + SourceDefinitionID string `json:"sourceDefinitionId"` + Name string `json:"name"` + DockerRepository string `json:"dockerRepository"` + DockerImageTag string `json:"dockerImageTag"` + DocumentationURL *string `json:"documentationUrl,omitempty"` + Icon *string `json:"icon,omitempty"` // The Airbyte Protocol version supported by the connector - ProtocolVersion *string `json:"protocolVersion,omitempty"` + ProtocolVersion *string `json:"protocolVersion,omitempty"` + ReleaseStage *ReleaseStage `json:"releaseStage,omitempty"` // The date when this connector was first released, in yyyy-mm-dd format. - ReleaseDate *types.Date `json:"releaseDate,omitempty"` - ReleaseStage *ReleaseStage `json:"releaseStage,omitempty"` + ReleaseDate *types.Date `json:"releaseDate,omitempty"` + SourceType *SourceType `json:"sourceType,omitempty"` // actor definition specific resource requirements. if default is set, these are the requirements that should be set for ALL jobs run for this actor definition. it is overriden by the job type specific configurations. if not set, the platform will use defaults. these values will be overriden by configuration at the connection level. ResourceRequirements *ActorDefinitionResourceRequirements `json:"resourceRequirements,omitempty"` - SourceDefinitionID string `json:"sourceDefinitionId"` - SourceType *SourceDefinitionReadSourceType `json:"sourceType,omitempty"` + // Number of seconds allowed between 2 airbyte protocol messages. The source will timeout if this delay is reach + MaxSecondsBetweenMessages *int64 `json:"maxSecondsBetweenMessages,omitempty"` +} + +func (s SourceDefinitionRead) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *SourceDefinitionRead) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + return err + } + return nil +} + +func (o *SourceDefinitionRead) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceDefinitionRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *SourceDefinitionRead) GetDockerRepository() string { + if o == nil { + return "" + } + return o.DockerRepository +} + +func (o *SourceDefinitionRead) GetDockerImageTag() string { + if o == nil { + return "" + } + return o.DockerImageTag +} + +func (o *SourceDefinitionRead) GetDocumentationURL() *string { + if o == nil { + return nil + } + return o.DocumentationURL +} + +func (o *SourceDefinitionRead) GetIcon() *string { + if o == nil { + return nil + } + return o.Icon +} + +func (o *SourceDefinitionRead) GetProtocolVersion() *string { + if o == nil { + return nil + } + return o.ProtocolVersion +} + +func (o *SourceDefinitionRead) GetReleaseStage() *ReleaseStage { + if o == nil { + return nil + } + return o.ReleaseStage +} + +func (o *SourceDefinitionRead) GetReleaseDate() *types.Date { + if o == nil { + return nil + } + return o.ReleaseDate +} + +func (o *SourceDefinitionRead) GetSourceType() *SourceType { + if o == nil { + return nil + } + return o.SourceType +} + +func (o *SourceDefinitionRead) GetResourceRequirements() *ActorDefinitionResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} + +func (o *SourceDefinitionRead) GetMaxSecondsBetweenMessages() *int64 { + if o == nil { + return nil + } + return o.MaxSecondsBetweenMessages } diff --git a/internal/sdk/pkg/models/shared/sourcedefinitionreadlist.go b/internal/sdk/pkg/models/shared/sourcedefinitionreadlist.go old mode 100755 new mode 100644 index 9c360c6..587cfe2 --- a/internal/sdk/pkg/models/shared/sourcedefinitionreadlist.go +++ b/internal/sdk/pkg/models/shared/sourcedefinitionreadlist.go @@ -2,7 +2,13 @@ package shared -// SourceDefinitionReadList - Successful operation type SourceDefinitionReadList struct { SourceDefinitions []SourceDefinitionRead `json:"sourceDefinitions"` } + +func (o *SourceDefinitionReadList) GetSourceDefinitions() []SourceDefinitionRead { + if o == nil { + return []SourceDefinitionRead{} + } + return o.SourceDefinitions +} diff --git a/internal/sdk/pkg/models/shared/sourcedefinitionspecification.go b/internal/sdk/pkg/models/shared/sourcedefinitionspecification.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/sourcedefinitionspecificationread.go b/internal/sdk/pkg/models/shared/sourcedefinitionspecificationread.go old mode 100755 new mode 100644 index 395d179..78620c3 --- a/internal/sdk/pkg/models/shared/sourcedefinitionspecificationread.go +++ b/internal/sdk/pkg/models/shared/sourcedefinitionspecificationread.go @@ -2,12 +2,46 @@ package shared -// SourceDefinitionSpecificationRead - Successful operation type SourceDefinitionSpecificationRead struct { - AdvancedAuth *AdvancedAuth `json:"advancedAuth,omitempty"` + SourceDefinitionID string `json:"sourceDefinitionId"` + DocumentationURL *string `json:"documentationUrl,omitempty"` // The specification for what values are required to configure the sourceDefinition. ConnectionSpecification *SourceDefinitionSpecification `json:"connectionSpecification,omitempty"` - DocumentationURL *string `json:"documentationUrl,omitempty"` + AdvancedAuth *AdvancedAuth `json:"advancedAuth,omitempty"` JobInfo SynchronousJobRead `json:"jobInfo"` - SourceDefinitionID string `json:"sourceDefinitionId"` +} + +func (o *SourceDefinitionSpecificationRead) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceDefinitionSpecificationRead) GetDocumentationURL() *string { + if o == nil { + return nil + } + return o.DocumentationURL +} + +func (o *SourceDefinitionSpecificationRead) GetConnectionSpecification() *SourceDefinitionSpecification { + if o == nil { + return nil + } + return o.ConnectionSpecification +} + +func (o *SourceDefinitionSpecificationRead) GetAdvancedAuth() *AdvancedAuth { + if o == nil { + return nil + } + return o.AdvancedAuth +} + +func (o *SourceDefinitionSpecificationRead) GetJobInfo() SynchronousJobRead { + if o == nil { + return SynchronousJobRead{} + } + return o.JobInfo } diff --git a/internal/sdk/pkg/models/shared/sourcedefinitionupdate.go b/internal/sdk/pkg/models/shared/sourcedefinitionupdate.go old mode 100755 new mode 100644 index 5ddb7b2..b7120af --- a/internal/sdk/pkg/models/shared/sourcedefinitionupdate.go +++ b/internal/sdk/pkg/models/shared/sourcedefinitionupdate.go @@ -4,8 +4,29 @@ package shared // SourceDefinitionUpdate - Update the SourceDefinition. Currently, the only allowed attribute to update is the default docker image version. type SourceDefinitionUpdate struct { - DockerImageTag string `json:"dockerImageTag"` + SourceDefinitionID string `json:"sourceDefinitionId"` + DockerImageTag string `json:"dockerImageTag"` // actor definition specific resource requirements. if default is set, these are the requirements that should be set for ALL jobs run for this actor definition. it is overriden by the job type specific configurations. if not set, the platform will use defaults. these values will be overriden by configuration at the connection level. ResourceRequirements *ActorDefinitionResourceRequirements `json:"resourceRequirements,omitempty"` - SourceDefinitionID string `json:"sourceDefinitionId"` +} + +func (o *SourceDefinitionUpdate) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceDefinitionUpdate) GetDockerImageTag() string { + if o == nil { + return "" + } + return o.DockerImageTag +} + +func (o *SourceDefinitionUpdate) GetResourceRequirements() *ActorDefinitionResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements } diff --git a/internal/sdk/pkg/models/shared/sourcediscoverschemaread.go b/internal/sdk/pkg/models/shared/sourcediscoverschemaread.go old mode 100755 new mode 100644 index 820fc5f..44b7766 --- a/internal/sdk/pkg/models/shared/sourcediscoverschemaread.go +++ b/internal/sdk/pkg/models/shared/sourcediscoverschemaread.go @@ -4,13 +4,55 @@ package shared // SourceDiscoverSchemaRead - Returns the results of a discover catalog job. If the job was not successful, the catalog field will not be present. jobInfo will aways be present and its status be used to determine if the job was successful or not. type SourceDiscoverSchemaRead struct { - BreakingChange *bool `json:"breakingChange,omitempty"` // describes the available schema (catalog). - Catalog *AirbyteCatalog `json:"catalog,omitempty"` + Catalog *AirbyteCatalog `json:"catalog,omitempty"` + JobInfo SynchronousJobRead `json:"jobInfo"` + CatalogID *string `json:"catalogId,omitempty"` // Describes the difference between two Airbyte catalogs. - CatalogDiff *CatalogDiff `json:"catalogDiff,omitempty"` - CatalogID *string `json:"catalogId,omitempty"` + CatalogDiff *CatalogDiff `json:"catalogDiff,omitempty"` + BreakingChange *bool `json:"breakingChange,omitempty"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. - ConnectionStatus *ConnectionStatus `json:"connectionStatus,omitempty"` - JobInfo SynchronousJobRead `json:"jobInfo"` + ConnectionStatus *ConnectionStatus `json:"connectionStatus,omitempty"` +} + +func (o *SourceDiscoverSchemaRead) GetCatalog() *AirbyteCatalog { + if o == nil { + return nil + } + return o.Catalog +} + +func (o *SourceDiscoverSchemaRead) GetJobInfo() SynchronousJobRead { + if o == nil { + return SynchronousJobRead{} + } + return o.JobInfo +} + +func (o *SourceDiscoverSchemaRead) GetCatalogID() *string { + if o == nil { + return nil + } + return o.CatalogID +} + +func (o *SourceDiscoverSchemaRead) GetCatalogDiff() *CatalogDiff { + if o == nil { + return nil + } + return o.CatalogDiff +} + +func (o *SourceDiscoverSchemaRead) GetBreakingChange() *bool { + if o == nil { + return nil + } + return o.BreakingChange +} + +func (o *SourceDiscoverSchemaRead) GetConnectionStatus() *ConnectionStatus { + if o == nil { + return nil + } + return o.ConnectionStatus } diff --git a/internal/sdk/pkg/models/shared/sourcediscoverschemarequestbody.go b/internal/sdk/pkg/models/shared/sourcediscoverschemarequestbody.go old mode 100755 new mode 100644 index 0c2c4f3..0574e12 --- a/internal/sdk/pkg/models/shared/sourcediscoverschemarequestbody.go +++ b/internal/sdk/pkg/models/shared/sourcediscoverschemarequestbody.go @@ -3,8 +3,36 @@ package shared type SourceDiscoverSchemaRequestBody struct { + SourceID string `json:"sourceId"` ConnectionID *string `json:"connectionId,omitempty"` DisableCache *bool `json:"disable_cache,omitempty"` NotifySchemaChange *bool `json:"notifySchemaChange,omitempty"` - SourceID string `json:"sourceId"` +} + +func (o *SourceDiscoverSchemaRequestBody) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *SourceDiscoverSchemaRequestBody) GetConnectionID() *string { + if o == nil { + return nil + } + return o.ConnectionID +} + +func (o *SourceDiscoverSchemaRequestBody) GetDisableCache() *bool { + if o == nil { + return nil + } + return o.DisableCache +} + +func (o *SourceDiscoverSchemaRequestBody) GetNotifySchemaChange() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChange } diff --git a/internal/sdk/pkg/models/shared/sourcediscoverschemawriterequestbody.go b/internal/sdk/pkg/models/shared/sourcediscoverschemawriterequestbody.go old mode 100755 new mode 100644 index e708bc4..7d83415 --- a/internal/sdk/pkg/models/shared/sourcediscoverschemawriterequestbody.go +++ b/internal/sdk/pkg/models/shared/sourcediscoverschemawriterequestbody.go @@ -6,7 +6,35 @@ package shared type SourceDiscoverSchemaWriteRequestBody struct { // describes the available schema (catalog). Catalog AirbyteCatalog `json:"catalog"` - ConfigurationHash *string `json:"configurationHash,omitempty"` - ConnectorVersion *string `json:"connectorVersion,omitempty"` SourceID *string `json:"sourceId,omitempty"` + ConnectorVersion *string `json:"connectorVersion,omitempty"` + ConfigurationHash *string `json:"configurationHash,omitempty"` +} + +func (o *SourceDiscoverSchemaWriteRequestBody) GetCatalog() AirbyteCatalog { + if o == nil { + return AirbyteCatalog{} + } + return o.Catalog +} + +func (o *SourceDiscoverSchemaWriteRequestBody) GetSourceID() *string { + if o == nil { + return nil + } + return o.SourceID +} + +func (o *SourceDiscoverSchemaWriteRequestBody) GetConnectorVersion() *string { + if o == nil { + return nil + } + return o.ConnectorVersion +} + +func (o *SourceDiscoverSchemaWriteRequestBody) GetConfigurationHash() *string { + if o == nil { + return nil + } + return o.ConfigurationHash } diff --git a/internal/sdk/pkg/models/shared/sourceidrequestbody.go b/internal/sdk/pkg/models/shared/sourceidrequestbody.go old mode 100755 new mode 100644 index bc7edfe..2b8ab11 --- a/internal/sdk/pkg/models/shared/sourceidrequestbody.go +++ b/internal/sdk/pkg/models/shared/sourceidrequestbody.go @@ -5,3 +5,10 @@ package shared type SourceIDRequestBody struct { SourceID string `json:"sourceId"` } + +func (o *SourceIDRequestBody) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} diff --git a/internal/sdk/pkg/models/shared/sourceoauthconsentrequest.go b/internal/sdk/pkg/models/shared/sourceoauthconsentrequest.go old mode 100755 new mode 100644 index bd5e387..2bee936 --- a/internal/sdk/pkg/models/shared/sourceoauthconsentrequest.go +++ b/internal/sdk/pkg/models/shared/sourceoauthconsentrequest.go @@ -3,11 +3,46 @@ package shared type SourceOauthConsentRequest struct { + SourceDefinitionID string `json:"sourceDefinitionId"` + WorkspaceID string `json:"workspaceId"` + // The url to redirect to after getting the user consent + RedirectURL string `json:"redirectUrl"` // The values required to configure OAuth flows. The schema for this must match the `OAuthConfigSpecification.oauthUserInputFromConnectorConfigSpecification` schema. OAuthInputConfiguration interface{} `json:"oAuthInputConfiguration,omitempty"` - // The url to redirect to after getting the user consent - RedirectURL string `json:"redirectUrl"` - SourceDefinitionID string `json:"sourceDefinitionId"` - SourceID *string `json:"sourceId,omitempty"` - WorkspaceID string `json:"workspaceId"` + SourceID *string `json:"sourceId,omitempty"` +} + +func (o *SourceOauthConsentRequest) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceOauthConsentRequest) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *SourceOauthConsentRequest) GetRedirectURL() string { + if o == nil { + return "" + } + return o.RedirectURL +} + +func (o *SourceOauthConsentRequest) GetOAuthInputConfiguration() interface{} { + if o == nil { + return nil + } + return o.OAuthInputConfiguration +} + +func (o *SourceOauthConsentRequest) GetSourceID() *string { + if o == nil { + return nil + } + return o.SourceID } diff --git a/internal/sdk/pkg/models/shared/sourceread.go b/internal/sdk/pkg/models/shared/sourceread.go old mode 100755 new mode 100644 index 24f5d11..739e8dd --- a/internal/sdk/pkg/models/shared/sourceread.go +++ b/internal/sdk/pkg/models/shared/sourceread.go @@ -2,14 +2,62 @@ package shared -// SourceRead - Successful operation type SourceRead struct { + SourceDefinitionID string `json:"sourceDefinitionId"` + SourceID string `json:"sourceId"` + WorkspaceID string `json:"workspaceId"` // The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source. ConnectionConfiguration interface{} `json:"connectionConfiguration"` - Icon *string `json:"icon,omitempty"` Name string `json:"name"` - SourceDefinitionID string `json:"sourceDefinitionId"` - SourceID string `json:"sourceId"` SourceName string `json:"sourceName"` - WorkspaceID string `json:"workspaceId"` + Icon *string `json:"icon,omitempty"` +} + +func (o *SourceRead) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceRead) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *SourceRead) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *SourceRead) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *SourceRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *SourceRead) GetSourceName() string { + if o == nil { + return "" + } + return o.SourceName +} + +func (o *SourceRead) GetIcon() *string { + if o == nil { + return nil + } + return o.Icon } diff --git a/internal/sdk/pkg/models/shared/sourcereadlist.go b/internal/sdk/pkg/models/shared/sourcereadlist.go old mode 100755 new mode 100644 index ca0813f..dd45046 --- a/internal/sdk/pkg/models/shared/sourcereadlist.go +++ b/internal/sdk/pkg/models/shared/sourcereadlist.go @@ -2,7 +2,13 @@ package shared -// SourceReadList - Successful operation type SourceReadList struct { Sources []SourceRead `json:"sources"` } + +func (o *SourceReadList) GetSources() []SourceRead { + if o == nil { + return []SourceRead{} + } + return o.Sources +} diff --git a/internal/sdk/pkg/models/shared/sourcesearch.go b/internal/sdk/pkg/models/shared/sourcesearch.go old mode 100755 new mode 100644 index c8fe3df..a4e70b7 --- a/internal/sdk/pkg/models/shared/sourcesearch.go +++ b/internal/sdk/pkg/models/shared/sourcesearch.go @@ -3,11 +3,53 @@ package shared type SourceSearch struct { + SourceDefinitionID *string `json:"sourceDefinitionId,omitempty"` + SourceID *string `json:"sourceId,omitempty"` + WorkspaceID *string `json:"workspaceId,omitempty"` // The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source. ConnectionConfiguration interface{} `json:"connectionConfiguration,omitempty"` Name *string `json:"name,omitempty"` - SourceDefinitionID *string `json:"sourceDefinitionId,omitempty"` - SourceID *string `json:"sourceId,omitempty"` SourceName *string `json:"sourceName,omitempty"` - WorkspaceID *string `json:"workspaceId,omitempty"` +} + +func (o *SourceSearch) GetSourceDefinitionID() *string { + if o == nil { + return nil + } + return o.SourceDefinitionID +} + +func (o *SourceSearch) GetSourceID() *string { + if o == nil { + return nil + } + return o.SourceID +} + +func (o *SourceSearch) GetWorkspaceID() *string { + if o == nil { + return nil + } + return o.WorkspaceID +} + +func (o *SourceSearch) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *SourceSearch) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *SourceSearch) GetSourceName() *string { + if o == nil { + return nil + } + return o.SourceName } diff --git a/internal/sdk/pkg/models/shared/sourcesnippetread.go b/internal/sdk/pkg/models/shared/sourcesnippetread.go old mode 100755 new mode 100644 index e5b5a1c..9659531 --- a/internal/sdk/pkg/models/shared/sourcesnippetread.go +++ b/internal/sdk/pkg/models/shared/sourcesnippetread.go @@ -3,9 +3,44 @@ package shared type SourceSnippetRead struct { - Icon *string `json:"icon,omitempty"` + SourceID string `json:"sourceId"` Name string `json:"name"` SourceDefinitionID string `json:"sourceDefinitionId"` - SourceID string `json:"sourceId"` SourceName string `json:"sourceName"` + Icon *string `json:"icon,omitempty"` +} + +func (o *SourceSnippetRead) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *SourceSnippetRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *SourceSnippetRead) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *SourceSnippetRead) GetSourceName() string { + if o == nil { + return "" + } + return o.SourceName +} + +func (o *SourceSnippetRead) GetIcon() *string { + if o == nil { + return nil + } + return o.Icon } diff --git a/internal/sdk/pkg/models/shared/sourceupdate.go b/internal/sdk/pkg/models/shared/sourceupdate.go old mode 100755 new mode 100644 index d35ee2e..abb268d --- a/internal/sdk/pkg/models/shared/sourceupdate.go +++ b/internal/sdk/pkg/models/shared/sourceupdate.go @@ -3,9 +3,37 @@ package shared type SourceUpdate struct { + SourceID string `json:"sourceId"` // The values required to configure the source. The schema for this must match the schema return by source_definition_specifications/get for the source. ConnectionConfiguration interface{} `json:"connectionConfiguration"` Name string `json:"name"` SecretID *string `json:"secretId,omitempty"` - SourceID string `json:"sourceId"` +} + +func (o *SourceUpdate) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *SourceUpdate) GetConnectionConfiguration() interface{} { + if o == nil { + return nil + } + return o.ConnectionConfiguration +} + +func (o *SourceUpdate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *SourceUpdate) GetSecretID() *string { + if o == nil { + return nil + } + return o.SecretID } diff --git a/internal/sdk/pkg/models/shared/stateblob.go b/internal/sdk/pkg/models/shared/stateblob.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/streamdescriptor.go b/internal/sdk/pkg/models/shared/streamdescriptor.go old mode 100755 new mode 100644 index 238a4fd..0534a37 --- a/internal/sdk/pkg/models/shared/streamdescriptor.go +++ b/internal/sdk/pkg/models/shared/streamdescriptor.go @@ -6,3 +6,17 @@ type StreamDescriptor struct { Name string `json:"name"` Namespace *string `json:"namespace,omitempty"` } + +func (o *StreamDescriptor) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *StreamDescriptor) GetNamespace() *string { + if o == nil { + return nil + } + return o.Namespace +} diff --git a/internal/sdk/pkg/models/shared/streamjsonschema.go b/internal/sdk/pkg/models/shared/streamjsonschema.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/streamstate.go b/internal/sdk/pkg/models/shared/streamstate.go old mode 100755 new mode 100644 index c5f62aa..3dd26ee --- a/internal/sdk/pkg/models/shared/streamstate.go +++ b/internal/sdk/pkg/models/shared/streamstate.go @@ -6,3 +6,17 @@ type StreamState struct { StreamDescriptor StreamDescriptor `json:"streamDescriptor"` StreamState *StateBlob `json:"streamState,omitempty"` } + +func (o *StreamState) GetStreamDescriptor() StreamDescriptor { + if o == nil { + return StreamDescriptor{} + } + return o.StreamDescriptor +} + +func (o *StreamState) GetStreamState() *StateBlob { + if o == nil { + return nil + } + return o.StreamState +} diff --git a/internal/sdk/pkg/models/shared/streamstatuscreaterequestbody.go b/internal/sdk/pkg/models/shared/streamstatuscreaterequestbody.go old mode 100755 new mode 100644 index fea371d..5633376 --- a/internal/sdk/pkg/models/shared/streamstatuscreaterequestbody.go +++ b/internal/sdk/pkg/models/shared/streamstatuscreaterequestbody.go @@ -5,12 +5,12 @@ package shared type StreamStatusCreateRequestBody struct { AttemptNumber int `json:"attemptNumber"` ConnectionID string `json:"connectionId"` + JobID int64 `json:"jobId"` // Values: // * `FAILED` - A failure has occurred // * `CANCELED` - The run has been canceled // IncompleteRunCause *StreamStatusIncompleteRunCause `json:"incompleteRunCause,omitempty"` - JobID int64 `json:"jobId"` JobType StreamStatusJobType `json:"jobType"` // Values: // * `PENDING` - The stream operation has been selected to run @@ -25,3 +25,73 @@ type StreamStatusCreateRequestBody struct { TransitionedAt int64 `json:"transitionedAt"` WorkspaceID string `json:"workspaceId"` } + +func (o *StreamStatusCreateRequestBody) GetAttemptNumber() int { + if o == nil { + return 0 + } + return o.AttemptNumber +} + +func (o *StreamStatusCreateRequestBody) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *StreamStatusCreateRequestBody) GetJobID() int64 { + if o == nil { + return 0 + } + return o.JobID +} + +func (o *StreamStatusCreateRequestBody) GetIncompleteRunCause() *StreamStatusIncompleteRunCause { + if o == nil { + return nil + } + return o.IncompleteRunCause +} + +func (o *StreamStatusCreateRequestBody) GetJobType() StreamStatusJobType { + if o == nil { + return StreamStatusJobType("") + } + return o.JobType +} + +func (o *StreamStatusCreateRequestBody) GetRunState() StreamStatusRunState { + if o == nil { + return StreamStatusRunState("") + } + return o.RunState +} + +func (o *StreamStatusCreateRequestBody) GetStreamName() string { + if o == nil { + return "" + } + return o.StreamName +} + +func (o *StreamStatusCreateRequestBody) GetStreamNamespace() *string { + if o == nil { + return nil + } + return o.StreamNamespace +} + +func (o *StreamStatusCreateRequestBody) GetTransitionedAt() int64 { + if o == nil { + return 0 + } + return o.TransitionedAt +} + +func (o *StreamStatusCreateRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/streamstatusincompleteruncause.go b/internal/sdk/pkg/models/shared/streamstatusincompleteruncause.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/streamstatusjobtype.go b/internal/sdk/pkg/models/shared/streamstatusjobtype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/streamstatuslistrequestbody.go b/internal/sdk/pkg/models/shared/streamstatuslistrequestbody.go old mode 100755 new mode 100644 index 09cbbde..96de908 --- a/internal/sdk/pkg/models/shared/streamstatuslistrequestbody.go +++ b/internal/sdk/pkg/models/shared/streamstatuslistrequestbody.go @@ -12,3 +12,59 @@ type StreamStatusListRequestBody struct { StreamNamespace *string `json:"streamNamespace,omitempty"` WorkspaceID string `json:"workspaceId"` } + +func (o *StreamStatusListRequestBody) GetAttemptNumber() *int { + if o == nil { + return nil + } + return o.AttemptNumber +} + +func (o *StreamStatusListRequestBody) GetConnectionID() *string { + if o == nil { + return nil + } + return o.ConnectionID +} + +func (o *StreamStatusListRequestBody) GetJobID() *int64 { + if o == nil { + return nil + } + return o.JobID +} + +func (o *StreamStatusListRequestBody) GetJobType() *StreamStatusJobType { + if o == nil { + return nil + } + return o.JobType +} + +func (o *StreamStatusListRequestBody) GetPagination() Pagination { + if o == nil { + return Pagination{} + } + return o.Pagination +} + +func (o *StreamStatusListRequestBody) GetStreamName() *string { + if o == nil { + return nil + } + return o.StreamName +} + +func (o *StreamStatusListRequestBody) GetStreamNamespace() *string { + if o == nil { + return nil + } + return o.StreamNamespace +} + +func (o *StreamStatusListRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/streamstatusread.go b/internal/sdk/pkg/models/shared/streamstatusread.go old mode 100755 new mode 100644 index fb47a84..007de5f --- a/internal/sdk/pkg/models/shared/streamstatusread.go +++ b/internal/sdk/pkg/models/shared/streamstatusread.go @@ -2,17 +2,16 @@ package shared -// StreamStatusRead - Successfully created stream status. type StreamStatusRead struct { AttemptNumber int `json:"attemptNumber"` ConnectionID string `json:"connectionId"` ID string `json:"id"` + JobID int64 `json:"jobId"` // Values: // * `FAILED` - A failure has occurred // * `CANCELED` - The run has been canceled // IncompleteRunCause *StreamStatusIncompleteRunCause `json:"incompleteRunCause,omitempty"` - JobID int64 `json:"jobId"` JobType StreamStatusJobType `json:"jobType"` // Values: // * `PENDING` - The stream operation has been selected to run @@ -27,3 +26,80 @@ type StreamStatusRead struct { TransitionedAt int64 `json:"transitionedAt"` WorkspaceID string `json:"workspaceId"` } + +func (o *StreamStatusRead) GetAttemptNumber() int { + if o == nil { + return 0 + } + return o.AttemptNumber +} + +func (o *StreamStatusRead) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *StreamStatusRead) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *StreamStatusRead) GetJobID() int64 { + if o == nil { + return 0 + } + return o.JobID +} + +func (o *StreamStatusRead) GetIncompleteRunCause() *StreamStatusIncompleteRunCause { + if o == nil { + return nil + } + return o.IncompleteRunCause +} + +func (o *StreamStatusRead) GetJobType() StreamStatusJobType { + if o == nil { + return StreamStatusJobType("") + } + return o.JobType +} + +func (o *StreamStatusRead) GetRunState() StreamStatusRunState { + if o == nil { + return StreamStatusRunState("") + } + return o.RunState +} + +func (o *StreamStatusRead) GetStreamName() string { + if o == nil { + return "" + } + return o.StreamName +} + +func (o *StreamStatusRead) GetStreamNamespace() string { + if o == nil { + return "" + } + return o.StreamNamespace +} + +func (o *StreamStatusRead) GetTransitionedAt() int64 { + if o == nil { + return 0 + } + return o.TransitionedAt +} + +func (o *StreamStatusRead) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/streamstatusreadlist.go b/internal/sdk/pkg/models/shared/streamstatusreadlist.go old mode 100755 new mode 100644 index d9719c1..fcb495c --- a/internal/sdk/pkg/models/shared/streamstatusreadlist.go +++ b/internal/sdk/pkg/models/shared/streamstatusreadlist.go @@ -2,7 +2,13 @@ package shared -// StreamStatusReadList - Successfully queried stream statuses. type StreamStatusReadList struct { StreamStatuses []StreamStatusRead `json:"streamStatuses,omitempty"` } + +func (o *StreamStatusReadList) GetStreamStatuses() []StreamStatusRead { + if o == nil { + return nil + } + return o.StreamStatuses +} diff --git a/internal/sdk/pkg/models/shared/streamstatusrunstate.go b/internal/sdk/pkg/models/shared/streamstatusrunstate.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/streamstatusupdaterequestbody.go b/internal/sdk/pkg/models/shared/streamstatusupdaterequestbody.go old mode 100755 new mode 100644 index 34f0285..78093ff --- a/internal/sdk/pkg/models/shared/streamstatusupdaterequestbody.go +++ b/internal/sdk/pkg/models/shared/streamstatusupdaterequestbody.go @@ -3,15 +3,15 @@ package shared type StreamStatusUpdateRequestBody struct { + ID string `json:"id"` AttemptNumber int `json:"attemptNumber"` ConnectionID string `json:"connectionId"` - ID string `json:"id"` + JobID int64 `json:"jobId"` // Values: // * `FAILED` - A failure has occurred // * `CANCELED` - The run has been canceled // IncompleteRunCause *StreamStatusIncompleteRunCause `json:"incompleteRunCause,omitempty"` - JobID int64 `json:"jobId"` JobType StreamStatusJobType `json:"jobType"` // Values: // * `PENDING` - The stream operation has been selected to run @@ -26,3 +26,80 @@ type StreamStatusUpdateRequestBody struct { TransitionedAt int64 `json:"transitionedAt"` WorkspaceID string `json:"workspaceId"` } + +func (o *StreamStatusUpdateRequestBody) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *StreamStatusUpdateRequestBody) GetAttemptNumber() int { + if o == nil { + return 0 + } + return o.AttemptNumber +} + +func (o *StreamStatusUpdateRequestBody) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *StreamStatusUpdateRequestBody) GetJobID() int64 { + if o == nil { + return 0 + } + return o.JobID +} + +func (o *StreamStatusUpdateRequestBody) GetIncompleteRunCause() *StreamStatusIncompleteRunCause { + if o == nil { + return nil + } + return o.IncompleteRunCause +} + +func (o *StreamStatusUpdateRequestBody) GetJobType() StreamStatusJobType { + if o == nil { + return StreamStatusJobType("") + } + return o.JobType +} + +func (o *StreamStatusUpdateRequestBody) GetRunState() StreamStatusRunState { + if o == nil { + return StreamStatusRunState("") + } + return o.RunState +} + +func (o *StreamStatusUpdateRequestBody) GetStreamName() string { + if o == nil { + return "" + } + return o.StreamName +} + +func (o *StreamStatusUpdateRequestBody) GetStreamNamespace() *string { + if o == nil { + return nil + } + return o.StreamNamespace +} + +func (o *StreamStatusUpdateRequestBody) GetTransitionedAt() int64 { + if o == nil { + return 0 + } + return o.TransitionedAt +} + +func (o *StreamStatusUpdateRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/streamtransform.go b/internal/sdk/pkg/models/shared/streamtransform.go old mode 100755 new mode 100644 index b6750a8..3a7e6d0 --- a/internal/sdk/pkg/models/shared/streamtransform.go +++ b/internal/sdk/pkg/models/shared/streamtransform.go @@ -7,19 +7,19 @@ import ( "fmt" ) -type StreamTransformTransformType string +type TransformType string const ( - StreamTransformTransformTypeAddStream StreamTransformTransformType = "add_stream" - StreamTransformTransformTypeRemoveStream StreamTransformTransformType = "remove_stream" - StreamTransformTransformTypeUpdateStream StreamTransformTransformType = "update_stream" + TransformTypeAddStream TransformType = "add_stream" + TransformTypeRemoveStream TransformType = "remove_stream" + TransformTypeUpdateStream TransformType = "update_stream" ) -func (e StreamTransformTransformType) ToPointer() *StreamTransformTransformType { +func (e TransformType) ToPointer() *TransformType { return &e } -func (e *StreamTransformTransformType) UnmarshalJSON(data []byte) error { +func (e *TransformType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -30,16 +30,37 @@ func (e *StreamTransformTransformType) UnmarshalJSON(data []byte) error { case "remove_stream": fallthrough case "update_stream": - *e = StreamTransformTransformType(v) + *e = TransformType(v) return nil default: - return fmt.Errorf("invalid value for StreamTransformTransformType: %v", v) + return fmt.Errorf("invalid value for TransformType: %v", v) } } type StreamTransform struct { - StreamDescriptor StreamDescriptor `json:"streamDescriptor"` - TransformType StreamTransformTransformType `json:"transformType"` + TransformType TransformType `json:"transformType"` + StreamDescriptor StreamDescriptor `json:"streamDescriptor"` // list of field transformations. order does not matter. UpdateStream []FieldTransform `json:"updateStream,omitempty"` } + +func (o *StreamTransform) GetTransformType() TransformType { + if o == nil { + return TransformType("") + } + return o.TransformType +} + +func (o *StreamTransform) GetStreamDescriptor() StreamDescriptor { + if o == nil { + return StreamDescriptor{} + } + return o.StreamDescriptor +} + +func (o *StreamTransform) GetUpdateStream() []FieldTransform { + if o == nil { + return nil + } + return o.UpdateStream +} diff --git a/internal/sdk/pkg/models/shared/synchronousjobread.go b/internal/sdk/pkg/models/shared/synchronousjobread.go old mode 100755 new mode 100644 index 3794024..14da5cc --- a/internal/sdk/pkg/models/shared/synchronousjobread.go +++ b/internal/sdk/pkg/models/shared/synchronousjobread.go @@ -2,15 +2,93 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type SynchronousJobRead struct { + ID string `json:"id"` + ConfigType JobConfigType `json:"configType"` // only present if a config id was provided. ConfigID *string `json:"configId,omitempty"` - ConfigType JobConfigType `json:"configType"` - ConnectorConfigurationUpdated *bool `json:"connectorConfigurationUpdated,omitempty"` CreatedAt int64 `json:"createdAt"` EndedAt int64 `json:"endedAt"` - FailureReason *FailureReason `json:"failureReason,omitempty"` - ID string `json:"id"` - Logs *LogRead `json:"logs,omitempty"` Succeeded bool `json:"succeeded"` + ConnectorConfigurationUpdated *bool `default:"false" json:"connectorConfigurationUpdated"` + Logs *LogRead `json:"logs,omitempty"` + FailureReason *FailureReason `json:"failureReason,omitempty"` +} + +func (s SynchronousJobRead) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *SynchronousJobRead) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + return err + } + return nil +} + +func (o *SynchronousJobRead) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *SynchronousJobRead) GetConfigType() JobConfigType { + if o == nil { + return JobConfigType("") + } + return o.ConfigType +} + +func (o *SynchronousJobRead) GetConfigID() *string { + if o == nil { + return nil + } + return o.ConfigID +} + +func (o *SynchronousJobRead) GetCreatedAt() int64 { + if o == nil { + return 0 + } + return o.CreatedAt +} + +func (o *SynchronousJobRead) GetEndedAt() int64 { + if o == nil { + return 0 + } + return o.EndedAt +} + +func (o *SynchronousJobRead) GetSucceeded() bool { + if o == nil { + return false + } + return o.Succeeded +} + +func (o *SynchronousJobRead) GetConnectorConfigurationUpdated() *bool { + if o == nil { + return nil + } + return o.ConnectorConfigurationUpdated +} + +func (o *SynchronousJobRead) GetLogs() *LogRead { + if o == nil { + return nil + } + return o.Logs +} + +func (o *SynchronousJobRead) GetFailureReason() *FailureReason { + if o == nil { + return nil + } + return o.FailureReason } diff --git a/internal/sdk/pkg/models/shared/syncmode.go b/internal/sdk/pkg/models/shared/syncmode.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/models/shared/updateactivemanifestrequestbody.go b/internal/sdk/pkg/models/shared/updateactivemanifestrequestbody.go old mode 100755 new mode 100644 index 1f90d65..49e9d9c --- a/internal/sdk/pkg/models/shared/updateactivemanifestrequestbody.go +++ b/internal/sdk/pkg/models/shared/updateactivemanifestrequestbody.go @@ -3,7 +3,28 @@ package shared type UpdateActiveManifestRequestBody struct { + WorkspaceID string `json:"workspaceId"` SourceDefinitionID string `json:"sourceDefinitionId"` Version int64 `json:"version"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *UpdateActiveManifestRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *UpdateActiveManifestRequestBody) GetSourceDefinitionID() string { + if o == nil { + return "" + } + return o.SourceDefinitionID +} + +func (o *UpdateActiveManifestRequestBody) GetVersion() int64 { + if o == nil { + return 0 + } + return o.Version } diff --git a/internal/sdk/pkg/models/shared/webbackendcheckupdatesread.go b/internal/sdk/pkg/models/shared/webbackendcheckupdatesread.go old mode 100755 new mode 100644 index c73bdfd..bfd73ca --- a/internal/sdk/pkg/models/shared/webbackendcheckupdatesread.go +++ b/internal/sdk/pkg/models/shared/webbackendcheckupdatesread.go @@ -7,3 +7,17 @@ type WebBackendCheckUpdatesRead struct { DestinationDefinitions int64 `json:"destinationDefinitions"` SourceDefinitions int64 `json:"sourceDefinitions"` } + +func (o *WebBackendCheckUpdatesRead) GetDestinationDefinitions() int64 { + if o == nil { + return 0 + } + return o.DestinationDefinitions +} + +func (o *WebBackendCheckUpdatesRead) GetSourceDefinitions() int64 { + if o == nil { + return 0 + } + return o.SourceDefinitions +} diff --git a/internal/sdk/pkg/models/shared/webbackendconnectioncreate.go b/internal/sdk/pkg/models/shared/webbackendconnectioncreate.go old mode 100755 new mode 100644 index ad2750e..672d253 --- a/internal/sdk/pkg/models/shared/webbackendconnectioncreate.go +++ b/internal/sdk/pkg/models/shared/webbackendconnectioncreate.go @@ -2,32 +2,166 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type WebBackendConnectionCreate struct { - DestinationID string `json:"destinationId"` - Geography *Geography `json:"geography,omitempty"` // Optional name of the connection Name *string `json:"name,omitempty"` // Method used for computing final namespace in destination NamespaceDefinition *NamespaceDefinitionType `json:"namespaceDefinition,omitempty"` // Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'. - NamespaceFormat *string `json:"namespaceFormat,omitempty"` - NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` - OperationIds []string `json:"operationIds,omitempty"` - Operations []OperationCreate `json:"operations,omitempty"` + NamespaceFormat *string `default:"null" json:"namespaceFormat"` // Prefix that will be prepended to the name of each stream when it is written to the destination. - Prefix *string `json:"prefix,omitempty"` - // optional resource requirements to run workers (blank for unbounded allocations) - ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + Prefix *string `json:"prefix,omitempty"` + SourceID string `json:"sourceId"` + DestinationID string `json:"destinationId"` + OperationIds []string `json:"operationIds,omitempty"` + // describes the available schema (catalog). + SyncCatalog *AirbyteCatalog `json:"syncCatalog,omitempty"` // if null, then no schedule is set. Schedule *ConnectionSchedule `json:"schedule,omitempty"` + // determine how the schedule data should be interpreted + ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` // schedule for when the the connection should run, per the schedule type ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` - // determine how the schedule data should be interpreted - ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` - SourceCatalogID *string `json:"sourceCatalogId,omitempty"` - SourceID string `json:"sourceId"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. Status ConnectionStatus `json:"status"` - // describes the available schema (catalog). - SyncCatalog *AirbyteCatalog `json:"syncCatalog,omitempty"` + // optional resource requirements to run workers (blank for unbounded allocations) + ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + Operations []OperationCreate `json:"operations,omitempty"` + SourceCatalogID *string `json:"sourceCatalogId,omitempty"` + Geography *Geography `json:"geography,omitempty"` + NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` +} + +func (w WebBackendConnectionCreate) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(w, "", false) +} + +func (w *WebBackendConnectionCreate) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + return err + } + return nil +} + +func (o *WebBackendConnectionCreate) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *WebBackendConnectionCreate) GetNamespaceDefinition() *NamespaceDefinitionType { + if o == nil { + return nil + } + return o.NamespaceDefinition +} + +func (o *WebBackendConnectionCreate) GetNamespaceFormat() *string { + if o == nil { + return nil + } + return o.NamespaceFormat +} + +func (o *WebBackendConnectionCreate) GetPrefix() *string { + if o == nil { + return nil + } + return o.Prefix +} + +func (o *WebBackendConnectionCreate) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *WebBackendConnectionCreate) GetDestinationID() string { + if o == nil { + return "" + } + return o.DestinationID +} + +func (o *WebBackendConnectionCreate) GetOperationIds() []string { + if o == nil { + return nil + } + return o.OperationIds +} + +func (o *WebBackendConnectionCreate) GetSyncCatalog() *AirbyteCatalog { + if o == nil { + return nil + } + return o.SyncCatalog +} + +func (o *WebBackendConnectionCreate) GetSchedule() *ConnectionSchedule { + if o == nil { + return nil + } + return o.Schedule +} + +func (o *WebBackendConnectionCreate) GetScheduleType() *ConnectionScheduleType { + if o == nil { + return nil + } + return o.ScheduleType +} + +func (o *WebBackendConnectionCreate) GetScheduleData() *ConnectionScheduleData { + if o == nil { + return nil + } + return o.ScheduleData +} + +func (o *WebBackendConnectionCreate) GetStatus() ConnectionStatus { + if o == nil { + return ConnectionStatus("") + } + return o.Status +} + +func (o *WebBackendConnectionCreate) GetResourceRequirements() *ResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} + +func (o *WebBackendConnectionCreate) GetOperations() []OperationCreate { + if o == nil { + return nil + } + return o.Operations +} + +func (o *WebBackendConnectionCreate) GetSourceCatalogID() *string { + if o == nil { + return nil + } + return o.SourceCatalogID +} + +func (o *WebBackendConnectionCreate) GetGeography() *Geography { + if o == nil { + return nil + } + return o.Geography +} + +func (o *WebBackendConnectionCreate) GetNonBreakingChangesPreference() *NonBreakingChangesPreference { + if o == nil { + return nil + } + return o.NonBreakingChangesPreference } diff --git a/internal/sdk/pkg/models/shared/webbackendconnectionlistitem.go b/internal/sdk/pkg/models/shared/webbackendconnectionlistitem.go old mode 100755 new mode 100644 index 750173d..0e8886e --- a/internal/sdk/pkg/models/shared/webbackendconnectionlistitem.go +++ b/internal/sdk/pkg/models/shared/webbackendconnectionlistitem.go @@ -4,19 +4,96 @@ package shared // WebBackendConnectionListItem - Information about a connection that shows up in the connection list view. type WebBackendConnectionListItem struct { - ConnectionID string `json:"connectionId"` - Destination DestinationSnippetRead `json:"destination"` - IsSyncing bool `json:"isSyncing"` - // epoch time of the latest sync job. null if no sync job has taken place. - LatestSyncJobCreatedAt *int64 `json:"latestSyncJobCreatedAt,omitempty"` - LatestSyncJobStatus *JobStatus `json:"latestSyncJobStatus,omitempty"` - Name string `json:"name"` - // schedule for when the the connection should run, per the schedule type - ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` + ConnectionID string `json:"connectionId"` + Name string `json:"name"` // determine how the schedule data should be interpreted ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` - SchemaChange SchemaChange `json:"schemaChange"` - Source SourceSnippetRead `json:"source"` + // schedule for when the the connection should run, per the schedule type + ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. - Status ConnectionStatus `json:"status"` + Status ConnectionStatus `json:"status"` + Source SourceSnippetRead `json:"source"` + Destination DestinationSnippetRead `json:"destination"` + // epoch time of the latest sync job. null if no sync job has taken place. + LatestSyncJobCreatedAt *int64 `json:"latestSyncJobCreatedAt,omitempty"` + LatestSyncJobStatus *JobStatus `json:"latestSyncJobStatus,omitempty"` + IsSyncing bool `json:"isSyncing"` + SchemaChange SchemaChange `json:"schemaChange"` +} + +func (o *WebBackendConnectionListItem) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *WebBackendConnectionListItem) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *WebBackendConnectionListItem) GetScheduleType() *ConnectionScheduleType { + if o == nil { + return nil + } + return o.ScheduleType +} + +func (o *WebBackendConnectionListItem) GetScheduleData() *ConnectionScheduleData { + if o == nil { + return nil + } + return o.ScheduleData +} + +func (o *WebBackendConnectionListItem) GetStatus() ConnectionStatus { + if o == nil { + return ConnectionStatus("") + } + return o.Status +} + +func (o *WebBackendConnectionListItem) GetSource() SourceSnippetRead { + if o == nil { + return SourceSnippetRead{} + } + return o.Source +} + +func (o *WebBackendConnectionListItem) GetDestination() DestinationSnippetRead { + if o == nil { + return DestinationSnippetRead{} + } + return o.Destination +} + +func (o *WebBackendConnectionListItem) GetLatestSyncJobCreatedAt() *int64 { + if o == nil { + return nil + } + return o.LatestSyncJobCreatedAt +} + +func (o *WebBackendConnectionListItem) GetLatestSyncJobStatus() *JobStatus { + if o == nil { + return nil + } + return o.LatestSyncJobStatus +} + +func (o *WebBackendConnectionListItem) GetIsSyncing() bool { + if o == nil { + return false + } + return o.IsSyncing +} + +func (o *WebBackendConnectionListItem) GetSchemaChange() SchemaChange { + if o == nil { + return SchemaChange("") + } + return o.SchemaChange } diff --git a/internal/sdk/pkg/models/shared/webbackendconnectionlistrequestbody.go b/internal/sdk/pkg/models/shared/webbackendconnectionlistrequestbody.go old mode 100755 new mode 100644 index f3ee3e4..f7d261b --- a/internal/sdk/pkg/models/shared/webbackendconnectionlistrequestbody.go +++ b/internal/sdk/pkg/models/shared/webbackendconnectionlistrequestbody.go @@ -3,7 +3,28 @@ package shared type WebBackendConnectionListRequestBody struct { - DestinationID []string `json:"destinationId,omitempty"` - SourceID []string `json:"sourceId,omitempty"` WorkspaceID string `json:"workspaceId"` + SourceID []string `json:"sourceId,omitempty"` + DestinationID []string `json:"destinationId,omitempty"` +} + +func (o *WebBackendConnectionListRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *WebBackendConnectionListRequestBody) GetSourceID() []string { + if o == nil { + return nil + } + return o.SourceID +} + +func (o *WebBackendConnectionListRequestBody) GetDestinationID() []string { + if o == nil { + return nil + } + return o.DestinationID } diff --git a/internal/sdk/pkg/models/shared/webbackendconnectionread.go b/internal/sdk/pkg/models/shared/webbackendconnectionread.go old mode 100755 new mode 100644 index 1b7712a..4d5ecad --- a/internal/sdk/pkg/models/shared/webbackendconnectionread.go +++ b/internal/sdk/pkg/models/shared/webbackendconnectionread.go @@ -2,44 +2,247 @@ package shared -// WebBackendConnectionRead - Successful operation +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + type WebBackendConnectionRead struct { - // Describes the difference between two Airbyte catalogs. - CatalogDiff *CatalogDiff `json:"catalogDiff,omitempty"` - CatalogID *string `json:"catalogId,omitempty"` - ConnectionID string `json:"connectionId"` - Destination DestinationRead `json:"destination"` - DestinationID string `json:"destinationId"` - Geography *Geography `json:"geography,omitempty"` - IsSyncing bool `json:"isSyncing"` - // epoch time of the latest sync job. null if no sync job has taken place. - LatestSyncJobCreatedAt *int64 `json:"latestSyncJobCreatedAt,omitempty"` - LatestSyncJobStatus *JobStatus `json:"latestSyncJobStatus,omitempty"` - Name string `json:"name"` + ConnectionID string `json:"connectionId"` + Name string `json:"name"` // Method used for computing final namespace in destination NamespaceDefinition *NamespaceDefinitionType `json:"namespaceDefinition,omitempty"` // Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'. - NamespaceFormat *string `json:"namespaceFormat,omitempty"` - NonBreakingChangesPreference NonBreakingChangesPreference `json:"nonBreakingChangesPreference"` - NotifySchemaChanges bool `json:"notifySchemaChanges"` - NotifySchemaChangesByEmail bool `json:"notifySchemaChangesByEmail"` - OperationIds []string `json:"operationIds,omitempty"` - Operations []OperationRead `json:"operations,omitempty"` + NamespaceFormat *string `default:"null" json:"namespaceFormat"` // Prefix that will be prepended to the name of each stream when it is written to the destination. - Prefix *string `json:"prefix,omitempty"` - // optional resource requirements to run workers (blank for unbounded allocations) - ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + Prefix *string `json:"prefix,omitempty"` + SourceID string `json:"sourceId"` + DestinationID string `json:"destinationId"` + // describes the available schema (catalog). + SyncCatalog AirbyteCatalog `json:"syncCatalog"` // if null, then no schedule is set. Schedule *ConnectionSchedule `json:"schedule,omitempty"` - // schedule for when the the connection should run, per the schedule type - ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` // determine how the schedule data should be interpreted ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` - SchemaChange SchemaChange `json:"schemaChange"` - Source SourceRead `json:"source"` - SourceID string `json:"sourceId"` + // schedule for when the the connection should run, per the schedule type + ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. - Status ConnectionStatus `json:"status"` - // describes the available schema (catalog). - SyncCatalog AirbyteCatalog `json:"syncCatalog"` + Status ConnectionStatus `json:"status"` + OperationIds []string `json:"operationIds,omitempty"` + Source SourceRead `json:"source"` + Destination DestinationRead `json:"destination"` + Operations []OperationRead `json:"operations,omitempty"` + // epoch time of the latest sync job. null if no sync job has taken place. + LatestSyncJobCreatedAt *int64 `json:"latestSyncJobCreatedAt,omitempty"` + LatestSyncJobStatus *JobStatus `json:"latestSyncJobStatus,omitempty"` + IsSyncing bool `json:"isSyncing"` + // optional resource requirements to run workers (blank for unbounded allocations) + ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + CatalogID *string `json:"catalogId,omitempty"` + // Describes the difference between two Airbyte catalogs. + CatalogDiff *CatalogDiff `json:"catalogDiff,omitempty"` + Geography *Geography `json:"geography,omitempty"` + SchemaChange SchemaChange `json:"schemaChange"` + NotifySchemaChanges bool `json:"notifySchemaChanges"` + NotifySchemaChangesByEmail bool `json:"notifySchemaChangesByEmail"` + NonBreakingChangesPreference NonBreakingChangesPreference `json:"nonBreakingChangesPreference"` +} + +func (w WebBackendConnectionRead) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(w, "", false) +} + +func (w *WebBackendConnectionRead) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + return err + } + return nil +} + +func (o *WebBackendConnectionRead) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *WebBackendConnectionRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *WebBackendConnectionRead) GetNamespaceDefinition() *NamespaceDefinitionType { + if o == nil { + return nil + } + return o.NamespaceDefinition +} + +func (o *WebBackendConnectionRead) GetNamespaceFormat() *string { + if o == nil { + return nil + } + return o.NamespaceFormat +} + +func (o *WebBackendConnectionRead) GetPrefix() *string { + if o == nil { + return nil + } + return o.Prefix +} + +func (o *WebBackendConnectionRead) GetSourceID() string { + if o == nil { + return "" + } + return o.SourceID +} + +func (o *WebBackendConnectionRead) GetDestinationID() string { + if o == nil { + return "" + } + return o.DestinationID +} + +func (o *WebBackendConnectionRead) GetSyncCatalog() AirbyteCatalog { + if o == nil { + return AirbyteCatalog{} + } + return o.SyncCatalog +} + +func (o *WebBackendConnectionRead) GetSchedule() *ConnectionSchedule { + if o == nil { + return nil + } + return o.Schedule +} + +func (o *WebBackendConnectionRead) GetScheduleType() *ConnectionScheduleType { + if o == nil { + return nil + } + return o.ScheduleType +} + +func (o *WebBackendConnectionRead) GetScheduleData() *ConnectionScheduleData { + if o == nil { + return nil + } + return o.ScheduleData +} + +func (o *WebBackendConnectionRead) GetStatus() ConnectionStatus { + if o == nil { + return ConnectionStatus("") + } + return o.Status +} + +func (o *WebBackendConnectionRead) GetOperationIds() []string { + if o == nil { + return nil + } + return o.OperationIds +} + +func (o *WebBackendConnectionRead) GetSource() SourceRead { + if o == nil { + return SourceRead{} + } + return o.Source +} + +func (o *WebBackendConnectionRead) GetDestination() DestinationRead { + if o == nil { + return DestinationRead{} + } + return o.Destination +} + +func (o *WebBackendConnectionRead) GetOperations() []OperationRead { + if o == nil { + return nil + } + return o.Operations +} + +func (o *WebBackendConnectionRead) GetLatestSyncJobCreatedAt() *int64 { + if o == nil { + return nil + } + return o.LatestSyncJobCreatedAt +} + +func (o *WebBackendConnectionRead) GetLatestSyncJobStatus() *JobStatus { + if o == nil { + return nil + } + return o.LatestSyncJobStatus +} + +func (o *WebBackendConnectionRead) GetIsSyncing() bool { + if o == nil { + return false + } + return o.IsSyncing +} + +func (o *WebBackendConnectionRead) GetResourceRequirements() *ResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} + +func (o *WebBackendConnectionRead) GetCatalogID() *string { + if o == nil { + return nil + } + return o.CatalogID +} + +func (o *WebBackendConnectionRead) GetCatalogDiff() *CatalogDiff { + if o == nil { + return nil + } + return o.CatalogDiff +} + +func (o *WebBackendConnectionRead) GetGeography() *Geography { + if o == nil { + return nil + } + return o.Geography +} + +func (o *WebBackendConnectionRead) GetSchemaChange() SchemaChange { + if o == nil { + return SchemaChange("") + } + return o.SchemaChange +} + +func (o *WebBackendConnectionRead) GetNotifySchemaChanges() bool { + if o == nil { + return false + } + return o.NotifySchemaChanges +} + +func (o *WebBackendConnectionRead) GetNotifySchemaChangesByEmail() bool { + if o == nil { + return false + } + return o.NotifySchemaChangesByEmail +} + +func (o *WebBackendConnectionRead) GetNonBreakingChangesPreference() NonBreakingChangesPreference { + if o == nil { + return NonBreakingChangesPreference("") + } + return o.NonBreakingChangesPreference } diff --git a/internal/sdk/pkg/models/shared/webbackendconnectionreadlist.go b/internal/sdk/pkg/models/shared/webbackendconnectionreadlist.go old mode 100755 new mode 100644 index 7dad6cf..feba0e6 --- a/internal/sdk/pkg/models/shared/webbackendconnectionreadlist.go +++ b/internal/sdk/pkg/models/shared/webbackendconnectionreadlist.go @@ -2,7 +2,13 @@ package shared -// WebBackendConnectionReadList - Successful operation type WebBackendConnectionReadList struct { Connections []WebBackendConnectionListItem `json:"connections"` } + +func (o *WebBackendConnectionReadList) GetConnections() []WebBackendConnectionListItem { + if o == nil { + return []WebBackendConnectionListItem{} + } + return o.Connections +} diff --git a/internal/sdk/pkg/models/shared/webbackendconnectionrequestbody.go b/internal/sdk/pkg/models/shared/webbackendconnectionrequestbody.go old mode 100755 new mode 100644 index f50b44e..500d440 --- a/internal/sdk/pkg/models/shared/webbackendconnectionrequestbody.go +++ b/internal/sdk/pkg/models/shared/webbackendconnectionrequestbody.go @@ -3,6 +3,20 @@ package shared type WebBackendConnectionRequestBody struct { - ConnectionID string `json:"connectionId"` WithRefreshedCatalog *bool `json:"withRefreshedCatalog,omitempty"` + ConnectionID string `json:"connectionId"` +} + +func (o *WebBackendConnectionRequestBody) GetWithRefreshedCatalog() *bool { + if o == nil { + return nil + } + return o.WithRefreshedCatalog +} + +func (o *WebBackendConnectionRequestBody) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID } diff --git a/internal/sdk/pkg/models/shared/webbackendconnectionupdate.go b/internal/sdk/pkg/models/shared/webbackendconnectionupdate.go old mode 100755 new mode 100644 index 53d6706..ee0491d --- a/internal/sdk/pkg/models/shared/webbackendconnectionupdate.go +++ b/internal/sdk/pkg/models/shared/webbackendconnectionupdate.go @@ -2,34 +2,175 @@ package shared +import ( + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" +) + // WebBackendConnectionUpdate - Used to apply a patch-style update to a connection, which means that null properties remain unchanged type WebBackendConnectionUpdate struct { - ConnectionID string `json:"connectionId"` - Geography *Geography `json:"geography,omitempty"` // Name that will be set to the connection - Name *string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` + ConnectionID string `json:"connectionId"` // Method used for computing final namespace in destination NamespaceDefinition *NamespaceDefinitionType `json:"namespaceDefinition,omitempty"` // Used when namespaceDefinition is 'customformat'. If blank then behaves like namespaceDefinition = 'destination'. If "${SOURCE_NAMESPACE}" then behaves like namespaceDefinition = 'source'. - NamespaceFormat *string `json:"namespaceFormat,omitempty"` - NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` - NotifySchemaChanges *bool `json:"notifySchemaChanges,omitempty"` - NotifySchemaChangesByEmail *bool `json:"notifySchemaChangesByEmail,omitempty"` - Operations []WebBackendOperationCreateOrUpdate `json:"operations,omitempty"` + NamespaceFormat *string `default:"null" json:"namespaceFormat"` // Prefix that will be prepended to the name of each stream when it is written to the destination. Prefix *string `json:"prefix,omitempty"` - // optional resource requirements to run workers (blank for unbounded allocations) - ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + // describes the available schema (catalog). + SyncCatalog *AirbyteCatalog `json:"syncCatalog,omitempty"` // if null, then no schedule is set. Schedule *ConnectionSchedule `json:"schedule,omitempty"` + // determine how the schedule data should be interpreted + ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` // schedule for when the the connection should run, per the schedule type ScheduleData *ConnectionScheduleData `json:"scheduleData,omitempty"` - // determine how the schedule data should be interpreted - ScheduleType *ConnectionScheduleType `json:"scheduleType,omitempty"` - SkipReset *bool `json:"skipReset,omitempty"` - SourceCatalogID *string `json:"sourceCatalogId,omitempty"` // Active means that data is flowing through the connection. Inactive means it is not. Deprecated means the connection is off and cannot be re-activated. the schema field describes the elements of the schema that will be synced. Status *ConnectionStatus `json:"status,omitempty"` - // describes the available schema (catalog). - SyncCatalog *AirbyteCatalog `json:"syncCatalog,omitempty"` + // optional resource requirements to run workers (blank for unbounded allocations) + ResourceRequirements *ResourceRequirements `json:"resourceRequirements,omitempty"` + SkipReset *bool `json:"skipReset,omitempty"` + Operations []WebBackendOperationCreateOrUpdate `json:"operations,omitempty"` + SourceCatalogID *string `json:"sourceCatalogId,omitempty"` + Geography *Geography `json:"geography,omitempty"` + NotifySchemaChanges *bool `json:"notifySchemaChanges,omitempty"` + NotifySchemaChangesByEmail *bool `json:"notifySchemaChangesByEmail,omitempty"` + NonBreakingChangesPreference *NonBreakingChangesPreference `json:"nonBreakingChangesPreference,omitempty"` +} + +func (w WebBackendConnectionUpdate) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(w, "", false) +} + +func (w *WebBackendConnectionUpdate) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &w, "", false, false); err != nil { + return err + } + return nil +} + +func (o *WebBackendConnectionUpdate) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *WebBackendConnectionUpdate) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *WebBackendConnectionUpdate) GetNamespaceDefinition() *NamespaceDefinitionType { + if o == nil { + return nil + } + return o.NamespaceDefinition +} + +func (o *WebBackendConnectionUpdate) GetNamespaceFormat() *string { + if o == nil { + return nil + } + return o.NamespaceFormat +} + +func (o *WebBackendConnectionUpdate) GetPrefix() *string { + if o == nil { + return nil + } + return o.Prefix +} + +func (o *WebBackendConnectionUpdate) GetSyncCatalog() *AirbyteCatalog { + if o == nil { + return nil + } + return o.SyncCatalog +} + +func (o *WebBackendConnectionUpdate) GetSchedule() *ConnectionSchedule { + if o == nil { + return nil + } + return o.Schedule +} + +func (o *WebBackendConnectionUpdate) GetScheduleType() *ConnectionScheduleType { + if o == nil { + return nil + } + return o.ScheduleType +} + +func (o *WebBackendConnectionUpdate) GetScheduleData() *ConnectionScheduleData { + if o == nil { + return nil + } + return o.ScheduleData +} + +func (o *WebBackendConnectionUpdate) GetStatus() *ConnectionStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *WebBackendConnectionUpdate) GetResourceRequirements() *ResourceRequirements { + if o == nil { + return nil + } + return o.ResourceRequirements +} + +func (o *WebBackendConnectionUpdate) GetSkipReset() *bool { + if o == nil { + return nil + } + return o.SkipReset +} + +func (o *WebBackendConnectionUpdate) GetOperations() []WebBackendOperationCreateOrUpdate { + if o == nil { + return nil + } + return o.Operations +} + +func (o *WebBackendConnectionUpdate) GetSourceCatalogID() *string { + if o == nil { + return nil + } + return o.SourceCatalogID +} + +func (o *WebBackendConnectionUpdate) GetGeography() *Geography { + if o == nil { + return nil + } + return o.Geography +} + +func (o *WebBackendConnectionUpdate) GetNotifySchemaChanges() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChanges +} + +func (o *WebBackendConnectionUpdate) GetNotifySchemaChangesByEmail() *bool { + if o == nil { + return nil + } + return o.NotifySchemaChangesByEmail +} + +func (o *WebBackendConnectionUpdate) GetNonBreakingChangesPreference() *NonBreakingChangesPreference { + if o == nil { + return nil + } + return o.NonBreakingChangesPreference } diff --git a/internal/sdk/pkg/models/shared/webbackendgeographieslistresult.go b/internal/sdk/pkg/models/shared/webbackendgeographieslistresult.go old mode 100755 new mode 100644 index eeb72a2..52aed3a --- a/internal/sdk/pkg/models/shared/webbackendgeographieslistresult.go +++ b/internal/sdk/pkg/models/shared/webbackendgeographieslistresult.go @@ -2,7 +2,13 @@ package shared -// WebBackendGeographiesListResult - Successful operation type WebBackendGeographiesListResult struct { Geographies []Geography `json:"geographies"` } + +func (o *WebBackendGeographiesListResult) GetGeographies() []Geography { + if o == nil { + return []Geography{} + } + return o.Geographies +} diff --git a/internal/sdk/pkg/models/shared/webbackendoperationcreateorupdate.go b/internal/sdk/pkg/models/shared/webbackendoperationcreateorupdate.go old mode 100755 new mode 100644 index 05f3f55..01b389e --- a/internal/sdk/pkg/models/shared/webbackendoperationcreateorupdate.go +++ b/internal/sdk/pkg/models/shared/webbackendoperationcreateorupdate.go @@ -3,8 +3,36 @@ package shared type WebBackendOperationCreateOrUpdate struct { - Name string `json:"name"` OperationID *string `json:"operationId,omitempty"` - OperatorConfiguration OperatorConfiguration `json:"operatorConfiguration"` WorkspaceID string `json:"workspaceId"` + Name string `json:"name"` + OperatorConfiguration OperatorConfiguration `json:"operatorConfiguration"` +} + +func (o *WebBackendOperationCreateOrUpdate) GetOperationID() *string { + if o == nil { + return nil + } + return o.OperationID +} + +func (o *WebBackendOperationCreateOrUpdate) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *WebBackendOperationCreateOrUpdate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *WebBackendOperationCreateOrUpdate) GetOperatorConfiguration() OperatorConfiguration { + if o == nil { + return OperatorConfiguration{} + } + return o.OperatorConfiguration } diff --git a/internal/sdk/pkg/models/shared/webbackendworkspacestate.go b/internal/sdk/pkg/models/shared/webbackendworkspacestate.go old mode 100755 new mode 100644 index a770844..b17307c --- a/internal/sdk/pkg/models/shared/webbackendworkspacestate.go +++ b/internal/sdk/pkg/models/shared/webbackendworkspacestate.go @@ -5,3 +5,10 @@ package shared type WebBackendWorkspaceState struct { WorkspaceID string `json:"workspaceId"` } + +func (o *WebBackendWorkspaceState) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/webbackendworkspacestateresult.go b/internal/sdk/pkg/models/shared/webbackendworkspacestateresult.go old mode 100755 new mode 100644 index f1b60e2..1bb22e7 --- a/internal/sdk/pkg/models/shared/webbackendworkspacestateresult.go +++ b/internal/sdk/pkg/models/shared/webbackendworkspacestateresult.go @@ -2,9 +2,29 @@ package shared -// WebBackendWorkspaceStateResult - Successful operation type WebBackendWorkspaceStateResult struct { HasConnections bool `json:"hasConnections"` - HasDestinations bool `json:"hasDestinations"` HasSources bool `json:"hasSources"` + HasDestinations bool `json:"hasDestinations"` +} + +func (o *WebBackendWorkspaceStateResult) GetHasConnections() bool { + if o == nil { + return false + } + return o.HasConnections +} + +func (o *WebBackendWorkspaceStateResult) GetHasSources() bool { + if o == nil { + return false + } + return o.HasSources +} + +func (o *WebBackendWorkspaceStateResult) GetHasDestinations() bool { + if o == nil { + return false + } + return o.HasDestinations } diff --git a/internal/sdk/pkg/models/shared/webhookconfigread.go b/internal/sdk/pkg/models/shared/webhookconfigread.go old mode 100755 new mode 100644 index 0881356..3942205 --- a/internal/sdk/pkg/models/shared/webhookconfigread.go +++ b/internal/sdk/pkg/models/shared/webhookconfigread.go @@ -8,3 +8,17 @@ type WebhookConfigRead struct { // human-readable name e.g. for display in UI Name *string `json:"name,omitempty"` } + +func (o *WebhookConfigRead) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *WebhookConfigRead) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/internal/sdk/pkg/models/shared/webhookconfigwrite.go b/internal/sdk/pkg/models/shared/webhookconfigwrite.go old mode 100755 new mode 100644 index 93480a5..3b7bd03 --- a/internal/sdk/pkg/models/shared/webhookconfigwrite.go +++ b/internal/sdk/pkg/models/shared/webhookconfigwrite.go @@ -3,10 +3,31 @@ package shared type WebhookConfigWrite struct { - // an auth token, to be passed as the value for an HTTP Authorization header. - AuthToken *string `json:"authToken,omitempty"` // human readable name for this webhook e.g. for UI display. Name *string `json:"name,omitempty"` + // an auth token, to be passed as the value for an HTTP Authorization header. + AuthToken *string `json:"authToken,omitempty"` // if supplied, the webhook config will be validated by checking that this URL returns a 2xx response. ValidationURL *string `json:"validationUrl,omitempty"` } + +func (o *WebhookConfigWrite) GetName() *string { + if o == nil { + return nil + } + return o.Name +} + +func (o *WebhookConfigWrite) GetAuthToken() *string { + if o == nil { + return nil + } + return o.AuthToken +} + +func (o *WebhookConfigWrite) GetValidationURL() *string { + if o == nil { + return nil + } + return o.ValidationURL +} diff --git a/internal/sdk/pkg/models/shared/workflowstateread.go b/internal/sdk/pkg/models/shared/workflowstateread.go old mode 100755 new mode 100644 index 7d4f7b7..f82f319 --- a/internal/sdk/pkg/models/shared/workflowstateread.go +++ b/internal/sdk/pkg/models/shared/workflowstateread.go @@ -5,3 +5,10 @@ package shared type WorkflowStateRead struct { Running bool `json:"running"` } + +func (o *WorkflowStateRead) GetRunning() bool { + if o == nil { + return false + } + return o.Running +} diff --git a/internal/sdk/pkg/models/shared/workspacecreate.go b/internal/sdk/pkg/models/shared/workspacecreate.go old mode 100755 new mode 100644 index 8ad0188..64742c6 --- a/internal/sdk/pkg/models/shared/workspacecreate.go +++ b/internal/sdk/pkg/models/shared/workspacecreate.go @@ -3,14 +3,84 @@ package shared type WorkspaceCreate struct { - AnonymousDataCollection *bool `json:"anonymousDataCollection,omitempty"` - DefaultGeography *Geography `json:"defaultGeography,omitempty"` - DisplaySetupWizard *bool `json:"displaySetupWizard,omitempty"` Email *string `json:"email,omitempty"` + AnonymousDataCollection *bool `json:"anonymousDataCollection,omitempty"` Name string `json:"name"` News *bool `json:"news,omitempty"` - NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` - Notifications []Notification `json:"notifications,omitempty"` SecurityUpdates *bool `json:"securityUpdates,omitempty"` + Notifications []Notification `json:"notifications,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + DisplaySetupWizard *bool `json:"displaySetupWizard,omitempty"` + DefaultGeography *Geography `json:"defaultGeography,omitempty"` WebhookConfigs []WebhookConfigWrite `json:"webhookConfigs,omitempty"` } + +func (o *WorkspaceCreate) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +func (o *WorkspaceCreate) GetAnonymousDataCollection() *bool { + if o == nil { + return nil + } + return o.AnonymousDataCollection +} + +func (o *WorkspaceCreate) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *WorkspaceCreate) GetNews() *bool { + if o == nil { + return nil + } + return o.News +} + +func (o *WorkspaceCreate) GetSecurityUpdates() *bool { + if o == nil { + return nil + } + return o.SecurityUpdates +} + +func (o *WorkspaceCreate) GetNotifications() []Notification { + if o == nil { + return nil + } + return o.Notifications +} + +func (o *WorkspaceCreate) GetNotificationSettings() *NotificationSettings { + if o == nil { + return nil + } + return o.NotificationSettings +} + +func (o *WorkspaceCreate) GetDisplaySetupWizard() *bool { + if o == nil { + return nil + } + return o.DisplaySetupWizard +} + +func (o *WorkspaceCreate) GetDefaultGeography() *Geography { + if o == nil { + return nil + } + return o.DefaultGeography +} + +func (o *WorkspaceCreate) GetWebhookConfigs() []WebhookConfigWrite { + if o == nil { + return nil + } + return o.WebhookConfigs +} diff --git a/internal/sdk/pkg/models/shared/workspacegivefeedback.go b/internal/sdk/pkg/models/shared/workspacegivefeedback.go old mode 100755 new mode 100644 index 18ddf33..b57e04e --- a/internal/sdk/pkg/models/shared/workspacegivefeedback.go +++ b/internal/sdk/pkg/models/shared/workspacegivefeedback.go @@ -5,3 +5,10 @@ package shared type WorkspaceGiveFeedback struct { WorkspaceID string `json:"workspaceId"` } + +func (o *WorkspaceGiveFeedback) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/workspaceidrequestbody.go b/internal/sdk/pkg/models/shared/workspaceidrequestbody.go old mode 100755 new mode 100644 index e044dc9..bbb2d20 --- a/internal/sdk/pkg/models/shared/workspaceidrequestbody.go +++ b/internal/sdk/pkg/models/shared/workspaceidrequestbody.go @@ -5,3 +5,10 @@ package shared type WorkspaceIDRequestBody struct { WorkspaceID string `json:"workspaceId"` } + +func (o *WorkspaceIDRequestBody) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} diff --git a/internal/sdk/pkg/models/shared/workspaceread.go b/internal/sdk/pkg/models/shared/workspaceread.go old mode 100755 new mode 100644 index 3ca73d5..31a99dc --- a/internal/sdk/pkg/models/shared/workspaceread.go +++ b/internal/sdk/pkg/models/shared/workspaceread.go @@ -2,22 +2,133 @@ package shared -// WorkspaceRead - Successful operation type WorkspaceRead struct { - AnonymousDataCollection *bool `json:"anonymousDataCollection,omitempty"` + WorkspaceID string `json:"workspaceId"` CustomerID string `json:"customerId"` - DefaultGeography *Geography `json:"defaultGeography,omitempty"` - DisplaySetupWizard *bool `json:"displaySetupWizard,omitempty"` Email *string `json:"email,omitempty"` - FeedbackDone *bool `json:"feedbackDone,omitempty"` - FirstCompletedSync *bool `json:"firstCompletedSync,omitempty"` - InitialSetupComplete bool `json:"initialSetupComplete"` Name string `json:"name"` + Slug string `json:"slug"` + InitialSetupComplete bool `json:"initialSetupComplete"` + DisplaySetupWizard *bool `json:"displaySetupWizard,omitempty"` + AnonymousDataCollection *bool `json:"anonymousDataCollection,omitempty"` News *bool `json:"news,omitempty"` - NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` - Notifications []Notification `json:"notifications,omitempty"` SecurityUpdates *bool `json:"securityUpdates,omitempty"` - Slug string `json:"slug"` + Notifications []Notification `json:"notifications,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + FirstCompletedSync *bool `json:"firstCompletedSync,omitempty"` + FeedbackDone *bool `json:"feedbackDone,omitempty"` + DefaultGeography *Geography `json:"defaultGeography,omitempty"` WebhookConfigs []WebhookConfigRead `json:"webhookConfigs,omitempty"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *WorkspaceRead) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *WorkspaceRead) GetCustomerID() string { + if o == nil { + return "" + } + return o.CustomerID +} + +func (o *WorkspaceRead) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +func (o *WorkspaceRead) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *WorkspaceRead) GetSlug() string { + if o == nil { + return "" + } + return o.Slug +} + +func (o *WorkspaceRead) GetInitialSetupComplete() bool { + if o == nil { + return false + } + return o.InitialSetupComplete +} + +func (o *WorkspaceRead) GetDisplaySetupWizard() *bool { + if o == nil { + return nil + } + return o.DisplaySetupWizard +} + +func (o *WorkspaceRead) GetAnonymousDataCollection() *bool { + if o == nil { + return nil + } + return o.AnonymousDataCollection +} + +func (o *WorkspaceRead) GetNews() *bool { + if o == nil { + return nil + } + return o.News +} + +func (o *WorkspaceRead) GetSecurityUpdates() *bool { + if o == nil { + return nil + } + return o.SecurityUpdates +} + +func (o *WorkspaceRead) GetNotifications() []Notification { + if o == nil { + return nil + } + return o.Notifications +} + +func (o *WorkspaceRead) GetNotificationSettings() *NotificationSettings { + if o == nil { + return nil + } + return o.NotificationSettings +} + +func (o *WorkspaceRead) GetFirstCompletedSync() *bool { + if o == nil { + return nil + } + return o.FirstCompletedSync +} + +func (o *WorkspaceRead) GetFeedbackDone() *bool { + if o == nil { + return nil + } + return o.FeedbackDone +} + +func (o *WorkspaceRead) GetDefaultGeography() *Geography { + if o == nil { + return nil + } + return o.DefaultGeography +} + +func (o *WorkspaceRead) GetWebhookConfigs() []WebhookConfigRead { + if o == nil { + return nil + } + return o.WebhookConfigs } diff --git a/internal/sdk/pkg/models/shared/workspacereadlist.go b/internal/sdk/pkg/models/shared/workspacereadlist.go old mode 100755 new mode 100644 index 531f937..2e83f4c --- a/internal/sdk/pkg/models/shared/workspacereadlist.go +++ b/internal/sdk/pkg/models/shared/workspacereadlist.go @@ -2,7 +2,13 @@ package shared -// WorkspaceReadList - Successful operation type WorkspaceReadList struct { Workspaces []WorkspaceRead `json:"workspaces"` } + +func (o *WorkspaceReadList) GetWorkspaces() []WorkspaceRead { + if o == nil { + return []WorkspaceRead{} + } + return o.Workspaces +} diff --git a/internal/sdk/pkg/models/shared/workspaceupdate.go b/internal/sdk/pkg/models/shared/workspaceupdate.go old mode 100755 new mode 100644 index 5ae0f8a..c3ca72e --- a/internal/sdk/pkg/models/shared/workspaceupdate.go +++ b/internal/sdk/pkg/models/shared/workspaceupdate.go @@ -4,15 +4,92 @@ package shared // WorkspaceUpdate - Used to apply a patch-style update to a workspace, which means that null properties remain unchanged type WorkspaceUpdate struct { - AnonymousDataCollection *bool `json:"anonymousDataCollection,omitempty"` - DefaultGeography *Geography `json:"defaultGeography,omitempty"` - DisplaySetupWizard *bool `json:"displaySetupWizard,omitempty"` + WorkspaceID string `json:"workspaceId"` Email *string `json:"email,omitempty"` InitialSetupComplete *bool `json:"initialSetupComplete,omitempty"` + DisplaySetupWizard *bool `json:"displaySetupWizard,omitempty"` + AnonymousDataCollection *bool `json:"anonymousDataCollection,omitempty"` News *bool `json:"news,omitempty"` - NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` - Notifications []Notification `json:"notifications,omitempty"` SecurityUpdates *bool `json:"securityUpdates,omitempty"` + Notifications []Notification `json:"notifications,omitempty"` + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + DefaultGeography *Geography `json:"defaultGeography,omitempty"` WebhookConfigs []WebhookConfigWrite `json:"webhookConfigs,omitempty"` - WorkspaceID string `json:"workspaceId"` +} + +func (o *WorkspaceUpdate) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *WorkspaceUpdate) GetEmail() *string { + if o == nil { + return nil + } + return o.Email +} + +func (o *WorkspaceUpdate) GetInitialSetupComplete() *bool { + if o == nil { + return nil + } + return o.InitialSetupComplete +} + +func (o *WorkspaceUpdate) GetDisplaySetupWizard() *bool { + if o == nil { + return nil + } + return o.DisplaySetupWizard +} + +func (o *WorkspaceUpdate) GetAnonymousDataCollection() *bool { + if o == nil { + return nil + } + return o.AnonymousDataCollection +} + +func (o *WorkspaceUpdate) GetNews() *bool { + if o == nil { + return nil + } + return o.News +} + +func (o *WorkspaceUpdate) GetSecurityUpdates() *bool { + if o == nil { + return nil + } + return o.SecurityUpdates +} + +func (o *WorkspaceUpdate) GetNotifications() []Notification { + if o == nil { + return nil + } + return o.Notifications +} + +func (o *WorkspaceUpdate) GetNotificationSettings() *NotificationSettings { + if o == nil { + return nil + } + return o.NotificationSettings +} + +func (o *WorkspaceUpdate) GetDefaultGeography() *Geography { + if o == nil { + return nil + } + return o.DefaultGeography +} + +func (o *WorkspaceUpdate) GetWebhookConfigs() []WebhookConfigWrite { + if o == nil { + return nil + } + return o.WebhookConfigs } diff --git a/internal/sdk/pkg/models/shared/workspaceupdatename.go b/internal/sdk/pkg/models/shared/workspaceupdatename.go old mode 100755 new mode 100644 index 808cf2e..16004f2 --- a/internal/sdk/pkg/models/shared/workspaceupdatename.go +++ b/internal/sdk/pkg/models/shared/workspaceupdatename.go @@ -3,6 +3,20 @@ package shared type WorkspaceUpdateName struct { - Name string `json:"name"` WorkspaceID string `json:"workspaceId"` + Name string `json:"name"` +} + +func (o *WorkspaceUpdateName) GetWorkspaceID() string { + if o == nil { + return "" + } + return o.WorkspaceID +} + +func (o *WorkspaceUpdateName) GetName() string { + if o == nil { + return "" + } + return o.Name } diff --git a/internal/sdk/pkg/types/bigint.go b/internal/sdk/pkg/types/bigint.go old mode 100755 new mode 100644 index b37a415..afd0cd2 --- a/internal/sdk/pkg/types/bigint.go +++ b/internal/sdk/pkg/types/bigint.go @@ -7,42 +7,15 @@ import ( "math/big" ) -type BigInt struct { - big.Int -} - -func (b BigInt) MarshalJSON() ([]byte, error) { - return []byte(`"` + b.String() + `"`), nil -} - -func (b *BigInt) UnmarshalJSON(p []byte) error { - if string(p) == "null" { - return nil - } - - stringVal := string(p) - if len(stringVal) > 2 && stringVal[0] == '"' && stringVal[len(stringVal)-1] == '"' { - stringVal = stringVal[1 : len(stringVal)-1] - } - - var z big.Int - _, ok := z.SetString(string(stringVal), 10) - if !ok { - return fmt.Errorf("not a valid big integer: %s", p) - } - b.Int = z - return nil -} - -// MustBigIntFromString provides a helper function to return a big.Int from a string +// MustNewBigIntFromString returns an instance of big.Int from a string // The string is assumed to be base 10 and if it is not a valid big.Int -// then the function will return nil -func MustBigIntFromString(s string) *BigInt { +// then the function panics. +// Avoid using this function in production code. +func MustNewBigIntFromString(s string) *big.Int { i, ok := new(big.Int).SetString(s, 10) if !ok { - return nil - } - return &BigInt{ - Int: *i, + panic(fmt.Errorf("failed to parse string as big.Int")) } + + return i } diff --git a/internal/sdk/pkg/types/date.go b/internal/sdk/pkg/types/date.go old mode 100755 new mode 100644 index 01c69b7..c4648fa --- a/internal/sdk/pkg/types/date.go +++ b/internal/sdk/pkg/types/date.go @@ -67,6 +67,10 @@ func MustDateFromString(str string) Date { return d } +func (d Date) GetTime() time.Time { + return d.Time +} + func (d Date) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%s"`, d.Time.Format("2006-01-02"))), nil } diff --git a/internal/sdk/pkg/types/datetime.go b/internal/sdk/pkg/types/datetime.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/types/decimal.go b/internal/sdk/pkg/types/decimal.go new file mode 100644 index 0000000..a42284b --- /dev/null +++ b/internal/sdk/pkg/types/decimal.go @@ -0,0 +1,20 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package types + +import ( + "fmt" + + "github.com/ericlagergren/decimal" +) + +// MustNewDecimalFromString returns an instance of Decimal from a string +// Avoid using this function in production code. +func MustNewDecimalFromString(s string) *decimal.Big { + d, ok := new(decimal.Big).SetString(s) + if !ok { + panic(fmt.Errorf("failed to parse string as decimal.Big")) + } + + return d +} diff --git a/internal/sdk/pkg/types/pointers.go b/internal/sdk/pkg/types/pointers.go new file mode 100644 index 0000000..4f15e99 --- /dev/null +++ b/internal/sdk/pkg/types/pointers.go @@ -0,0 +1,10 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package types + +func String(s string) *string { return &s } +func Bool(b bool) *bool { return &b } +func Int(i int) *int { return &i } +func Int64(i int64) *int64 { return &i } +func Float32(f float32) *float32 { return &f } +func Float64(f float64) *float64 { return &f } diff --git a/internal/sdk/pkg/utils/contenttype.go b/internal/sdk/pkg/utils/contenttype.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/utils/form.go b/internal/sdk/pkg/utils/form.go old mode 100755 new mode 100644 index bf96265..a71d9cd --- a/internal/sdk/pkg/utils/form.go +++ b/internal/sdk/pkg/utils/form.go @@ -10,17 +10,20 @@ import ( "strings" "time" - "airbyte/internal/sdk/pkg/types" + "github.com/ericlagergren/decimal" + + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/types" ) func populateForm(paramName string, explode bool, objType reflect.Type, objValue reflect.Value, delimiter string, getFieldName func(reflect.StructField) string) url.Values { formValues := url.Values{} + if isNil(objType, objValue) { + return formValues + } + if objType.Kind() == reflect.Pointer { - if objValue.IsNil() { - return formValues - } objType = objType.Elem() objValue = objValue.Elem() } @@ -32,10 +35,10 @@ func populateForm(paramName string, explode bool, objType reflect.Type, objValue formValues.Add(paramName, valToString(objValue.Interface())) case types.Date: formValues.Add(paramName, valToString(objValue.Interface())) - case types.BigInt: - formValues.Add(paramName, valToString(objValue.Interface())) case big.Int: formValues.Add(paramName, valToString(objValue.Interface())) + case decimal.Big: + formValues.Add(paramName, valToString(objValue.Interface())) default: var items []string @@ -43,11 +46,11 @@ func populateForm(paramName string, explode bool, objType reflect.Type, objValue fieldType := objType.Field(i) valType := objValue.Field(i) - if valType.Kind() == reflect.Pointer { - if valType.IsNil() { - continue - } + if isNil(fieldType.Type, valType) { + continue + } + if valType.Kind() == reflect.Pointer { valType = valType.Elem() } diff --git a/internal/sdk/pkg/utils/headers.go b/internal/sdk/pkg/utils/headers.go old mode 100755 new mode 100644 index d8ca9b1..0837022 --- a/internal/sdk/pkg/utils/headers.go +++ b/internal/sdk/pkg/utils/headers.go @@ -31,10 +31,11 @@ func PopulateHeaders(ctx context.Context, req *http.Request, headers interface{} } func serializeHeader(objType reflect.Type, objValue reflect.Value, explode bool) string { + if isNil(objType, objValue) { + return "" + } + if objType.Kind() == reflect.Pointer { - if objValue.IsNil() { - return "" - } objType = objType.Elem() objValue = objValue.Elem() } @@ -47,10 +48,11 @@ func serializeHeader(objType reflect.Type, objValue reflect.Value, explode bool) fieldType := objType.Field(i) valType := objValue.Field(i) + if isNil(fieldType.Type, valType) { + continue + } + if fieldType.Type.Kind() == reflect.Pointer { - if valType.IsNil() { - continue - } valType = valType.Elem() } diff --git a/internal/sdk/pkg/utils/json.go b/internal/sdk/pkg/utils/json.go new file mode 100644 index 0000000..4a47d94 --- /dev/null +++ b/internal/sdk/pkg/utils/json.go @@ -0,0 +1,579 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package utils + +import ( + "bytes" + "encoding/json" + "fmt" + "math/big" + "reflect" + "strings" + "time" + "unsafe" + + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/types" + + "github.com/ericlagergren/decimal" +) + +func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, error) { + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + + switch { + case isModelType(typ): + if topLevel { + return json.Marshal(v) + } + + if isNil(typ, val) { + return []byte("null"), nil + } + + out := map[string]json.RawMessage{} + + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + fieldVal := val.Field(i) + + fieldName := field.Name + + omitEmpty := false + jsonTag := field.Tag.Get("json") + if jsonTag != "" { + for _, tag := range strings.Split(jsonTag, ",") { + if tag == "omitempty" { + omitEmpty = true + } else { + fieldName = tag + } + } + } + + if isNil(field.Type, fieldVal) { + if omitEmpty { + continue + } + } + + if !field.IsExported() && field.Tag.Get("const") == "" { + continue + } + + additionalProperties := field.Tag.Get("additionalProperties") + if fieldName == "-" && additionalProperties == "" { + continue + } + + if additionalProperties == "true" { + if field.Type.Kind() != reflect.Map { + return nil, fmt.Errorf("additionalProperties must be a map") + } + + for _, key := range fieldVal.MapKeys() { + r, err := marshalValue(fieldVal.MapIndex(key).Interface(), field.Tag) + if err != nil { + return nil, err + } + + out[key.String()] = r + } + + continue + } + + var fv interface{} + + if field.IsExported() { + fv = fieldVal.Interface() + } else { + pt := reflect.New(typ).Elem() + pt.Set(val) + + pf := pt.Field(i) + + fv = reflect.NewAt(pf.Type(), unsafe.Pointer(pf.UnsafeAddr())).Elem().Interface() + } + + r, err := marshalValue(fv, field.Tag) + if err != nil { + return nil, err + } + + out[fieldName] = r + } + + return json.Marshal(out) + default: + return marshalValue(v, tag) + } +} + +func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, disallowUnknownFields bool) error { + if reflect.TypeOf(v).Kind() != reflect.Ptr { + return fmt.Errorf("v must be a pointer") + } + + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + + switch { + case isModelType(typ): + if topLevel || bytes.Equal(b, []byte("null")) { + d := json.NewDecoder(bytes.NewReader(b)) + if disallowUnknownFields { + d.DisallowUnknownFields() + } + return d.Decode(v) + } + + var unmarhsaled map[string]json.RawMessage + + if err := json.Unmarshal(b, &unmarhsaled); err != nil { + return err + } + + var additionalPropertiesField *reflect.StructField + var additionalPropertiesValue *reflect.Value + + for i := 0; i < typ.NumField(); i++ { + field := typ.Field(i) + fieldVal := val.Field(i) + + fieldName := field.Name + + jsonTag := field.Tag.Get("json") + if jsonTag != "" { + for _, tag := range strings.Split(jsonTag, ",") { + if tag != "omitempty" { + fieldName = tag + } + } + } + + if field.Tag.Get("additionalProperties") == "true" { + additionalPropertiesField = &field + additionalPropertiesValue = &fieldVal + continue + } + + // If we receive a value for a const field ignore it but mark it as unmarshaled + if field.Tag.Get("const") != "" { + if r, ok := unmarhsaled[fieldName]; ok { + val := string(r) + if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { + val = val[1 : len(val)-1] + } + if val != field.Tag.Get("const") { + return fmt.Errorf("const field %s does not match expected value %s", fieldName, field.Tag.Get("const")) + } + + delete(unmarhsaled, fieldName) + } + } else if !field.IsExported() { + continue + } + + value, ok := unmarhsaled[fieldName] + if !ok { + defaultTag := field.Tag.Get("default") + if defaultTag != "" { + value = handleDefaultConstValue(defaultTag, fieldVal.Interface(), field.Tag) + ok = true + } + } else { + delete(unmarhsaled, fieldName) + } + + if ok { + if err := unmarshalValue(value, fieldVal, field.Tag, disallowUnknownFields); err != nil { + return err + } + } + } + + keys := make([]string, 0, len(unmarhsaled)) + for k := range unmarhsaled { + keys = append(keys, k) + } + + if len(keys) > 0 { + if disallowUnknownFields && (additionalPropertiesField == nil || additionalPropertiesValue == nil) { + return fmt.Errorf("unknown fields: %v", keys) + } + + if additionalPropertiesField != nil && additionalPropertiesValue != nil { + if additionalPropertiesValue.Kind() != reflect.Map { + return fmt.Errorf("additionalProperties must be a map") + } + + additionalPropertiesValue.Set(reflect.MakeMap(additionalPropertiesField.Type)) + + for key, value := range unmarhsaled { + val := reflect.New(additionalPropertiesField.Type.Elem()) + + if err := unmarshalValue(value, val, additionalPropertiesField.Tag, disallowUnknownFields); err != nil { + return err + } + + additionalPropertiesValue.SetMapIndex(reflect.ValueOf(key), val.Elem()) + } + } + } + default: + return unmarshalValue(b, reflect.ValueOf(v), tag, disallowUnknownFields) + } + + return nil +} + +func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) { + constTag := tag.Get("const") + if constTag != "" { + return handleDefaultConstValue(constTag, v, tag), nil + } + + if isNil(reflect.TypeOf(v), reflect.ValueOf(v)) { + defaultTag := tag.Get("default") + if defaultTag != "" { + return handleDefaultConstValue(defaultTag, v, tag), nil + } + + return []byte("null"), nil + } + + typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) + switch typ.Kind() { + case reflect.Map: + if isNil(typ, val) { + return []byte("null"), nil + } + + out := map[string]json.RawMessage{} + + for _, key := range val.MapKeys() { + itemVal := val.MapIndex(key) + + if isNil(itemVal.Type(), itemVal) { + out[key.String()] = []byte("null") + continue + } + + r, err := marshalValue(itemVal.Interface(), tag) + if err != nil { + return nil, err + } + + out[key.String()] = r + } + + return json.Marshal(out) + case reflect.Slice, reflect.Array: + if isNil(typ, val) { + return []byte("null"), nil + } + + out := []json.RawMessage{} + + for i := 0; i < val.Len(); i++ { + itemVal := val.Index(i) + + if isNil(itemVal.Type(), itemVal) { + out = append(out, []byte("null")) + continue + } + + r, err := marshalValue(itemVal.Interface(), tag) + if err != nil { + return nil, err + } + + out = append(out, r) + } + + return json.Marshal(out) + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + return []byte(fmt.Sprintf(`"%s"`, val.Interface().(time.Time).Format(time.RFC3339Nano))), nil + case reflect.TypeOf(big.Int{}): + format := tag.Get("bigint") + if format == "string" { + b := val.Interface().(big.Int) + return []byte(fmt.Sprintf(`"%s"`, (&b).String())), nil + } + case reflect.TypeOf(decimal.Big{}): + format := tag.Get("decimal") + if format == "number" { + b := val.Interface().(decimal.Big) + f, ok := (&b).Float64() + if ok { + return []byte(b.String()), nil + } + + return []byte(fmt.Sprintf(`%f`, f)), nil + } + } + } + + return json.Marshal(v) +} + +func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.StructTag) json.RawMessage { + if tagValue == "null" { + return []byte("null") + } + + typ := dereferenceTypePointer(reflect.TypeOf(val)) + switch typ { + case reflect.TypeOf(time.Time{}): + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + case reflect.TypeOf(big.Int{}): + bigIntTag := tag.Get("bigint") + if bigIntTag == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(decimal.Big{}): + decimalTag := tag.Get("decimal") + if decimalTag != "number" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(types.Date{}): + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + default: + if typ.Kind() == reflect.String { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + } + + return []byte(tagValue) +} + +func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag, disallowUnknownFields bool) error { + if bytes.Equal(value, []byte("null")) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + typ := dereferenceTypePointer(v.Type()) + + switch typ.Kind() { + case reflect.Map: + if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + var unmarhsaled map[string]json.RawMessage + + if err := json.Unmarshal(value, &unmarhsaled); err != nil { + return err + } + + m := reflect.MakeMap(typ) + + for k, value := range unmarhsaled { + itemVal := reflect.New(typ.Elem()) + + if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + return err + } + + m.SetMapIndex(reflect.ValueOf(k), itemVal.Elem()) + } + + v.Set(m) + return nil + case reflect.Slice, reflect.Array: + if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { + if v.CanAddr() { + return json.Unmarshal(value, v.Addr().Interface()) + } else { + return json.Unmarshal(value, v.Interface()) + } + } + + var unmarhsaled []json.RawMessage + + if err := json.Unmarshal(value, &unmarhsaled); err != nil { + return err + } + + arrVal := v + + for _, value := range unmarhsaled { + itemVal := reflect.New(typ.Elem()) + + if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { + return err + } + + arrVal = reflect.Append(arrVal, itemVal.Elem()) + } + + v.Set(arrVal) + return nil + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + t, err := time.Parse(time.RFC3339Nano, s) + if err != nil { + return fmt.Errorf("failed to parse string as time.Time: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(t)) + return nil + case reflect.TypeOf(big.Int{}): + var b *big.Int + + format := tag.Get("bigint") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var ok bool + b, ok = new(big.Int).SetString(s, 10) + if !ok { + return fmt.Errorf("failed to parse string as big.Int") + } + } else { + if err := json.Unmarshal(value, &b); err != nil { + return err + } + } + + if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + case reflect.TypeOf(decimal.Big{}): + var d *decimal.Big + format := tag.Get("decimal") + if format == "number" { + var ok bool + d, ok = new(decimal.Big).SetString(string(value)) + if !ok { + return fmt.Errorf("failed to parse number as decimal.Big") + } + } else { + if err := json.Unmarshal(value, &d); err != nil { + return err + } + } + + if v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Ptr { + v = v.Elem() + } + + v.Set(reflect.ValueOf(d)) + return nil + case reflect.TypeOf(types.Date{}): + var s string + + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + d, err := types.DateFromString(s) + if err != nil { + return fmt.Errorf("failed to parse string as types.Date: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(d)) + return nil + } + } + + var val interface{} + + if v.CanAddr() { + val = v.Addr().Interface() + } else { + val = v.Interface() + } + + d := json.NewDecoder(bytes.NewReader(value)) + if disallowUnknownFields { + d.DisallowUnknownFields() + } + return d.Decode(val) +} + +func dereferencePointers(typ reflect.Type, val reflect.Value) (reflect.Type, reflect.Value) { + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + val = val.Elem() + } else { + return typ, val + } + + return dereferencePointers(typ, val) +} + +func dereferenceTypePointer(typ reflect.Type) reflect.Type { + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } else { + return typ + } + + return dereferenceTypePointer(typ) +} + +func isComplexValueType(typ reflect.Type) bool { + switch typ.Kind() { + case reflect.Struct: + switch typ { + case reflect.TypeOf(time.Time{}): + fallthrough + case reflect.TypeOf(big.Int{}): + fallthrough + case reflect.TypeOf(decimal.Big{}): + fallthrough + case reflect.TypeOf(types.Date{}): + return true + } + } + + return false +} + +func isModelType(typ reflect.Type) bool { + if isComplexValueType(typ) { + return false + } + + if typ.Kind() == reflect.Struct { + return true + } + + return false +} diff --git a/internal/sdk/pkg/utils/pathparams.go b/internal/sdk/pkg/utils/pathparams.go old mode 100755 new mode 100644 index c2fd728..d587636 --- a/internal/sdk/pkg/utils/pathparams.go +++ b/internal/sdk/pkg/utils/pathparams.go @@ -5,9 +5,15 @@ package utils import ( "context" "fmt" + "math/big" "net/url" "reflect" "strings" + "time" + + "github.com/ericlagergren/decimal" + + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/types" ) func GenerateURL(ctx context.Context, serverURL, path string, pathParams interface{}, globals map[string]map[string]map[string]interface{}) (string, error) { @@ -61,10 +67,11 @@ func GenerateURL(ctx context.Context, serverURL, path string, pathParams interfa func getSimplePathParams(ctx context.Context, parentName string, objType reflect.Type, objValue reflect.Value, explode bool) map[string]string { pathParams := make(map[string]string) + if isNil(objType, objValue) { + return nil + } + if objType.Kind() == reflect.Ptr { - if objValue.IsNil() { - return nil - } objType = objType.Elem() objValue = objValue.Elem() } @@ -94,30 +101,42 @@ func getSimplePathParams(ctx context.Context, parentName string, objType reflect } pathParams[parentName] = strings.Join(ppVals, ",") case reflect.Struct: - var ppVals []string - for i := 0; i < objType.NumField(); i++ { - fieldType := objType.Field(i) - valType := objValue.Field(i) - - ppTag := parseParamTag(pathParamTagKey, fieldType, "simple", explode) - if ppTag == nil { - continue - } + switch objValue.Interface().(type) { + case time.Time: + pathParams[parentName] = valToString(objValue.Interface()) + case types.Date: + pathParams[parentName] = valToString(objValue.Interface()) + case big.Int: + pathParams[parentName] = valToString(objValue.Interface()) + case decimal.Big: + pathParams[parentName] = valToString(objValue.Interface()) + default: + var ppVals []string + for i := 0; i < objType.NumField(); i++ { + fieldType := objType.Field(i) + valType := objValue.Field(i) + + ppTag := parseParamTag(pathParamTagKey, fieldType, "simple", explode) + if ppTag == nil { + continue + } - if fieldType.Type.Kind() == reflect.Pointer { - if valType.IsNil() { + if isNil(fieldType.Type, valType) { continue } - valType = valType.Elem() - } - if explode { - ppVals = append(ppVals, fmt.Sprintf("%s=%s", ppTag.ParamName, valToString(valType.Interface()))) - } else { - ppVals = append(ppVals, fmt.Sprintf("%s,%s", ppTag.ParamName, valToString(valType.Interface()))) + if fieldType.Type.Kind() == reflect.Pointer { + valType = valType.Elem() + } + + if explode { + ppVals = append(ppVals, fmt.Sprintf("%s=%s", ppTag.ParamName, valToString(valType.Interface()))) + } else { + ppVals = append(ppVals, fmt.Sprintf("%s,%s", ppTag.ParamName, valToString(valType.Interface()))) + } } + pathParams[parentName] = strings.Join(ppVals, ",") } - pathParams[parentName] = strings.Join(ppVals, ",") default: pathParams[parentName] = valToString(objValue.Interface()) } diff --git a/internal/sdk/pkg/utils/queryparams.go b/internal/sdk/pkg/utils/queryparams.go old mode 100755 new mode 100644 index 87ecef8..0e94bce --- a/internal/sdk/pkg/utils/queryparams.go +++ b/internal/sdk/pkg/utils/queryparams.go @@ -76,15 +76,13 @@ func PopulateQueryParams(ctx context.Context, req *http.Request, queryParams int } func populateSerializedParams(tag *paramTag, objType reflect.Type, objValue reflect.Value) (map[string]string, error) { + if isNil(objType, objValue) { + return nil, nil + } + if objType.Kind() == reflect.Pointer { - if objValue.IsNil() { - return nil, nil - } objValue = objValue.Elem() } - if objValue.Interface() == nil { - return nil, nil - } values := map[string]string{} @@ -103,10 +101,11 @@ func populateSerializedParams(tag *paramTag, objType reflect.Type, objValue refl func populateDeepObjectParams(req *http.Request, tag *paramTag, objType reflect.Type, objValue reflect.Value) url.Values { values := url.Values{} + if isNil(objType, objValue) { + return values + } + if objType.Kind() == reflect.Pointer { - if objValue.IsNil() { - return values - } objType = objType.Elem() objValue = objValue.Elem() } @@ -117,10 +116,11 @@ func populateDeepObjectParams(req *http.Request, tag *paramTag, objType reflect. fieldType := objType.Field(i) valType := objValue.Field(i) + if isNil(fieldType.Type, valType) { + continue + } + if fieldType.Type.Kind() == reflect.Pointer { - if valType.IsNil() { - continue - } valType = valType.Elem() } diff --git a/internal/sdk/pkg/utils/requestbody.go b/internal/sdk/pkg/utils/requestbody.go old mode 100755 new mode 100644 index 5c1d263..950f39a --- a/internal/sdk/pkg/utils/requestbody.go +++ b/internal/sdk/pkg/utils/requestbody.go @@ -5,7 +5,6 @@ package utils import ( "bytes" "context" - "encoding/json" "fmt" "io" "mime/multipart" @@ -26,21 +25,25 @@ var ( urlEncodedEncodingRegex = regexp.MustCompile(`application\/x-www-form-urlencoded.*`) ) -func SerializeRequestBody(ctx context.Context, request interface{}, requestFieldName string, serializationMethod string) (*bytes.Buffer, string, error) { +func SerializeRequestBody(ctx context.Context, request interface{}, nullable, optional bool, requestFieldName, serializationMethod, tag string) (io.Reader, string, error) { requestStructType := reflect.TypeOf(request) requestValType := reflect.ValueOf(request) - if requestStructType.Kind() == reflect.Pointer { - if requestValType.IsNil() { + if isNil(requestStructType, requestValType) { + if !nullable && optional { return nil, "", nil } + return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType, tag) + } + + if requestStructType.Kind() == reflect.Pointer { requestStructType = requestStructType.Elem() requestValType = requestValType.Elem() } if requestStructType.Kind() != reflect.Struct { - return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType) + return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType, tag) } requestField, ok := requestStructType.FieldByName(requestFieldName) @@ -50,24 +53,44 @@ func SerializeRequestBody(ctx context.Context, request interface{}, requestField if tag != nil { // request object (non-flattened) requestVal := requestValType.FieldByName(requestFieldName) - if requestField.Type.Kind() == reflect.Pointer && requestVal.IsNil() { - return nil, "", nil + if isNil(requestField.Type, requestVal) { + if !nullable && optional { + return nil, "", nil + } + + return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) } - return serializeContentType(requestFieldName, tag.MediaType, requestVal) + return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) } } // flattened request object - return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], requestValType) + return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], reflect.ValueOf(request), tag) } -func serializeContentType(fieldName string, mediaType string, val reflect.Value) (*bytes.Buffer, string, error) { +func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (*bytes.Buffer, string, error) { buf := &bytes.Buffer{} + if isNil(val.Type(), val) { + // TODO: what does a null mean for other content types? Just returning an empty buffer for now + if jsonEncodingRegex.MatchString(mediaType) { + if _, err := buf.Write([]byte("null")); err != nil { + return nil, "", err + } + } + + return buf, mediaType, nil + } + switch { case jsonEncodingRegex.MatchString(mediaType): - if err := json.NewEncoder(buf).Encode(val.Interface()); err != nil { + data, err := MarshalJSON(val.Interface(), reflect.StructTag(tag), true) + if err != nil { + return nil, "", err + } + + if _, err := buf.Write(data); err != nil { return nil, "", err } case multipartEncodingRegex.MatchString(mediaType): @@ -116,11 +139,11 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { fieldType := field.Type valType := requestValType.Field(i) - if fieldType.Kind() == reflect.Pointer { - if valType.IsNil() { - continue - } + if isNil(fieldType, valType) { + continue + } + if fieldType.Kind() == reflect.Pointer { fieldType = fieldType.Elem() valType = valType.Elem() } @@ -137,7 +160,7 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { writer.Close() return "", err } - d, err := json.Marshal(valType.Interface()) + d, err := MarshalJSON(valType.Interface(), field.Tag, true) if err != nil { writer.Close() return "", err @@ -231,18 +254,18 @@ func encodeFormData(fieldName string, w io.Writer, data interface{}) error { fieldType := field.Type valType := requestValType.Field(i) - if fieldType.Kind() == reflect.Pointer { - if valType.IsNil() { - continue - } + if isNil(fieldType, valType) { + continue + } + if fieldType.Kind() == reflect.Pointer { fieldType = fieldType.Elem() valType = valType.Elem() } tag := parseFormTag(field) if tag.JSON { - data, err := json.Marshal(valType.Interface()) + data, err := MarshalJSON(valType.Interface(), field.Tag, true) if err != nil { return err } diff --git a/internal/sdk/pkg/utils/retries.go b/internal/sdk/pkg/utils/retries.go old mode 100755 new mode 100644 diff --git a/internal/sdk/pkg/utils/security.go b/internal/sdk/pkg/utils/security.go old mode 100755 new mode 100644 index ec837d7..fa5eff7 --- a/internal/sdk/pkg/utils/security.go +++ b/internal/sdk/pkg/utils/security.go @@ -3,6 +3,7 @@ package utils import ( + "context" "encoding/base64" "fmt" "net/http" @@ -26,137 +27,142 @@ type securityTag struct { SubType string } -type SecurityClient struct { - client HTTPClient +type securityConfig struct { headers map[string]string queryParams map[string]string } -func newSecurityClient(client HTTPClient) *SecurityClient { +type SecurityClient struct { + HTTPClient + security func(ctx context.Context) (interface{}, error) +} + +func newSecurityClient(client HTTPClient, security func(ctx context.Context) (interface{}, error)) *SecurityClient { return &SecurityClient{ - client: client, - headers: make(map[string]string), - queryParams: make(map[string]string), + HTTPClient: client, + security: security, } } func (c *SecurityClient) Do(req *http.Request) (*http.Response, error) { - for k, v := range c.headers { + securityCtx, err := c.security(req.Context()) + if err != nil { + return nil, err + } + + ctx := securityConfig{ + headers: make(map[string]string), + queryParams: make(map[string]string), + } + parseSecurityStruct(&ctx, securityCtx) + + for k, v := range ctx.headers { req.Header.Set(k, v) } queryParams := req.URL.Query() - for k, v := range c.queryParams { - queryParams.Set(k, v) + for k, v := range ctx.queryParams { + queryParams.Add(k, v) } req.URL.RawQuery = queryParams.Encode() - return c.client.Do(req) + return c.HTTPClient.Do(req) } -func ConfigureSecurityClient(c HTTPClient, security interface{}) *SecurityClient { - client := parseSecurityStruct(c, security) - if client != nil { - return client - } +func ConfigureSecurityClient(c HTTPClient, security func(ctx context.Context) (interface{}, error)) *SecurityClient { + return newSecurityClient(c, security) +} - return newSecurityClient(c) +func trueReflectValue(val reflect.Value) reflect.Value { + kind := val.Type().Kind() + for kind == reflect.Interface || kind == reflect.Ptr { + innerVal := val.Elem() + if !innerVal.IsValid() { + break + } + val = innerVal + kind = val.Type().Kind() + } + return val } -func parseSecurityStruct(c HTTPClient, security interface{}) *SecurityClient { - securityStructType := reflect.TypeOf(security) - securityValType := reflect.ValueOf(security) +func parseSecurityStruct(c *securityConfig, security interface{}) { + securityValType := trueReflectValue(reflect.ValueOf(security)) + securityStructType := securityValType.Type() - if securityStructType.Kind() == reflect.Ptr { - if securityValType.IsNil() { - return nil - } + if isNil(securityStructType, securityValType) { + return + } + if securityStructType.Kind() == reflect.Ptr { securityStructType = securityStructType.Elem() securityValType = securityValType.Elem() } - client := newSecurityClient(c) - for i := 0; i < securityStructType.NumField(); i++ { fieldType := securityStructType.Field(i) valType := securityValType.Field(i) kind := valType.Kind() - if fieldType.Type.Kind() == reflect.Pointer { - if valType.IsNil() { - continue - } + if isNil(fieldType.Type, valType) { + continue + } + if fieldType.Type.Kind() == reflect.Pointer { kind = valType.Elem().Kind() } secTag := parseSecurityTag(fieldType) if secTag != nil { if secTag.Option { - return parseSecurityOption(c, valType.Interface()) + handleSecurityOption(c, valType.Interface()) } else if secTag.Scheme { // Special case for basic auth which could be a flattened struct if secTag.SubType == "basic" && kind != reflect.Struct { - parseSecurityScheme(client, secTag, security) - return client + parseSecurityScheme(c, secTag, security) } else { - parseSecurityScheme(client, secTag, valType.Interface()) + parseSecurityScheme(c, secTag, valType.Interface()) } } } } - - return client } -func parseSecurityOption(c HTTPClient, option interface{}) *SecurityClient { - optionStructType := reflect.TypeOf(option) - optionValType := reflect.ValueOf(option) - - if optionStructType.Kind() == reflect.Ptr { - if optionValType.IsNil() { - return nil - } +func handleSecurityOption(c *securityConfig, option interface{}) error { + optionValType := trueReflectValue(reflect.ValueOf(option)) + optionStructType := optionValType.Type() - optionStructType = optionStructType.Elem() - optionValType = optionValType.Elem() + if isNil(optionStructType, optionValType) { + return nil } - client := newSecurityClient(c) - for i := 0; i < optionStructType.NumField(); i++ { fieldType := optionStructType.Field(i) valType := optionValType.Field(i) secTag := parseSecurityTag(fieldType) if secTag != nil && secTag.Scheme { - parseSecurityScheme(client, secTag, valType.Interface()) + parseSecurityScheme(c, secTag, valType.Interface()) } } - return client + return nil } -func parseSecurityScheme(client *SecurityClient, schemeTag *securityTag, scheme interface{}) { - schemeType := reflect.TypeOf(scheme) - schemeVal := reflect.ValueOf(scheme) - - if schemeType.Kind() == reflect.Ptr { - if schemeVal.IsNil() { - return - } +func parseSecurityScheme(client *securityConfig, schemeTag *securityTag, scheme interface{}) { + schemeVal := trueReflectValue(reflect.ValueOf(scheme)) + schemeType := schemeVal.Type() - schemeType = schemeType.Elem() - schemeVal = schemeVal.Elem() + if isNil(schemeType, schemeVal) { + return } if schemeType.Kind() == reflect.Struct { if schemeTag.Type == "http" && schemeTag.SubType == "basic" { - parseBasicAuthScheme(client, schemeVal.Interface()) + handleBasicAuthScheme(client, schemeVal.Interface()) return } @@ -164,11 +170,11 @@ func parseSecurityScheme(client *SecurityClient, schemeTag *securityTag, scheme fieldType := schemeType.Field(i) valType := schemeVal.Field(i) - if fieldType.Type.Kind() == reflect.Ptr { - if valType.IsNil() { - continue - } + if isNil(fieldType.Type, valType) { + continue + } + if fieldType.Type.Kind() == reflect.Ptr { valType = valType.Elem() } @@ -184,7 +190,7 @@ func parseSecurityScheme(client *SecurityClient, schemeTag *securityTag, scheme } } -func parseSecuritySchemeValue(client *SecurityClient, schemeTag *securityTag, secTag *securityTag, val interface{}) { +func parseSecuritySchemeValue(client *securityConfig, schemeTag *securityTag, secTag *securityTag, val interface{}) { switch schemeTag.Type { case "apiKey": switch schemeTag.SubType { @@ -221,7 +227,7 @@ func prefixBearer(authHeaderValue string) string { return fmt.Sprintf("Bearer %s", authHeaderValue) } -func parseBasicAuthScheme(client *SecurityClient, scheme interface{}) { +func handleBasicAuthScheme(client *securityConfig, scheme interface{}) { schemeStructType := reflect.TypeOf(scheme) schemeValType := reflect.ValueOf(scheme) diff --git a/internal/sdk/pkg/utils/utils.go b/internal/sdk/pkg/utils/utils.go old mode 100755 new mode 100644 index 5f50f16..8c8161a --- a/internal/sdk/pkg/utils/utils.go +++ b/internal/sdk/pkg/utils/utils.go @@ -3,7 +3,6 @@ package utils import ( - "encoding/json" "fmt" "io" "math/big" @@ -12,7 +11,7 @@ import ( "strings" "time" - "airbyte/internal/sdk/pkg/types" + "github.com/ericlagergren/decimal" ) const ( @@ -32,12 +31,12 @@ var ( } ) -func UnmarshalJsonFromResponseBody(body io.Reader, out interface{}) error { +func UnmarshalJsonFromResponseBody(body io.Reader, out interface{}, tag string) error { data, err := io.ReadAll(body) if err != nil { return fmt.Errorf("error reading response body: %w", err) } - if err := json.Unmarshal(data, &out); err != nil { + if err := UnmarshalJSON(data, out, reflect.StructTag(tag), true, false); err != nil { return fmt.Errorf("error unmarshalling json response body: %w", err) } @@ -45,6 +44,10 @@ func UnmarshalJsonFromResponseBody(body io.Reader, out interface{}) error { } func ReplaceParameters(stringWithParams string, params map[string]string) string { + if len(params) == 0 { + return stringWithParams + } + return paramRegex.ReplaceAllStringFunc(stringWithParams, func(match string) string { match = match[1 : len(match)-1] return params[match] @@ -78,7 +81,6 @@ func parseStructTag(tagKey string, field reflect.StructField) map[string]string parts = append(parts, "true") case 2: // key=value option - break default: // invalid option continue @@ -123,10 +125,10 @@ func valToString(val interface{}) string { switch v := val.(type) { case time.Time: return v.Format(time.RFC3339Nano) - case types.BigInt: - return v.String() case big.Int: return v.String() + case decimal.Big: + return v.String() default: return fmt.Sprintf("%v", v) } @@ -150,3 +152,11 @@ func populateFromGlobals(fieldType reflect.StructField, valType reflect.Value, p return valType } + +func isNil(typ reflect.Type, val reflect.Value) bool { + if typ.Kind() == reflect.Ptr || typ.Kind() == reflect.Map || typ.Kind() == reflect.Slice || typ.Kind() == reflect.Interface { + return val.IsNil() + } + + return false +} diff --git a/internal/sdk/scheduler.go b/internal/sdk/scheduler.go old mode 100755 new mode 100644 index c6e61d5..26bfcb9 --- a/internal/sdk/scheduler.go +++ b/internal/sdk/scheduler.go @@ -3,33 +3,34 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type scheduler struct { +type Scheduler struct { sdkConfiguration sdkConfiguration } -func newScheduler(sdkConfig sdkConfiguration) *scheduler { - return &scheduler{ +func newScheduler(sdkConfig sdkConfiguration) *Scheduler { + return &Scheduler{ sdkConfiguration: sdkConfig, } } -// ExecuteDestinationCheckConnection - Run check connection for a given destination configuration -func (s *scheduler) ExecuteDestinationCheckConnection(ctx context.Context, request shared.DestinationCoreConfig) (*operations.ExecuteDestinationCheckConnectionResponse, error) { +// ExecuteSourceCheckConnection - Run check connection for a given source configuration +func (s *Scheduler) ExecuteSourceCheckConnection(ctx context.Context, request shared.SourceCoreConfig) (*operations.ExecuteSourceCheckConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/scheduler/destinations/check_connection" + url := strings.TrimSuffix(baseURL, "/") + "/v1/scheduler/sources/check_connection" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -37,12 +38,15 @@ func (s *scheduler) ExecuteDestinationCheckConnection(ctx context.Context, reque return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -60,12 +64,13 @@ func (s *scheduler) ExecuteDestinationCheckConnection(ctx context.Context, reque if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ExecuteDestinationCheckConnectionResponse{ + res := &operations.ExecuteSourceCheckConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -74,34 +79,38 @@ func (s *scheduler) ExecuteDestinationCheckConnection(ctx context.Context, reque case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CheckConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CheckConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CheckConnectionRead = out + res.CheckConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ExecuteSourceCheckConnection - Run check connection for a given source configuration -func (s *scheduler) ExecuteSourceCheckConnection(ctx context.Context, request shared.SourceCoreConfig) (*operations.ExecuteSourceCheckConnectionResponse, error) { +// ExecuteSourceDiscoverSchema - Run discover schema for a given source a source configuration +func (s *Scheduler) ExecuteSourceDiscoverSchema(ctx context.Context, request shared.SourceCoreConfig) (*operations.ExecuteSourceDiscoverSchemaResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/scheduler/sources/check_connection" + url := strings.TrimSuffix(baseURL, "/") + "/v1/scheduler/sources/discover_schema" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -109,12 +118,15 @@ func (s *scheduler) ExecuteSourceCheckConnection(ctx context.Context, request sh return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -132,12 +144,13 @@ func (s *scheduler) ExecuteSourceCheckConnection(ctx context.Context, request sh if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ExecuteSourceCheckConnectionResponse{ + res := &operations.ExecuteSourceDiscoverSchemaResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -146,34 +159,38 @@ func (s *scheduler) ExecuteSourceCheckConnection(ctx context.Context, request sh case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CheckConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDiscoverSchemaRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CheckConnectionRead = out + res.SourceDiscoverSchemaRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ExecuteSourceDiscoverSchema - Run discover schema for a given source a source configuration -func (s *scheduler) ExecuteSourceDiscoverSchema(ctx context.Context, request shared.SourceCoreConfig) (*operations.ExecuteSourceDiscoverSchemaResponse, error) { +// ExecuteDestinationCheckConnection - Run check connection for a given destination configuration +func (s *Scheduler) ExecuteDestinationCheckConnection(ctx context.Context, request shared.DestinationCoreConfig) (*operations.ExecuteDestinationCheckConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/scheduler/sources/discover_schema" + url := strings.TrimSuffix(baseURL, "/") + "/v1/scheduler/destinations/check_connection" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -181,12 +198,15 @@ func (s *scheduler) ExecuteSourceDiscoverSchema(ctx context.Context, request sha return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -204,12 +224,13 @@ func (s *scheduler) ExecuteSourceDiscoverSchema(ctx context.Context, request sha if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ExecuteSourceDiscoverSchemaResponse{ + res := &operations.ExecuteDestinationCheckConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -218,22 +239,26 @@ func (s *scheduler) ExecuteSourceDiscoverSchema(ctx context.Context, request sha case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDiscoverSchemaRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CheckConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDiscoverSchemaRead = out + res.CheckConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/sdk.go b/internal/sdk/sdk.go old mode 100755 new mode 100644 index a2c54cf..12cee43 --- a/internal/sdk/sdk.go +++ b/internal/sdk/sdk.go @@ -3,9 +3,10 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" + "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "net/http" "time" ) @@ -41,13 +42,15 @@ func Float64(f float64) *float64 { return &f } type sdkConfiguration struct { DefaultClient HTTPClient SecurityClient HTTPClient - Security *shared.Security + Security func(context.Context) (interface{}, error) ServerURL string ServerIndex int Language string OpenAPIDocVersion string SDKVersion string GenVersion string + UserAgent string + RetryConfig *utils.RetryConfig } func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { @@ -58,7 +61,7 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { return ServerList[c.ServerIndex], nil } -// Airbyte - Airbyte Configuration API: Airbyte Configuration API +// SDK - Airbyte Configuration API: Airbyte Configuration API // [https://airbyte.io](https://airbyte.io). // // The Configuration API is an internal Airbyte API that is designed for communications between different Airbyte components. @@ -83,64 +86,64 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { // * When authenticating to the Configuration API, you must use Basic Authentication by setting the Authentication Header to Basic and base64 encoding the username and password (which are `airbyte` and `password` by default - so base64 encoding `airbyte:password` results in `YWlyYnl0ZTpwYXNzd29yZA==`). So the full header reads `'Authorization': "Basic YWlyYnl0ZTpwYXNzd29yZA=="` // // https://airbyte.io - Find out more about Airbyte -type Airbyte struct { - // Attempt - Interactions with attempt related resources. - Attempt *attempt - // Connection - Connection between sources and destinations. - Connection *connection - ConnectorBuilderProject *connectorBuilderProject - DeclarativeSourceDefinitions *declarativeSourceDefinitions - // Destination - Destination related resources. - Destination *destination - // DestinationDefinition - DestinationDefinition related resources. - DestinationDefinition *destinationDefinition - // DestinationDefinitionSpecification - DestinationDefinitionSpecification related resources. - DestinationDefinitionSpecification *destinationDefinitionSpecification - // DestinationOauth - Source OAuth related resources to delegate access from user. - DestinationOauth *destinationOauth - // Health - Healthchecks - Health *health - Internal *internal - Jobs *jobs - Logs *logs - Notifications *notifications - Openapi *openapi - Operation *operation - Scheduler *scheduler - // Source - Source related resources. - Source *source - // SourceDefinition - SourceDefinition related resources. - SourceDefinition *sourceDefinition - // SourceDefinitionSpecification - SourceDefinition specification related resources. - SourceDefinitionSpecification *sourceDefinitionSpecification - // SourceOauth - Source OAuth related resources to delegate access from user. - SourceOauth *sourceOauth - // State - Interactions with state related resources. - State *state - StreamStatuses *streamStatuses - Streams *streams - // WebBackend - Endpoints for the Airbyte web application. Those APIs should not be called outside the web application implementation and are not +type SDK struct { + // Workspace related resources. + Workspace *Workspace + Notifications *Notifications + // SourceDefinition related resources. + SourceDefinition *SourceDefinition + // SourceDefinition specification related resources. + SourceDefinitionSpecification *SourceDefinitionSpecification + DeclarativeSourceDefinitions *DeclarativeSourceDefinitions + ConnectorBuilderProject *ConnectorBuilderProject + // Source related resources. + Source *Source + Internal *Internal + // DestinationDefinition related resources. + DestinationDefinition *DestinationDefinition + // DestinationDefinitionSpecification related resources. + DestinationDefinitionSpecification *DestinationDefinitionSpecification + // Destination related resources. + Destination *Destination + // Connection between sources and destinations. + Connection *Connection + // Interactions with state related resources. + State *State + Operation *Operation + Scheduler *Scheduler + // Source OAuth related resources to delegate access from user. + SourceOauth *SourceOauth + // Source OAuth related resources to delegate access from user. + DestinationOauth *DestinationOauth + // Endpoints for the Airbyte web application. Those APIs should not be called outside the web application implementation and are not // guaranteeing any backwards compatibility. // - WebBackend *webBackend - // Workspace - Workspace related resources. - Workspace *workspace + WebBackend *WebBackend + Jobs *Jobs + // Healthchecks + Health *Health + Logs *Logs + Openapi *Openapi + // Interactions with attempt related resources. + Attempt *Attempt + StreamStatuses *StreamStatuses + Streams *Streams sdkConfiguration sdkConfiguration } -type SDKOption func(*Airbyte) +type SDKOption func(*SDK) // WithServerURL allows the overriding of the default server URL func WithServerURL(serverURL string) SDKOption { - return func(sdk *Airbyte) { + return func(sdk *SDK) { sdk.sdkConfiguration.ServerURL = serverURL } } // WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption { - return func(sdk *Airbyte) { + return func(sdk *SDK) { if params != nil { serverURL = utils.ReplaceParameters(serverURL, params) } @@ -151,7 +154,7 @@ func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOptio // WithServerIndex allows the overriding of the default server by index func WithServerIndex(serverIndex int) SDKOption { - return func(sdk *Airbyte) { + return func(sdk *SDK) { if serverIndex < 0 || serverIndex >= len(ServerList) { panic(fmt.Errorf("server index %d out of range", serverIndex)) } @@ -162,26 +165,48 @@ func WithServerIndex(serverIndex int) SDKOption { // WithClient allows the overriding of the default HTTP client used by the SDK func WithClient(client HTTPClient) SDKOption { - return func(sdk *Airbyte) { + return func(sdk *SDK) { sdk.sdkConfiguration.DefaultClient = client } } +func withSecurity(security interface{}) func(context.Context) (interface{}, error) { + return func(context.Context) (interface{}, error) { + return &security, nil + } +} + // WithSecurity configures the SDK to use the provided security details func WithSecurity(security shared.Security) SDKOption { - return func(sdk *Airbyte) { - sdk.sdkConfiguration.Security = &security + return func(sdk *SDK) { + sdk.sdkConfiguration.Security = withSecurity(security) + } +} + +// WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication +func WithSecuritySource(security func(context.Context) (shared.Security, error)) SDKOption { + return func(sdk *SDK) { + sdk.sdkConfiguration.Security = func(ctx context.Context) (interface{}, error) { + return security(ctx) + } + } +} + +func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption { + return func(sdk *SDK) { + sdk.sdkConfiguration.RetryConfig = &retryConfig } } // New creates a new instance of the SDK with the provided options -func New(opts ...SDKOption) *Airbyte { - sdk := &Airbyte{ +func New(opts ...SDKOption) *SDK { + sdk := &SDK{ sdkConfiguration: sdkConfiguration{ - Language: "terraform", + Language: "go", OpenAPIDocVersion: "1.0.0", SDKVersion: "1.0.4", - GenVersion: "2.75.1", + GenVersion: "2.192.1", + UserAgent: "speakeasy-sdk/go 1.0.4 2.192.1 1.0.0 airbyte", }, } for _, opt := range opts { @@ -200,55 +225,55 @@ func New(opts ...SDKOption) *Airbyte { } } - sdk.Attempt = newAttempt(sdk.sdkConfiguration) + sdk.Workspace = newWorkspace(sdk.sdkConfiguration) - sdk.Connection = newConnection(sdk.sdkConfiguration) + sdk.Notifications = newNotifications(sdk.sdkConfiguration) - sdk.ConnectorBuilderProject = newConnectorBuilderProject(sdk.sdkConfiguration) + sdk.SourceDefinition = newSourceDefinition(sdk.sdkConfiguration) + + sdk.SourceDefinitionSpecification = newSourceDefinitionSpecification(sdk.sdkConfiguration) sdk.DeclarativeSourceDefinitions = newDeclarativeSourceDefinitions(sdk.sdkConfiguration) - sdk.Destination = newDestination(sdk.sdkConfiguration) + sdk.ConnectorBuilderProject = newConnectorBuilderProject(sdk.sdkConfiguration) + + sdk.Source = newSource(sdk.sdkConfiguration) + + sdk.Internal = newInternal(sdk.sdkConfiguration) sdk.DestinationDefinition = newDestinationDefinition(sdk.sdkConfiguration) sdk.DestinationDefinitionSpecification = newDestinationDefinitionSpecification(sdk.sdkConfiguration) - sdk.DestinationOauth = newDestinationOauth(sdk.sdkConfiguration) - - sdk.Health = newHealth(sdk.sdkConfiguration) + sdk.Destination = newDestination(sdk.sdkConfiguration) - sdk.Internal = newInternal(sdk.sdkConfiguration) + sdk.Connection = newConnection(sdk.sdkConfiguration) - sdk.Jobs = newJobs(sdk.sdkConfiguration) + sdk.State = newState(sdk.sdkConfiguration) - sdk.Logs = newLogs(sdk.sdkConfiguration) + sdk.Operation = newOperation(sdk.sdkConfiguration) - sdk.Notifications = newNotifications(sdk.sdkConfiguration) + sdk.Scheduler = newScheduler(sdk.sdkConfiguration) - sdk.Openapi = newOpenapi(sdk.sdkConfiguration) + sdk.SourceOauth = newSourceOauth(sdk.sdkConfiguration) - sdk.Operation = newOperation(sdk.sdkConfiguration) + sdk.DestinationOauth = newDestinationOauth(sdk.sdkConfiguration) - sdk.Scheduler = newScheduler(sdk.sdkConfiguration) + sdk.WebBackend = newWebBackend(sdk.sdkConfiguration) - sdk.Source = newSource(sdk.sdkConfiguration) + sdk.Jobs = newJobs(sdk.sdkConfiguration) - sdk.SourceDefinition = newSourceDefinition(sdk.sdkConfiguration) + sdk.Health = newHealth(sdk.sdkConfiguration) - sdk.SourceDefinitionSpecification = newSourceDefinitionSpecification(sdk.sdkConfiguration) + sdk.Logs = newLogs(sdk.sdkConfiguration) - sdk.SourceOauth = newSourceOauth(sdk.sdkConfiguration) + sdk.Openapi = newOpenapi(sdk.sdkConfiguration) - sdk.State = newState(sdk.sdkConfiguration) + sdk.Attempt = newAttempt(sdk.sdkConfiguration) sdk.StreamStatuses = newStreamStatuses(sdk.sdkConfiguration) sdk.Streams = newStreams(sdk.sdkConfiguration) - sdk.WebBackend = newWebBackend(sdk.sdkConfiguration) - - sdk.Workspace = newWorkspace(sdk.sdkConfiguration) - return sdk } diff --git a/internal/sdk/source.go b/internal/sdk/source.go old mode 100755 new mode 100644 index 5e3f141..43f36fc --- a/internal/sdk/source.go +++ b/internal/sdk/source.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// source - Source related resources. -type source struct { +// Source related resources. +type Source struct { sdkConfiguration sdkConfiguration } -func newSource(sdkConfig sdkConfiguration) *source { - return &source{ +func newSource(sdkConfig sdkConfiguration) *Source { + return &Source{ sdkConfiguration: sdkConfig, } } -// ApplySchemaChangeForSource - Auto propagate the change on a catalog to a catalog saved in the DB. It will fetch all the connections linked to a source id and apply the provided diff to their catalog. -func (s *source) ApplySchemaChangeForSource(ctx context.Context, request shared.SourceAutoPropagateChange) (*operations.ApplySchemaChangeForSourceResponse, error) { +// CreateSource - Create a source +func (s *Source) CreateSource(ctx context.Context, request shared.SourceCreate) (*operations.CreateSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/apply_schema_changes" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *source) ApplySchemaChangeForSource(ctx context.Context, request shared. return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,49 +65,53 @@ func (s *source) ApplySchemaChangeForSource(ctx context.Context, request shared. if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ApplySchemaChangeForSourceResponse{ + res := &operations.CreateSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: - case httpRes.StatusCode == 404: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.SourceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// CheckConnectionToSource - Check connection to the source -func (s *source) CheckConnectionToSource(ctx context.Context, request shared.SourceIDRequestBody) (*operations.CheckConnectionToSourceResponse, error) { +// UpdateSource - Update a source +func (s *Source) UpdateSource(ctx context.Context, request shared.SourceUpdate) (*operations.UpdateSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/check_connection" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -111,12 +119,15 @@ func (s *source) CheckConnectionToSource(ctx context.Context, request shared.Sou return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -134,12 +145,13 @@ func (s *source) CheckConnectionToSource(ctx context.Context, request shared.Sou if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CheckConnectionToSourceResponse{ + res := &operations.UpdateSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -148,44 +160,50 @@ func (s *source) CheckConnectionToSource(ctx context.Context, request shared.Sou case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CheckConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CheckConnectionRead = out + res.SourceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// CheckConnectionToSourceForUpdate - Check connection for a proposed update to a source -func (s *source) CheckConnectionToSourceForUpdate(ctx context.Context, request shared.SourceUpdate) (*operations.CheckConnectionToSourceForUpdateResponse, error) { +// PartialUpdateSource - Partially update a source +func (s *Source) PartialUpdateSource(ctx context.Context, request shared.PartialSourceUpdate) (*operations.PartialUpdateSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/check_connection_for_update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/partial_update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -193,12 +211,15 @@ func (s *source) CheckConnectionToSourceForUpdate(ctx context.Context, request s return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -216,12 +237,13 @@ func (s *source) CheckConnectionToSourceForUpdate(ctx context.Context, request s if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CheckConnectionToSourceForUpdateResponse{ + res := &operations.PartialUpdateSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -230,44 +252,51 @@ func (s *source) CheckConnectionToSourceForUpdate(ctx context.Context, request s case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CheckConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CheckConnectionRead = out + res.SourceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// CloneSource - Clone source -func (s *source) CloneSource(ctx context.Context, request shared.SourceCloneRequestBody) (*operations.CloneSourceResponse, error) { +// ListSourcesForWorkspace - List sources for workspace +// List sources for workspace. Does not return deleted sources. +func (s *Source) ListSourcesForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListSourcesForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/clone" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/list" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -275,12 +304,15 @@ func (s *source) CloneSource(ctx context.Context, request shared.SourceCloneRequ return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -298,12 +330,13 @@ func (s *source) CloneSource(ctx context.Context, request shared.SourceCloneRequ if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CloneSourceResponse{ + res := &operations.ListSourcesForWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -312,44 +345,50 @@ func (s *source) CloneSource(ctx context.Context, request shared.SourceCloneRequ case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceRead = out + res.SourceReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// CreateSource - Create a source -func (s *source) CreateSource(ctx context.Context, request shared.SourceCreate) (*operations.CreateSourceResponse, error) { +// GetSource - Get source +func (s *Source) GetSource(ctx context.Context, request shared.SourceIDRequestBody) (*operations.GetSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/create" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -357,12 +396,15 @@ func (s *source) CreateSource(ctx context.Context, request shared.SourceCreate) return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -380,12 +422,13 @@ func (s *source) CreateSource(ctx context.Context, request shared.SourceCreate) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CreateSourceResponse{ + res := &operations.GetSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -394,34 +437,50 @@ func (s *source) CreateSource(ctx context.Context, request shared.SourceCreate) case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.SourceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceRead = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// DeleteSource - Delete a source -func (s *source) DeleteSource(ctx context.Context, request shared.SourceIDRequestBody) (*operations.DeleteSourceResponse, error) { +// GetMostRecentSourceActorCatalog - Get most recent ActorCatalog for source +func (s *Source) GetMostRecentSourceActorCatalog(ctx context.Context, request shared.SourceIDRequestBody) (*operations.GetMostRecentSourceActorCatalogResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/delete" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/most_recent_source_actor_catalog" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -429,12 +488,15 @@ func (s *source) DeleteSource(ctx context.Context, request shared.SourceIDReques return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -452,49 +514,65 @@ func (s *source) DeleteSource(ctx context.Context, request shared.SourceIDReques if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.DeleteSourceResponse{ + res := &operations.GetMostRecentSourceActorCatalogResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.ActorCatalogWithUpdatedAt + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ActorCatalogWithUpdatedAt = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// DiscoverSchemaForSource - Discover the schema catalog of the source -func (s *source) DiscoverSchemaForSource(ctx context.Context, request shared.SourceDiscoverSchemaRequestBody) (*operations.DiscoverSchemaForSourceResponse, error) { +// SearchSources - Search sources +func (s *Source) SearchSources(ctx context.Context, request shared.SourceSearch) (*operations.SearchSourcesResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/discover_schema" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/search" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -502,12 +580,15 @@ func (s *source) DiscoverSchemaForSource(ctx context.Context, request shared.Sou return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -525,12 +606,13 @@ func (s *source) DiscoverSchemaForSource(ctx context.Context, request shared.Sou if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.DiscoverSchemaForSourceResponse{ + res := &operations.SearchSourcesResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -539,44 +621,38 @@ func (s *source) DiscoverSchemaForSource(ctx context.Context, request shared.Sou case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDiscoverSchemaRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.SourceDiscoverSchemaRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.SourceReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetMostRecentSourceActorCatalog - Get most recent ActorCatalog for source -func (s *source) GetMostRecentSourceActorCatalog(ctx context.Context, request shared.SourceIDRequestBody) (*operations.GetMostRecentSourceActorCatalogResponse, error) { +// CloneSource - Clone source +func (s *Source) CloneSource(ctx context.Context, request shared.SourceCloneRequestBody) (*operations.CloneSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/most_recent_source_actor_catalog" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/clone" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -584,12 +660,15 @@ func (s *source) GetMostRecentSourceActorCatalog(ctx context.Context, request sh return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -607,12 +686,13 @@ func (s *source) GetMostRecentSourceActorCatalog(ctx context.Context, request sh if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetMostRecentSourceActorCatalogResponse{ + res := &operations.CloneSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -621,44 +701,50 @@ func (s *source) GetMostRecentSourceActorCatalog(ctx context.Context, request sh case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ActorCatalogWithUpdatedAt - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ActorCatalogWithUpdatedAt = out + res.SourceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetSource - Get source -func (s *source) GetSource(ctx context.Context, request shared.SourceIDRequestBody) (*operations.GetSourceResponse, error) { +// DeleteSource - Delete a source +func (s *Source) DeleteSource(ctx context.Context, request shared.SourceIDRequestBody) (*operations.DeleteSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/get" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/delete" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -666,12 +752,15 @@ func (s *source) GetSource(ctx context.Context, request shared.SourceIDRequestBo return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -689,59 +778,54 @@ func (s *source) GetSource(ctx context.Context, request shared.SourceIDRequestBo if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetSourceResponse{ + res := &operations.DeleteSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.SourceRead = out - } + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListSourcesForWorkspace - List sources for workspace -// List sources for workspace. Does not return deleted sources. -func (s *source) ListSourcesForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListSourcesForWorkspaceResponse, error) { +// CheckConnectionToSource - Check connection to the source +func (s *Source) CheckConnectionToSource(ctx context.Context, request shared.SourceIDRequestBody) (*operations.CheckConnectionToSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/check_connection" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -749,12 +833,15 @@ func (s *source) ListSourcesForWorkspace(ctx context.Context, request shared.Wor return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -772,12 +859,13 @@ func (s *source) ListSourcesForWorkspace(ctx context.Context, request shared.Wor if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListSourcesForWorkspaceResponse{ + res := &operations.CheckConnectionToSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -786,44 +874,50 @@ func (s *source) ListSourcesForWorkspace(ctx context.Context, request shared.Wor case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CheckConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceReadList = out + res.CheckConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// PartialUpdateSource - Partially update a source -func (s *source) PartialUpdateSource(ctx context.Context, request shared.PartialSourceUpdate) (*operations.PartialUpdateSourceResponse, error) { +// CheckConnectionToSourceForUpdate - Check connection for a proposed update to a source +func (s *Source) CheckConnectionToSourceForUpdate(ctx context.Context, request shared.SourceUpdate) (*operations.CheckConnectionToSourceForUpdateResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/partial_update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/check_connection_for_update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -831,12 +925,15 @@ func (s *source) PartialUpdateSource(ctx context.Context, request shared.Partial return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -854,12 +951,13 @@ func (s *source) PartialUpdateSource(ctx context.Context, request shared.Partial if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.PartialUpdateSourceResponse{ + res := &operations.CheckConnectionToSourceForUpdateResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -868,44 +966,50 @@ func (s *source) PartialUpdateSource(ctx context.Context, request shared.Partial case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CheckConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceRead = out + res.CheckConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SearchSources - Search sources -func (s *source) SearchSources(ctx context.Context, request shared.SourceSearch) (*operations.SearchSourcesResponse, error) { +// DiscoverSchemaForSource - Discover the schema catalog of the source +func (s *Source) DiscoverSchemaForSource(ctx context.Context, request shared.SourceDiscoverSchemaRequestBody) (*operations.DiscoverSchemaForSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/search" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/discover_schema" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -913,12 +1017,15 @@ func (s *source) SearchSources(ctx context.Context, request shared.SourceSearch) return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -936,12 +1043,13 @@ func (s *source) SearchSources(ctx context.Context, request shared.SourceSearch) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SearchSourcesResponse{ + res := &operations.DiscoverSchemaForSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -950,34 +1058,50 @@ func (s *source) SearchSources(ctx context.Context, request shared.SourceSearch) case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDiscoverSchemaRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceReadList = out + res.SourceDiscoverSchemaRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateSource - Update a source -func (s *source) UpdateSource(ctx context.Context, request shared.SourceUpdate) (*operations.UpdateSourceResponse, error) { +// ApplySchemaChangeForSource - Auto propagate the change on a catalog to a catalog saved in the DB. It will fetch all the connections linked to a source id and apply the provided diff to their catalog. +func (s *Source) ApplySchemaChangeForSource(ctx context.Context, request shared.SourceAutoPropagateChange) (*operations.ApplySchemaChangeForSourceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/apply_schema_changes" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -985,12 +1109,15 @@ func (s *source) UpdateSource(ctx context.Context, request shared.SourceUpdate) return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -1008,46 +1135,42 @@ func (s *source) UpdateSource(ctx context.Context, request shared.SourceUpdate) if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateSourceResponse{ + res := &operations.ApplySchemaChangeForSourceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.SourceRead = out - } + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1055,11 +1178,11 @@ func (s *source) UpdateSource(ctx context.Context, request shared.SourceUpdate) } // WriteDiscoverCatalogResult - Should only called from worker, to write result from discover activity back to DB. -func (s *source) WriteDiscoverCatalogResult(ctx context.Context, request shared.SourceDiscoverSchemaWriteRequestBody) (*operations.WriteDiscoverCatalogResultResponse, error) { +func (s *Source) WriteDiscoverCatalogResult(ctx context.Context, request shared.SourceDiscoverSchemaWriteRequestBody) (*operations.WriteDiscoverCatalogResultResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/sources/write_discover_catalog_result" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -1067,12 +1190,15 @@ func (s *source) WriteDiscoverCatalogResult(ctx context.Context, request shared. return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -1090,6 +1216,7 @@ func (s *source) WriteDiscoverCatalogResult(ctx context.Context, request shared. if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -1104,12 +1231,14 @@ func (s *source) WriteDiscoverCatalogResult(ctx context.Context, request shared. case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.DiscoverCatalogResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.DiscoverCatalogResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DiscoverCatalogResult = out + res.DiscoverCatalogResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/sourcedefinition.go b/internal/sdk/sourcedefinition.go old mode 100755 new mode 100644 index 7729a52..03a964c --- a/internal/sdk/sourcedefinition.go +++ b/internal/sdk/sourcedefinition.go @@ -3,44 +3,47 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// sourceDefinition - SourceDefinition related resources. -type sourceDefinition struct { +// SourceDefinition related resources. +type SourceDefinition struct { sdkConfiguration sdkConfiguration } -func newSourceDefinition(sdkConfig sdkConfiguration) *sourceDefinition { - return &sourceDefinition{ +func newSourceDefinition(sdkConfig sdkConfiguration) *SourceDefinition { + return &SourceDefinition{ sdkConfiguration: sdkConfig, } } -// CreateCustomSourceDefinition - Creates a custom sourceDefinition for the given workspace -func (s *sourceDefinition) CreateCustomSourceDefinition(ctx context.Context, request shared.CustomSourceDefinitionCreate) (*operations.CreateCustomSourceDefinitionResponse, error) { +// UpdateSourceDefinition - Update a sourceDefinition +func (s *SourceDefinition) UpdateSourceDefinition(ctx context.Context, request *shared.SourceDefinitionUpdate) (*operations.UpdateSourceDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/create_custom" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -58,12 +61,13 @@ func (s *sourceDefinition) CreateCustomSourceDefinition(ctx context.Context, req if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CreateCustomSourceDefinitionResponse{ + res := &operations.UpdateSourceDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -72,49 +76,55 @@ func (s *sourceDefinition) CreateCustomSourceDefinition(ctx context.Context, req case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.SourceDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDefinitionRead = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// DeleteSourceDefinition - Delete a source definition -func (s *sourceDefinition) DeleteSourceDefinition(ctx context.Context, request shared.SourceDefinitionIDRequestBody) (*operations.DeleteSourceDefinitionResponse, error) { +// ListSourceDefinitions - List all the sourceDefinitions the current Airbyte deployment is configured to use +func (s *SourceDefinition) ListSourceDefinitions(ctx context.Context) (*operations.ListSourceDefinitionsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/delete" - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") - if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) - } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/list" - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) - - req.Header.Set("Content-Type", reqContentType) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -135,59 +145,41 @@ func (s *sourceDefinition) DeleteSourceDefinition(ctx context.Context, request s contentType := httpRes.Header.Get("Content-Type") - res := &operations.DeleteSourceDefinitionResponse{ + res := &operations.ListSourceDefinitionsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.SourceDefinitionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetSourceDefinition - Get source -func (s *sourceDefinition) GetSourceDefinition(ctx context.Context, request shared.SourceDefinitionIDRequestBody) (*operations.GetSourceDefinitionResponse, error) { +// ListLatestSourceDefinitions - List the latest sourceDefinitions Airbyte supports +// Guaranteed to retrieve the latest information on supported sources. +func (s *SourceDefinition) ListLatestSourceDefinitions(ctx context.Context) (*operations.ListLatestSourceDefinitionsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/get" - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") - if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) - } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/list_latest" - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) - - req.Header.Set("Content-Type", reqContentType) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -208,7 +200,7 @@ func (s *sourceDefinition) GetSourceDefinition(ctx context.Context, request shar contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetSourceDefinitionResponse{ + res := &operations.ListLatestSourceDefinitionsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -217,44 +209,26 @@ func (s *sourceDefinition) GetSourceDefinition(ctx context.Context, request shar case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.SourceDefinitionRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.SourceDefinitionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetSourceDefinitionForWorkspace - Get a sourceDefinition that is configured for the given workspace -func (s *sourceDefinition) GetSourceDefinitionForWorkspace(ctx context.Context, request shared.SourceDefinitionIDWithWorkspaceID) (*operations.GetSourceDefinitionForWorkspaceResponse, error) { +// GetSourceDefinition - Get source +func (s *SourceDefinition) GetSourceDefinition(ctx context.Context, request shared.SourceDefinitionIDRequestBody) (*operations.GetSourceDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/get_for_workspace" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -262,12 +236,15 @@ func (s *sourceDefinition) GetSourceDefinitionForWorkspace(ctx context.Context, return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -285,12 +262,13 @@ func (s *sourceDefinition) GetSourceDefinitionForWorkspace(ctx context.Context, if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetSourceDefinitionForWorkspaceResponse{ + res := &operations.GetSourceDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -299,44 +277,50 @@ func (s *sourceDefinition) GetSourceDefinitionForWorkspace(ctx context.Context, case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDefinitionRead = out + res.SourceDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GrantSourceDefinitionToWorkspace - grant a private, non-custom sourceDefinition to a given workspace -func (s *sourceDefinition) GrantSourceDefinitionToWorkspace(ctx context.Context, request shared.SourceDefinitionIDWithWorkspaceID) (*operations.GrantSourceDefinitionToWorkspaceResponse, error) { +// DeleteSourceDefinition - Delete a source definition +func (s *SourceDefinition) DeleteSourceDefinition(ctx context.Context, request shared.SourceDefinitionIDRequestBody) (*operations.DeleteSourceDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/grant_definition" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/delete" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -344,12 +328,15 @@ func (s *sourceDefinition) GrantSourceDefinitionToWorkspace(ctx context.Context, return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -367,64 +354,68 @@ func (s *sourceDefinition) GrantSourceDefinitionToWorkspace(ctx context.Context, if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GrantSourceDefinitionToWorkspaceResponse{ + res := &operations.DeleteSourceDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.PrivateSourceDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.PrivateSourceDefinitionRead = out - } + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListLatestSourceDefinitions - List the latest sourceDefinitions Airbyte supports -// Guaranteed to retrieve the latest information on supported sources. -func (s *sourceDefinition) ListLatestSourceDefinitions(ctx context.Context) (*operations.ListLatestSourceDefinitionsResponse, error) { +// ListPrivateSourceDefinitions - List all private, non-custom sourceDefinitions, and for each indicate whether the given workspace has a grant for using the definition. Used by admins to view and modify a given workspace's grants. +func (s *SourceDefinition) ListPrivateSourceDefinitions(ctx context.Context, request *shared.WorkspaceIDRequestBody) (*operations.ListPrivateSourceDefinitionsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/list_latest" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/list_private" - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, fmt.Errorf("error serializing request body: %w", err) + } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + + req.Header.Set("Content-Type", reqContentType) client := s.sdkConfiguration.SecurityClient @@ -440,12 +431,13 @@ func (s *sourceDefinition) ListLatestSourceDefinitions(ctx context.Context) (*op if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListLatestSourceDefinitionsResponse{ + res := &operations.ListPrivateSourceDefinitionsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -454,34 +446,38 @@ func (s *sourceDefinition) ListLatestSourceDefinitions(ctx context.Context) (*op case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.PrivateSourceDefinitionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDefinitionReadList = out + res.PrivateSourceDefinitionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListPrivateSourceDefinitions - List all private, non-custom sourceDefinitions, and for each indicate whether the given workspace has a grant for using the definition. Used by admins to view and modify a given workspace's grants. -func (s *sourceDefinition) ListPrivateSourceDefinitions(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListPrivateSourceDefinitionsResponse, error) { +// ListSourceDefinitionsForWorkspace - List all the sourceDefinitions the given workspace is configured to use +func (s *SourceDefinition) ListSourceDefinitionsForWorkspace(ctx context.Context, request *shared.WorkspaceIDRequestBody) (*operations.ListSourceDefinitionsForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/list_private" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/list_for_workspace" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -499,12 +495,13 @@ func (s *sourceDefinition) ListPrivateSourceDefinitions(ctx context.Context, req if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListPrivateSourceDefinitionsResponse{ + res := &operations.ListSourceDefinitionsForWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -513,29 +510,40 @@ func (s *sourceDefinition) ListPrivateSourceDefinitions(ctx context.Context, req case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.PrivateSourceDefinitionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.PrivateSourceDefinitionReadList = out + res.SourceDefinitionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListSourceDefinitions - List all the sourceDefinitions the current Airbyte deployment is configured to use -func (s *sourceDefinition) ListSourceDefinitions(ctx context.Context) (*operations.ListSourceDefinitionsResponse, error) { +// CreateCustomSourceDefinition - Creates a custom sourceDefinition for the given workspace +func (s *SourceDefinition) CreateCustomSourceDefinition(ctx context.Context, request *shared.CustomSourceDefinitionCreate) (*operations.CreateCustomSourceDefinitionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/create_custom" - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, fmt.Errorf("error serializing request body: %w", err) + } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + + req.Header.Set("Content-Type", reqContentType) client := s.sdkConfiguration.SecurityClient @@ -551,12 +559,13 @@ func (s *sourceDefinition) ListSourceDefinitions(ctx context.Context) (*operatio if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListSourceDefinitionsResponse{ + res := &operations.CreateCustomSourceDefinitionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -565,34 +574,54 @@ func (s *sourceDefinition) ListSourceDefinitions(ctx context.Context) (*operatio case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDefinitionReadList = out + res.SourceDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListSourceDefinitionsForWorkspace - List all the sourceDefinitions the given workspace is configured to use -func (s *sourceDefinition) ListSourceDefinitionsForWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.ListSourceDefinitionsForWorkspaceResponse, error) { +// GetSourceDefinitionForWorkspace - Get a sourceDefinition that is configured for the given workspace +func (s *SourceDefinition) GetSourceDefinitionForWorkspace(ctx context.Context, request shared.SourceDefinitionIDWithWorkspaceID) (*operations.GetSourceDefinitionForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/list_for_workspace" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/get_for_workspace" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } + + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -610,12 +639,13 @@ func (s *sourceDefinition) ListSourceDefinitionsForWorkspace(ctx context.Context if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListSourceDefinitionsForWorkspaceResponse{ + res := &operations.GetSourceDefinitionForWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -624,24 +654,50 @@ func (s *sourceDefinition) ListSourceDefinitionsForWorkspace(ctx context.Context case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDefinitionReadList = out + res.SourceDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// RevokeSourceDefinitionFromWorkspace - revoke a grant to a private, non-custom sourceDefinition from a given workspace -func (s *sourceDefinition) RevokeSourceDefinitionFromWorkspace(ctx context.Context, request shared.SourceDefinitionIDWithWorkspaceID) (*operations.RevokeSourceDefinitionFromWorkspaceResponse, error) { +// GrantSourceDefinitionToWorkspace - grant a private, non-custom sourceDefinition to a given workspace +func (s *SourceDefinition) GrantSourceDefinitionToWorkspace(ctx context.Context, request shared.SourceDefinitionIDWithWorkspaceID) (*operations.GrantSourceDefinitionToWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/revoke_definition" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/grant_definition" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -649,12 +705,15 @@ func (s *sourceDefinition) RevokeSourceDefinitionFromWorkspace(ctx context.Conte return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -672,59 +731,81 @@ func (s *sourceDefinition) RevokeSourceDefinitionFromWorkspace(ctx context.Conte if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.RevokeSourceDefinitionFromWorkspaceResponse{ + res := &operations.GrantSourceDefinitionToWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.PrivateSourceDefinitionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.PrivateSourceDefinitionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateSourceDefinition - Update a sourceDefinition -func (s *sourceDefinition) UpdateSourceDefinition(ctx context.Context, request shared.SourceDefinitionUpdate) (*operations.UpdateSourceDefinitionResponse, error) { +// RevokeSourceDefinitionFromWorkspace - revoke a grant to a private, non-custom sourceDefinition from a given workspace +func (s *SourceDefinition) RevokeSourceDefinitionFromWorkspace(ctx context.Context, request shared.SourceDefinitionIDWithWorkspaceID) (*operations.RevokeSourceDefinitionFromWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definitions/revoke_definition" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -742,46 +823,42 @@ func (s *sourceDefinition) UpdateSourceDefinition(ctx context.Context, request s if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateSourceDefinitionResponse{ + res := &operations.RevokeSourceDefinitionFromWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.SourceDefinitionRead = out - } + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/sourcedefinitionspecification.go b/internal/sdk/sourcedefinitionspecification.go old mode 100755 new mode 100644 index a74a970..3a56063 --- a/internal/sdk/sourcedefinitionspecification.go +++ b/internal/sdk/sourcedefinitionspecification.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// sourceDefinitionSpecification - SourceDefinition specification related resources. -type sourceDefinitionSpecification struct { +// SourceDefinitionSpecification - SourceDefinition specification related resources. +type SourceDefinitionSpecification struct { sdkConfiguration sdkConfiguration } -func newSourceDefinitionSpecification(sdkConfig sdkConfiguration) *sourceDefinitionSpecification { - return &sourceDefinitionSpecification{ +func newSourceDefinitionSpecification(sdkConfig sdkConfiguration) *SourceDefinitionSpecification { + return &SourceDefinitionSpecification{ sdkConfiguration: sdkConfig, } } // GetSourceDefinitionSpecification - Get specification for a SourceDefinition. -func (s *sourceDefinitionSpecification) GetSourceDefinitionSpecification(ctx context.Context, request shared.SourceDefinitionIDWithWorkspaceID) (*operations.GetSourceDefinitionSpecificationResponse, error) { +func (s *SourceDefinitionSpecification) GetSourceDefinitionSpecification(ctx context.Context, request shared.SourceDefinitionIDWithWorkspaceID) (*operations.GetSourceDefinitionSpecificationResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definition_specifications/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *sourceDefinitionSpecification) GetSourceDefinitionSpecification(ctx con return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,6 +65,7 @@ func (s *sourceDefinitionSpecification) GetSourceDefinitionSpecification(ctx con if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -75,32 +80,38 @@ func (s *sourceDefinitionSpecification) GetSourceDefinitionSpecification(ctx con case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionSpecificationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionSpecificationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDefinitionSpecificationRead = out + res.SourceDefinitionSpecificationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -108,11 +119,11 @@ func (s *sourceDefinitionSpecification) GetSourceDefinitionSpecification(ctx con } // GetSpecificationForSourceID - Get specification for a source. -func (s *sourceDefinitionSpecification) GetSpecificationForSourceID(ctx context.Context, request shared.SourceIDRequestBody) (*operations.GetSpecificationForSourceIDResponse, error) { +func (s *SourceDefinitionSpecification) GetSpecificationForSourceID(ctx context.Context, request shared.SourceIDRequestBody) (*operations.GetSpecificationForSourceIDResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/source_definition_specifications/get_for_source" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -120,12 +131,15 @@ func (s *sourceDefinitionSpecification) GetSpecificationForSourceID(ctx context. return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -143,6 +157,7 @@ func (s *sourceDefinitionSpecification) GetSpecificationForSourceID(ctx context. if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -157,32 +172,38 @@ func (s *sourceDefinitionSpecification) GetSpecificationForSourceID(ctx context. case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.SourceDefinitionSpecificationRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.SourceDefinitionSpecificationRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SourceDefinitionSpecificationRead = out + res.SourceDefinitionSpecificationRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/sourceoauth.go b/internal/sdk/sourceoauth.go old mode 100755 new mode 100644 index 0c74084..7e56f77 --- a/internal/sdk/sourceoauth.go +++ b/internal/sdk/sourceoauth.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// sourceOauth - Source OAuth related resources to delegate access from user. -type sourceOauth struct { +// SourceOauth - Source OAuth related resources to delegate access from user. +type SourceOauth struct { sdkConfiguration sdkConfiguration } -func newSourceOauth(sdkConfig sdkConfiguration) *sourceOauth { - return &sourceOauth{ +func newSourceOauth(sdkConfig sdkConfiguration) *SourceOauth { + return &SourceOauth{ sdkConfiguration: sdkConfig, } } -// CompleteSourceOAuth - Given a source def ID generate an access/refresh token etc. -func (s *sourceOauth) CompleteSourceOAuth(ctx context.Context, request shared.CompleteSourceOauthRequest) (*operations.CompleteSourceOAuthResponse, error) { +// SetInstancewideSourceOauthParams - Sets instancewide variables to be used for the oauth flow when creating this source. When set, these variables will be injected into a connector's configuration before any interaction with the connector image itself. This enables running oauth flows with consistent variables e.g: the company's Google Ads developer_token, client_id, and client_secret without the user having to know about these variables. +func (s *SourceOauth) SetInstancewideSourceOauthParams(ctx context.Context, request shared.SetInstancewideSourceOauthParamsRequestBody) (*operations.SetInstancewideSourceOauthParamsResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_oauths/complete_oauth" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_oauths/oauth_params/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *sourceOauth) CompleteSourceOAuth(ctx context.Context, request shared.Co return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,46 +65,42 @@ func (s *sourceOauth) CompleteSourceOAuth(ctx context.Context, request shared.Co if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CompleteSourceOAuthResponse{ + res := &operations.SetInstancewideSourceOauthParamsResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { case httpRes.StatusCode == 200: + case httpRes.StatusCode == 400: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.CompleteOAuthResponse - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.KnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CompleteOAuthResponse = out + res.KnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.InvalidInputExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -108,11 +108,11 @@ func (s *sourceOauth) CompleteSourceOAuth(ctx context.Context, request shared.Co } // GetSourceOAuthConsent - Given a source connector definition ID, return the URL to the consent screen where to redirect the user to. -func (s *sourceOauth) GetSourceOAuthConsent(ctx context.Context, request shared.SourceOauthConsentRequest) (*operations.GetSourceOAuthConsentResponse, error) { +func (s *SourceOauth) GetSourceOAuthConsent(ctx context.Context, request shared.SourceOauthConsentRequest) (*operations.GetSourceOAuthConsentResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/source_oauths/get_consent_url" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -120,12 +120,15 @@ func (s *sourceOauth) GetSourceOAuthConsent(ctx context.Context, request shared. return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -143,6 +146,7 @@ func (s *sourceOauth) GetSourceOAuthConsent(ctx context.Context, request shared. if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -157,44 +161,50 @@ func (s *sourceOauth) GetSourceOAuthConsent(ctx context.Context, request shared. case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.OAuthConsentRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.OAuthConsentRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.OAuthConsentRead = out + res.OAuthConsentRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// RevokeSourceOAuthTokens - Given a source definition ID and workspace ID revoke access/refresh token etc. -func (s *sourceOauth) RevokeSourceOAuthTokens(ctx context.Context, request shared.RevokeSourceOauthTokensRequest) (*operations.RevokeSourceOAuthTokensResponse, error) { +// CompleteSourceOAuth - Given a source def ID generate an access/refresh token etc. +func (s *SourceOauth) CompleteSourceOAuth(ctx context.Context, request shared.CompleteSourceOauthRequest) (*operations.CompleteSourceOAuthResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_oauths/revoke" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_oauths/complete_oauth" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -202,12 +212,15 @@ func (s *sourceOauth) RevokeSourceOAuthTokens(ctx context.Context, request share return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -225,49 +238,65 @@ func (s *sourceOauth) RevokeSourceOAuthTokens(ctx context.Context, request share if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.RevokeSourceOAuthTokensResponse{ + res := &operations.CompleteSourceOAuthResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { case httpRes.StatusCode == 200: - case httpRes.StatusCode == 400: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.KnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.CompleteOAuthResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.KnownExceptionInfo = out + res.CompleteOAuthResponse = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// SetInstancewideSourceOauthParams - Sets instancewide variables to be used for the oauth flow when creating this source. When set, these variables will be injected into a connector's configuration before any interaction with the connector image itself. This enables running oauth flows with consistent variables e.g: the company's Google Ads developer_token, client_id, and client_secret without the user having to know about these variables. -func (s *sourceOauth) SetInstancewideSourceOauthParams(ctx context.Context, request shared.SetInstancewideSourceOauthParamsRequestBody) (*operations.SetInstancewideSourceOauthParamsResponse, error) { +// RevokeSourceOAuthTokens - Given a source definition ID and workspace ID revoke access/refresh token etc. +func (s *SourceOauth) RevokeSourceOAuthTokens(ctx context.Context, request shared.RevokeSourceOauthTokensRequest) (*operations.RevokeSourceOAuthTokensResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/source_oauths/oauth_params/create" + url := strings.TrimSuffix(baseURL, "/") + "/v1/source_oauths/revoke" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -275,12 +304,15 @@ func (s *sourceOauth) SetInstancewideSourceOauthParams(ctx context.Context, requ return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -298,12 +330,13 @@ func (s *sourceOauth) SetInstancewideSourceOauthParams(ctx context.Context, requ if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.SetInstancewideSourceOauthParamsResponse{ + res := &operations.RevokeSourceOAuthTokensResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -313,22 +346,26 @@ func (s *sourceOauth) SetInstancewideSourceOauthParams(ctx context.Context, requ case httpRes.StatusCode == 400: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.KnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.KnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.KnownExceptionInfo = out + res.KnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/state.go b/internal/sdk/state.go old mode 100755 new mode 100644 index 4ec3e7d..41d4f46 --- a/internal/sdk/state.go +++ b/internal/sdk/state.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// state - Interactions with state related resources. -type state struct { +// State - Interactions with state related resources. +type State struct { sdkConfiguration sdkConfiguration } -func newState(sdkConfig sdkConfiguration) *state { - return &state{ +func newState(sdkConfig sdkConfiguration) *State { + return &State{ sdkConfiguration: sdkConfig, } } -// CreateOrUpdateState - Create or update the state for a connection. -func (s *state) CreateOrUpdateState(ctx context.Context, request shared.ConnectionStateCreateOrUpdate) (*operations.CreateOrUpdateStateResponse, error) { +// GetState - Fetch the current state for a connection. +func (s *State) GetState(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetStateResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/state/create_or_update" + url := strings.TrimSuffix(baseURL, "/") + "/v1/state/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *state) CreateOrUpdateState(ctx context.Context, request shared.Connecti return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,12 +65,13 @@ func (s *state) CreateOrUpdateState(ctx context.Context, request shared.Connecti if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CreateOrUpdateStateResponse{ + res := &operations.GetStateResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -75,44 +80,50 @@ func (s *state) CreateOrUpdateState(ctx context.Context, request shared.Connecti case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionState - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionState + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionState = out + res.ConnectionState = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetState - Fetch the current state for a connection. -func (s *state) GetState(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetStateResponse, error) { +// CreateOrUpdateState - Create or update the state for a connection. +func (s *State) CreateOrUpdateState(ctx context.Context, request shared.ConnectionStateCreateOrUpdate) (*operations.CreateOrUpdateStateResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/state/get" + url := strings.TrimSuffix(baseURL, "/") + "/v1/state/create_or_update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -120,12 +131,15 @@ func (s *state) GetState(ctx context.Context, request shared.ConnectionIDRequest return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -143,12 +157,13 @@ func (s *state) GetState(ctx context.Context, request shared.ConnectionIDRequest if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetStateResponse{ + res := &operations.CreateOrUpdateStateResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -157,32 +172,38 @@ func (s *state) GetState(ctx context.Context, request shared.ConnectionIDRequest case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionState - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionState + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.ConnectionState = out + res.ConnectionState = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/streams.go b/internal/sdk/streams.go old mode 100755 new mode 100644 index d7b7e52..515f750 --- a/internal/sdk/streams.go +++ b/internal/sdk/streams.go @@ -3,43 +3,46 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type streams struct { +type Streams struct { sdkConfiguration sdkConfiguration } -func newStreams(sdkConfig sdkConfiguration) *streams { - return &streams{ +func newStreams(sdkConfig sdkConfiguration) *Streams { + return &Streams{ sdkConfiguration: sdkConfig, } } -// CreateStreamStatus - Creates a stream status. -func (s *streams) CreateStreamStatus(ctx context.Context, request shared.StreamStatusCreateRequestBody) (*operations.CreateStreamStatusResponse, error) { +// GetStreamStatuses - Gets a list of stream statuses filtered by parameters (with AND semantics). +func (s *Streams) GetStreamStatuses(ctx context.Context, request *shared.StreamStatusListRequestBody) (*operations.GetStreamStatusesResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/create" + url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/list" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -57,48 +60,53 @@ func (s *streams) CreateStreamStatus(ctx context.Context, request shared.StreamS if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CreateStreamStatusResponse{ + res := &operations.GetStreamStatusesResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 201: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.StreamStatusRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.StreamStatusReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.StreamStatusRead = out + res.StreamStatusReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetStreamStatuses - Gets a list of stream statuses filtered by parameters (with AND semantics). -func (s *streams) GetStreamStatuses(ctx context.Context, request shared.StreamStatusListRequestBody) (*operations.GetStreamStatusesResponse, error) { +// CreateStreamStatus - Creates a stream status. +func (s *Streams) CreateStreamStatus(ctx context.Context, request *shared.StreamStatusCreateRequestBody) (*operations.CreateStreamStatusResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -116,26 +124,29 @@ func (s *streams) GetStreamStatuses(ctx context.Context, request shared.StreamSt if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetStreamStatusesResponse{ + res := &operations.CreateStreamStatusResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 201: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.StreamStatusReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.StreamStatusRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.StreamStatusReadList = out + res.StreamStatusRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -143,21 +154,23 @@ func (s *streams) GetStreamStatuses(ctx context.Context, request shared.StreamSt } // UpdateStreamStatus - Updates a stream status. -func (s *streams) UpdateStreamStatus(ctx context.Context, request shared.StreamStatusUpdateRequestBody) (*operations.UpdateStreamStatusResponse, error) { +func (s *Streams) UpdateStreamStatus(ctx context.Context, request *shared.StreamStatusUpdateRequestBody) (*operations.UpdateStreamStatusResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -175,6 +188,7 @@ func (s *streams) UpdateStreamStatus(ctx context.Context, request shared.StreamS if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -191,12 +205,14 @@ func (s *streams) UpdateStreamStatus(ctx context.Context, request shared.StreamS case httpRes.StatusCode == 201: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.StreamStatusRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.StreamStatusRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.StreamStatusRead = out + res.StreamStatusRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/streamstatuses.go b/internal/sdk/streamstatuses.go old mode 100755 new mode 100644 index 50c8e84..2ec7947 --- a/internal/sdk/streamstatuses.go +++ b/internal/sdk/streamstatuses.go @@ -3,43 +3,46 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -type streamStatuses struct { +type StreamStatuses struct { sdkConfiguration sdkConfiguration } -func newStreamStatuses(sdkConfig sdkConfiguration) *streamStatuses { - return &streamStatuses{ +func newStreamStatuses(sdkConfig sdkConfiguration) *StreamStatuses { + return &StreamStatuses{ sdkConfiguration: sdkConfig, } } -// CreateStreamStatus - Creates a stream status. -func (s *streamStatuses) CreateStreamStatus(ctx context.Context, request shared.StreamStatusCreateRequestBody) (*operations.CreateStreamStatusResponse, error) { +// GetStreamStatuses - Gets a list of stream statuses filtered by parameters (with AND semantics). +func (s *StreamStatuses) GetStreamStatuses(ctx context.Context, request *shared.StreamStatusListRequestBody) (*operations.GetStreamStatusesResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/create" + url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/list" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -57,48 +60,53 @@ func (s *streamStatuses) CreateStreamStatus(ctx context.Context, request shared. if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.CreateStreamStatusResponse{ + res := &operations.GetStreamStatusesResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 201: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.StreamStatusRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.StreamStatusReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.StreamStatusRead = out + res.StreamStatusReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetStreamStatuses - Gets a list of stream statuses filtered by parameters (with AND semantics). -func (s *streamStatuses) GetStreamStatuses(ctx context.Context, request shared.StreamStatusListRequestBody) (*operations.GetStreamStatusesResponse, error) { +// CreateStreamStatus - Creates a stream status. +func (s *StreamStatuses) CreateStreamStatus(ctx context.Context, request *shared.StreamStatusCreateRequestBody) (*operations.CreateStreamStatusResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -116,26 +124,29 @@ func (s *streamStatuses) GetStreamStatuses(ctx context.Context, request shared.S if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetStreamStatusesResponse{ + res := &operations.CreateStreamStatusResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 201: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.StreamStatusReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.StreamStatusRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.StreamStatusReadList = out + res.StreamStatusRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -143,21 +154,23 @@ func (s *streamStatuses) GetStreamStatuses(ctx context.Context, request shared.S } // UpdateStreamStatus - Updates a stream status. -func (s *streamStatuses) UpdateStreamStatus(ctx context.Context, request shared.StreamStatusUpdateRequestBody) (*operations.UpdateStreamStatusResponse, error) { +func (s *StreamStatuses) UpdateStreamStatus(ctx context.Context, request *shared.StreamStatusUpdateRequestBody) (*operations.UpdateStreamStatusResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/stream_statuses/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -175,6 +188,7 @@ func (s *streamStatuses) UpdateStreamStatus(ctx context.Context, request shared. if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -191,12 +205,14 @@ func (s *streamStatuses) UpdateStreamStatus(ctx context.Context, request shared. case httpRes.StatusCode == 201: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.StreamStatusRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.StreamStatusRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.StreamStatusRead = out + res.StreamStatusRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/webbackend.go b/internal/sdk/webbackend.go old mode 100755 new mode 100644 index 5c4d65e..5b54521 --- a/internal/sdk/webbackend.go +++ b/internal/sdk/webbackend.go @@ -3,50 +3,41 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// webBackend - Endpoints for the Airbyte web application. Those APIs should not be called outside the web application implementation and are not +// WebBackend - Endpoints for the Airbyte web application. Those APIs should not be called outside the web application implementation and are not // guaranteeing any backwards compatibility. -type webBackend struct { +type WebBackend struct { sdkConfiguration sdkConfiguration } -func newWebBackend(sdkConfig sdkConfiguration) *webBackend { - return &webBackend{ +func newWebBackend(sdkConfig sdkConfiguration) *WebBackend { + return &WebBackend{ sdkConfiguration: sdkConfig, } } -// GetStateType - Fetch the current state type for a connection. -func (s *webBackend) GetStateType(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetStateTypeResponse, error) { +// WebBackendCheckUpdates - Returns a summary of source and destination definitions that could be updated. +func (s *WebBackend) WebBackendCheckUpdates(ctx context.Context) (*operations.WebBackendCheckUpdatesResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/state/get_type" - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") - if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) - } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/check_updates" - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) - - req.Header.Set("Content-Type", reqContentType) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -67,7 +58,7 @@ func (s *webBackend) GetStateType(ctx context.Context, request shared.Connection contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetStateTypeResponse{ + res := &operations.WebBackendCheckUpdatesResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -76,49 +67,44 @@ func (s *webBackend) GetStateType(ctx context.Context, request shared.Connection case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.ConnectionStateType - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.ConnectionStateType = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WebBackendCheckUpdatesRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.InvalidInputExceptionInfo = out + res.WebBackendCheckUpdatesRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// WebBackendCheckUpdates - Returns a summary of source and destination definitions that could be updated. -func (s *webBackend) WebBackendCheckUpdates(ctx context.Context) (*operations.WebBackendCheckUpdatesResponse, error) { +// WebBackendListConnectionsForWorkspace - Returns all non-deleted connections for a workspace. +func (s *WebBackend) WebBackendListConnectionsForWorkspace(ctx context.Context, request shared.WebBackendConnectionListRequestBody) (*operations.WebBackendListConnectionsForWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/check_updates" + url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/connections/list" - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, fmt.Errorf("error serializing request body: %w", err) + } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } + + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + + req.Header.Set("Content-Type", reqContentType) client := s.sdkConfiguration.SecurityClient @@ -134,12 +120,13 @@ func (s *webBackend) WebBackendCheckUpdates(ctx context.Context) (*operations.We if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.WebBackendCheckUpdatesResponse{ + res := &operations.WebBackendListConnectionsForWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -148,24 +135,50 @@ func (s *webBackend) WebBackendCheckUpdates(ctx context.Context) (*operations.We case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WebBackendCheckUpdatesRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WebBackendConnectionReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WebBackendCheckUpdatesRead = out + res.WebBackendConnectionReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// WebBackendCreateConnection - Create a connection -func (s *webBackend) WebBackendCreateConnection(ctx context.Context, request shared.WebBackendConnectionCreate) (*operations.WebBackendCreateConnectionResponse, error) { +// WebBackendGetConnection - Get a connection +func (s *WebBackend) WebBackendGetConnection(ctx context.Context, request shared.WebBackendConnectionRequestBody) (*operations.WebBackendGetConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/connections/create" + url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/connections/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -173,12 +186,15 @@ func (s *webBackend) WebBackendCreateConnection(ctx context.Context, request sha return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -196,12 +212,13 @@ func (s *webBackend) WebBackendCreateConnection(ctx context.Context, request sha if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.WebBackendCreateConnectionResponse{ + res := &operations.WebBackendGetConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -210,34 +227,50 @@ func (s *webBackend) WebBackendCreateConnection(ctx context.Context, request sha case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WebBackendConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WebBackendConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WebBackendConnectionRead = out + res.WebBackendConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// WebBackendGetConnection - Get a connection -func (s *webBackend) WebBackendGetConnection(ctx context.Context, request shared.WebBackendConnectionRequestBody) (*operations.WebBackendGetConnectionResponse, error) { +// WebBackendCreateConnection - Create a connection +func (s *WebBackend) WebBackendCreateConnection(ctx context.Context, request shared.WebBackendConnectionCreate) (*operations.WebBackendCreateConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/connections/get" + url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/connections/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -245,12 +278,15 @@ func (s *webBackend) WebBackendGetConnection(ctx context.Context, request shared return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -268,12 +304,13 @@ func (s *webBackend) WebBackendGetConnection(ctx context.Context, request shared if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.WebBackendGetConnectionResponse{ + res := &operations.WebBackendCreateConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -282,54 +319,61 @@ func (s *webBackend) WebBackendGetConnection(ctx context.Context, request shared case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WebBackendConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WebBackendConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WebBackendConnectionRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out + res.WebBackendConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// WebBackendGetWorkspaceState - Returns the current state of a workspace -func (s *webBackend) WebBackendGetWorkspaceState(ctx context.Context, request shared.WebBackendWorkspaceState) (*operations.WebBackendGetWorkspaceStateResponse, error) { +// WebBackendUpdateConnection - Update a connection +// Apply a patch-style update to a connection. Only fields present on the update request body will be updated. +// Any operations that lack an ID will be created. Then, the newly created operationId will be applied to the +// connection along with the rest of the operationIds in the request body. +// Apply a patch-style update to a connection. Only fields present on the update request body will be updated. +// Note that if a catalog is present in the request body, the connection's entire catalog will be replaced +// with the catalog from the request. This means that to modify a single stream, the entire new catalog +// containing the updated stream needs to be sent. +func (s *WebBackend) WebBackendUpdateConnection(ctx context.Context, request shared.WebBackendConnectionUpdate) (*operations.WebBackendUpdateConnectionResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/workspace/state" + url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/connections/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -347,12 +391,13 @@ func (s *webBackend) WebBackendGetWorkspaceState(ctx context.Context, request sh if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.WebBackendGetWorkspaceStateResponse{ + res := &operations.WebBackendUpdateConnectionResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -361,44 +406,38 @@ func (s *webBackend) WebBackendGetWorkspaceState(ctx context.Context, request sh case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WebBackendWorkspaceStateResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WebBackendConnectionRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WebBackendWorkspaceStateResult = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out + res.WebBackendConnectionRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// WebBackendListConnectionsForWorkspace - Returns all non-deleted connections for a workspace. -func (s *webBackend) WebBackendListConnectionsForWorkspace(ctx context.Context, request shared.WebBackendConnectionListRequestBody) (*operations.WebBackendListConnectionsForWorkspaceResponse, error) { +// GetStateType - Fetch the current state type for a connection. +func (s *WebBackend) GetStateType(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetStateTypeResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/connections/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/state/get_type" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -406,12 +445,15 @@ func (s *webBackend) WebBackendListConnectionsForWorkspace(ctx context.Context, return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -429,12 +471,13 @@ func (s *webBackend) WebBackendListConnectionsForWorkspace(ctx context.Context, if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.WebBackendListConnectionsForWorkspaceResponse{ + res := &operations.GetStateTypeResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -443,54 +486,64 @@ func (s *webBackend) WebBackendListConnectionsForWorkspace(ctx context.Context, case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WebBackendConnectionReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.ConnectionStateType + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WebBackendConnectionReadList = out + res.ConnectionStateType = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// WebBackendListGeographies - Returns available geographies can be selected to run data syncs in a particular geography. -// The 'auto' entry indicates that the sync will be automatically assigned to a geography according -// to the platform default behavior. Entries other than 'auto' are two-letter country codes that -// follow the ISO 3166-1 alpha-2 standard. -// -// Returns all available geographies in which a data sync can run. -func (s *webBackend) WebBackendListGeographies(ctx context.Context) (*operations.WebBackendListGeographiesResponse, error) { +// WebBackendGetWorkspaceState - Returns the current state of a workspace +func (s *WebBackend) WebBackendGetWorkspaceState(ctx context.Context, request *shared.WebBackendWorkspaceState) (*operations.WebBackendGetWorkspaceStateResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/geographies/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/workspace/state" - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, fmt.Errorf("error serializing request body: %w", err) + } + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + + req.Header.Set("Content-Type", reqContentType) client := s.sdkConfiguration.SecurityClient @@ -506,12 +559,13 @@ func (s *webBackend) WebBackendListGeographies(ctx context.Context) (*operations if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.WebBackendListGeographiesResponse{ + res := &operations.WebBackendGetWorkspaceStateResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -520,46 +574,60 @@ func (s *webBackend) WebBackendListGeographies(ctx context.Context) (*operations case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WebBackendGeographiesListResult - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WebBackendWorkspaceStateResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WebBackendGeographiesListResult = out + res.WebBackendWorkspaceStateResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// WebBackendUpdateConnection - Update a connection -// Apply a patch-style update to a connection. Only fields present on the update request body will be updated. -// Any operations that lack an ID will be created. Then, the newly created operationId will be applied to the -// connection along with the rest of the operationIds in the request body. -// Apply a patch-style update to a connection. Only fields present on the update request body will be updated. -// Note that if a catalog is present in the request body, the connection's entire catalog will be replaced -// with the catalog from the request. This means that to modify a single stream, the entire new catalog -// containing the updated stream needs to be sent. -func (s *webBackend) WebBackendUpdateConnection(ctx context.Context, request shared.WebBackendConnectionUpdate) (*operations.WebBackendUpdateConnectionResponse, error) { +// WebBackendListGeographies - Returns available geographies can be selected to run data syncs in a particular geography. +// The 'auto' entry indicates that the sync will be automatically assigned to a geography according +// to the platform default behavior. Entries other than 'auto' are two-letter country codes that +// follow the ISO 3166-1 alpha-2 standard. +// +// Returns all available geographies in which a data sync can run. +func (s *WebBackend) WebBackendListGeographies(ctx context.Context) (*operations.WebBackendListGeographiesResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/connections/update" - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") - if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) - } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + url := strings.TrimSuffix(baseURL, "/") + "/v1/web_backend/geographies/list" - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) - - req.Header.Set("Content-Type", reqContentType) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -580,7 +648,7 @@ func (s *webBackend) WebBackendUpdateConnection(ctx context.Context, request sha contentType := httpRes.Header.Get("Content-Type") - res := &operations.WebBackendUpdateConnectionResponse{ + res := &operations.WebBackendListGeographiesResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -589,22 +657,14 @@ func (s *webBackend) WebBackendUpdateConnection(ctx context.Context, request sha case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WebBackendConnectionRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.WebBackendConnectionRead = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WebBackendGeographiesListResult + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.WebBackendGeographiesListResult = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/sdk/workspace.go b/internal/sdk/workspace.go old mode 100755 new mode 100644 index a737f37..c98f313 --- a/internal/sdk/workspace.go +++ b/internal/sdk/workspace.go @@ -3,34 +3,35 @@ package sdk import ( - "airbyte/internal/sdk/pkg/models/operations" - "airbyte/internal/sdk/pkg/models/shared" - "airbyte/internal/sdk/pkg/utils" "bytes" "context" "fmt" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/operations" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/sdkerrors" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/models/shared" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/utils" "io" "net/http" "strings" ) -// workspace - Workspace related resources. -type workspace struct { +// Workspace related resources. +type Workspace struct { sdkConfiguration sdkConfiguration } -func newWorkspace(sdkConfig sdkConfiguration) *workspace { - return &workspace{ +func newWorkspace(sdkConfig sdkConfiguration) *Workspace { + return &Workspace{ sdkConfiguration: sdkConfig, } } // CreateWorkspace - Creates a workspace -func (s *workspace) CreateWorkspace(ctx context.Context, request shared.WorkspaceCreate) (*operations.CreateWorkspaceResponse, error) { +func (s *Workspace) CreateWorkspace(ctx context.Context, request shared.WorkspaceCreate) (*operations.CreateWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/create" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -38,12 +39,15 @@ func (s *workspace) CreateWorkspace(ctx context.Context, request shared.Workspac return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -61,6 +65,7 @@ func (s *workspace) CreateWorkspace(ctx context.Context, request shared.Workspac if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -75,22 +80,26 @@ func (s *workspace) CreateWorkspace(ctx context.Context, request shared.Workspac case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WorkspaceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WorkspaceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WorkspaceRead = out + res.WorkspaceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -98,11 +107,11 @@ func (s *workspace) CreateWorkspace(ctx context.Context, request shared.Workspac } // DeleteWorkspace - Deletes a workspace -func (s *workspace) DeleteWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.DeleteWorkspaceResponse, error) { +func (s *Workspace) DeleteWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.DeleteWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/delete" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -110,12 +119,15 @@ func (s *workspace) DeleteWorkspace(ctx context.Context, request shared.Workspac return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -133,6 +145,7 @@ func (s *workspace) DeleteWorkspace(ctx context.Context, request shared.Workspac if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -148,49 +161,43 @@ func (s *workspace) DeleteWorkspace(ctx context.Context, request shared.Workspac case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetWorkspace - Find workspace by ID -func (s *workspace) GetWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.GetWorkspaceResponse, error) { +// ListWorkspaces - List all workspaces registered in the current Airbyte deployment +func (s *Workspace) ListWorkspaces(ctx context.Context) (*operations.ListWorkspacesResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/get" - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") - if err != nil { - return nil, fmt.Errorf("error serializing request body: %w", err) - } - if bodyReader == nil { - return nil, fmt.Errorf("request body is required") - } + url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/list" - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + req, err := http.NewRequestWithContext(ctx, "POST", url, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) - - req.Header.Set("Content-Type", reqContentType) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) client := s.sdkConfiguration.SecurityClient @@ -211,7 +218,7 @@ func (s *workspace) GetWorkspace(ctx context.Context, request shared.WorkspaceID contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetWorkspaceResponse{ + res := &operations.ListWorkspacesResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -220,44 +227,26 @@ func (s *workspace) GetWorkspace(ctx context.Context, request shared.WorkspaceID case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WorkspaceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.WorkspaceRead = out - } - case httpRes.StatusCode == 404: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WorkspaceReadList + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.WorkspaceReadList = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// GetWorkspaceByConnectionID - Find workspace by connection id -func (s *workspace) GetWorkspaceByConnectionID(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetWorkspaceByConnectionIDResponse, error) { +// GetWorkspace - Find workspace by ID +func (s *Workspace) GetWorkspace(ctx context.Context, request shared.WorkspaceIDRequestBody) (*operations.GetWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/get_by_connection_id" + url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/get" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -265,12 +254,15 @@ func (s *workspace) GetWorkspaceByConnectionID(ctx context.Context, request shar return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -288,12 +280,13 @@ func (s *workspace) GetWorkspaceByConnectionID(ctx context.Context, request shar if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.GetWorkspaceByConnectionIDResponse{ + res := &operations.GetWorkspaceResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -302,32 +295,38 @@ func (s *workspace) GetWorkspaceByConnectionID(ctx context.Context, request shar case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WorkspaceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WorkspaceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WorkspaceRead = out + res.WorkspaceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -335,11 +334,11 @@ func (s *workspace) GetWorkspaceByConnectionID(ctx context.Context, request shar } // GetWorkspaceBySlug - Find workspace by slug -func (s *workspace) GetWorkspaceBySlug(ctx context.Context, request shared.SlugRequestBody) (*operations.GetWorkspaceBySlugResponse, error) { +func (s *Workspace) GetWorkspaceBySlug(ctx context.Context, request shared.SlugRequestBody) (*operations.GetWorkspaceBySlugResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/get_by_slug" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -347,12 +346,15 @@ func (s *workspace) GetWorkspaceBySlug(ctx context.Context, request shared.SlugR return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -370,6 +372,7 @@ func (s *workspace) GetWorkspaceBySlug(ctx context.Context, request shared.SlugR if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -384,49 +387,68 @@ func (s *workspace) GetWorkspaceBySlug(ctx context.Context, request shared.SlugR case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WorkspaceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WorkspaceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WorkspaceRead = out + res.WorkspaceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// ListWorkspaces - List all workspaces registered in the current Airbyte deployment -func (s *workspace) ListWorkspaces(ctx context.Context) (*operations.ListWorkspacesResponse, error) { +// GetWorkspaceByConnectionID - Find workspace by connection id +func (s *Workspace) GetWorkspaceByConnectionID(ctx context.Context, request shared.ConnectionIDRequestBody) (*operations.GetWorkspaceByConnectionIDResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/list" + url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/get_by_connection_id" - req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, fmt.Errorf("error serializing request body: %w", err) + } + if bodyReader == nil { + return nil, fmt.Errorf("request body is required") + } + + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) + + req.Header.Set("Content-Type", reqContentType) client := s.sdkConfiguration.SecurityClient @@ -442,12 +464,13 @@ func (s *workspace) ListWorkspaces(ctx context.Context) (*operations.ListWorkspa if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.ListWorkspacesResponse{ + res := &operations.GetWorkspaceByConnectionIDResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, @@ -456,12 +479,38 @@ func (s *workspace) ListWorkspaces(ctx context.Context) (*operations.ListWorkspa case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WorkspaceReadList - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WorkspaceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.WorkspaceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WorkspaceReadList = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -469,11 +518,11 @@ func (s *workspace) ListWorkspaces(ctx context.Context) (*operations.ListWorkspa } // UpdateWorkspace - Update workspace state -func (s *workspace) UpdateWorkspace(ctx context.Context, request shared.WorkspaceUpdate) (*operations.UpdateWorkspaceResponse, error) { +func (s *Workspace) UpdateWorkspace(ctx context.Context, request shared.WorkspaceUpdate) (*operations.UpdateWorkspaceResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/update" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -481,12 +530,15 @@ func (s *workspace) UpdateWorkspace(ctx context.Context, request shared.Workspac return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -504,6 +556,7 @@ func (s *workspace) UpdateWorkspace(ctx context.Context, request shared.Workspac if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) @@ -518,44 +571,50 @@ func (s *workspace) UpdateWorkspace(ctx context.Context, request shared.Workspac case httpRes.StatusCode == 200: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.WorkspaceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.WorkspaceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.WorkspaceRead = out + res.WorkspaceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateWorkspaceFeedback - Update workspace feedback state -func (s *workspace) UpdateWorkspaceFeedback(ctx context.Context, request shared.WorkspaceGiveFeedback) (*operations.UpdateWorkspaceFeedbackResponse, error) { +// UpdateWorkspaceName - Update workspace name +func (s *Workspace) UpdateWorkspaceName(ctx context.Context, request shared.WorkspaceUpdateName) (*operations.UpdateWorkspaceNameResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/tag_feedback_status_as_done" + url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/update_name" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -563,12 +622,15 @@ func (s *workspace) UpdateWorkspaceFeedback(ctx context.Context, request shared. return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -586,39 +648,65 @@ func (s *workspace) UpdateWorkspaceFeedback(ctx context.Context, request shared. if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateWorkspaceFeedbackResponse{ + res := &operations.UpdateWorkspaceNameResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 204: + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.WorkspaceRead + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.WorkspaceRead = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.NotFoundKnownExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(contentType, `application/json`): + var out shared.InvalidInputExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.InvalidInputExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } return res, nil } -// UpdateWorkspaceName - Update workspace name -func (s *workspace) UpdateWorkspaceName(ctx context.Context, request shared.WorkspaceUpdateName) (*operations.UpdateWorkspaceNameResponse, error) { +// UpdateWorkspaceFeedback - Update workspace feedback state +func (s *Workspace) UpdateWorkspaceFeedback(ctx context.Context, request shared.WorkspaceGiveFeedback) (*operations.UpdateWorkspaceFeedbackResponse, error) { baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/update_name" + url := strings.TrimSuffix(baseURL, "/") + "/v1/workspaces/tag_feedback_status_as_done" - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, "Request", "json") + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "json", `request:"mediaType=application/json"`) if err != nil { return nil, fmt.Errorf("error serializing request body: %w", err) } @@ -626,12 +714,15 @@ func (s *workspace) UpdateWorkspaceName(ctx context.Context, request shared.Work return nil, fmt.Errorf("request body is required") } - req, err := http.NewRequestWithContext(ctx, "POST", url, bodyReader) + debugBody := bytes.NewBuffer([]byte{}) + debugReader := io.TeeReader(bodyReader, debugBody) + + req, err := http.NewRequestWithContext(ctx, "POST", url, debugReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") - req.Header.Set("user-agent", fmt.Sprintf("speakeasy-sdk/%s %s %s %s", s.sdkConfiguration.Language, s.sdkConfiguration.SDKVersion, s.sdkConfiguration.GenVersion, s.sdkConfiguration.OpenAPIDocVersion)) + req.Header.Set("user-agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) @@ -649,46 +740,30 @@ func (s *workspace) UpdateWorkspaceName(ctx context.Context, request shared.Work if err != nil { return nil, fmt.Errorf("error reading response body: %w", err) } + httpRes.Request.Body = io.NopCloser(debugBody) httpRes.Body.Close() httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) contentType := httpRes.Header.Get("Content-Type") - res := &operations.UpdateWorkspaceNameResponse{ + res := &operations.UpdateWorkspaceFeedbackResponse{ StatusCode: httpRes.StatusCode, ContentType: contentType, RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.WorkspaceRead - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.WorkspaceRead = out - } + case httpRes.StatusCode == 204: case httpRes.StatusCode == 404: switch { case utils.MatchContentType(contentType, `application/json`): - var out *shared.NotFoundKnownExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { - return nil, err - } - - res.NotFoundKnownExceptionInfo = out - } - case httpRes.StatusCode == 422: - switch { - case utils.MatchContentType(contentType, `application/json`): - var out *shared.InvalidInputExceptionInfo - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out); err != nil { + var out shared.NotFoundKnownExceptionInfo + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.InvalidInputExceptionInfo = out + res.NotFoundKnownExceptionInfo = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/validators/DateValidator.go b/internal/validators/DateValidator.go old mode 100755 new mode 100644 index bc102fc..a0829cc --- a/internal/validators/DateValidator.go +++ b/internal/validators/DateValidator.go @@ -3,8 +3,8 @@ package validators import ( - "airbyte/internal/sdk/pkg/types" "context" + "github.com/aballiet/terraform-provider-airbyte/internal/sdk/pkg/types" "github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag" "github.com/hashicorp/terraform-plugin-framework/schema/validator" ) diff --git a/internal/validators/ExactlyOneChild.go b/internal/validators/ExactlyOneChild.go old mode 100755 new mode 100644 index 839ef01..5741558 --- a/internal/validators/ExactlyOneChild.go +++ b/internal/validators/ExactlyOneChild.go @@ -15,6 +15,10 @@ type exactlyOneChild struct { } func (validator exactlyOneChild) ValidateObject(ctx context.Context, req validator.ObjectRequest, resp *validator.ObjectResponse) { + // Only validate the attribute configuration value if it is known. + if req.ConfigValue.IsNull() || req.ConfigValue.IsUnknown() { + return + } defined := make(map[string]bool) count := 0 for key, attr := range req.ConfigValue.Attributes() { diff --git a/internal/validators/JSONParseValidator.go b/internal/validators/JSONParseValidator.go old mode 100755 new mode 100644 diff --git a/internal/validators/RFC3339Validator.go b/internal/validators/RFC3339Validator.go old mode 100755 new mode 100644 index 42c90dc..ad3d715 --- a/internal/validators/RFC3339Validator.go +++ b/internal/validators/RFC3339Validator.go @@ -4,15 +4,15 @@ package validators import ( "context" + "time" + "github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag" "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "time" ) var _ validator.String = RFC3339TimeValidator{} -type RFC3339TimeValidator struct { -} +type RFC3339TimeValidator struct{} func (validator RFC3339TimeValidator) Description(ctx context.Context) string { return "value must be a string in RFC3339 format" @@ -28,7 +28,7 @@ func (validator RFC3339TimeValidator) ValidateString(ctx context.Context, req va return } - if _, err := time.Parse(time.RFC3339, req.ConfigValue.ValueString()); err != nil { + if _, err := time.Parse(time.RFC3339Nano, req.ConfigValue.ValueString()); err != nil { resp.Diagnostics.Append(validatordiag.InvalidAttributeTypeDiagnostic( req.Path, validator.MarkdownDescription(ctx), @@ -42,7 +42,7 @@ func (validator RFC3339TimeValidator) ValidateString(ctx context.Context, req va // attribute value: // // - Is a String. -// - Is in RFC3339 Format. +// - Is in RFC3339Nano Format. // // Null (unconfigured) and unknown (known after apply) values are skipped. func IsRFC3339() validator.String { diff --git a/main.go b/main.go old mode 100755 new mode 100644 index 9f0fff8..c3a933c --- a/main.go +++ b/main.go @@ -7,15 +7,11 @@ import ( "flag" "log" - "airbyte/internal/provider" + "github.com/aballiet/terraform-provider-airbyte/internal/provider" "github.com/hashicorp/terraform-plugin-framework/providerserver" ) -// 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 "go generate" to generate the docs for the registry/website on each regeneration of the provider. // Run the docs generation tool, check its repository for more information on how it works and how docs // can be customized. diff --git a/terraform-registry-manifest.json b/terraform-registry-manifest.json old mode 100755 new mode 100644 diff --git a/tools/tools.go b/tools/tools.go old mode 100755 new mode 100644