cmd

package
v0.0.0-...-cac11cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version - Current version of gh-sso.
	VERSION = "0.0.1"
)

Variables

View Source
var (

	// EnterpriseQuery is a GraphQL query to validate a Github Enterprise Account.
	EnterpriseQuery struct {
		Enterprise struct {
			ID   githubv4.String `graphql:"id"`
			Name githubv4.String `graphql:"name"`
		} `graphql:"enterprise(slug: $enterpriseName)"`
	}

	// EnterpriseUsersQuery is a GraphQL query to retrieve all users in an Enterprise.
	EnterpriseMembersQuery struct {
		Enterprise struct {
			Members struct {
				Edges []struct {
					Node struct {
						EnterpriseUserAccount struct {
							Login githubv4.String `graphql:"login"`
							Name  githubv4.String `graphql:"name"`
						} `graphql:"... on EnterpriseUserAccount"`
					} `graphql:"node"`
				} `graphql:"edges"`
				PageInfo struct {
					EndCursor   githubv4.String  `graphql:"endCursor"`
					HasNextPage githubv4.Boolean `graphql:"hasNextPage"`
				} `graphql:"pageInfo"`
			} `graphql:"members(first: 100, after: $cursor)"`
		} `graphql:"enterprise(slug: $enterpriseName)"`
	}

	// EnterpriseSamlIdpUsersQuery is a GraphQL query for a Github Enterprise Account's SAML IDP User details.
	EnterpriseSamlIdpUsersQuery struct {
		Enterprise struct {
			OwnerInfo struct {
				SamlIdentityProvider struct {
					ExternalIdentities struct {
						Edges []struct {
							Node struct {
								Guid         githubv4.String `graphql:"guid"`
								SamlIdentity struct {
									NameId githubv4.String `graphql:"nameId"`
								} `graphql:"samlIdentity"`
								User struct {
									Login githubv4.String `graphql:"login"`
									Name  githubv4.String `graphql:"name"`
								} `graphql:"user"`
							} `graphql:"node"`
						} `graphql:"edges"`
						PageInfo struct {
							EndCursor   githubv4.String  `graphql:"endCursor"`
							HasNextPage githubv4.Boolean `graphql:"hasNextPage"`
						} `graphql:"pageInfo"`
					} `graphql:"externalIdentities(first: 100, after: $cursor)"`
				} `graphql:"samlIdentityProvider"`
			} `graphql:"ownerInfo"`
		} `graphql:"enterprise(slug: $enterpriseName)"`
	}

	// EnterpriseRepositoriesQuery lists the organizations in the enterprise.
	EnterpriseOrganizationsQuery struct {
		Enterprise struct {
			Organizations struct {
				Edges []struct {
					Node struct {
						Login githubv4.String `graphql:"login"`
					} `graphql:"node"`
				} `graphql:"edges"`
				PageInfo struct {
					EndCursor   githubv4.String  `graphql:"endCursor"`
					HasNextPage githubv4.Boolean `graphql:"hasNextPage"`
				} `graphql:"pageInfo"`
			} `graphql:"organizations(first: 100, after: $cursor1)"`
		} `graphql:"enterprise(slug: $enterpriseName)"`
	}

	// OrganizationQuery is a GraphQL query for a Github Organization.
	OrganizationQuery struct {
		Organization struct {
			ID   githubv4.String `graphql:"id"`
			Name githubv4.String `graphql:"name"`
		} `graphql:"organization(login: $organizationName)"`
	}

	// OrganizationSamlIdpUsersQuery is a GraphQL query for a Github Organization SAML IDP Users.
	OrganizationSamlIdpUsersQuery struct {
		Organization struct {
			SamlIdentityProvider struct {
				ExternalIdentities struct {
					Edges []struct {
						Node struct {
							Guid         githubv4.String `graphql:"guid"`
							SamlIdentity struct {
								NameId   githubv4.String `graphql:"nameId"`
								Username githubv4.String `graphql:"username"`
							} `graphql:"samlIdentity"`
							User struct {
								Login githubv4.String `graphql:"login"`
								Name  githubv4.String `graphql:"name"`
							} `graphql:"user"`
						} `graphql:"node"`
					} `graphql:"edges"`
					PageInfo struct {
						EndCursor   githubv4.String  `graphql:"endCursor"`
						HasNextPage githubv4.Boolean `graphql:"hasNextPage"`
					} `graphql:"pageInfo"`
				} `graphql:"externalIdentities(first: 100, after: $cursor)"`
			} `graphql:"samlIdentityProvider"`
		} `graphql:"organization(login: $organizationName)"`
	}

	// OrganizationRepositoriesQuery lists the repositories in the organization.
	OrganizationRepositoriesQuery struct {
		Organization struct {
			Name         githubv4.String `graphql:"name"`
			Repositories struct {
				Edges []struct {
					Node struct {
						Name githubv4.String `graphql:"name"`
					} `graphql:"node"`
				} `graphql:"edges"`
				PageInfo struct {
					EndCursor   githubv4.String  `graphql:"endCursor"`
					HasNextPage githubv4.Boolean `graphql:"hasNextPage"`
				} `graphql:"pageInfo"`
			} `graphql:"repositories(first: 100, after: $cursor)"`
		} `graphql:"organization(login: $organizationName)"`
	}
)
View Source
var (
	// Client for use with githubv4.
	Client *githubv4.Client

	// Context.
	Ctx context.Context

	// Configuration.
	Cfg Config
)

Functions

func Execute

func Execute()

Execute is the entry point for the root command.

Types

type Config

type Config struct {
	// GitHub API token.
	Token         string   `mapstructure:"token"`
	Enterprises   []string `mapstructure:"enterprises,flow"`
	Organizations []string `mapstructure:"organizations,flow"`
}

Configuration object.

type Enterprise

type Enterprise struct {
	ID            string
	Login         string
	Name          string
	Organizations map[string]Organization
	Users         map[string]User
}

Enterprise - Top-level enterprise.

type ListFlags

type ListFlags struct {
	Enterprises   []string
	Organizations []string
}

lstCmd flags.

type Organization

type Organization struct {
	ID           string
	Login        string
	Name         string
	Repositories map[string]Repository
	Users        map[string]User
}

Organization - Top-Level organization; also used for Enterprise member orgs.

type Repository

type Repository struct {
	Name string
}

Repository - Individual repository in an organization.

type User

type User struct {
	Name       string
	SamlNameId string
}

User - User details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL