github

package
v5.45.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 37 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PROTECTION_ALLOWS_DELETIONS                 = "allows_deletions"
	PROTECTION_ALLOWS_FORCE_PUSHES              = "allows_force_pushes"
	PROTECTION_BLOCKS_CREATIONS                 = "blocks_creations"
	PROTECTION_DISMISSES_STALE_REVIEWS          = "dismiss_stale_reviews"
	PROTECTION_IS_ADMIN_ENFORCED                = "enforce_admins"
	PROTECTION_PATTERN                          = "pattern"
	PROTECTION_REQUIRED_APPROVING_REVIEW_COUNT  = "required_approving_review_count"
	PROTECTION_REQUIRED_STATUS_CHECK_CONTEXTS   = "contexts"
	PROTECTION_REQUIRES_APPROVING_REVIEWS       = "required_pull_request_reviews"
	PROTECTION_REQUIRES_CODE_OWNER_REVIEWS      = "require_code_owner_reviews"
	PROTECTION_REQUIRES_COMMIT_SIGNATURES       = "require_signed_commits"
	PROTECTION_REQUIRES_LINEAR_HISTORY          = "required_linear_history"
	PROTECTION_REQUIRES_CONVERSATION_RESOLUTION = "require_conversation_resolution"
	PROTECTION_REQUIRES_STATUS_CHECKS           = "required_status_checks"
	PROTECTION_REQUIRES_STRICT_STATUS_CHECKS    = "strict"
	PROTECTION_RESTRICTS_PUSHES                 = "push_restrictions"
	PROTECTION_RESTRICTS_REVIEW_DISMISSALS      = "restrict_dismissals"
	PROTECTION_RESTRICTS_REVIEW_DISMISSERS      = "dismissal_restrictions"
	PROTECTION_FORCE_PUSHES_BYPASSERS           = "force_push_bypassers"
	PROTECTION_PULL_REQUESTS_BYPASSERS          = "pull_request_bypassers"
	PROTECTION_LOCK_BRANCH                      = "lock_branch"
	PROTECTION_REQUIRES_LAST_PUSH_APPROVAL      = "require_last_push_approval"

	REPOSITORY_ID = "repository_id"
)

Variables

This section is empty.

Functions

func GenerateOAuthTokenFromApp

func GenerateOAuthTokenFromApp(baseURL, appID, appInstallationID, pemData string) (string, error)

GenerateOAuthTokenFromApp generates a GitHub OAuth access token from a set of valid GitHub App credentials. The returned token can be used to interact with both GitHub's REST and GraphQL APIs.

func NewEtagTransport

func NewEtagTransport(rt http.RoundTripper) *etagTransport

func OwnerOrOrgEnvDefaultFunc

func OwnerOrOrgEnvDefaultFunc() (interface{}, error)

func Provider

func Provider() terraform.ResourceProvider

func RateLimitedHTTPClient

func RateLimitedHTTPClient(client *http.Client, writeDelay time.Duration, readDelay time.Duration, parallelRequests bool) *http.Client

Types

type Actor

type Actor struct {
	ID   githubv4.ID
	Name githubv4.String
	Slug githubv4.String
}

type ActorUser added in v5.4.0

type ActorUser struct {
	ID    githubv4.ID
	Name  githubv4.String
	Login githubv4.String
}

type BranchProtectionResourceData

type BranchProtectionResourceData struct {
	AllowsDeletions                bool
	AllowsForcePushes              bool
	BlocksCreations                bool
	BranchProtectionRuleID         string
	BypassForcePushActorIDs        []string
	BypassPullRequestActorIDs      []string
	DismissesStaleReviews          bool
	IsAdminEnforced                bool
	Pattern                        string
	PushActorIDs                   []string
	RepositoryID                   string
	RequiredApprovingReviewCount   int
	RequiredStatusCheckContexts    []string
	RequiresApprovingReviews       bool
	RequiresCodeOwnerReviews       bool
	RequiresCommitSignatures       bool
	RequiresLinearHistory          bool
	RequiresConversationResolution bool
	RequiresStatusChecks           bool
	RequiresStrictStatusChecks     bool
	RestrictsPushes                bool
	RestrictsReviewDismissals      bool
	ReviewDismissalActorIDs        []string
	RequireLastPushApproval        bool
	LockBranch                     bool
}

