-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diag: Move (Diagnostics).ToTfprotov6Diagnostics() method to internal/…
- Loading branch information
Showing
8 changed files
with
157 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:breaking-change | ||
diag: Removed `Diagnostics` type `ToTfprotov6Diagnostics()` method. This was not intended for usage by provider developers. | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package toproto6 | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-framework/diag" | ||
"github.com/hashicorp/terraform-plugin-go/tfprotov6" | ||
) | ||
|
||
// Diagnostics converts the diagnostics into the tfprotov6 collection type. | ||
func Diagnostics(diagnostics diag.Diagnostics) []*tfprotov6.Diagnostic { | ||
var results []*tfprotov6.Diagnostic | ||
|
||
for _, diagnostic := range diagnostics { | ||
tfprotov6Diagnostic := &tfprotov6.Diagnostic{ | ||
Detail: diagnostic.Detail(), | ||
Severity: diagnostic.Severity().ToTfprotov6DiagnosticSeverity(), | ||
Summary: diagnostic.Summary(), | ||
} | ||
|
||
if diagWithPath, ok := diagnostic.(diag.DiagnosticWithPath); ok { | ||
tfprotov6Diagnostic.Attribute = diagWithPath.Path() | ||
} | ||
|
||
results = append(results, tfprotov6Diagnostic) | ||
} | ||
|
||
return results | ||
} |
Oops, something went wrong.