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))
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ func (s *scfOrganizationManagerDataSource) Read(ctx context.Context, request dat
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Extract the project ID and instance id of the model
|
||||
projectId := model.ProjectId.ValueString()
|
||||
orgId := model.OrgId.ValueString()
|
||||
|
|
@ -166,6 +168,8 @@ func (s *scfOrganizationManagerDataSource) Read(ctx context.Context, request dat
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
err = mapFieldsDataSource(ScfOrgManager, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &response.Diagnostics, "Error reading scf organization manager", fmt.Sprintf("Processing API response: %v", err))
|
||||
|
|
|
|||
|
|
@ -214,6 +214,8 @@ func (s *scfOrganizationManagerResource) Create(ctx context.Context, request res
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Set logging context with the project ID and username.
|
||||
projectId := model.ProjectId.ValueString()
|
||||
orgId := model.OrgId.ValueString()
|
||||
|
|
@ -235,6 +237,8 @@ func (s *scfOrganizationManagerResource) Create(ctx context.Context, request res
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
err = mapFieldsCreate(scfOrgManagerCreateResponse, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &response.Diagnostics, "Error creating scf organization manager", fmt.Sprintf("Mapping fields: %v", err))
|
||||
|
|
@ -259,6 +263,8 @@ func (s *scfOrganizationManagerResource) Read(ctx context.Context, request resou
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Extract the project ID, region and org id of the model
|
||||
projectId := model.ProjectId.ValueString()
|
||||
orgId := model.OrgId.ValueString()
|
||||
|
|
@ -281,6 +287,8 @@ func (s *scfOrganizationManagerResource) Read(ctx context.Context, request resou
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
err = mapFieldsRead(scfOrgManager, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &response.Diagnostics, "Error reading scf organization manager", fmt.Sprintf("Processing API response: %v", err))
|
||||
|
|
@ -307,6 +315,8 @@ func (s *scfOrganizationManagerResource) Delete(ctx context.Context, request res
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
projectId := model.ProjectId.ValueString()
|
||||
orgId := model.OrgId.ValueString()
|
||||
region := model.Region.ValueString()
|
||||
|
|
@ -326,6 +336,9 @@ func (s *scfOrganizationManagerResource) Delete(ctx context.Context, request res
|
|||
core.LogAndAddError(ctx, &response.Diagnostics, "Error deleting scf organization manager", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
tflog.Info(ctx, "Scf organization manager deleted")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ func (s *scfPlatformDataSource) Read(ctx context.Context, request datasource.Rea
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.InitProviderContext(ctx)
|
||||
|
||||
// Extract the project ID region and platform id of the model
|
||||
projectId := model.ProjectId.ValueString()
|
||||
platformId := model.PlatformId.ValueString()
|
||||
|
|
@ -161,6 +163,8 @@ func (s *scfPlatformDataSource) Read(ctx context.Context, request datasource.Rea
|
|||
return
|
||||
}
|
||||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
err = mapFields(scfPlatformResponse, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &response.Diagnostics, "Error reading scf platform", fmt.Sprintf("Processing API response: %v", err))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue