parent
d1e12fcf64
commit
24b7387db9
140 changed files with 1597 additions and 7 deletions
|
|
@ -136,6 +136,8 @@ func (s *scfOrganizationDataSource) Read(ctx context.Context, request datasource
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Extract the project ID and instance id of the model
|
||||
projectId := model.ProjectId.ValueString()
|
||||
orgId := model.OrgId.ValueString()
|
||||
|
|
@ -163,6 +165,8 @@ func (s *scfOrganizationDataSource) Read(ctx context.Context, request datasource
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
err = mapFields(scfOrgResponse, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &response.Diagnostics, "Error reading scf organization", fmt.Sprintf("Processing API response: %v", err))
|
||||
|
|
|
|||
|
|
@ -232,6 +232,8 @@ func (s *scfOrganizationResource) Create(ctx context.Context, request resource.C
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Set logging context with the project ID and instance ID.
|
||||
region := model.Region.ValueString()
|
||||
projectId := model.ProjectId.ValueString()
|
||||
|
|
@ -255,6 +257,9 @@ func (s *scfOrganizationResource) Create(ctx context.Context, request resource.C
|
|||
core.LogAndAddError(ctx, &response.Diagnostics, "Error creating scf organization", fmt.Sprintf("Calling API to create org: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
orgId := *scfOrgCreateResponse.Guid
|
||||
|
||||
// Apply the org quota if provided
|
||||
|
|
@ -314,6 +319,8 @@ func (s *scfOrganizationResource) Read(ctx context.Context, request resource.Rea
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Extract the project ID and instance id of the model
|
||||
projectId := model.ProjectId.ValueString()
|
||||
orgId := model.OrgId.ValueString()
|
||||
|
|
@ -335,6 +342,8 @@ func (s *scfOrganizationResource) Read(ctx context.Context, request resource.Rea
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
err = mapFields(scfOrgResponse, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &response.Diagnostics, "Error reading scf organization", fmt.Sprintf("Processing API response: %v", err))
|
||||
|
|
@ -356,6 +365,9 @@ func (s *scfOrganizationResource) Update(ctx context.Context, request resource.U
|
|||
if response.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
region := model.Region.ValueString()
|
||||
projectId := model.ProjectId.ValueString()
|
||||
orgId := model.OrgId.ValueString()
|
||||
|
|
@ -385,6 +397,8 @@ func (s *scfOrganizationResource) Update(ctx context.Context, request resource.U
|
|||
return
|
||||
}
|
||||
org = updatedOrg
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
}
|
||||
|
||||
// handle a quota change of the org
|
||||
|
|
@ -424,6 +438,8 @@ func (s *scfOrganizationResource) Delete(ctx context.Context, request resource.D
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
orgId := model.OrgId.ValueString()
|
||||
|
||||
|
|
@ -441,6 +457,8 @@ func (s *scfOrganizationResource) Delete(ctx context.Context, request resource.D
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
_, err = wait.DeleteOrganizationWaitHandler(ctx, s.client, projectId, model.Region.ValueString(), orgId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &response.Diagnostics, "Error waiting for scf org deletion", fmt.Sprintf("SCFOrganization deleting waiting: %v", err))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue