Skip to content

Commit

Permalink
fix: remove deprecated schedule field
Browse files Browse the repository at this point in the history
  • Loading branch information
aballiet committed Nov 17, 2023
1 parent 2cb40aa commit 6f36487
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 129 deletions.
24 changes: 10 additions & 14 deletions examples/resources/airbyte_connection/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,19 @@ resource "airbyte_connection" "my_connection" {
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
time_unit = "minutes"
units = 9
}
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"
source_catalog_id = "aa5e6b8d-d995-4b85-b38d-b9804e4cb5e1"
source_id = "451ef85f-dd64-4863-9632-1f097ee8d406"
status = "inactive"
sync_catalog = {
streams = [
Expand All @@ -43,7 +39,7 @@ resource "airbyte_connection" "my_connection" {
cursor_field = [
"...",
]
destination_sync_mode = "append_dedup"
destination_sync_mode = "overwrite"
field_selection_enabled = true
primary_key = [
[
Expand All @@ -58,20 +54,20 @@ resource "airbyte_connection" "my_connection" {
]
},
]
suggested = false
suggested = true
sync_mode = "incremental"
}
stream = {
default_cursor_field = [
"...",
]
json_schema = {
"East" = "{ \"see\": \"documentation\" }"
"Avon" = "{ \"see\": \"documentation\" }"
"Sausages" = "{ \"see\": \"documentation\" }"
"East" = "{ \"see\": \"documentation\" }"
}
name = "Rick Hammes"
name = "Mildred Lueilwitz"
namespace = "...my_namespace..."
source_defined_cursor = true
source_defined_cursor = false
source_defined_primary_key = [
[
"...",
Expand Down
6 changes: 3 additions & 3 deletions examples/resources/airbyte_source/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "airbyte_source" "my_source" {
connection_configuration = { "user" : "charles" }
name = "Brett Cassin"
name = "Ervin Renner DVM"
secret_id = "airbyte_oauth_workspace_0509f049-d671-48cb-8105-0a23d47e6db6_secret_e0d38206-034e-4d75-9d21-da5a99b02826_v1"
source_definition_id = "5525dbfb-0168-4610-8133-587515722b62"
workspace_id = "5efa1bbf-a8d6-445f-b19d-133279f15ad8"
source_definition_id = "95525dbf-b016-4861-8013-3587515722b6"
workspace_id = "25efa1bb-fa8d-4645-b719-d133279f15ad"
}
12 changes: 6 additions & 6 deletions examples/resources/airbyte_source_definition/resource.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
resource "airbyte_source_definition" "my_sourcedefinition" {
scope_id = "bb3fe33f-ac92-456c-b878-498930f77eda"
scope_type = "workspace"
scope_id = "8bb3fe33-fac9-4256-8f87-8498930f77ed"
scope_type = "organization"
source_definition = {
name = "Cathy Gislason"
name = "Holly Hane"
docker_repository = "...my_docker_repository..."
docker_image_tag = "...my_docker_image_tag..."
documentation_url = "https://frivolous-limit.org"
documentation_url = "http://moist-escalator.name"
icon = "...my_icon..."
resource_requirements = {
default = {
Expand All @@ -16,7 +16,7 @@ resource "airbyte_source_definition" "my_sourcedefinition" {
}
job_specific = [
{
job_type = "connection_updater"
job_type = "replicate"
resource_requirements = {
cpu_request = "...my_cpu_request..."
cpu_limit = "...my_cpu_limit..."
Expand All @@ -27,5 +27,5 @@ resource "airbyte_source_definition" "my_sourcedefinition" {
]
}
}
workspace_id = "3535457d-2442-468f-b977-c6f814b5f1dc"
workspace_id = "c3535457-d244-4268-bf97-7c6f814b5f1d"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ resource "airbyte_source_definition_manifest" "my_sourcedefinitionmanifest" {
description = "...my_description..."
manifest = {}
spec = {}
version = 2
version = 8
}
set_as_active_manifest = true
source_definition_id = "6d3e6067-c0fa-4a27-a057-1d07b12f607a"
workspace_id = "ea75f355-b45b-4ce4-9de0-c2038bc3c121"
source_definition_id = "06d3e606-7c0f-4aa2-be05-71d07b12f607"
workspace_id = "aea75f35-5b45-4bce-85de-0c2038bc3c12"
}
22 changes: 11 additions & 11 deletions examples/resources/airbyte_workspace/resource.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
resource "airbyte_workspace" "my_workspace" {
anonymous_data_collection = true
default_geography = "auto"
anonymous_data_collection = false
default_geography = "us"
display_setup_wizard = false
email = "Kristofer41@hotmail.com"
name = "Mr. Cheryl Powlowski"
email = "Ole0@hotmail.com"
name = "Jill Carroll Jr."
news = false
notifications = [
{
customerio_configuration = {}
notification_type = "customerio"
send_on_failure = false
send_on_success = true
send_on_failure = true
send_on_success = false
slack_configuration = {
webhook = "...my_webhook..."
}
Expand All @@ -20,7 +20,7 @@ resource "airbyte_workspace" "my_workspace" {
send_on_breaking_change_syncs_disabled = {
customerio_configuration = {}
notification_type = [
"customerio",
"slack",
]
slack_configuration = {
webhook = "...my_webhook..."
Expand All @@ -47,7 +47,7 @@ resource "airbyte_workspace" "my_workspace" {
send_on_connection_update_action_required = {
customerio_configuration = {}
notification_type = [
"slack",
"customerio",
]
slack_configuration = {
webhook = "...my_webhook..."
Expand Down Expand Up @@ -90,13 +90,13 @@ resource "airbyte_workspace" "my_workspace" {
}
}
}
organization_id = "1ccc7d20-b17e-4ae1-9d9c-435027c42c7c"
organization_id = "61ccc7d2-0b17-4eae-9dd9-c435027c42c7"
security_updates = false
webhook_configs = [
{
auth_token = "...my_auth_token..."
id = "80631914-6c84-4086-bd9d-1434d4688b60"
name = "Norma Bogisich"
id = "d8063191-46c8-4408-a3d9-d1434d4688b6"
name = "Dr. Theresa Dibbert"
validation_url = "...my_validation_url..."
},
]
Expand Down
4 changes: 2 additions & 2 deletions files.gen
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ 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
Expand All @@ -463,6 +462,7 @@ internal/sdk/pkg/models/shared/actordefinitionrequestbody.go
internal/sdk/pkg/models/shared/connectionautopropagateresult.go
internal/sdk/pkg/models/shared/connectionautopropagateschemachange.go
internal/sdk/pkg/models/shared/connectionsearch.go
internal/sdk/pkg/models/shared/connectionschedule.go
internal/sdk/pkg/models/shared/connectionstreamrequestbody.go
internal/sdk/pkg/models/shared/connectionstream.go
internal/sdk/pkg/models/shared/knownexceptioninfo.go
Expand Down Expand Up @@ -563,7 +563,7 @@ internal/sdk/pkg/models/shared/organizationreadlist.go
internal/sdk/pkg/models/shared/listorganizationsbyuserrequestbody.go
internal/sdk/pkg/models/shared/security.go
internal/provider/type_resource_requirements.go
internal/provider/type_connection_schedule.go
internal/provider/type_basic_schedule.go
internal/provider/type_cron.go
internal/provider/type_connection_schedule_data.go
internal/provider/type_selected_field_info.go
Expand Down
24 changes: 0 additions & 24 deletions internal/provider/connection_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type ConnectionResourceModel struct {
OperationIds []types.String `tfsdk:"operation_ids"`
Prefix types.String `tfsdk:"prefix"`
ResourceRequirements *ResourceRequirements `tfsdk:"resource_requirements"`
Schedule *ConnectionSchedule `tfsdk:"schedule"`
ScheduleData *ConnectionScheduleData `tfsdk:"schedule_data"`
ScheduleType types.String `tfsdk:"schedule_type"`
SourceCatalogID types.String `tfsdk:"source_catalog_id"`
Expand Down Expand Up @@ -169,29 +168,6 @@ func (r *ConnectionResource) Schema(ctx context.Context, req resource.SchemaRequ
},
Description: `optional resource requirements to run workers (blank for unbounded allocations)`,
},
"schedule": schema.SingleNestedAttribute{
Computed: true,
Optional: true,
Attributes: map[string]schema.Attribute{
"time_unit": schema.StringAttribute{
Required: true,
Description: `must be one of ["minutes", "hours", "days", "weeks", "months"]`,
Validators: []validator.String{
stringvalidator.OneOf(
"minutes",
"hours",
"days",
"weeks",
"months",
),
},
},
"units": schema.Int64Attribute{
Required: true,
},
},
Description: `if null, then no schedule is set.`,
},
"schedule_data": schema.SingleNestedAttribute{
Computed: true,
Optional: true,
Expand Down
45 changes: 9 additions & 36 deletions internal/provider/connection_resource_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,6 @@ func (r *ConnectionResourceModel) ToCreateSDKType() *shared.ConnectionCreate {
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())
Expand All @@ -180,11 +171,11 @@ func (r *ConnectionResourceModel) ToCreateSDKType() *shared.ConnectionCreate {
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()
timeUnit := shared.ConnectionScheduleDataTimeUnit(r.ScheduleData.BasicSchedule.TimeUnit.ValueString())
units := r.ScheduleData.BasicSchedule.Units.ValueInt64()
basicSchedule = &shared.BasicSchedule{
TimeUnit: timeUnit1,
Units: units1,
TimeUnit: timeUnit,
Units: units,
}
}
var cron *shared.Cron
Expand Down Expand Up @@ -274,7 +265,6 @@ func (r *ConnectionResourceModel) ToCreateSDKType() *shared.ConnectionCreate {
DestinationID: destinationID,
OperationIds: operationIds,
SyncCatalog: syncCatalog,
Schedule: schedule,
ScheduleType: scheduleType,
ScheduleData: scheduleData,
Status: status,
Expand Down Expand Up @@ -440,15 +430,6 @@ func (r *ConnectionResourceModel) ToUpdateSDKType() *shared.ConnectionUpdate {
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())
Expand All @@ -459,11 +440,11 @@ func (r *ConnectionResourceModel) ToUpdateSDKType() *shared.ConnectionUpdate {
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()
timeUnit := shared.ConnectionScheduleDataTimeUnit(r.ScheduleData.BasicSchedule.TimeUnit.ValueString())
units := r.ScheduleData.BasicSchedule.Units.ValueInt64()
basicSchedule = &shared.BasicSchedule{
TimeUnit: timeUnit1,
Units: units1,
TimeUnit: timeUnit,
Units: units,
}
}
var cron *shared.Cron
Expand Down Expand Up @@ -563,7 +544,6 @@ func (r *ConnectionResourceModel) ToUpdateSDKType() *shared.ConnectionUpdate {
Prefix: prefix,
OperationIds: operationIds,
SyncCatalog: syncCatalog,
Schedule: schedule,
ScheduleType: scheduleType,
ScheduleData: scheduleData,
Status: status,
Expand Down Expand Up @@ -652,21 +632,14 @@ func (r *ConnectionResourceModel) RefreshFromCreateResponse(resp *shared.Connect
r.ResourceRequirements.MemoryRequest = types.StringNull()
}
}
if resp.Schedule == nil {
r.Schedule = nil
} else {
r.Schedule = &ConnectionSchedule{}
r.Schedule.TimeUnit = types.StringValue(string(resp.Schedule.TimeUnit))
r.Schedule.Units = types.Int64Value(resp.Schedule.Units)
}
if resp.ScheduleData == nil {
r.ScheduleData = nil
} else {
r.ScheduleData = &ConnectionScheduleData{}
if resp.ScheduleData.BasicSchedule == nil {
r.ScheduleData.BasicSchedule = nil
} else {
r.ScheduleData.BasicSchedule = &ConnectionSchedule{}
r.ScheduleData.BasicSchedule = &BasicSchedule{}
r.ScheduleData.BasicSchedule.TimeUnit = types.StringValue(string(resp.ScheduleData.BasicSchedule.TimeUnit))
r.ScheduleData.BasicSchedule.Units = types.Int64Value(resp.ScheduleData.BasicSchedule.Units)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package provider

import "github.com/hashicorp/terraform-plugin-framework/types"

type ConnectionSchedule struct {
type BasicSchedule struct {
TimeUnit types.String `tfsdk:"time_unit"`
Units types.Int64 `tfsdk:"units"`
}
4 changes: 2 additions & 2 deletions internal/provider/type_connection_schedule_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
package provider

type ConnectionScheduleData struct {
BasicSchedule *ConnectionSchedule `tfsdk:"basic_schedule"`
Cron *Cron `tfsdk:"cron"`
BasicSchedule *BasicSchedule `tfsdk:"basic_schedule"`
Cron *Cron `tfsdk:"cron"`
}
9 changes: 0 additions & 9 deletions internal/sdk/pkg/models/shared/connectioncreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ type ConnectionCreate struct {
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
Expand Down Expand Up @@ -104,13 +102,6 @@ func (o *ConnectionCreate) GetSyncCatalog() *AirbyteCatalog {
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
Expand Down
Loading

0 comments on commit 6f36487

Please sign in to comment.