type BranchProtectionRule

type BranchProtectionRule struct {
	Repository struct {
		ID   githubv4.String
		Name githubv4.String
	}
	PushAllowances struct {
		Nodes []PushActorTypes
	} `graphql:"pushAllowances(first: 100)"`
	ReviewDismissalAllowances struct {
		Nodes []DismissalActorTypes
	} `graphql:"reviewDismissalAllowances(first: 100)"`
	BypassForcePushAllowances struct {
		Nodes []BypassForcePushActorTypes
	} `graphql:"bypassForcePushAllowances(first: 100)"`
	BypassPullRequestAllowances struct {
		Nodes []BypassPullRequestActorTypes
	} `graphql:"bypassPullRequestAllowances(first: 100)"`
	AllowsDeletions                githubv4.Boolean
	AllowsForcePushes              githubv4.Boolean
	BlocksCreations                githubv4.Boolean
	DismissesStaleReviews          githubv4.Boolean
	ID                             githubv4.ID
	IsAdminEnforced                githubv4.Boolean
	Pattern                        githubv4.String
	RequiredApprovingReviewCount   githubv4.Int
	RequiredStatusCheckContexts    []githubv4.String
	RequiresApprovingReviews       githubv4.Boolean
	RequiresCodeOwnerReviews       githubv4.Boolean
	RequiresCommitSignatures       githubv4.Boolean
	RequiresLinearHistory          githubv4.Boolean
	RequiresConversationResolution githubv4.Boolean
	RequiresStatusChecks           githubv4.Boolean
	RequiresStrictStatusChecks     githubv4.Boolean
	RestrictsPushes                githubv4.Boolean
	RestrictsReviewDismissals      githubv4.Boolean
	RequireLastPushApproval        githubv4.Boolean
	LockBranch                     githubv4.Boolean
}

type BypassForcePushActorTypes added in v5.27.0

type BypassForcePushActorTypes struct {
	Actor struct {
		App  Actor     `graphql:"... on App"`
		Team Actor     `graphql:"... on Team"`
		User ActorUser `graphql:"... on User"`
	}
}

type BypassPullRequestActorTypes

type BypassPullRequestActorTypes struct {
	Actor struct {
		App  Actor     `graphql:"... on App"`
		Team Actor     `graphql:"... on Team"`
		User ActorUser `graphql:"... on User"`
	}
}

type Config

type Config struct {
	Token            string
	Owner            string
	BaseURL          string
	Insecure         bool
	WriteDelay       time.Duration
	ReadDelay        time.Duration
	ParallelRequests bool
}

func (*Config) Anonymous

func (c *Config) Anonymous() bool

func (*Config) AnonymousHTTPClient

func (c *Config) AnonymousHTTPClient() *http.Client

func (*Config) AuthenticatedHTTPClient

func (c *Config) AuthenticatedHTTPClient() *http.Client

func (*Config) ConfigureOwner

func (c *Config) ConfigureOwner(owner *Owner) (*Owner, error)

func (*Config) Meta

func (c *Config) Meta() (interface{}, error)

Meta returns the meta parameter that is passed into subsequent resources https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/helper/schema#ConfigureFunc

func (*Config) NewGraphQLClient

func (c *Config) NewGraphQLClient(client *http.Client) (*githubv4.Client, error)

func (*Config) NewRESTClient

func (c *Config) NewRESTClient(client *http.Client) (*github.Client, error)

type DismissalActorTypes

type DismissalActorTypes struct {
	Actor struct {
		App  Actor     `graphql:"... on App"`
		Team Actor     `graphql:"... on Team"`
		User ActorUser `graphql:"... on User"`
	}
}

type ExternalIdentities added in v5.33.0

