Skip to content

Commit

Permalink
Merge pull request #4 from opengovern/fix_check_build
Browse files Browse the repository at this point in the history
fix: fixed cycle import and added custom hydrate functions
  • Loading branch information
ArshiaBP authored Nov 15, 2024
2 parents 8eaaa3d + 0729d8a commit 9f8c3e2
Show file tree
Hide file tree
Showing 88 changed files with 191 additions and 202 deletions.
5 changes: 2 additions & 3 deletions provider/describer/action_artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import (
"context"
"github.com/google/go-github/v55/github"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"strconv"
)

func GetAllArtifacts(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllArtifacts(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -30,7 +29,7 @@ func GetAllArtifacts(ctx context.Context, githubClient provider.GitHubClient, st
return values, nil
}

func GetRepositoryArtifacts(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
func GetRepositoryArtifacts(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
client := githubClient.RestClient
opts := &github.ListOptions{PerPage: maxPagesCount}
repoFullName := formRepositoryFullName(owner, repo)
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/action_repository_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import (
"context"
"github.com/google/go-github/v55/github"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"strconv"
)

func GetAllRunners(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllRunners(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -30,7 +29,7 @@ func GetAllRunners(ctx context.Context, githubClient provider.GitHubClient, stre
return values, nil
}

func GetRepositoryRunners(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
func GetRepositoryRunners(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
client := githubClient.RestClient
opts := &github.ListOptions{PerPage: maxPagesCount}
repoFullName := formRepositoryFullName(owner, repo)
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/action_repository_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"context"
"github.com/google/go-github/v55/github"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
)

func GetAllSecrets(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllSecrets(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -29,7 +28,7 @@ func GetAllSecrets(ctx context.Context, githubClient provider.GitHubClient, stre
return values, nil
}

func GetRepositorySecrets(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
func GetRepositorySecrets(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
client := githubClient.RestClient
opts := &github.ListOptions{PerPage: maxPagesCount}
repoFullName := formRepositoryFullName(owner, repo)
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/action_repository_workflow_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import (
"context"
"github.com/google/go-github/v55/github"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"strconv"
)

func GetAllWorkflowRuns(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllWorkflowRuns(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -30,7 +29,7 @@ func GetAllWorkflowRuns(ctx context.Context, githubClient provider.GitHubClient,
return values, nil
}

func GetRepositoryWorkflowRuns(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
func GetRepositoryWorkflowRuns(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
client := githubClient.RestClient
opts := &github.ListWorkflowRunsOptions{
ListOptions: github.ListOptions{PerPage: maxPagesCount},
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/audit_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"context"
"github.com/google/go-github/v55/github"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
)

func GetAllAuditLogs(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllAuditLogs(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
organizations, err := getOrganizations(ctx, client)
if err != nil {
Expand All @@ -25,7 +24,7 @@ func GetAllAuditLogs(ctx context.Context, githubClient provider.GitHubClient, st
return values, nil
}

func GetRepositoryAuditLog(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, org string) ([]models.Resource, error) {
func GetRepositoryAuditLog(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, org string) ([]models.Resource, error) {
client := githubClient.RestClient
var phrase string
var include string
Expand Down
7 changes: 3 additions & 4 deletions provider/describer/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
)

func GetAllBlobs(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllBlobs(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -28,7 +27,7 @@ func GetAllBlobs(ctx context.Context, githubClient provider.GitHubClient, stream
return values, nil
}

func GetRepositoryBlobs(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
func GetRepositoryBlobs(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
client := githubClient.RestClient
fileSHAs, err := getFileSHAs(client, owner, repo)
if err != nil {
Expand All @@ -51,7 +50,7 @@ func GetRepositoryBlobs(ctx context.Context, githubClient provider.GitHubClient,
return values, nil
}

func GetBlob(ctx context.Context, githubClient provider.GitHubClient, owner, repo, sha string) (*models.Resource, error) {
func GetBlob(ctx context.Context, githubClient GitHubClient, owner, repo, sha string) (*models.Resource, error) {
client := githubClient.RestClient
blob, _, err := client.Git.GetBlob(ctx, owner, repo, sha)
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"github.com/shurcooL/githubv4"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
)

func GetAllBranches(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllBranches(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -30,7 +29,7 @@ func GetAllBranches(ctx context.Context, githubClient provider.GitHubClient, str
return values, nil
}

func GetRepositoryBranches(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
func GetRepositoryBranches(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
graphQLClient := githubClient.GraphQLClient
restClient := githubClient.RestClient
var query struct {
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"github.com/shurcooL/githubv4"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
"strconv"
)

func GetAllBranchProtections(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllBranchProtections(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -31,7 +30,7 @@ func GetAllBranchProtections(ctx context.Context, githubClient provider.GitHubCl
return values, nil
}

func GetRepositoryBranchProtections(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
func GetRepositoryBranchProtections(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
client := githubClient.GraphQLClient
var query struct {
RateLimit steampipemodels.RateLimit
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"github.com/shurcooL/githubv4"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
)

func GetAllCommits(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllCommits(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -30,7 +29,7 @@ func GetAllCommits(ctx context.Context, githubClient provider.GitHubClient, stre
return values, nil
}

func GetRepositoryCommits(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
func GetRepositoryCommits(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string) ([]models.Resource, error) {
client := githubClient.GraphQLClient
var query struct {
RateLimit steampipemodels.RateLimit
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/community_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"github.com/shurcooL/githubv4"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
)

func GetAllCommunityProfiles(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllCommunityProfiles(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
owner, err := getOwnerName(ctx, client)
if err != nil {
Expand All @@ -36,7 +35,7 @@ func GetAllCommunityProfiles(ctx context.Context, githubClient provider.GitHubCl
return values, nil
}

func GetRepositoryCommunityProfiles(ctx context.Context, githubClient provider.GitHubClient, owner, repo string) (*models.Resource, error) {
func GetRepositoryCommunityProfiles(ctx context.Context, githubClient GitHubClient, owner, repo string) (*models.Resource, error) {
client := githubClient.GraphQLClient
var query struct {
RateLimit steampipemodels.RateLimit
Expand Down
3 changes: 1 addition & 2 deletions provider/describer/gist.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"context"
"github.com/google/go-github/v55/github"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
)

func GetGistList(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetGistList(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
opt := &github.GistListOptions{ListOptions: github.ListOptions{PerPage: maxPagesCount}}
var values []models.Resource
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/gitignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
)

func GetGitIgnoreTemplateList(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetGitIgnoreTemplateList(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
gitIgnores, _, err := client.Gitignores.List(ctx)
if err != nil {
Expand All @@ -30,7 +29,7 @@ func GetGitIgnoreTemplateList(ctx context.Context, githubClient provider.GitHubC
return values, nil
}

func GetGitignoreTemplate(ctx context.Context, githubClient provider.GitHubClient, gitIgnoreName string) (*models.Resource, error) {
func GetGitignoreTemplate(ctx context.Context, githubClient GitHubClient, gitIgnoreName string) (*models.Resource, error) {
client := githubClient.RestClient
gitIgnore, _, err := client.Gitignores.Get(ctx, gitIgnoreName)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions provider/describer/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"github.com/shurcooL/githubv4"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
"strconv"
)

func GetIssueList(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetIssueList(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.GraphQLClient
var filters githubv4.IssueFilters
filters.States = &[]githubv4.IssueState{githubv4.IssueStateOpen, githubv4.IssueStateClosed}
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"github.com/shurcooL/githubv4"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
"strconv"
)

func GetAllIssueComments(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllIssueComments(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
issues, err := getIssues(ctx, client)
if err != nil {
Expand All @@ -29,7 +28,7 @@ func GetAllIssueComments(ctx context.Context, githubClient provider.GitHubClient
return values, nil
}

func GetRepositoryIssueComments(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, owner, repo string, issueNumber int) ([]models.Resource, error) {
func GetRepositoryIssueComments(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, owner, repo string, issueNumber int) ([]models.Resource, error) {
client := githubClient.GraphQLClient
var query struct {
RateLimit steampipemodels.RateLimit
Expand Down
3 changes: 1 addition & 2 deletions provider/describer/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
)

func GetLicenseList(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetLicenseList(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.GraphQLClient
var query struct {
RateLimit steampipemodels.RateLimit
Expand Down
3 changes: 1 addition & 2 deletions provider/describer/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import (
"context"
"github.com/google/go-github/v55/github"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"github.com/shurcooL/githubv4"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
"strconv"
"strings"
)

func GetOrganizationList(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetOrganizationList(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.GraphQLClient
var query struct {
RateLimit steampipemodels.RateLimit
Expand Down
5 changes: 2 additions & 3 deletions provider/describer/organization_collaborators.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package describer
import (
"context"
"github.com/opengovern/og-describer-github/pkg/sdk/models"
"github.com/opengovern/og-describer-github/provider"
"github.com/opengovern/og-describer-github/provider/model"
"github.com/shurcooL/githubv4"
steampipemodels "github.com/turbot/steampipe-plugin-github/github/models"
Expand All @@ -15,7 +14,7 @@ type CollaboratorEdge struct {
Node steampipemodels.CollaboratorLogin `graphql:"node @include(if:$includeOCNode)" json:"node"`
}

func GetAllOrganizationsCollaborators(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
func GetAllOrganizationsCollaborators(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender) ([]models.Resource, error) {
client := githubClient.RestClient
organizations, err := getOrganizations(ctx, client)
if err != nil {
Expand All @@ -32,7 +31,7 @@ func GetAllOrganizationsCollaborators(ctx context.Context, githubClient provider
return values, nil
}

func GetOrganizationCollaborators(ctx context.Context, githubClient provider.GitHubClient, stream *models.StreamSender, org string) ([]models.Resource, error) {
func GetOrganizationCollaborators(ctx context.Context, githubClient GitHubClient, stream *models.StreamSender, org string) ([]models.Resource, error) {
client := githubClient.GraphQLClient
affiliation := githubv4.CollaboratorAffiliationAll
var query struct {
Expand Down
Loading

0 comments on commit 9f8c3e2

Please sign in to comment.