-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from ellisvalentiner/feat/add-new-tables
feat: add new tables
- Loading branch information
Showing
12 changed files
with
398 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package confluence | ||
|
||
import ( | ||
"context" | ||
|
||
model "github.com/ctreminiom/go-atlassian/pkg/infra/models" | ||
|
||
"github.com/turbot/steampipe-plugin-sdk/grpc/proto" | ||
"github.com/turbot/steampipe-plugin-sdk/plugin" | ||
) | ||
|
||
//// TABLE DEFINITION | ||
|
||
func tableConfluenceContentLabel() *plugin.Table { | ||
return &plugin.Table{ | ||
Name: "confluence_content_label", | ||
Description: "Confluence Content Label.", | ||
List: &plugin.ListConfig{ | ||
ParentHydrate: listContent, | ||
Hydrate: listContentLabel, | ||
}, | ||
Columns: []*plugin.Column{ | ||
{ | ||
Name: "id", | ||
Type: proto.ColumnType_STRING, | ||
Description: "Automatically assigned when the label is created", | ||
}, | ||
{ | ||
Name: "content_id", | ||
Type: proto.ColumnType_STRING, | ||
Description: "Automatically assigned when the content is created", | ||
}, | ||
{ | ||
Name: "title", | ||
Type: proto.ColumnType_STRING, | ||
Description: "The content title", | ||
}, | ||
{ | ||
Name: "space_key", | ||
Type: proto.ColumnType_STRING, | ||
Description: "The space containing the content", | ||
}, | ||
{ | ||
Name: "prefix", | ||
Type: proto.ColumnType_STRING, | ||
Description: "The label prefix", | ||
}, | ||
{ | ||
Name: "name", | ||
Type: proto.ColumnType_STRING, | ||
Description: "The label name", | ||
}, | ||
{ | ||
Name: "label", | ||
Type: proto.ColumnType_STRING, | ||
Description: "The label", | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
type contentLabel struct { | ||
ID string `json:"id,omitempty"` | ||
ContentID string `json:"contentId,omitempty"` | ||
Title string `json:"title,omitempty"` | ||
SpaceKey string `json:"spaceKey,omitempty"` | ||
Prefix string `json:"prefix,omitempty"` | ||
Name string `json:"name,omitempty"` | ||
Label string `json:"label,omitempty"` | ||
} | ||
|
||
// LIST FUNCTIONS | ||
func listContentLabel(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { | ||
logger := plugin.Logger(ctx) | ||
logger.Trace("listContentLabel") | ||
|
||
content := h.Item.(*model.ContentScheme) | ||
for _, label := range content.Metadata.Labels.Results { | ||
row := contentLabel{ | ||
ID: label.ID, | ||
ContentID: content.ID, | ||
Title: content.Title, | ||
SpaceKey: content.Space.Key, | ||
Prefix: label.Prefix, | ||
Name: label.Name, | ||
Label: label.Label, | ||
} | ||
d.StreamListItem(ctx, row) | ||
} | ||
|
||
return nil, nil | ||
} |
Oops, something went wrong.