parent
d1e12fcf64
commit
24b7387db9
140 changed files with 1597 additions and 7 deletions
|
|
@ -221,6 +221,9 @@ func (r *scheduleResource) Create(ctx context.Context, req resource.CreateReques
|
|||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
serverId := model.ServerId.ValueString()
|
||||
region := model.Region.ValueString()
|
||||
|
|
@ -246,6 +249,9 @@ func (r *scheduleResource) Create(ctx context.Context, req resource.CreateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating server update schedule", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
ctx = tflog.SetField(ctx, "update_schedule_id", *scheduleResp.Id)
|
||||
|
||||
// Map response body to schema
|
||||
|
|
@ -270,6 +276,9 @@ func (r *scheduleResource) Read(ctx context.Context, req resource.ReadRequest, r
|
|||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
serverId := model.ServerId.ValueString()
|
||||
updateScheduleId := model.UpdateScheduleId.ValueInt64()
|
||||
|
|
@ -290,6 +299,8 @@ func (r *scheduleResource) Read(ctx context.Context, req resource.ReadRequest, r
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(scheduleResp, &model, region)
|
||||
if err != nil {
|
||||
|
|
@ -314,6 +325,9 @@ func (r *scheduleResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
serverId := model.ServerId.ValueString()
|
||||
updateScheduleId := model.UpdateScheduleId.ValueInt64()
|
||||
|
|
@ -336,6 +350,8 @@ func (r *scheduleResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(scheduleResp, &model, region)
|
||||
if err != nil {
|
||||
|
|
@ -358,6 +374,9 @@ func (r *scheduleResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
serverId := model.ServerId.ValueString()
|
||||
updateScheduleId := model.UpdateScheduleId.ValueInt64()
|
||||
|
|
@ -372,6 +391,9 @@ func (r *scheduleResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting server update schedule", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
tflog.Info(ctx, "Server update schedule deleted.")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,9 @@ func (r *scheduleDataSource) Read(ctx context.Context, req datasource.ReadReques
|
|||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
serverId := model.ServerId.ValueString()
|
||||
updateScheduleId := model.UpdateScheduleId.ValueInt64()
|
||||
|
|
@ -160,6 +163,8 @@ func (r *scheduleDataSource) Read(ctx context.Context, req datasource.ReadReques
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(scheduleResp, &model, region)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -158,6 +158,9 @@ func (r *schedulesDataSource) Read(ctx context.Context, req datasource.ReadReque
|
|||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
serverId := model.ServerId.ValueString()
|
||||
region := r.providerData.GetRegionWithOverride(model.Region)
|
||||
|
|
@ -180,6 +183,8 @@ func (r *schedulesDataSource) Read(ctx context.Context, req datasource.ReadReque
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
// Map response body to schema
|
||||
err = mapSchedulesDatasourceFields(ctx, schedules, &model, region)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue