Skip to content

Commit

Permalink
fix: Remove ResourceGroupProps references
Browse files Browse the repository at this point in the history
  • Loading branch information
thekeys93 committed Oct 30, 2024
1 parent ceceb23 commit 561393f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 56 deletions.
11 changes: 0 additions & 11 deletions api/resource_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"fmt"
"time"

"github.com/lacework/go-sdk/lwtime"
"github.com/pkg/errors"
)

Expand All @@ -34,16 +33,6 @@ type ResourceGroupsService struct {
client *Client
}

type ResourceGroupProps interface {
GetBaseProps() ResourceGroupPropsBase
}

type ResourceGroupPropsBase struct {
Description string `json:"description"`
UpdatedBy string `json:"updatedBy,omitempty"`
LastUpdated *lwtime.Epoch `json:"lastUpdated,omitempty"`
}

type ResourceGroup interface {
ID() string
ResourceGroupType() resourceGroupType
Expand Down
17 changes: 0 additions & 17 deletions api/resource_groups_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,10 @@ type ResourceGroupDataWithQuery struct {
IsOrg *bool `json:"isOrg,omitempty"`
}

func (group ResourceGroupDataWithQuery) GetProps() interface{} {
return nil
}

func (group ResourceGroupDataWithQuery) GetQuery() *RGQuery {
return group.Query
}

func (group ResourceGroupDataWithQuery) ResourceGroupType() resourceGroupType {
t, _ := FindResourceGroupType(group.Type)
return t
}

func (group ResourceGroupDataWithQuery) ID() string {
return group.ResourceGroupGuid
}

func (group *ResourceGroupDataWithQuery) ResetResourceGUID() {
group.ResourceGroupGuid = ""
}

func (group ResourceGroupDataWithQuery) IsV2Group() bool {
return true
}
43 changes: 15 additions & 28 deletions cli/cmd/resource_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,12 @@ Then navigate to Settings > Resource Groups.

var groupCommon [][]string

if group.Props != nil {
groupCommon = append(groupCommon,
[]string{group.Id, group.ResType, group.Name, strconv.Itoa(group.Enabled),
strconv.FormatBool(group.IsDefaultBoolean)},
)
cli.OutputHuman(renderSimpleTable([]string{"RESOURCE GROUP GUID", "TYPE", "NAME", "ENABLED",
"IS_DEFAULT_BOOLEAN"},
groupCommon))
cli.OutputHuman("\n")
//cli.OutputHuman(buildResourceGroupPropsTable(group))
} else {
groupCommon = append(groupCommon,
[]string{group.Id, group.ResType, group.Name, group.Description, strconv.Itoa(group.Enabled),
strconv.FormatBool(group.IsDefaultBoolean), group.UpdatedBy, group.UpdatedTime.UTC().String()},
)
cli.OutputHuman(renderSimpleTable([]string{"RESOURCE GROUP ID", "TYPE", "NAME", "DESCRIPTION", "STATE",
"DEFAULT", "UPDATED BY", "UPDATED_TIME"}, groupCommon))
}
groupCommon = append(groupCommon,
[]string{group.Id, group.ResType, group.Name, group.Description, strconv.Itoa(group.Enabled),
strconv.FormatBool(group.IsDefaultBoolean), group.UpdatedBy, group.UpdatedTime.UTC().String()},
)
cli.OutputHuman(renderSimpleTable([]string{"RESOURCE GROUP ID", "TYPE", "NAME", "DESCRIPTION", "STATE",
"DEFAULT", "UPDATED BY", "UPDATED_TIME"}, groupCommon))

return nil
},
Expand Down Expand Up @@ -310,14 +298,13 @@ func IsDefault(isDefault int) string {
}

type resourceGroup struct {
Id string `json:"resource_guid"`
ResType string `json:"type"`
Name string `json:"name"`
Props api.ResourceGroupProps `json:"props"`
Enabled int `json:"enabled"`
IsDefaultBoolean bool `json:"isDefault"`
Query *api.RGQuery `json:"query"`
Description string `json:"description,omitempty"`
UpdatedTime *time.Time `json:"updatedTime,omitempty"`
UpdatedBy string `json:"updatedBy,omitempty"`
Id string `json:"resourceGroupGuid"`
ResType string `json:"type"`
Name string `json:"name"`
Enabled int `json:"enabled"`
IsDefaultBoolean bool `json:"isDefault"`
Query *api.RGQuery `json:"query"`
Description string `json:"description,omitempty"`
UpdatedTime *time.Time `json:"updatedTime,omitempty"`
UpdatedBy string `json:"updatedBy,omitempty"`
}

0 comments on commit 561393f

Please sign in to comment.