Skip to content

Commit 6f01414

Browse files
committed
Remove int64 to int32 conversion
1 parent e5d2b9c commit 6f01414

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

internal/resources/k6/data_source_k6_schedule.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ type scheduleDataSourceModel struct {
3636
LoadTestID types.String `tfsdk:"load_test_id"`
3737
Starts types.String `tfsdk:"starts"`
3838
Frequency types.String `tfsdk:"frequency"`
39-
Interval types.Int64 `tfsdk:"interval"`
40-
Occurrences types.Int64 `tfsdk:"occurrences"`
39+
Interval types.Int32 `tfsdk:"interval"`
40+
Occurrences types.Int32 `tfsdk:"occurrences"`
4141
Until types.String `tfsdk:"until"`
4242
Deactivated types.Bool `tfsdk:"deactivated"`
4343
NextRun types.String `tfsdk:"next_run"`
@@ -75,11 +75,11 @@ func (d *scheduleDataSource) Schema(_ context.Context, _ datasource.SchemaReques
7575
Description: "The frequency of the schedule (HOURLY, DAILY, WEEKLY, MONTHLY).",
7676
Computed: true,
7777
},
78-
"interval": schema.Int64Attribute{
78+
"interval": schema.Int32Attribute{
7979
Description: "The interval between each frequency iteration.",
8080
Computed: true,
8181
},
82-
"occurrences": schema.Int64Attribute{
82+
"occurrences": schema.Int32Attribute{
8383
Description: "How many times the recurrence will repeat.",
8484
Computed: true,
8585
},
@@ -167,15 +167,15 @@ func populateScheduleDataSourceModel(schedule *k6.ScheduleApiModel, model *sched
167167
model.Frequency = types.StringValue(string(recurrenceRule.GetFrequency()))
168168

169169
if interval, ok := recurrenceRule.GetIntervalOk(); ok && interval != nil {
170-
model.Interval = types.Int64Value(int64(*interval))
170+
model.Interval = types.Int32Value(*interval)
171171
} else {
172-
model.Interval = types.Int64Null()
172+
model.Interval = types.Int32Null()
173173
}
174174

175175
if count, ok := recurrenceRule.GetCountOk(); ok && count != nil {
176-
model.Occurrences = types.Int64Value(int64(*count))
176+
model.Occurrences = types.Int32Value(*count)
177177
} else {
178-
model.Occurrences = types.Int64Null()
178+
model.Occurrences = types.Int32Null()
179179
}
180180

181181
if until, ok := recurrenceRule.GetUntilOk(); ok && until != nil {

internal/resources/k6/data_source_k6_schedules.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ func (d *schedulesDataSource) Schema(_ context.Context, _ datasource.SchemaReque
6262
"load_test_id": types.StringType,
6363
"starts": types.StringType,
6464
"frequency": types.StringType,
65-
"interval": types.Int64Type,
66-
"occurrences": types.Int64Type,
65+
"interval": types.Int32Type,
66+
"occurrences": types.Int32Type,
6767
"until": types.StringType,
6868
"deactivated": types.BoolType,
6969
"next_run": types.StringType,

internal/resources/k6/resource_schedule.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ type scheduleResourceModel struct {
4545
LoadTestID types.String `tfsdk:"load_test_id"`
4646
Starts types.String `tfsdk:"starts"`
4747
Frequency types.String `tfsdk:"frequency"`
48-
Interval types.Int64 `tfsdk:"interval"`
49-
Occurrences types.Int64 `tfsdk:"occurrences"`
48+
Interval types.Int32 `tfsdk:"interval"`
49+
Occurrences types.Int32 `tfsdk:"occurrences"`
5050
Until types.String `tfsdk:"until"`
5151
Deactivated types.Bool `tfsdk:"deactivated"`
5252
NextRun types.String `tfsdk:"next_run"`
@@ -87,11 +87,11 @@ func (r *scheduleResource) Schema(_ context.Context, _ resource.SchemaRequest, r
8787
Description: "The frequency of the schedule (HOURLY, DAILY, WEEKLY, MONTHLY).",
8888
Required: true,
8989
},
90-
"interval": schema.Int64Attribute{
90+
"interval": schema.Int32Attribute{
9191
Description: "The interval between each frequency iteration (e.g., 2 = every 2 hours for HOURLY).",
9292
Optional: true,
9393
},
94-
"occurrences": schema.Int64Attribute{
94+
"occurrences": schema.Int32Attribute{
9595
Description: "How many times the recurrence will repeat.",
9696
Optional: true,
9797
},
@@ -173,11 +173,11 @@ func (r *scheduleResource) Create(ctx context.Context, req resource.CreateReques
173173
// Build recurrence rule
174174
recurrenceRule := k6.NewScheduleRecurrenceRule(*frequency)
175175
if !plan.Interval.IsNull() {
176-
interval := int32(plan.Interval.ValueInt64())
176+
interval := plan.Interval.ValueInt32()
177177
recurrenceRule.SetInterval(interval)
178178
}
179179
if !plan.Occurrences.IsNull() {
180-
count := int32(plan.Occurrences.ValueInt64())
180+
count := plan.Occurrences.ValueInt32()
181181
recurrenceRule.SetCount(count)
182182
}
183183
if !plan.Until.IsNull() {
@@ -320,11 +320,11 @@ func (r *scheduleResource) Update(ctx context.Context, req resource.UpdateReques
320320
// Build recurrence rule
321321
recurrenceRule := k6.NewScheduleRecurrenceRule(*frequency)
322322
if !plan.Interval.IsNull() {
323-
interval := int32(plan.Interval.ValueInt64())
323+
interval := plan.Interval.ValueInt32()
324324
recurrenceRule.SetInterval(interval)
325325
}
326326
if !plan.Occurrences.IsNull() {
327-
count := int32(plan.Occurrences.ValueInt64())
327+
count := plan.Occurrences.ValueInt32()
328328
recurrenceRule.SetCount(count)
329329
}
330330
if !plan.Until.IsNull() {
@@ -430,15 +430,15 @@ func (r *scheduleResource) populateModelFromAPI(schedule *k6.ScheduleApiModel, m
430430
model.Frequency = types.StringValue(string(recurrenceRule.GetFrequency()))
431431

432432
if interval, ok := recurrenceRule.GetIntervalOk(); ok && interval != nil {
433-
model.Interval = types.Int64Value(int64(*interval))
433+
model.Interval = types.Int32Value(*interval)
434434
} else {
435-
model.Interval = types.Int64Null()
435+
model.Interval = types.Int32Null()
436436
}
437437

438438
if count, ok := recurrenceRule.GetCountOk(); ok && count != nil {
439-
model.Occurrences = types.Int64Value(int64(*count))
439+
model.Occurrences = types.Int32Value(*count)
440440
} else {
441-
model.Occurrences = types.Int64Null()
441+
model.Occurrences = types.Int32Null()
442442
}
443443

444444
if until, ok := recurrenceRule.GetUntilOk(); ok && until != nil {

0 commit comments

Comments
 (0)