Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ArshiaBP committed Dec 6, 2024
2 parents 2e0d98a + 6c29511 commit 3cdf0bf
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 210 deletions.
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ toolchain go1.22.5
require (
github.com/go-errors/errors v1.4.2
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.6.0
github.com/hashicorp/go-hclog v1.6.3
github.com/iancoleman/strcase v0.3.0
github.com/mitchellh/go-homedir v1.1.0
github.com/nats-io/nats.go v1.36.0
github.com/opengovern/og-util v1.1.5
github.com/opengovern/og-util v1.1.9
github.com/spf13/cobra v1.7.0
github.com/turbot/steampipe-plugin-sdk/v5 v5.8.0
go.uber.org/zap v1.26.0
Expand Down Expand Up @@ -49,7 +52,7 @@ require (
github.com/ghodss/yaml v1.0.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/labstack/echo/v4 v4.12.0 // indirect
github.com/turbot/go-kit v0.9.0 // indirect
github.com/turbot/go-kit v0.9.0
golang.org/x/time v0.8.0
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/genproto v0.0.0-20241113202542-65e8d215514f // indirect
Expand Down Expand Up @@ -94,7 +97,6 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.14.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect
Expand All @@ -115,7 +117,6 @@ require (
github.com/hashicorp/vault/api v1.14.0 // indirect
github.com/hashicorp/vault/api/auth/kubernetes v0.7.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.3 // indirect
Expand All @@ -137,7 +138,6 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand Down
90 changes: 6 additions & 84 deletions go.sum

Large diffs are not rendered by default.

160 changes: 80 additions & 80 deletions pkg/sdk/es/resources_clients.go

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions pkg/sdk/runable/steampipe_es_client_generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (
pluginPath = flag.String("pluginPath", "", "Location of the steampipe plugin")
)

const PluginPath = "C:\\Users\\ASUS\\GolandProjects\\og-describer-googleworkspace\\steampipe-plugin-googleworkspace\\googleworkspace"
const PluginPath = "../../../../steampipe-plugin-googleworkspace/googleworkspace" // TODO: change to steampipe plugin

type IntegrationType struct {
Name string
Expand All @@ -43,11 +43,11 @@ type ResourceType struct {

func main() {
if output == nil || len(*output) == 0 {
v := "C:\\Users\\ASUS\\GolandProjects\\og-describer-googleworkspace\\pkg\\sdk\\es\\resources_clients.go"
v := "../../es/resources_clients.go"
output = &v
}
if file == nil || len(*file) == 0 {
v := "C:\\Users\\ASUS\\GolandProjects\\og-describer-googleworkspace\\provider\\model\\model.go"
v := "../../../../provider/model/model.go"
file = &v
}

Expand All @@ -57,7 +57,7 @@ func main() {
}

if resourceTypesFile == nil || len(*resourceTypesFile) == 0 {
rt := "C:\\Users\\ASUS\\GolandProjects\\og-describer-googleworkspace\\provider\\resource_types\\resource-types.json"
rt := "../../../../provider/resource_types/resource-types.json"
resourceTypesFile = &rt
}

Expand Down Expand Up @@ -179,9 +179,9 @@ func List{{ .Name }}(ctx context.Context, d *plugin.QueryData, _ *plugin.Hydrate
plugin.Logger(ctx).Error("List{{ .Name }} NewSelfClientCached", "error", err)
return nil, err
}
accountId, err := sc.GetConfigTableValueOrNil(ctx, steampipesdk.OpenGovernanceConfigKeyAccountID)
integrationID, err := sc.GetConfigTableValueOrNil(ctx, steampipesdk.OpenGovernanceConfigKeyIntegrationID)
if err != nil {
plugin.Logger(ctx).Error("List{{ .Name }} GetConfigTableValueOrNil for OpenGovernanceConfigKeyAccountID", "error", err)
plugin.Logger(ctx).Error("List{{ .Name }} GetConfigTableValueOrNil for OpenGovernanceConfigKeyIntegrationID", "error", err)
return nil, err
}
encodedResourceCollectionFilters, err := sc.GetConfigTableValueOrNil(ctx, steampipesdk.OpenGovernanceConfigKeyResourceCollectionFilters)
Expand All @@ -195,7 +195,7 @@ func List{{ .Name }}(ctx context.Context, d *plugin.QueryData, _ *plugin.Hydrate
return nil, err
}
paginator, err := k.New{{ .Name }}Paginator(essdk.BuildFilter(ctx, d.QueryContext, list{{ .Name }}Filters, "{{ .IntegrationType }}", accountId, encodedResourceCollectionFilters, clientType), d.QueryContext.Limit)
paginator, err := k.New{{ .Name }}Paginator(essdk.BuildFilter(ctx, d.QueryContext, list{{ .Name }}Filters, integrationID, encodedResourceCollectionFilters, clientType), d.QueryContext.Limit)
if err != nil {
plugin.Logger(ctx).Error("List{{ .Name }} New{{ .Name }}Paginator", "error", err)
return nil, err
Expand Down Expand Up @@ -242,7 +242,7 @@ func Get{{ .Name }}(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateD
if err != nil {
return nil, err
}
accountId, err := sc.GetConfigTableValueOrNil(ctx, steampipesdk.OpenGovernanceConfigKeyAccountID)
integrationID, err := sc.GetConfigTableValueOrNil(ctx, steampipesdk.OpenGovernanceConfigKeyIntegrationID)
if err != nil {
return nil, err
}
Expand All @@ -256,7 +256,7 @@ func Get{{ .Name }}(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateD
}
limit := int64(1)
paginator, err := k.New{{ .Name }}Paginator(essdk.BuildFilter(ctx, d.QueryContext, get{{ .Name }}Filters, "{{ .IntegrationType }}", accountId, encodedResourceCollectionFilters, clientType), &limit)
paginator, err := k.New{{ .Name }}Paginator(essdk.BuildFilter(ctx, d.QueryContext, get{{ .Name }}Filters, integrationID, encodedResourceCollectionFilters, clientType), &limit)
if err != nil {
return nil, err
}
Expand Down
32 changes: 16 additions & 16 deletions provider/resource_types/resource-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,112 +3,112 @@
"ResourceName": "GoogleWorkspace/User",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListUsers)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetUser)",
"SteampipeTable": "google_workspace_user",
"SteampipeTable": "googleworkspace_user",
"Model": "User"
},
{
"ResourceName": "GoogleWorkspace/UserAlias",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListUserAliases)",
"GetDescriber": "",
"SteampipeTable": "google_workspace_user_alias",
"SteampipeTable": "googleworkspace_user_alias",
"Model": "UserAlias"
},
{
"ResourceName": "GoogleWorkspace/Group",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListGroups)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetGroup)",
"SteampipeTable": "google_workspace_group",
"SteampipeTable": "googleworkspace_group",
"Model": "Group"
},
{
"ResourceName": "GoogleWorkspace/GroupMember",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListGroupMembers)",
"GetDescriber": "",
"SteampipeTable": "google_workspace_group_member",
"SteampipeTable": "googleworkspace_group_member",
"Model": "GroupMember"
},
{
"ResourceName": "GoogleWorkspace/GroupAlias",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListGroupAliases)",
"GetDescriber": "",
"SteampipeTable": "google_workspace_group_alias",
"SteampipeTable": "googleworkspace_group_alias",
"Model": "GroupAlias"
},
{
"ResourceName": "GoogleWorkspace/OrgUnit",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListOrgUnits)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetOrgUnit)",
"SteampipeTable": "google_workspace_org_unit",
"SteampipeTable": "googleworkspace_org_unit",
"Model": "OrgUnit"
},
{
"ResourceName": "GoogleWorkspace/MobileDevice",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListMobileDevices)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetMobileDevice)",
"SteampipeTable": "google_workspace_mobile_device",
"SteampipeTable": "googleworkspace_mobile_device",
"Model": "MobileDevice"
},
{
"ResourceName": "GoogleWorkspace/ChromeDevice",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListChromeDevices)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetChromeDevice)",
"SteampipeTable": "google_workspace_chrome_device",
"SteampipeTable": "googleworkspace_chrome_device",
"Model": "ChromeDevice"
},
{
"ResourceName": "GoogleWorkspace/Role",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListRoles)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetRole)",
"SteampipeTable": "google_workspace_role",
"SteampipeTable": "googleworkspace_role",
"Model": "Role"
},
{
"ResourceName": "GoogleWorkspace/RoleAssignment",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListRoleAssignments)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetRoleAssignment)",
"SteampipeTable": "google_workspace_role_assignment",
"SteampipeTable": "googleworkspace_role_assignment",
"Model": "RoleAssignment"
},
{
"ResourceName": "GoogleWorkspace/Domain",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListDomains)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetDomain)",
"SteampipeTable": "google_workspace_domain",
"SteampipeTable": "googleworkspace_domain",
"Model": "Domain"
},
{
"ResourceName": "GoogleWorkspace/DomainAlias",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListDomainAliases)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetDomainAlias)",
"SteampipeTable": "google_workspace_domain_alias",
"SteampipeTable": "googleworkspace_domain_alias",
"Model": "DomainAlias"
},
{
"ResourceName": "GoogleWorkspace/Privilege",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListPrivileges)",
"GetDescriber": "",
"SteampipeTable": "google_workspace_privilege",
"SteampipeTable": "googleworkspace_privilege",
"Model": "Privilege"
},
{
"ResourceName": "GoogleWorkspace/ResourceBuilding",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListResourceBuildings)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetResourceBuilding)",
"SteampipeTable": "google_workspace_resource_building",
"SteampipeTable": "googleworkspace_resource_building",
"Model": "ResourceBuilding"
},
{
"ResourceName": "GoogleWorkspace/ResourceCalender",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListResourceCalenders)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetResourceCalender)",
"SteampipeTable": "google_workspace_resource_calender",
"SteampipeTable": "googleworkspace_resource_calender",
"Model": "ResourceCalender"
},
{
"ResourceName": "GoogleWorkspace/ResourceFeature",
"ListDescriber": "DescribeListByGoogleWorkspace(describer.ListResourceFeatures)",
"GetDescriber": "DescribeSingleByGoogleWorkspace(describer.GetResourceFeature)",
"SteampipeTable": "google_workspace_resource_feature",
"SteampipeTable": "googleworkspace_resource_feature",
"Model": "ResourceFeature"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func tableGoogleWorkspaceChromeDevice(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_chrome_device",
Name: "googleworkspace_chrome_device",
Description: "Details of mobile devices, including model, status, hardware, and software information.",
List: &plugin.ListConfig{
Hydrate: nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func tableGoogleWorkspaceDomain(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_domain",
Name: "googleworkspace_domain",
Description: "Information about domain aliases in Google Workspace, including domain name, verification status, and aliases.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListDomain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceDomainAlias(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_domain_alias",
Name: "googleworkspace_domain_alias",
Description: "Information about a domain alias entry, including the parent domain, alias name, and verification status.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListDomainAlias,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceGroup(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_group",
Name: "googleworkspace_group",
Description: "Groups in the Google Workspace domain.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceGroupAlias(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_group_alias",
Name: "googleworkspace_group_alias",
Description: "Details about user aliases in Google Workspace, including alias, primary email, and alias type.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListGroupAlias,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceGroupMember(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_group_member",
Name: "googleworkspace_group_member",
Description: "Group members in the Google Workspace domain.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListGroupMember,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceMobileDevice(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_mobile_device",
Name: "googleworkspace_mobile_device",
Description: "Device details including model, status, hardware, and applications.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListMobileDevice,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceOrgUnit(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_org_unit",
Name: "googleworkspace_org_unit",
Description: "Organizational Units in the Google Workspace domain.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListOrgUnit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspacePrivilege(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_privilege",
Name: "googleworkspace_privilege",
Description: "Information about privileges, including service details and child privileges.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListPrivilege,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceResourceBuilding(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_resource_building",
Name: "googleworkspace_resource_building",
Description: "Details about a building, including address, coordinates, and floor information.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListResourceBuilding,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceResourceCalender(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_resource_calender",
Name: "googleworkspace_resource_calender",
Description: "Details about resources in a building, including capacity, floor, and category.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListResourceCalender,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceResourceFeature(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_resource_feature",
Name: "googleworkspace_resource_feature",
Description: "Details about a resource, including its name, kind, and etags.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListResourceFeature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceRole(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_role",
Name: "googleworkspace_role",
Description: "Details about roles in the Google Workspace system, including privileges and system settings.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListRole,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceRoleAssignment(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_role_assignment",
Name: "googleworkspace_role_assignment",
Description: "Details about role assignments in Google Workspace, including assignee, scope, and conditions.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListRoleAssignment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceUser(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_user",
Name: "googleworkspace_user",
Description: "Users in the Google Workspace domain.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListUser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func tableGoogleWorkspaceUserAlias(ctx context.Context) *plugin.Table {
return &plugin.Table{
Name: "google_workspace_user_alias",
Name: "googleworkspace_user_alias",
Description: "User aliases in the Google Workspace domain.",
List: &plugin.ListConfig{
Hydrate: opengovernance.ListUserAlias,
Expand Down

0 comments on commit 3cdf0bf

Please sign in to comment.