parent
d1e12fcf64
commit
24b7387db9
140 changed files with 1597 additions and 7 deletions
|
|
@ -172,6 +172,9 @@ func (d *networkAreaDataSource) Read(ctx context.Context, req datasource.ReadReq
|
|||
}
|
||||
organizationId := model.OrganizationId.ValueString()
|
||||
networkAreaId := model.NetworkAreaId.ValueString()
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
ctx = tflog.SetField(ctx, "organization_id", organizationId)
|
||||
ctx = tflog.SetField(ctx, "network_area_id", networkAreaId)
|
||||
|
||||
|
|
@ -191,6 +194,8 @@ func (d *networkAreaDataSource) Read(ctx context.Context, req datasource.ReadReq
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
networkAreaRanges := networkAreaResp.Ipv4.NetworkRanges
|
||||
|
||||
err = mapFields(ctx, networkAreaResp, networkAreaRanges, &model)
|
||||
|
|
|
|||
|
|
@ -240,6 +240,9 @@ func (r *networkAreaResource) Create(ctx context.Context, req resource.CreateReq
|
|||
}
|
||||
|
||||
organizationId := model.OrganizationId.ValueString()
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
ctx = tflog.SetField(ctx, "organization_id", organizationId)
|
||||
|
||||
// Generate API request body from model
|
||||
|
|
@ -256,6 +259,8 @@ func (r *networkAreaResource) Create(ctx context.Context, req resource.CreateReq
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
networkArea, err := wait.CreateNetworkAreaWaitHandler(ctx, r.client, organizationId, *area.AreaId).WaitWithContext(context.Background())
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating network area", fmt.Sprintf("Network area creation waiting: %v", err))
|
||||
|
|
@ -291,6 +296,9 @@ func (r *networkAreaResource) Read(ctx context.Context, req resource.ReadRequest
|
|||
}
|
||||
organizationId := model.OrganizationId.ValueString()
|
||||
networkAreaId := model.NetworkAreaId.ValueString()
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
ctx = tflog.SetField(ctx, "organization_id", organizationId)
|
||||
ctx = tflog.SetField(ctx, "network_area_id", networkAreaId)
|
||||
|
||||
|
|
@ -305,6 +313,8 @@ func (r *networkAreaResource) Read(ctx context.Context, req resource.ReadRequest
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
networkAreaRanges := networkAreaResp.Ipv4.NetworkRanges
|
||||
|
||||
// Map response body to schema
|
||||
|
|
@ -333,6 +343,9 @@ func (r *networkAreaResource) Update(ctx context.Context, req resource.UpdateReq
|
|||
}
|
||||
organizationId := model.OrganizationId.ValueString()
|
||||
networkAreaId := model.NetworkAreaId.ValueString()
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
ctx = tflog.SetField(ctx, "organization_id", organizationId)
|
||||
ctx = tflog.SetField(ctx, "network_area_id", networkAreaId)
|
||||
|
||||
|
|
@ -365,6 +378,9 @@ func (r *networkAreaResource) Update(ctx context.Context, req resource.UpdateReq
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating network area", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
waitResp, err := wait.UpdateNetworkAreaWaitHandler(ctx, r.client, organizationId, networkAreaId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating network area", fmt.Sprintf("Network area update waiting: %v", err))
|
||||
|
|
@ -416,6 +432,9 @@ func (r *networkAreaResource) Delete(ctx context.Context, req resource.DeleteReq
|
|||
|
||||
organizationId := model.OrganizationId.ValueString()
|
||||
networkAreaId := model.NetworkAreaId.ValueString()
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
ctx = tflog.SetField(ctx, "organization_id", organizationId)
|
||||
ctx = tflog.SetField(ctx, "network_area_id", networkAreaId)
|
||||
|
||||
|
|
@ -431,6 +450,9 @@ func (r *networkAreaResource) Delete(ctx context.Context, req resource.DeleteReq
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting network area", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
_, err = wait.DeleteNetworkAreaWaitHandler(ctx, r.client, organizationId, networkAreaId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting network area", fmt.Sprintf("Network area deletion waiting: %v", err))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue