Skip to content

Commit

Permalink
Fix azuread_group to populate resource_behavior_options and resource_…
Browse files Browse the repository at this point in the history
…provisioning_options columns with improved data type handling. Closes #188 (#192)
  • Loading branch information
ParthaI authored Aug 6, 2024
1 parent df43245 commit 1182f6c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions azuread/table_azuread_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/iancoleman/strcase"

abstractions "github.com/microsoft/kiota-abstractions-go"
jsonserialization "github.com/microsoft/kiota-serialization-json-go"
msgraphcore "github.com/microsoftgraph/msgraph-sdk-go-core"
"github.com/microsoftgraph/msgraph-sdk-go/groups"
"github.com/microsoftgraph/msgraph-sdk-go/models"
Expand Down Expand Up @@ -429,13 +428,14 @@ func buildGroupBoolNEFilter(quals plugin.KeyColumnQualMap) []string {
func formatResourceBehaviorOptions(ctx context.Context, group models.Groupable) []string {
var resourceBehaviorOptions []string
data := group.GetAdditionalData()["resourceBehaviorOptions"]

if data != nil {
parsedData := group.GetAdditionalData()["resourceBehaviorOptions"].([]*jsonserialization.JsonParseNode)
parsedData := group.GetAdditionalData()["resourceBehaviorOptions"].([]interface{})

for _, r := range parsedData {
val, err := r.GetStringValue()
if err != nil {
plugin.Logger(ctx).Error("failed to parse resourceBehaviorOptions: %v", err)
val, ok := r.(*string)
if !ok {
plugin.Logger(ctx).Error("failed to parse resourceBehaviorOptions: %v", r)
val = nil
}

Expand All @@ -450,13 +450,14 @@ func formatResourceBehaviorOptions(ctx context.Context, group models.Groupable)
func formatResourceProvisioningOptions(ctx context.Context, group models.Groupable) []string {
var resourceProvisioningOptions []string
data := group.GetAdditionalData()["resourceProvisioningOptions"]

if data != nil {
parsedData := data.([]*jsonserialization.JsonParseNode)
parsedData := data.([]interface{})

for _, r := range parsedData {
val, err := r.GetStringValue()
if err != nil {
plugin.Logger(ctx).Error("failed to parse resourceProvisioningOptions: %v", err)
val, ok := r.(*string)
if !ok {
plugin.Logger(ctx).Error("failed to parse resourceProvisioningOptions: %v", r)
val = nil
}

Expand Down

0 comments on commit 1182f6c

Please sign in to comment.