diff --git a/steampipe-plugin-github/github/community_profile_utils.go b/steampipe-plugin-github/github/community_profile_utils.go deleted file mode 100644 index 0f9b97c7..00000000 --- a/steampipe-plugin-github/github/community_profile_utils.go +++ /dev/null @@ -1,101 +0,0 @@ -package github - -import ( - "context" - "fmt" - "slices" - - "github.com/opengovern/og-describer-github/steampipe-plugin-github/github/models" - "github.com/shurcooL/githubv4" - "github.com/turbot/steampipe-plugin-sdk/v5/plugin" -) - -func extractCommunityProfileFromHydrateItem(h *plugin.HydrateData) (models.CommunityProfile, error) { - if cp, ok := h.Item.(models.CommunityProfile); ok { - return cp, nil - } else { - return models.CommunityProfile{}, fmt.Errorf("unable to parse hydrate item %v as an CommunityProfile", h.Item) - } -} - -func appendCommunityProfileColumnIncludes(m *map[string]interface{}, cols []string) { - (*m)["includeCPLicense"] = githubv4.Boolean(slices.Contains(cols, "license_info")) - (*m)["includeCPCodeOfConduct"] = githubv4.Boolean(slices.Contains(cols, "code_of_conduct")) - (*m)["includeCPIssueTemplates"] = githubv4.Boolean(slices.Contains(cols, "issue_templates")) - (*m)["includeCPPullRequestTemplates"] = githubv4.Boolean(slices.Contains(cols, "pull_request_templates")) - (*m)["includeCPReadme"] = githubv4.Boolean(slices.Contains(cols, "readme")) - (*m)["includeCPContributing"] = githubv4.Boolean(slices.Contains(cols, "contributing")) - (*m)["includeCPSecurity"] = githubv4.Boolean(slices.Contains(cols, "security")) -} - -func cpHydrateLicense(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - cp, err := extractCommunityProfileFromHydrateItem(h) - if err != nil { - return nil, err - } - return cp.LicenseInfo, nil -} - -func cpHydrateCodeOfConduct(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - cp, err := extractCommunityProfileFromHydrateItem(h) - if err != nil { - return nil, err - } - return cp.CodeOfConduct, nil -} - -func cpHydrateIssueTemplates(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - cp, err := extractCommunityProfileFromHydrateItem(h) - if err != nil { - return nil, err - } - return cp.IssueTemplates, nil -} - -func cpHydratePullRequestTemplates(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - cp, err := extractCommunityProfileFromHydrateItem(h) - if err != nil { - return nil, err - } - return cp.PullRequestTemplates, nil -} - -func cpHydrateReadme(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - cp, err := extractCommunityProfileFromHydrateItem(h) - if err != nil { - return nil, err - } - if cp.ReadMeUpper.Blob.Text != "" { - return cp.ReadMeUpper.Blob, nil - } else { - return cp.ReadMeLower.Blob, nil - } -} - -func cpHydrateContributing(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - cp, err := extractCommunityProfileFromHydrateItem(h) - if err != nil { - return nil, err - } - if cp.ContributingUpper.Blob.Text != "" { - return cp.ContributingUpper.Blob, nil - } else if cp.ContributingLower.Blob.Text != "" { - return cp.ContributingLower.Blob, nil - } else { - return cp.ContributingTitle.Blob, nil - } -} - -func cpHydrateSecurity(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - cp, err := extractCommunityProfileFromHydrateItem(h) - if err != nil { - return nil, err - } - if cp.SecurityUpper.Blob.Text != "" { - return cp.SecurityUpper.Blob, nil - } else if cp.SecurityLower.Blob.Text != "" { - return cp.SecurityLower.Blob, nil - } else { - return cp.SecurityTitle.Blob, nil - } -} diff --git a/steampipe-plugin-github/github/plugin.go b/steampipe-plugin-github/github/plugin.go index 88a0acfb..4a7d48ca 100644 --- a/steampipe-plugin-github/github/plugin.go +++ b/steampipe-plugin-github/github/plugin.go @@ -27,8 +27,6 @@ func Plugin(ctx context.Context) *plugin.Plugin { "github_branch_protection": tableGitHubBranchProtection(), "github_code_owner": tableGitHubCodeOwner(), "github_commit": tableGitHubCommit(), - "github_community_profile": tableGitHubCommunityProfile(), - "github_gitignore": tableGitHubGitignore(), "github_issue": tableGitHubIssue(), "github_license": tableGitHubLicense(), "github_organization": tableGitHubOrganization(), @@ -50,13 +48,10 @@ func Plugin(ctx context.Context) *plugin.Plugin { "github_repository_ruleset": tableGitHubRepositoryRuleset(), "github_repository_sbom": tableGitHubRepositorySbom(), "github_repository_vulnerability_alert": tableGitHubRepositoryVulnerabilityAlert(), - "github_stargazer": tableGitHubStargazer(), "github_tag": tableGitHubTag(), "github_team": tableGitHubTeam(), "github_team_member": tableGitHubTeamMember(), "github_team_repository": tableGitHubTeamRepository(), - "github_traffic_view_daily": tableGitHubTrafficViewDaily(), - "github_traffic_view_weekly": tableGitHubTrafficViewWeekly(), "github_tree": tableGitHubTree(), "github_user": tableGitHubUser(), "github_workflow": tableGitHubWorkflow(), @@ -64,8 +59,6 @@ func Plugin(ctx context.Context) *plugin.Plugin { "github_maven_package": tableGitHubMavenPackage(), "github_npm_package": tableGitHubNPMPackage(), "github_nuget_package": tableGitHubNugetPackage(), - "github_ruby_gems_package": tableGitHubRubyGemsPackage(), - "github_package_version": tableGitHubPackageVersion(), "github_artifact_dockerfile": tableGitHubArtifactDockerFile(), }, } diff --git a/steampipe-plugin-github/github/stargazer_utils.go b/steampipe-plugin-github/github/stargazer_utils.go deleted file mode 100644 index 24c7ccbc..00000000 --- a/steampipe-plugin-github/github/stargazer_utils.go +++ /dev/null @@ -1,47 +0,0 @@ -package github - -import ( - "context" - "fmt" - "slices" - - "github.com/shurcooL/githubv4" - "github.com/turbot/steampipe-plugin-sdk/v5/plugin" -) - -func extractStargazerFromHydrateItem(h *plugin.HydrateData) (Stargazer, error) { - if str, ok := h.Item.(Stargazer); ok { - return str, nil - } else { - return Stargazer{}, fmt.Errorf("unable to parse hydrate item %v as a Stargazer", h.Item) - } -} - -func appendStargazerColumnIncludes(m *map[string]interface{}, cols []string) { - (*m)["includeStargazerStarredAt"] = githubv4.Boolean(slices.Contains(cols, "starred_at")) - (*m)["includeStargazerNode"] = githubv4.Boolean(slices.Contains(cols, "user_login") || slices.Contains(cols, "user_detail")) -} - -func strHydrateStarredAt(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - str, err := extractStargazerFromHydrateItem(h) - if err != nil { - return nil, err - } - return str.StarredAt, nil -} - -func strHydrateUserLogin(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - str, err := extractStargazerFromHydrateItem(h) - if err != nil { - return nil, err - } - return str.Node.Login, nil -} - -func strHydrateUser(_ context.Context, _ *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - str, err := extractStargazerFromHydrateItem(h) - if err != nil { - return nil, err - } - return str.Node, nil -} \ No newline at end of file