Documentation ¶
Overview ¶
Package cloud provides types for use with cloud providers.
Index ¶
- func NewTestModuleRepo(provider, name string) string
- func NewTestRepo() string
- type Client
- type ClientOptions
- type Cloud
- type CloudOAuthConfig
- type Config
- type CreateWebhookOptions
- type Credentials
- type DeleteWebhookOptions
- type EventHandler
- type GetRepoTarballOptions
- type GetWebhookOptions
- type HandleEventOptions
- type ListRepositoriesOptions
- type ListTagsOptions
- type OIDCConfig
- type Service
- type SetStatusOptions
- type Team
- type UpdateWebhookOptions
- type User
- type VCSEvent
- type VCSEventType
- type VCSPullEvent
- type VCSPullEventAction
- type VCSPushEvent
- type VCSStatus
- type VCSTagEvent
- type VCSTagEventAction
- type Webhook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestModuleRepo ¶
func NewTestRepo ¶
func NewTestRepo() string
Types ¶
type Client ¶
type Client interface { GetUser(ctx context.Context) (*User, error) // ListRepositories lists repositories accessible to the current user. ListRepositories(ctx context.Context, opts ListRepositoriesOptions) ([]string, error) GetRepository(ctx context.Context, identifier string) (string, error) // GetRepoTarball retrieves a .tar.gz tarball of a git repository GetRepoTarball(ctx context.Context, opts GetRepoTarballOptions) ([]byte, error) // CreateWebhook creates a webhook on the cloud provider, returning the // provider's unique ID for the webhook. CreateWebhook(ctx context.Context, opts CreateWebhookOptions) (string, error) UpdateWebhook(ctx context.Context, id string, opts UpdateWebhookOptions) error GetWebhook(ctx context.Context, opts GetWebhookOptions) (Webhook, error) DeleteWebhook(ctx context.Context, opts DeleteWebhookOptions) error SetStatus(ctx context.Context, opts SetStatusOptions) error // ListTags lists git tags on a repository. Each tag should be prefixed with // 'tags/'. ListTags(ctx context.Context, opts ListTagsOptions) ([]string, error) }
type ClientOptions ¶
type ClientOptions struct { Hostname string SkipTLSVerification bool Credentials }
ClientOptions are options for constructing a cloud client
type Cloud ¶
type Cloud interface { NewClient(context.Context, ClientOptions) (Client, error) EventHandler }
Cloud is an external provider of various cloud services e.g. identity provider, VCS repositories etc.
type CloudOAuthConfig ¶
CloudOAuthConfig is the configuration for a cloud provider and its OAuth configuration.
type Config ¶
Config is configuration for a cloud provider
func (*Config) HTTPClient ¶
type CreateWebhookOptions ¶
type CreateWebhookOptions struct { Repo string // repo identifier, <owner>/<repo> Secret string // secret string for generating signature Endpoint string // otf's external-facing host[:port] Events []VCSEventType }
type Credentials ¶
type Credentials struct { // tokens are mutually-exclusive - at least one must be specified OAuthToken *oauth2.Token PersonalToken *string }
Credentials are credentials for a cloud client
type DeleteWebhookOptions ¶
type DeleteWebhookOptions struct { Repo string // Repository identifier, <owner>/<repo> ID string // vcs' webhook ID }
DeleteWebhookOptions are options for deleting a webhook.
type EventHandler ¶
type EventHandler interface { // HandleEvent extracts a cloud-specific event from the http request, converting it into a // VCS event. Returns nil if the event is to be ignored. HandleEvent(w http.ResponseWriter, r *http.Request, opts HandleEventOptions) VCSEvent }
EventHandler handles incoming events
type GetRepoTarballOptions ¶
type GetWebhookOptions ¶
type GetWebhookOptions struct { Repo string // Repository identifier, <owner>/<repo> ID string // vcs' webhook ID }
GetWebhookOptions are options for retrieving a webhook.
type HandleEventOptions ¶
type ListRepositoriesOptions ¶
type ListRepositoriesOptions struct {
PageSize int
}
type ListTagsOptions ¶
type ListTagsOptions struct { Repo string // repo identifier, <owner>/<repo> Prefix string // only list tags that start with this string }
ListTagsOptions are options for listing tags on a vcs repository
type OIDCConfig ¶
type OIDCConfig struct { // Name is the user-friendly identifier of the oidc endpoint. Name string // IssuerURL is the issuer url for the oidc provider. IssuerURL string // RedirectURL is the redirect url for the oidc provider. RedirectURL string // ClientID is the client id for the oidc provider. ClientID string // ClientSecret is the client secret for the oidc provider. ClientSecret string // Scopes is a list of optional scopes to pass to the oidc provider. Scopes []string // Skip TLS Verification when communicating with issuer SkipTLSVerification bool }
OIDCConfig is the configuration for a generic oidc provider.
type SetStatusOptions ¶
type SetStatusOptions struct { Workspace string // workspace name Repo string // <owner>/<repo> Ref string // git ref Status VCSStatus TargetURL string Description string }
SetStatusOptions are options for setting a status on a VCS repo
type UpdateWebhookOptions ¶
type UpdateWebhookOptions CreateWebhookOptions
type VCSEvent ¶
type VCSEvent any
VCSEvent is a VCS event received from a cloud, e.g. a commit event from github
type VCSEventType ¶
type VCSEventType int
const ( VCSPullEventType VCSEventType = iota VCSPushEventType )
type VCSPullEvent ¶
type VCSPullEvent struct { RepoID uuid.UUID Action VCSPullEventAction CommitSHA string Branch string // head branch DefaultBranch string }
VCSPullEvent occurs when an action is carried out on a pull request
type VCSPullEventAction ¶
type VCSPullEventAction string
const ( VCSPullEventOpened VCSPullEventAction = "opened" VCSPullEventClosed VCSPullEventAction = "closed" // closed without merging VCSPullEventMerged VCSPullEventAction = "merged" VCSPullEventUpdated VCSPullEventAction = "updated" )
type VCSPushEvent ¶
VCSPushEvent occurs when a commit is pushed to a repo.
type VCSTagEvent ¶
type VCSTagEvent struct { RepoID uuid.UUID CommitSHA string Tag string Action VCSTagEventAction DefaultBranch string }
VCSTagEvent occurs when a tag is created or deleted on a repo.
type VCSTagEventAction ¶
type VCSTagEventAction string
const ( VCSTagEventCreatedAction VCSTagEventAction = "created" VCSTagEventDeletedAction VCSTagEventAction = "deleted" )