Documentation
¶
Index ¶
- func GetSSHKeysFromGitHubTeam(client GitHubClient, org, teamSlug string) (string, error)
- type GitHubClient
- type MockGitHubClient
- func (_m *MockGitHubClient) EXPECT() *MockGitHubClient_Expecter
- func (_mock *MockGitHubClient) ListTeamMembersBySlug(ctx context.Context, org string, teamSlug string, ...) ([]*github.User, error)
- func (_mock *MockGitHubClient) ListUserKeys(ctx context.Context, username string) ([]*github.Key, error)
- type MockGitHubClient_Expecter
- func (_e *MockGitHubClient_Expecter) ListTeamMembersBySlug(ctx interface{}, org interface{}, teamSlug interface{}, opts interface{}) *MockGitHubClient_ListTeamMembersBySlug_Call
- func (_e *MockGitHubClient_Expecter) ListUserKeys(ctx interface{}, username interface{}) *MockGitHubClient_ListUserKeys_Call
- type MockGitHubClient_ListTeamMembersBySlug_Call
- func (_c *MockGitHubClient_ListTeamMembersBySlug_Call) Return(users []*github.User, err error) *MockGitHubClient_ListTeamMembersBySlug_Call
- func (_c *MockGitHubClient_ListTeamMembersBySlug_Call) Run(run func(ctx context.Context, org string, teamSlug string, ...)) *MockGitHubClient_ListTeamMembersBySlug_Call
- func (_c *MockGitHubClient_ListTeamMembersBySlug_Call) RunAndReturn(...) *MockGitHubClient_ListTeamMembersBySlug_Call
- type MockGitHubClient_ListUserKeys_Call
- func (_c *MockGitHubClient_ListUserKeys_Call) Return(keys []*github.Key, err error) *MockGitHubClient_ListUserKeys_Call
- func (_c *MockGitHubClient_ListUserKeys_Call) Run(run func(ctx context.Context, username string)) *MockGitHubClient_ListUserKeys_Call
- func (_c *MockGitHubClient_ListUserKeys_Call) RunAndReturn(run func(ctx context.Context, username string) ([]*github.Key, error)) *MockGitHubClient_ListUserKeys_Call
- type RealGitHubClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSSHKeysFromGitHubTeam ¶
func GetSSHKeysFromGitHubTeam(client GitHubClient, org, teamSlug string) (string, error)
GetSSHKeysFromGitHubTeam fetches the public SSH keys of all members of the specified GitHub team and formats them for inclusion in instance metadata.
Types ¶
type GitHubClient ¶
type GitHubClient interface {
ListTeamMembersBySlug(ctx context.Context, org, teamSlug string, opts *github.TeamListTeamMembersOptions) ([]*github.User, error)
ListUserKeys(ctx context.Context, username string) ([]*github.Key, error)
}
GitHubClient abstracts the GitHub API calls used to fetch team SSH keys.
type MockGitHubClient ¶
MockGitHubClient is an autogenerated mock type for the GitHubClient type
func NewMockGitHubClient ¶
func NewMockGitHubClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockGitHubClient
NewMockGitHubClient creates a new instance of MockGitHubClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockGitHubClient) EXPECT ¶
func (_m *MockGitHubClient) EXPECT() *MockGitHubClient_Expecter
func (*MockGitHubClient) ListTeamMembersBySlug ¶
func (_mock *MockGitHubClient) ListTeamMembersBySlug(ctx context.Context, org string, teamSlug string, opts *github.TeamListTeamMembersOptions) ([]*github.User, error)
ListTeamMembersBySlug provides a mock function for the type MockGitHubClient
func (*MockGitHubClient) ListUserKeys ¶
func (_mock *MockGitHubClient) ListUserKeys(ctx context.Context, username string) ([]*github.Key, error)
ListUserKeys provides a mock function for the type MockGitHubClient
type MockGitHubClient_Expecter ¶
type MockGitHubClient_Expecter struct {
// contains filtered or unexported fields
}
func (*MockGitHubClient_Expecter) ListTeamMembersBySlug ¶
func (_e *MockGitHubClient_Expecter) ListTeamMembersBySlug(ctx interface{}, org interface{}, teamSlug interface{}, opts interface{}) *MockGitHubClient_ListTeamMembersBySlug_Call
ListTeamMembersBySlug is a helper method to define mock.On call
- ctx context.Context
- org string
- teamSlug string
- opts *github.TeamListTeamMembersOptions
func (*MockGitHubClient_Expecter) ListUserKeys ¶
func (_e *MockGitHubClient_Expecter) ListUserKeys(ctx interface{}, username interface{}) *MockGitHubClient_ListUserKeys_Call
ListUserKeys is a helper method to define mock.On call
- ctx context.Context
- username string
type MockGitHubClient_ListTeamMembersBySlug_Call ¶
MockGitHubClient_ListTeamMembersBySlug_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListTeamMembersBySlug'
func (*MockGitHubClient_ListTeamMembersBySlug_Call) Return ¶
func (_c *MockGitHubClient_ListTeamMembersBySlug_Call) Return(users []*github.User, err error) *MockGitHubClient_ListTeamMembersBySlug_Call
func (*MockGitHubClient_ListTeamMembersBySlug_Call) Run ¶
func (_c *MockGitHubClient_ListTeamMembersBySlug_Call) Run(run func(ctx context.Context, org string, teamSlug string, opts *github.TeamListTeamMembersOptions)) *MockGitHubClient_ListTeamMembersBySlug_Call
func (*MockGitHubClient_ListTeamMembersBySlug_Call) RunAndReturn ¶
func (_c *MockGitHubClient_ListTeamMembersBySlug_Call) RunAndReturn(run func(ctx context.Context, org string, teamSlug string, opts *github.TeamListTeamMembersOptions) ([]*github.User, error)) *MockGitHubClient_ListTeamMembersBySlug_Call
type MockGitHubClient_ListUserKeys_Call ¶
MockGitHubClient_ListUserKeys_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUserKeys'
func (*MockGitHubClient_ListUserKeys_Call) Return ¶
func (_c *MockGitHubClient_ListUserKeys_Call) Return(keys []*github.Key, err error) *MockGitHubClient_ListUserKeys_Call
func (*MockGitHubClient_ListUserKeys_Call) Run ¶
func (_c *MockGitHubClient_ListUserKeys_Call) Run(run func(ctx context.Context, username string)) *MockGitHubClient_ListUserKeys_Call
func (*MockGitHubClient_ListUserKeys_Call) RunAndReturn ¶
func (_c *MockGitHubClient_ListUserKeys_Call) RunAndReturn(run func(ctx context.Context, username string) ([]*github.Key, error)) *MockGitHubClient_ListUserKeys_Call
type RealGitHubClient ¶
type RealGitHubClient struct {
// contains filtered or unexported fields
}
func NewGitHubClient ¶
func NewGitHubClient(ctx context.Context, token string) *RealGitHubClient
NewGitHubClient creates a new RealGitHubClient with the provided OAuth token.
func (*RealGitHubClient) ListTeamMembersBySlug ¶
func (c *RealGitHubClient) ListTeamMembersBySlug(ctx context.Context, org, teamSlug string, opts *github.TeamListTeamMembersOptions) ([]*github.User, error)
ListTeamMembersBySlug lists the members of a GitHub team identified by its slug.
func (*RealGitHubClient) ListUserKeys ¶
func (c *RealGitHubClient) ListUserKeys(ctx context.Context, username string) ([]*github.Key, error)
ListUserKeys lists the public SSH keys of a GitHub user.