Documentation
¶
Overview ¶
Package keyring is a simple wrapper that adds timeouts to the zalando/go-keyring package "Borrowed" with ❤️ from https://github.com/cli/cli/blob/17af24e147629aa1aed2546e87e9323aeabf4c8c/internal/keyring/keyring.go
Index ¶
- Variables
- func AddTeamMember(ctx context.Context, teamSlug, email string, role gql.TeamMemberRole) error
- func GetAllTeamSlugs(ctx context.Context) ([]string, error)
- func GetAllTeams(ctx context.Context) (*gql.TeamsResponse, error)
- func GetStatus(ctx context.Context, _ *flag.Status) ([]gql.TeamStatusMeUserTeamsTeamMemberConnectionNodesTeamMember, error)
- func GetTeamMembers(ctx context.Context, teamSlug string) ([]gql.TeamMembersTeamMembersTeamMemberConnectionNodesTeamMember, error)
- func GetTeamWorkloads(ctx context.Context, teamSlug string) ([]gql.GetTeamWorkloadsTeamWorkloadsWorkloadConnectionNodesWorkload, error)
- func GetUserEmails(ctx context.Context) ([]string, error)
- func GetUserTeams(ctx context.Context) ([]gql.UserTeamsMeUserTeamsTeamMemberConnectionNodesTeamMember, error)
- func GetUsers(ctx context.Context) (*gql.UsersResponse, error)
- func GraphqlClient(ctx context.Context) (graphql.Client, error)
- func IsConsoleAdmin(ctx context.Context) bool
- func Login(ctx context.Context, out cli.Output) error
- func Logout(ctx context.Context, out cli.Output) error
- func PullSchema(ctx context.Context, _ *flag.Schema) (string, error)
- func RemoveTeamMember(ctx context.Context, teamSlug, email string) error
- func StartProxy(ctx context.Context, out cli.Output, flags *flag.Proxy) error
- type AuthenticatedUser
Constants ¶
This section is empty.
Variables ¶
var ErrNotAuthenticated = errors.New("not authenticated")
Functions ¶
func AddTeamMember ¶
func GetAllTeams ¶
func GetAllTeams(ctx context.Context) (*gql.TeamsResponse, error)
func GetTeamMembers ¶
func GetTeamWorkloads ¶
func GetUserTeams ¶
func GetUserTeams(ctx context.Context) ([]gql.UserTeamsMeUserTeamsTeamMemberConnectionNodesTeamMember, error)
func IsConsoleAdmin ¶
IsConsoleAdmin checks if the authenticated user is a Console admin or not.
func Login ¶
Login initiates the OAuth2 authorization code flow to authenticate the user. The user's secret is saved in the system keyring. See AuthenticatedUser for primitives that allows interacting with the Nais API on behalf of the authenticated user.
Types ¶
type AuthenticatedUser ¶
type AuthenticatedUser struct {
oauth2.TokenSource
ConsoleHost string
}
AuthenticatedUser represents the authenticated user. It provides primitives for interacting with the Nais API on behalf of the user. The primitives may return an ErrNotAuthenticated if the user has invalid or expired credentials, in which case the user must reauthenticate through Login.
func GetAuthenticatedUser ¶
func GetAuthenticatedUser(ctx context.Context) (*AuthenticatedUser, error)
GetAuthenticatedUser may return an ErrNotAuthenticated if the user has invalid or expired credentials, in which case the user must reauthenticate through Login.
func (*AuthenticatedUser) HTTPClient ¶
func (a *AuthenticatedUser) HTTPClient(ctx context.Context) *http.Client
HTTPClient returns a http.Client configured with the user's access token.
func (*AuthenticatedUser) RoundTripper ¶
func (a *AuthenticatedUser) RoundTripper(base http.RoundTripper) http.RoundTripper
RoundTripper returns a http.RoundTripper configured with the user's access token.
func (*AuthenticatedUser) SetAuthorizationHeader ¶
func (a *AuthenticatedUser) SetAuthorizationHeader(headers http.Header) error
SetAuthorizationHeader sets the "Authorization" header with the user's access token.