Skip to content

Commit e2b04ca

Browse files
committed
fix: add new tables
1 parent 290c6f2 commit e2b04ca

File tree

10 files changed

+872
-481
lines changed

10 files changed

+872
-481
lines changed

cloudql/github/table_github_organization_team.go

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,37 @@ import (
99

1010
func gitHubTeamColumns() []*plugin.Column {
1111
return []*plugin.Column{
12-
{Name: "slug",
13-
Transform: transform.FromField("Description.Slug"),
14-
Type: proto.ColumnType_STRING, Description: "The team slug name."},
12+
{Name: "id", Type: proto.ColumnType_INT, Description: "The ID of the team.",
13+
Transform: transform.FromField("Description.ID")},
1514
{Name: "name",
1615
Transform: transform.FromField("Description.Name"),
1716
Type: proto.ColumnType_STRING, Description: "The name of the team."},
18-
{Name: "id", Type: proto.ColumnType_INT, Description: "The ID of the team.",
19-
Transform: transform.FromField("Description.ID")},
2017
{Name: "node_id", Type: proto.ColumnType_STRING, Description: "The node id of the team.",
2118
Transform: transform.FromField("Description.NodeID")},
19+
{Name: "slug", Type: proto.ColumnType_STRING, Description: "The node id of the team.",
20+
Transform: transform.FromField("Description.Slug")},
2221
{Name: "description", Type: proto.ColumnType_STRING, Description: "The description of the team.",
2322
Transform: transform.FromField("Description.Description")},
24-
{Name: "created_at", Type: proto.ColumnType_TIMESTAMP, Description: "Timestamp when team was created.",
25-
Transform: transform.FromField("Description.CreatedAt").NullIfZero().Transform(convertTimestamp)},
26-
{Name: "updated_at", Type: proto.ColumnType_TIMESTAMP, Description: "Timestamp when team was last updated.",
27-
Transform: transform.FromField("Description.UpdatedAt").NullIfZero().Transform(convertTimestamp)},
28-
{Name: "combined_slug", Type: proto.ColumnType_STRING, Description: "The slug corresponding to the organization and the team.",
29-
Transform: transform.FromField("Description.CombinedSlug")},
30-
{Name: "parent_team", Type: proto.ColumnType_JSON, Description: "The teams parent team.",
31-
Transform: transform.FromField("Description.ParentTeam")},
32-
{Name: "privacy", Type: proto.ColumnType_STRING, Description: "The privacy setting of the team (VISIBLE or SECRET).",
23+
{Name: "privacy", Type: proto.ColumnType_STRING, Description: "The description of the team.",
3324
Transform: transform.FromField("Description.Privacy")},
34-
{Name: "ancestors_total_count", Type: proto.ColumnType_INT, Description: "Count of ancestors this team has.",
35-
Transform: transform.FromField("Description.AncestorsTotalCount")},
36-
{Name: "child_teams_total_count", Type: proto.ColumnType_INT, Description: "Count of children teams this team has.",
37-
Transform: transform.FromField("Description.ChildTeamsTotalCount")},
38-
{Name: "discussions_total_count", Type: proto.ColumnType_INT, Description: "Count of team discussions.",
39-
Transform: transform.FromField("Description.DiscussionsTotalCount")},
40-
{Name: "invitations_total_count", Type: proto.ColumnType_INT, Description: "Count of outstanding team member invitations for the team.",
41-
Transform: transform.FromField("Description.InvitationsTotalCount")},
42-
{Name: "members_total_count", Type: proto.ColumnType_INT, Description: "Count of team members.",
43-
Transform: transform.FromField("Description.MembersTotalCount")},
44-
{Name: "projects_v2_total_count", Type: proto.ColumnType_INT, Description: "Count of the teams v2 projects.",
45-
Transform: transform.FromField("Description.ProjectsV2TotalCount")},
46-
{Name: "repositories_total_count", Type: proto.ColumnType_INT, Description: "Count of repositories the team has.",
47-
Transform: transform.FromField("Description.RepositoriesTotalCount")},
48-
{Name: "url", Type: proto.ColumnType_STRING, Description: "URL for the team page in GitHub.",
25+
{Name: "notification_setting", Type: proto.ColumnType_STRING, Description: "The description of the team.",
26+
Transform: transform.FromField("Description.NotificationSetting")},
27+
{Name: "url", Type: proto.ColumnType_STRING, Description: "The description of the team.",
4928
Transform: transform.FromField("Description.URL")},
50-
{Name: "discussions_url", Type: proto.ColumnType_STRING, Description: "URL for team discussions.",
51-
Transform: transform.FromField("Description.DiscussionsURL")},
52-
{Name: "members_url", Type: proto.ColumnType_STRING, Description: "URL for team members.",
53-
Transform: transform.FromField("Description.MembersURL")},
54-
{Name: "new_team_url", Type: proto.ColumnType_STRING, Description: "The HTTP URL creating a new team.",
55-
Transform: transform.FromField("Description.NewTeamURL")},
56-
{Name: "repositories_url", Type: proto.ColumnType_STRING, Description: "URL for team repositories.",
57-
Transform: transform.FromField("Description.RepositoriesURL")},
58-
{Name: "teams_url", Type: proto.ColumnType_STRING, Description: "URL for this team's teams.",
59-
Transform: transform.FromField("Description.TeamsURL")},
60-
{Name: "subscription", Type: proto.ColumnType_STRING, Description: "Subscription status of the current user to the team.",
61-
Transform: transform.FromField("Description.Subscription")},
29+
{Name: "html_url", Type: proto.ColumnType_STRING, Description: "The description of the team.",
30+
Transform: transform.FromField("Description.HTMLURL")},
31+
{Name: "permission", Type: proto.ColumnType_STRING, Description: "The description of the team.",
32+
Transform: transform.FromField("Description.Permission")},
33+
{Name: "members_count", Type: proto.ColumnType_STRING, Description: "The description of the team.",
34+
Transform: transform.FromField("Description.MembersCount")},
35+
{Name: "organization_id", Type: proto.ColumnType_STRING, Description: "The description of the team.",
36+
Transform: transform.FromField("Description.OrganizationID")},
37+
{Name: "repos_count", Type: proto.ColumnType_STRING, Description: "The description of the team.",
38+
Transform: transform.FromField("Description.ReposCount")},
39+
{Name: "parent_team_id", Type: proto.ColumnType_INT, Description: "The description of the team.",
40+
Transform: transform.FromField("Description.ParentTeamID")},
41+
{Name: "team_sync", Type: proto.ColumnType_JSON, Description: "The description of the team.",
42+
Transform: transform.FromField("Description.TeamSync")},
6243
}
6344
}
6445

cloudql/github/table_github_organization_token.go

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,64 +11,75 @@ import (
1111
func gitHubOrganizationTokenColumns() []*plugin.Column {
1212
tableCols := []*plugin.Column{
1313
{
14-
Name: "authorized_credential_id",
15-
Type: proto.ColumnType_INT,
16-
Description: "The organization the member is associated with.",
17-
Transform: transform.FromField("Description.AuthorizedCredentialId")},
18-
{
19-
Name: "authorized_credential_title",
14+
Name: "title",
2015
Type: proto.ColumnType_STRING,
21-
Description: "The role this user has in the organization. Returns null if information is not available to viewer.",
22-
Transform: transform.FromField("Description.AuthorizedCredentialTitle")},
23-
{
24-
Name: "authorized_credential_note",
25-
Type: proto.ColumnType_STRING,
26-
Transform: transform.FromField("Description.AuthorizedCredentialNote")},
27-
{
28-
Name: "authorized_credential_expires_at",
29-
Type: proto.ColumnType_TIMESTAMP,
30-
Description: "permissions",
31-
Transform: transform.FromField("Description.AuthorizedCredentialExpiresAt")},
16+
Description: "login",
17+
Transform: transform.FromField("Description.Title")},
3218
{
3319
Name: "login",
3420
Type: proto.ColumnType_STRING,
3521
Description: "login",
3622
Transform: transform.FromField("Description.Login")},
3723
{
38-
Name: "scopes",
39-
Description: "permissions",
40-
Type: proto.ColumnType_JSON,
41-
Transform: transform.FromField("Description.Scopes")},
24+
Name: "principle_type",
25+
Type: proto.ColumnType_STRING,
26+
Description: "login",
27+
Transform: transform.FromField("Description.PrincipleType")},
28+
{
29+
Name: "organization_id",
30+
Type: proto.ColumnType_STRING,
31+
Description: "login",
32+
Transform: transform.FromField("Description.OrganizationID")},
33+
{
34+
Name: "principal_id",
35+
Type: proto.ColumnType_STRING,
36+
Description: "login",
37+
Transform: transform.FromField("Description.PrincipalID")},
4238
{
4339
Name: "credential_id",
4440
Type: proto.ColumnType_INT,
45-
Description: "permissions",
41+
Description: "login",
4642
Transform: transform.FromField("Description.CredentialId")},
4743
{
4844
Name: "credential_type",
4945
Type: proto.ColumnType_STRING,
50-
Description: "permissions",
46+
Description: "login",
5147
Transform: transform.FromField("Description.CredentialType")},
5248
{
53-
Name: "credential_accessed_at",
54-
Type: proto.ColumnType_TIMESTAMP,
55-
Description: "permissions",
56-
Transform: transform.FromField("Description.CredentialAccessedAt")},
49+
Name: "token_last_eight",
50+
Type: proto.ColumnType_STRING,
51+
Description: "login",
52+
Transform: transform.FromField("Description.TokenLastEight")},
5753
{
5854
Name: "credential_authorized_at",
5955
Type: proto.ColumnType_TIMESTAMP,
60-
Description: "permissions",
56+
Description: "login",
6157
Transform: transform.FromField("Description.CredentialAuthorizedAt")},
6258
{
63-
Name: "token_last_eight",
64-
Type: proto.ColumnType_STRING,
65-
Description: "permissions",
66-
Transform: transform.FromField("Description.TokenLastEight")},
59+
Name: "scopes",
60+
Type: proto.ColumnType_JSON,
61+
Description: "login",
62+
Transform: transform.FromField("Description.Scopes")},
6763
{
6864
Name: "fingerprint",
6965
Type: proto.ColumnType_STRING,
70-
Description: "permissions",
66+
Description: "login",
7167
Transform: transform.FromField("Description.Fingerprint")},
68+
{
69+
Name: "credential_accessed_at",
70+
Type: proto.ColumnType_TIMESTAMP,
71+
Description: "login",
72+
Transform: transform.FromField("Description.CredentialAccessedAt")},
73+
{
74+
Name: "authorized_credential_id",
75+
Type: proto.ColumnType_INT,
76+
Description: "login",
77+
Transform: transform.FromField("Description.AuthorizedCredentialId")},
78+
{
79+
Name: "authorized_credential_expires_at",
80+
Type: proto.ColumnType_TIMESTAMP,
81+
Description: "login",
82+
Transform: transform.FromField("Description.AuthorizedCredentialExpiresAt")},
7283
}
7384

7485
return tableCols

cloudql/github/table_github_team_member.go

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func tableGitHubTeamMember() *plugin.Table {
1515
Hydrate: opengovernance.ListTeamMember,
1616
},
1717
Get: &plugin.GetConfig{
18-
KeyColumns: plugin.AllColumns([]string{"id"}),
18+
KeyColumns: plugin.AllColumns([]string{"team_id", "member_principal_id"}),
1919
Hydrate: opengovernance.GetTeamMember,
2020
},
2121
Columns: commonColumns(gitHubTeamMemberColumns()),
@@ -24,32 +24,12 @@ func tableGitHubTeamMember() *plugin.Table {
2424

2525
func gitHubTeamMemberColumns() []*plugin.Column {
2626
cols := []*plugin.Column{
27-
{Name: "slug", Type: proto.ColumnType_STRING, Description: "The team slug name.",
28-
Transform: transform.FromField("Description.Slug")},
29-
{Name: "role", Type: proto.ColumnType_STRING, Description: "The team member's role (MEMBER, MAINTAINER).",
30-
Transform: transform.FromField("Description.Role")},
31-
{Name: "login_id", Type: proto.ColumnType_STRING, Description: "Unique identifier for the user login.",
32-
Transform: transform.FromField("Description.LoginID")},
33-
{Name: "login", Type: proto.ColumnType_STRING, Description: "The login name of the user.",
34-
Transform: transform.FromField("Description.Login")},
35-
{Name: "id", Type: proto.ColumnType_INT, Description: "The ID of the user.",
36-
Transform: transform.FromField("Description.ID")},
37-
{Name: "name", Type: proto.ColumnType_STRING, Description: "The name of the user.",
38-
Transform: transform.FromField("Description.Name")},
39-
{Name: "node_id", Type: proto.ColumnType_STRING, Description: "The node ID of the user.",
40-
Transform: transform.FromField("Description.NodeID")},
41-
{Name: "email", Type: proto.ColumnType_STRING, Description: "The email of the user.",
42-
Transform: transform.FromField("Description.Email")},
43-
{Name: "created_at", Type: proto.ColumnType_TIMESTAMP, Description: "Timestamp when user was created.",
44-
Transform: transform.FromField("Description.CreatedAt")},
45-
{Name: "company", Type: proto.ColumnType_STRING, Description: "The company on the users profile.",
46-
Transform: transform.FromField("Description.Company")},
47-
{Name: "interaction_ability", Type: proto.ColumnType_JSON, Description: "The interaction ability settings for this user.",
48-
Transform: transform.FromField("Description.InteractionAbility")},
49-
{Name: "is_site_admin", Type: proto.ColumnType_BOOL, Description: "If true, user is a site administrator.",
50-
Transform: transform.FromField("Description.IsSiteAdmin")},
51-
{Name: "location", Type: proto.ColumnType_STRING, Description: "The location of the user.",
52-
Transform: transform.FromField("Description.Location")},
27+
{Name: "team_id", Type: proto.ColumnType_STRING, Description: "The team slug name.",
28+
Transform: transform.FromField("Description.TeamID")},
29+
{Name: "member_principal_type", Type: proto.ColumnType_STRING, Description: "The team slug name.",
30+
Transform: transform.FromField("Description.MemberPrincipalType")},
31+
{Name: "member_principal_id", Type: proto.ColumnType_STRING, Description: "The team slug name.",
32+
Transform: transform.FromField("Description.MemberPrincipalID")},
5333
}
5434

5535
return cols

discovery/describers/organization_role_assignment.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ type orgRoleListResponseForAssignment struct {
108108
Roles []OrgRoleForAssignment `json:"roles"`
109109
}
110110

111-
type GitHubTeam struct {
112-
ID int `json:"id"`
113-
}
114-
115111
type GitHubUser struct {
116112
ID int `json:"id"`
117113
}

0 commit comments

Comments
 (0)