type ExternalIdentities struct {
	Edges []struct {
		Node struct {
			User struct {
				Login githubv4.String
			}
			SamlIdentity struct {
				NameId     githubv4.String
				Username   githubv4.String
				GivenName  githubv4.String
				FamilyName githubv4.String
			}
			ScimIdentity struct {
				Username   githubv4.String
				GivenName  githubv4.String
				FamilyName githubv4.String
			}
		}
	}
	PageInfo struct {
		EndCursor   githubv4.String
		HasNextPage bool
	}
}

type MemberChange

type MemberChange struct {
	Old, New map[string]interface{}
}

type Owner

type Owner struct {
	StopContext    context.Context
	IsOrganization bool
	// contains filtered or unexported fields
}

type PageInfo

type PageInfo struct {
	EndCursor   githubv4.String
	HasNextPage bool
}

type PushActorTypes

type PushActorTypes struct {
	Actor struct {
		App  Actor     `graphql:"... on App"`
		Team Actor     `graphql:"... on Team"`
		User ActorUser `graphql:"... on User"`
	}
}

type RateLimitTransport

type RateLimitTransport struct {
	// contains filtered or unexported fields
}

RateLimitTransport implements GitHub's best practices for avoiding rate limits https://developer.github.com/v3/guides/best-practices-for-integrators/#dealing-with-abuse-rate-limits

func NewRateLimitTransport

func NewRateLimitTransport(rt http.RoundTripper, options ...RateLimitTransportOption) *RateLimitTransport

NewRateLimitTransport takes in an http.RoundTripper and a variadic list of optional functions that modify the RateLimitTransport struct itself. This may be used to alter the write delay in between requests, for example.

func (*RateLimitTransport) RoundTrip

func (rlt *RateLimitTransport) RoundTrip(req *http.Request) (*http.Response, error)

type RateLimitTransportOption

type RateLimitTransportOption func(*RateLimitTransport)

func WithParallelRequests added in v5.25.0

func WithParallelRequests(p bool) RateLimitTransportOption

WithParallelRequests is used to enforce serial api requests for rate limits

func WithReadDelay

func WithReadDelay(d time.Duration) RateLimitTransportOption

WithReadDelay is used to set the delay between read requests

func WithWriteDelay

func WithWriteDelay(d time.Duration) RateLimitTransportOption

WithWriteDelay is used to set the write delay between requests

type TeamsQuery

type TeamsQuery struct {
	Organization struct {
		ID    githubv4.String
		Teams struct {
			Nodes []struct {
				ID          githubv4.String
				DatabaseID  githubv4.Int
				Slug        githubv4.String
				Name        githubv4.String
				Description githubv4.String
				Privacy     githubv4.String
				Parent      struct {
					ID   githubv4.String
					Slug githubv4.String
					Name githubv4.String
				} `graphql:"parentTeam"`
				Members struct {
					Nodes []struct {
						Login githubv4.String
					}
				} `graphql:"members @skip(if: $summaryOnly)"`
				Repositories struct {
					Nodes []struct {
						Name githubv4.String
					}
				} `graphql:"repositories @skip(if: $summaryOnly)"`
			}
			PageInfo PageInfo
		} `graphql:"teams(first:$first, after:$cursor, rootTeamsOnly:$rootTeamsOnly)"`
	} `graphql:"organization(login:$login)"`
}

type UpdateTeamReviewAssignmentInput added in v5.9.0

type UpdateTeamReviewAssignmentInput struct {
	ClientMutationID                 string `json:"clientMutationId,omitempty"`
	TeamID                           string `graphql:"id" json:"id"`
	ReviewRequestDelegation          bool   `graphql:"enabled" json:"enabled"`
	ReviewRequestDelegationAlgorithm string `graphql:"algorithm" json:"algorithm"`
	ReviewRequestDelegationCount     int    `graphql:"teamMemberCount" json:"teamMemberCount"`
	ReviewRequestDelegationNotifyAll bool   `graphql:"notifyTeam" json:"notifyTeam"`
}

Source Files

Jump to

Keyboard shortcuts

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