Documentation ¶
Index ¶
- type CIDR
- type Client
- func (c *Client) CreateIPAllowListEntry(ctx context.Context, ownerID string, name string, value CIDR, isActive bool) (*IPAllowListEntry, error)
- func (c *Client) DeleteIPAllowListEntry(ctx context.Context, entryID string) (string, error)
- func (c *Client) GetEnterpriseID(ctx context.Context, enterpriseName string) (string, error)
- func (c *Client) GetEnterpriseIPAllowListEntries(ctx context.Context, enterpriseName string) ([]*IPAllowListEntry, error)
- func (c *Client) GetOrganizationID(ctx context.Context, organizationName string) (string, error)
- func (c *Client) GetOrganizationIPAllowListEntries(ctx context.Context, organizationName string) ([]*IPAllowListEntry, error)
- func (c *Client) UpdateIPAllowListEntry(ctx context.Context, entryID string, params IPAllowListEntryParameters) (*IPAllowListEntry, error)
- type ClientOption
- type ClientOptions
- type CreateIPAllowListEntryMutationResponse
- type DeleteUpAllowListEntryMutationResponse
- type Error
- type ErrorWithStatusCode
- type GetEnterpriseIDQueryResponse
- type GetEnterpriseIPAllowListQueryResponse
- type GetOrganizationIDQueryResponse
- type GetOrganizationIPAllowListQueryResponse
- type GraphQLRequest
- type GraphQLResponse
- type IPAllowListEntry
- type IPAllowListEntryParameters
- type PageInfo
- type UpdateIPAllowListEntryMutationResponse
- type Variables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewAuthenticatedGitHubClient ¶
func NewAuthenticatedGitHubClient(ctx context.Context, token string, opts ...ClientOption) *Client
NewAuthenticatedGitHubClient creates a new authenticated client (using Personal Access Token (classic)) with given ClientOptions
func NewGitHubClient ¶
func NewGitHubClient(httpClient *http.Client, opts ...ClientOption) *Client
NewGitHubClient creates a new client with a given http.Client and ClientOptions. This client does not handle authorization nor authentication, instead relies on http.Client implementation.
func (*Client) CreateIPAllowListEntry ¶
func (c *Client) CreateIPAllowListEntry(ctx context.Context, ownerID string, name string, value CIDR, isActive bool) (*IPAllowListEntry, error)
CreateIPAllowListEntry uses createIpAllowListEntry GraphQL mutation to create a new IP allow list entry for a given ownerID (organization or enterprise). Returns the newly created entry.
func (*Client) DeleteIPAllowListEntry ¶
DeleteIPAllowListEntry uses deleteIpAllowListEntry GraphQL mutation to delete an IP allow list entry with a given entryID. Returns entryID of the deleted entry.
func (*Client) GetEnterpriseID ¶
GetEnterpriseID fetches GitHub GraphQL API node_id for given enterpriseName.
func (*Client) GetEnterpriseIPAllowListEntries ¶
func (c *Client) GetEnterpriseIPAllowListEntries(ctx context.Context, enterpriseName string) ([]*IPAllowListEntry, error)
GetEnterpriseIPAllowListEntries retrieves IP allow list entries for a given enterpriseName.
func (*Client) GetOrganizationID ¶
GetOrganizationID fetches GitHub GraphQL API node_id for given organizationName.
func (*Client) GetOrganizationIPAllowListEntries ¶
func (c *Client) GetOrganizationIPAllowListEntries(ctx context.Context, organizationName string) ([]*IPAllowListEntry, error)
GetOrganizationIPAllowListEntries retrieves IP allow list entries for a given organizationName. Returns a slice of pointers to an entry as the API returns nil for entries managed on an enterprise level.
func (*Client) UpdateIPAllowListEntry ¶
func (c *Client) UpdateIPAllowListEntry(ctx context.Context, entryID string, params IPAllowListEntryParameters) (*IPAllowListEntry, error)
UpdateIPAllowListEntry uses updateIpAllowListEntry GraphQL mutation to set attributes an IP allow list entry with a given entryID to params. Returns the updated entry.
type ClientOption ¶
type ClientOption func(options *ClientOptions)
func WithConcurrency ¶
func WithConcurrency(concurrency int64) ClientOption
WithConcurrency determines maximum number of concurrent requests to the GitHub GraphQL API. Used to control rate limiting. concurrency must be >= 1, otherwise the option is ignored.
func WithEntriesCaching ¶
func WithEntriesCaching() ClientOption
WithEntriesCaching enables an entries cache. It reduces number of calls to GitHub's GraphQL API reducing rate limiting pressure.
func WithGraphQLAPIURL ¶
func WithGraphQLAPIURL(graphQLAPIURL string) ClientOption
WithGraphQLAPIURL sets GitHub's base GraphQL API URL.
func WithHeaders ¶
func WithHeaders(headers map[string]string) ClientOption
WithHeaders adds additional HTTP headers
func WithoutEntriesCaching ¶
func WithoutEntriesCaching() ClientOption
WithoutEntriesCaching disables an entries cache. Without caching client will perform multiple calls to GitHub's GraphQL API for each entry listing function call like GetOrganizationIPAllowListEntries. Also, it might put pressure on yours GitHub rate limit.
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
type CreateIPAllowListEntryMutationResponse ¶
type CreateIPAllowListEntryMutationResponse struct { CreateIPAllowListEntry struct { IPAllowListEntry IPAllowListEntry `json:"ipAllowListEntry"` } `json:"createIpAllowListEntry"` }
type DeleteUpAllowListEntryMutationResponse ¶
type DeleteUpAllowListEntryMutationResponse struct { DeleteIPAllowListEntry struct { IPAllowListEntry struct { ID string `json:"id"` } `json:"ipAllowListEntry"` } `json:"deleteIpAllowListEntry"` }
type ErrorWithStatusCode ¶
type ErrorWithStatusCode struct { StatusCode int // contains filtered or unexported fields }
func (ErrorWithStatusCode) Error ¶
func (e ErrorWithStatusCode) Error() string
type GetEnterpriseIDQueryResponse ¶
type GetEnterpriseIDQueryResponse struct { Enterprise struct { ID string `json:"id"` } `json:"enterprise"` }
type GetEnterpriseIPAllowListQueryResponse ¶
type GetEnterpriseIPAllowListQueryResponse struct { Enterprise struct { OwnerInfo struct { IPAllowListEntries struct { Nodes []*IPAllowListEntry `json:"nodes"` PageInfo PageInfo `json:"pageInfo"` } `json:"ipAllowListEntries"` } `json:"ownerInfo"` } `json:"enterprise"` }
type GetOrganizationIDQueryResponse ¶
type GetOrganizationIDQueryResponse struct { Organization struct { ID string `json:"id"` } `json:"organization"` }
type GetOrganizationIPAllowListQueryResponse ¶
type GetOrganizationIPAllowListQueryResponse struct { Organization struct { IPAllowListEntries struct { Nodes []*IPAllowListEntry `json:"nodes"` PageInfo PageInfo `json:"pageInfo"` } `json:"ipAllowListEntries"` } `json:"organization"` }
type GraphQLRequest ¶
type GraphQLResponse ¶
type GraphQLResponse struct { Data json.RawMessage `json:"data"` Errors []Error `json:"errors"` }
type IPAllowListEntry ¶
type UpdateIPAllowListEntryMutationResponse ¶
type UpdateIPAllowListEntryMutationResponse struct { UpdateIPAllowListEntry struct { IPAllowListEntry IPAllowListEntry `json:"ipAllowListEntry"` } `json:"updateIpAllowListEntry"` }