parent
d1e12fcf64
commit
24b7387db9
140 changed files with 1597 additions and 7 deletions
|
|
@ -132,6 +132,8 @@ func (g *gitDataSource) Read(ctx context.Context, req datasource.ReadRequest, re
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Extract the project ID and instance id of the model
|
||||
projectId := model.ProjectId.ValueString()
|
||||
instanceId := model.InstanceId.ValueString()
|
||||
|
|
@ -149,6 +151,8 @@ func (g *gitDataSource) Read(ctx context.Context, req datasource.ReadRequest, re
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
err = mapFields(ctx, gitInstanceResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading git instance", fmt.Sprintf("Processing API response: %v", err))
|
||||
|
|
|
|||
|
|
@ -195,6 +195,8 @@ func (g *gitResource) Create(ctx context.Context, req resource.CreateRequest, re
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Set logging context with the project ID and instance ID.
|
||||
projectId := model.ProjectId.ValueString()
|
||||
instanceName := model.Name.ValueString()
|
||||
|
|
@ -216,6 +218,8 @@ func (g *gitResource) Create(ctx context.Context, req resource.CreateRequest, re
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
gitInstanceId := *gitInstanceResp.Id
|
||||
_, err = wait.CreateGitInstanceWaitHandler(ctx, g.client, projectId, gitInstanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
|
|
@ -248,6 +252,8 @@ func (g *gitResource) Read(ctx context.Context, req resource.ReadRequest, resp *
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Extract the project ID and instance id of the model
|
||||
projectId := model.ProjectId.ValueString()
|
||||
instanceId := model.InstanceId.ValueString()
|
||||
|
|
@ -265,6 +271,8 @@ func (g *gitResource) Read(ctx context.Context, req resource.ReadRequest, resp *
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
err = mapFields(ctx, gitInstanceResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading git instance", fmt.Sprintf("Processing API response: %v", err))
|
||||
|
|
@ -298,6 +306,8 @@ func (g *gitResource) Delete(ctx context.Context, req resource.DeleteRequest, re
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
instanceId := model.InstanceId.ValueString()
|
||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||
|
|
@ -310,6 +320,8 @@ func (g *gitResource) Delete(ctx context.Context, req resource.DeleteRequest, re
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
_, err = wait.DeleteGitInstanceWaitHandler(ctx, g.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error waiting for instance deletion", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue