Skip to content

Commit

Permalink
Merge pull request #11 from opengovern/fix_parameters
Browse files Browse the repository at this point in the history
Fix parameters
  • Loading branch information
mohamadch91 authored Dec 22, 2024
2 parents a247673 + c24c82e commit 1be55b1
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 120 deletions.
34 changes: 20 additions & 14 deletions pkg/sdk/es/resources_clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -7284,13 +7284,16 @@ func (p ArtifactDockerFilePaginator) NextPage(ctx context.Context) ([]ArtifactDo
}

var listArtifactDockerFileFilters = map[string]string{
"git_url": "Description.GitURL",
"html_url": "Description.HTMLURL",
"name": "Description.Name",
"path": "Description.Path",
"repository": "Description.Repository",
"sha": "Description.Sha",
"uri": "Description.URI",
"dockerfile_content": "Description.DockerfileContent",
"dockerfile_content_base64": "Description.DockerfileContentBase64",
"git_url": "Description.GitURL",
"html_url": "Description.HTMLURL",
"last_updated_at": "Description.LastUpdatedAt",
"name": "Description.Name",
"path": "Description.Path",
"repository": "Description.Repository",
"sha": "Description.Sha",
"uri": "Description.URI",
}

func ListArtifactDockerFile(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {
Expand Down Expand Up @@ -7354,13 +7357,16 @@ func ListArtifactDockerFile(ctx context.Context, d *plugin.QueryData, _ *plugin.
}

var getArtifactDockerFileFilters = map[string]string{
"git_url": "Description.GitURL",
"html_url": "Description.HTMLURL",
"name": "Description.Name",
"path": "Description.Path",
"repository": "Description.Repository",
"sha": "Description.Sha",
"uri": "Description.URI",
"dockerfile_content": "Description.DockerfileContent",
"dockerfile_content_base64": "Description.DockerfileContentBase64",
"git_url": "Description.GitURL",
"html_url": "Description.HTMLURL",
"last_updated_at": "Description.LastUpdatedAt",
"name": "Description.Name",
"path": "Description.Path",
"repository": "Description.Repository",
"sha": "Description.Sha",
"uri": "Description.URI",
}

func GetArtifactDockerFile(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {
Expand Down
128 changes: 98 additions & 30 deletions provider/describer/action_workflow_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,117 @@ func GetAllWorkflowRuns(ctx context.Context, githubClient GitHubClient, organiza
sdk := newResilientSDK(githubClient.Token)

org := ctx.Value("organization")
orgName := org.(string)
if orgName != "" {
organizationName = orgName
if org != nil {
orgName := org.(string)
if orgName != "" {
organizationName = orgName
}
}

repo := ctx.Value("repository")
repoName := repo.(string)

runNumberParam := ctx.Value("run_number")
runNumber := runNumberParam.(string)

if runNumber != "" {
runNumbers := parseRunNumberFlag(runNumber)

if repoName != "" {
var values []models.Resource
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repoName, runNumbers)
if err != nil {
return nil, err
if repo != nil {
repoName := repo.(string)

runNumberParam := ctx.Value("run_number")
if runNumberParam != nil {
runNumber := runNumberParam.(string)

if runNumber != "" {
runNumbers := parseRunNumberFlag(runNumber)

if repoName != "" {
var values []models.Resource
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repoName, runNumbers)
if err != nil {
return nil, err
}
values = append(values, repoValues...)
return values, nil
} else {
var values []models.Resource
for _, repo := range repositories {
// repo.Name should be the repository name field from the returned resources
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repo.Name, runNumbers)
if err != nil {
return nil, err
}
values = append(values, repoValues...)
}
return values, nil
}
} else {
if repoName != "" {
var values []models.Resource
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repoName, nil)
if err != nil {
return nil, err
}
values = append(values, repoValues...)
return values, nil
} else {
var values []models.Resource
for _, repo := range repositories {
// repo.Name should be the repository name field from the returned resources
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repo.Name, nil)
if err != nil {
return nil, err
}
values = append(values, repoValues...)
}
return values, nil
}
}
values = append(values, repoValues...)
return values, nil
} else {
var values []models.Resource
for _, repo := range repositories {
// repo.Name should be the repository name field from the returned resources
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repo.Name, runNumbers)
if repoName != "" {
var values []models.Resource
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repoName, nil)
if err != nil {
return nil, err
}
values = append(values, repoValues...)
return values, nil
} else {
var values []models.Resource
for _, repo := range repositories {
// repo.Name should be the repository name field from the returned resources
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repo.Name, nil)
if err != nil {
return nil, err
}
values = append(values, repoValues...)
}
return values, nil
}
return values, nil
}
} else {
if repoName != "" {
var values []models.Resource
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repoName, nil)
if err != nil {
return nil, err
runNumberParam := ctx.Value("run_number")
if runNumberParam != nil {
runNumber := runNumberParam.(string)

if runNumber != "" {
runNumbers := parseRunNumberFlag(runNumber)
var values []models.Resource
for _, repo := range repositories {
// repo.Name should be the repository name field from the returned resources
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repo.Name, runNumbers)
if err != nil {
return nil, err
}
values = append(values, repoValues...)
}
return values, nil
} else {
var values []models.Resource
for _, repo := range repositories {
// repo.Name should be the repository name field from the returned resources
repoValues, err := GetRepositoryWorkflowRuns(ctx, sdk, stream, organizationName, repo.Name, nil)
if err != nil {
return nil, err
}
values = append(values, repoValues...)
}
return values, nil
}
values = append(values, repoValues...)
return values, nil
} else {
var values []models.Resource
for _, repo := range repositories {
Expand Down
Loading

0 comments on commit 1be55b1

Please sign in to comment.