Documentation
¶
Overview ¶
Package mockapi provides mocks of the HTTP API for use in integration tests.
Index ¶
- Constants
- Variables
- func JWTAccessToken(id string, expires time.Time) string
- func NumericID() string
- func Problem(status int, detail string) string
- func ProjectID() string
- func RequestLogger(t testing.TB) func(http.Handler) http.Handler
- func SSHKeyFingerprint(publicKey string) string
- type Activity
- type App
- type AuthServer
- func (s *AuthServer) APITokenExchanges() int
- func (s *AuthServer) AddRefreshToken(token string)
- func (s *AuthServer) AuthorizePrompts() []string
- func (s *AuthServer) RefreshRequests() int
- func (s *AuthServer) ReuseDetected() bool
- func (s *AuthServer) RevokedTokens() []string
- func (s *AuthServer) SSHCertificateCount() int
- func (s *AuthServer) SetJWTAccessTokens(jwt bool)
- func (s *AuthServer) SetRefreshDelay(d time.Duration)
- func (s *AuthServer) SetRefreshFailures(n int)
- func (s *AuthServer) SetRevokeFailures(n, status int)
- func (s *AuthServer) SetSSHCertificate(keyID string, lifetime time.Duration)
- func (s *AuthServer) SetTokenLifetime(d time.Duration)
- func (s *AuthServer) SetUniqueAccessTokens(unique bool)
- type Backup
- type BillingProfile
- type CanCreateRequiredAction
- type CanCreateResponse
- type Certificate
- type Commands
- type Deployment
- type Domain
- type DomainSSL
- type EnvLevelVariable
- type Environment
- type EnvironmentAction
- type HALLink
- type HalLinks
- type Handler
- func (h *Handler) AllRequests() []Request
- func (s *Handler) AutoscalingPatches(projectID, environmentID string) []map[string]any
- func (s *Handler) BackupRestores(projectID string) []map[string]any
- func (s *Handler) BillingProfile(id string) *BillingProfile
- func (h *Handler) DeploymentPatches(projectID, environmentID string) []map[string]any
- func (s *Handler) Domains(projectID, environmentID string) []*Domain
- func (s *Handler) Environment(projectID, environmentID string) *Environment
- func (s *Handler) EnvironmentActions(projectID, environmentID string) []EnvironmentAction
- func (h *Handler) FailNext(method, pattern string, status int, body string)
- func (s *Handler) Integrations(projectID string) []*Integration
- func (s *Handler) OrgIDs() []string
- func (s *Handler) OrgInvitations(orgID string) []OrgInvitation
- func (s *Handler) ProjectActivities(projectID string) []*Activity
- func (s *Handler) ProjectBackups(projectID string) []*Backup
- func (s *Handler) ProjectCertificates(projectID string) []*Certificate
- func (s *Handler) ProjectIDs() []string
- func (s *Handler) ProjectInvitations(projectID string) []ProjectInvitation
- func (s *Handler) ProjectSettingsPatches(projectID string) []map[string]any
- func (h *Handler) RejectAccessToken(token string)
- func (h *Handler) Requests(method, pattern string) []Request
- func (h *Handler) RequireStepUp(amr []string)
- func (h *Handler) RespondWithActivity(w http.ResponseWriter, projectID, environmentID, activityType string)
- func (s *Handler) SSHKeys() []*SSHKey
- func (s *Handler) SetActivityResult(result string)
- func (s *Handler) SetBillingProfiles(profiles []*BillingProfile)
- func (s *Handler) SetCanCreate(orgID string, r *CanCreateResponse)
- func (s *Handler) SetEnvLevelVariables(projectID, environmentID string, vars []*EnvLevelVariable)
- func (s *Handler) SetEnvironmentDomains(projectID, environmentID string, domains []*Domain)
- func (s *Handler) SetEnvironments(envs []*Environment)
- func (s *Handler) SetMyUser(u *User)
- func (s *Handler) SetOrgMembers(orgID string, members []*OrgMember)
- func (s *Handler) SetOrgs(orgs []*Org)
- func (s *Handler) SetOtherUserSSHKeys(values []string)
- func (s *Handler) SetProjectActivities(projectID string, activities []*Activity)
- func (s *Handler) SetProjectBackups(projectID string, backups []*Backup)
- func (s *Handler) SetProjectCertificates(projectID string, certs []*Certificate)
- func (s *Handler) SetProjectDomains(projectID string, domains []*Domain)
- func (s *Handler) SetProjectIntegrations(projectID string, integrations []*Integration)
- func (s *Handler) SetProjectVariables(projectID string, vars []*Variable)
- func (s *Handler) SetProjects(pros []*Project)
- func (s *Handler) SetSSHKeySource(source string)
- func (s *Handler) SetSSHKeys(keys []*SSHKey)
- func (s *Handler) SetTeamMembers(teamID string, members []*TeamMember)
- func (s *Handler) SetTeamProjects(teamID string, projects []*TeamProjectAccess)
- func (s *Handler) SetTeams(teams []*Team)
- func (s *Handler) SetUserGrants(grants []*UserGrant)
- type Integration
- type InvitationPermission
- type Mount
- type NameAttr
- type Org
- type OrgInvitation
- type OrgMember
- type OrgProject
- type OrgRef
- type Project
- type ProjectInvitation
- type ProjectRef
- type ProjectRepository
- type ProjectSubscriptionInfo
- type ProjectUserGrant
- type Request
- type SSHKey
- type Service
- type Subscription
- type Team
- type TeamCounts
- type TeamMember
- type TeamProjectAccess
- type User
- type UserGrant
- type UserRef
- type Variable
- type Worker
- type WorkerInfo
Constants ¶
const ( ActivityResultSuccess = "success" ActivityResultFailure = "failure" )
Activity results.
const ( SSHKeySourceAccounts = "accounts" SSHKeySourceAuth = "auth" )
SSH key sources, reported by /ssh-key-source.
const ActivityStateCancelled = "cancelled" //nolint:misspell // The API's spelling.
ActivityStateCancelled is the state of an activity after cancellation.
Variables ¶
var TestPhoneVerificationCode = "123456"
var ValidAPITokens = []string{"api-token-1", "api-token-2"}
ValidAPITokens are the API tokens that the server accepts. Each is exchanged for the access token at the same index in accessTokens, unless SetUniqueAccessTokens is used.
Functions ¶
func JWTAccessToken ¶
JWTAccessToken returns an unsigned JWT with the given "jti" and "exp" claims.
func RequestLogger ¶
RequestLogger logs requests to the test log, so that parallel tests' logs are not interleaved.
func SSHKeyFingerprint ¶
SSHKeyFingerprint returns the SHA-256 fingerprint of a public key, in the format of `ssh-keygen -l`.
Types ¶
type Activity ¶
type Activity struct {
ID string `json:"id"`
Type string `json:"type"`
Parameters map[string]any `json:"parameters"`
State string `json:"state"`
Result string `json:"result"`
CompletionPercent int `json:"completion_percent"`
CompletedAt time.Time `json:"completed_at"`
StartedAt time.Time `json:"started_at"`
Project string `json:"project"`
Environments []string `json:"environments"`
Integration string `json:"integration,omitempty"`
Description string `json:"description"`
Text string `json:"text"`
Payload any `json:"payload"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Links defaults to "self", "log" and, if the activity is cancellable, "#cancel".
Links HalLinks `json:"_links,omitempty"`
// contains filtered or unexported fields
}
func (Activity) MarshalJSON ¶
MarshalJSON adds the default links. Its value receiver means it also applies when encoding a value.
type App ¶
type App struct {
Name string `json:"name"`
Type string `json:"type"`
Size string `json:"size,omitempty"`
Disk int `json:"disk"`
Mounts map[string]Mount `json:"mounts"`
Resources map[string]any `json:"resources,omitempty"`
Web map[string]any `json:"web,omitempty"`
Runtime map[string]any `json:"runtime,omitempty"`
Stack any `json:"stack,omitempty"`
}
type AuthServer ¶
AuthServer is a mock authentication server for testing.
Like the real server, it rotates refresh tokens on every refresh. Reusing a rotated refresh token revokes all refresh tokens from the same login.
func NewAuthServer ¶
func NewAuthServer(t *testing.T) *AuthServer
NewAuthServer creates a new mock authentication server. The caller must call Close() on the server when finished.
func (*AuthServer) APITokenExchanges ¶
func (s *AuthServer) APITokenExchanges() int
APITokenExchanges returns the number of api_token grant requests received.
func (*AuthServer) AddRefreshToken ¶
func (s *AuthServer) AddRefreshToken(token string)
AddRefreshToken makes a refresh token valid, as if it had been issued at login.
func (*AuthServer) AuthorizePrompts ¶
func (s *AuthServer) AuthorizePrompts() []string
AuthorizePrompts returns the "prompt" parameter of each authorization request.
func (*AuthServer) RefreshRequests ¶
func (s *AuthServer) RefreshRequests() int
RefreshRequests returns the number of refresh_token grant requests received.
func (*AuthServer) ReuseDetected ¶
func (s *AuthServer) ReuseDetected() bool
ReuseDetected reports whether a rotated refresh token was sent again.
func (*AuthServer) RevokedTokens ¶
func (s *AuthServer) RevokedTokens() []string
RevokedTokens returns a copy of all tokens that have been revoked, excluding failed revocations.
func (*AuthServer) SSHCertificateCount ¶
func (s *AuthServer) SSHCertificateCount() int
SSHCertificateCount returns the number of SSH certificates issued.
func (*AuthServer) SetJWTAccessTokens ¶
func (s *AuthServer) SetJWTAccessTokens(jwt bool)
SetJWTAccessTokens makes the server issue access tokens as unsigned JWTs, whose "jti" claim is the token that it would otherwise issue, and whose "exp" claim is the token's expiry.
func (*AuthServer) SetRefreshDelay ¶
func (s *AuthServer) SetRefreshDelay(d time.Duration)
SetRefreshDelay delays refresh token responses, e.g. to make concurrent refreshes overlap.
func (*AuthServer) SetRefreshFailures ¶
func (s *AuthServer) SetRefreshFailures(n int)
SetRefreshFailures makes the next n refresh requests fail with a 503 error.
func (*AuthServer) SetRevokeFailures ¶
func (s *AuthServer) SetRevokeFailures(n, status int)
SetRevokeFailures makes the next n revocation requests fail with an HTTP status.
func (*AuthServer) SetSSHCertificate ¶
func (s *AuthServer) SetSSHCertificate(keyID string, lifetime time.Duration)
SetSSHCertificate sets the key ID and lifetime of issued SSH certificates (default: "test-key-id" and 1 minute). The legacy CLI only reuses a certificate if its key ID is the user ID, and it expires more than 2 minutes later.
func (*AuthServer) SetTokenLifetime ¶
func (s *AuthServer) SetTokenLifetime(d time.Duration)
SetTokenLifetime sets the lifetime of issued access tokens (default: 1 hour).
func (*AuthServer) SetUniqueAccessTokens ¶
func (s *AuthServer) SetUniqueAccessTokens(unique bool)
SetUniqueAccessTokens makes the server issue a new access token each time ("access-token-1", "access-token-2", ...), instead of always "access-token-1".
type Backup ¶
type Backup struct {
ID string `json:"id"`
EnvironmentID string `json:"environment"`
Status string `json:"status"`
Safe bool `json:"safe"`
Restorable bool `json:"restorable"`
Automated bool `json:"automated"`
CommitID string `json:"commit_id"`
ExpiresAt time.Time `json:"expires_at"`
Links HalLinks `json:"_links,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type BillingProfile ¶
type BillingProfile struct {
ID string `json:"billing_profile_id"`
Name string `json:"name"`
BillingEmail string `json:"billing_email"`
BillingContacts string `json:"billing_contacts"`
Country string `json:"country"`
Currency string `json:"currency"`
BillingStreet1 string `json:"billing_street_1"`
BillingStreet2 string `json:"billing_street_2"`
Locality string `json:"locality"`
AdministrativeArea string `json:"administrative_area"`
PostalCode string `json:"postal_code"`
PricingModel string `json:"pricing_model"`
Links HalLinks `json:"_links,omitempty"`
}
BillingProfile is a billing profile on the new billing system.
type CanCreateRequiredAction ¶
type CanCreateResponse ¶
type CanCreateResponse struct {
CanCreate bool `json:"can_create"`
Message string `json:"message"`
RequiredAction *CanCreateRequiredAction `json:"required_action"`
}
type Certificate ¶
type Certificate struct {
ID string `json:"id"`
Certificate string `json:"certificate"`
Chain []string `json:"chain"`
Domains []string `json:"domains"`
AuthType []string `json:"auth_type"`
Issuer []NameAttr `json:"issuer"`
IsProvisioned bool `json:"is_provisioned"`
IsInvalid bool `json:"is_invalid"`
IsRoot bool `json:"is_root"`
ExpiresAt time.Time `json:"expires_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Links HalLinks `json:"_links,omitempty"`
}
func (Certificate) MarshalJSON ¶
func (c Certificate) MarshalJSON() ([]byte, error)
MarshalJSON outputs empty lists instead of null.
type Deployment ¶
type Deployment struct {
WebApps map[string]App `json:"webapps"`
Services map[string]Service `json:"services"`
Workers map[string]Worker `json:"workers"`
Tasks map[string]App `json:"tasks,omitempty"`
ProjectInfo map[string]any `json:"project_info,omitempty"`
Routes map[string]any `json:"routes"`
Links HalLinks `json:"_links,omitempty"`
}
func (Deployment) MarshalJSON ¶
func (d Deployment) MarshalJSON() ([]byte, error)
MarshalJSON outputs empty objects instead of null, as the API does.
type Domain ¶
type Domain struct {
ID string `json:"id"`
Name string `json:"name"`
RegisteredName string `json:"registered_name,omitempty"`
Type string `json:"type"`
IsDefault bool `json:"is_default"`
ReplacementFor string `json:"replacement_for,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
SSL *DomainSSL `json:"ssl"`
Links HalLinks `json:"_links,omitempty"`
}
func (Domain) MarshalJSON ¶
MarshalJSON leaves out is_default from replacement domains, as the API does.
type DomainSSL ¶
type DomainSSL struct {
HasCertificate bool `json:"has_certificate"`
Certificate string `json:"certificate,omitempty"`
ExpiresOn *time.Time `json:"expires_on,omitempty"`
}
DomainSSL is computed from the project's certificates, as the API does.
type EnvLevelVariable ¶
type Environment ¶
type Environment struct {
ID string `json:"id"`
Name string `json:"name"`
MachineName string `json:"machine_name"`
Title string `json:"title"`
Type string `json:"type"`
Status string `json:"status"`
Parent any `json:"parent"`
Project string `json:"project"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Links HalLinks `json:"_links,omitempty"`
HTTPAccess map[string]any `json:"http_access,omitempty"`
HeadCommit string `json:"head_commit,omitempty"`
MergeInfo map[string]any `json:"merge_info,omitempty"`
CanRollingDeploy bool `json:"can_rolling_deploy,omitempty"`
// contains filtered or unexported fields
}
func (*Environment) AddOperations ¶
func (e *Environment) AddOperations(ops ...string)
AddOperations adds links for environment operations (e.g. "branch" or "merge"), which the CLI checks before running them.
func (*Environment) SetAutoscalingSettings ¶
func (e *Environment) SetAutoscalingSettings(s map[string]any)
SetAutoscalingSettings sets the autoscaling settings, and the environment links needed to read and manage them.
func (*Environment) SetCurrentDeployment ¶
func (e *Environment) SetCurrentDeployment(d *Deployment)
func (*Environment) SetNextDeployment ¶
func (e *Environment) SetNextDeployment(d map[string]any)
SetNextDeployment sets the next deployment, which is served as raw data so that tests can include fields the Deployment type lacks. PATCH requests to it are recorded, and returned by Handler.DeploymentPatches.
func (*Environment) SetSetting ¶
func (e *Environment) SetSetting(key string, val any)
type EnvironmentAction ¶
type EnvironmentAction struct {
Type string // The activity type, e.g. "environment.deploy".
Body map[string]any // The decoded request body, if any.
}
EnvironmentAction is a request to an environment operation, e.g. deploy or branch.
type HalLinks ¶
func MakeHALLinks ¶
MakeHALLinks helps make a list of HAL links out of arguments in the format name=path.
type Handler ¶
func NewHandler ¶
func (*Handler) AllRequests ¶
AllRequests returns every request received, in order.
func (*Handler) AutoscalingPatches ¶
AutoscalingPatches returns the bodies of PATCH requests to an environment's autoscaling settings.
func (*Handler) BackupRestores ¶
BackupRestores returns the bodies of requests to restore a project's backups.
func (*Handler) BillingProfile ¶
func (s *Handler) BillingProfile(id string) *BillingProfile
BillingProfile returns a copy of a billing profile, e.g. to check updates.
func (*Handler) DeploymentPatches ¶
DeploymentPatches returns the bodies of PATCH requests to an environment's next deployment.
func (*Handler) Domains ¶
Domains returns copies of a project's domains, or of an environment's if environmentID is not empty. SSL information is not included.
func (*Handler) Environment ¶
func (s *Handler) Environment(projectID, environmentID string) *Environment
Environment returns a copy of an environment, or nil if it does not exist.
func (*Handler) EnvironmentActions ¶
func (s *Handler) EnvironmentActions(projectID, environmentID string) []EnvironmentAction
EnvironmentActions returns the operation requests made to an environment.
func (*Handler) FailNext ¶
FailNext makes the next request with a method and a path matching a pattern fail with a status and a body, instead of reaching its route. The pattern is for path.Match, as in Requests. Each call fails one request.
A JSON body is sent as an API error (see Problem), and any other body as HTML, like a proxy's error page.
func (*Handler) Integrations ¶
func (s *Handler) Integrations(projectID string) []*Integration
Integrations returns copies of a project's integrations.
func (*Handler) OrgIDs ¶
func (s *Handler) OrgIDs() []string
OrgIDs returns the IDs of the organizations.
func (*Handler) OrgInvitations ¶
func (s *Handler) OrgInvitations(orgID string) []OrgInvitation
OrgInvitations returns copies of the invitations created on an organization.
func (*Handler) ProjectActivities ¶
ProjectActivities returns copies of a project's activities, newest first. The Payload is not copied.
func (*Handler) ProjectBackups ¶
ProjectBackups returns copies of a project's backups, sorted by ID.
func (*Handler) ProjectCertificates ¶
func (s *Handler) ProjectCertificates(projectID string) []*Certificate
ProjectCertificates returns copies of a project's certificates.
func (*Handler) ProjectIDs ¶
func (s *Handler) ProjectIDs() []string
ProjectIDs returns the IDs of the projects.
func (*Handler) ProjectInvitations ¶
func (s *Handler) ProjectInvitations(projectID string) []ProjectInvitation
ProjectInvitations returns copies of the invitations created on a project.
func (*Handler) ProjectSettingsPatches ¶
ProjectSettingsPatches returns the bodies of PATCH requests to a project's settings.
func (*Handler) RejectAccessToken ¶
RejectAccessToken makes requests with an access token fail with a 401 error, as if it were revoked.
func (*Handler) Requests ¶
Requests returns the requests received with a method and a path matching a pattern, in order. The pattern is for path.Match, where "*" matches one path segment.
func (*Handler) RequireStepUp ¶
RequireStepUp makes every request fail with a step-up authentication challenge (RFC 9470).
func (*Handler) RespondWithActivity ¶
func (h *Handler) RespondWithActivity(w http.ResponseWriter, projectID, environmentID, activityType string)
RespondWithActivity creates an activity and writes an action response that embeds it, for use in custom handlers. The activity is in progress until it is next read, when it completes with the result set by SetActivityResult.
func (*Handler) SSHKeys ¶
func (s *Handler) SSHKeys() []*SSHKey
SSHKeys returns copies of the SSH keys in the current user's account.
func (*Handler) SetActivityResult ¶
func (s *Handler) SetActivityResult(result string)
SetActivityResult sets the result of activities created from now on, e.g. by deploy or backup actions. The default is ActivityResultSuccess.
func (*Handler) SetBillingProfiles ¶
func (s *Handler) SetBillingProfiles(profiles []*BillingProfile)
func (*Handler) SetCanCreate ¶
func (s *Handler) SetCanCreate(orgID string, r *CanCreateResponse)
func (*Handler) SetEnvLevelVariables ¶
func (s *Handler) SetEnvLevelVariables(projectID, environmentID string, vars []*EnvLevelVariable)
func (*Handler) SetEnvironmentDomains ¶
SetEnvironmentDomains sets an environment's domains. The default branch's domains are the project's domains, so the project must be set first.
func (*Handler) SetEnvironments ¶
func (s *Handler) SetEnvironments(envs []*Environment)
func (*Handler) SetOrgMembers ¶
SetOrgMembers sets the members of an organization.
func (*Handler) SetOtherUserSSHKeys ¶
func (s *Handler) SetOtherUserSSHKeys(values []string)
SetOtherUserSSHKeys sets the values of SSH keys registered by other users.
func (*Handler) SetProjectActivities ¶
func (*Handler) SetProjectBackups ¶
func (*Handler) SetProjectCertificates ¶
func (s *Handler) SetProjectCertificates(projectID string, certs []*Certificate)
func (*Handler) SetProjectDomains ¶
func (*Handler) SetProjectIntegrations ¶
func (s *Handler) SetProjectIntegrations(projectID string, integrations []*Integration)
func (*Handler) SetProjectVariables ¶
func (*Handler) SetProjects ¶
func (s *Handler) SetProjects(pros []*Project)
func (*Handler) SetSSHKeySource ¶
func (s *Handler) SetSSHKeySource(source string)
SetSSHKeySource sets the API that owns SSH keys. By default, /ssh-key-source does not exist, so the CLI uses the Accounts API.
func (*Handler) SetSSHKeys ¶
func (s *Handler) SetSSHKeys(keys []*SSHKey)
SetSSHKeys sets the SSH keys in the current user's account.
func (*Handler) SetTeamMembers ¶
func (s *Handler) SetTeamMembers(teamID string, members []*TeamMember)
SetTeamMembers sets the users in a team.
func (*Handler) SetTeamProjects ¶
func (s *Handler) SetTeamProjects(teamID string, projects []*TeamProjectAccess)
SetTeamProjects sets the projects a team can access.
func (*Handler) SetTeams ¶
func (s *Handler) SetTeams(teams []*Team)
SetTeams sets the teams, replacing any existing teams, members and project access.
func (*Handler) SetUserGrants ¶
func (s *Handler) SetUserGrants(grants []*UserGrant)
type Integration ¶
type Integration struct {
ID string `json:"id"`
Type string `json:"type"`
BaseURL string `json:"base_url,omitempty"`
Token string `json:"-"` // Write-only in the API.
Repository string `json:"repository,omitempty"`
BuildPullRequests bool `json:"build_pull_requests,omitempty"`
BuildDraftPullRequests bool `json:"build_draft_pull_requests,omitempty"`
URL string `json:"url,omitempty"`
Events []string `json:"events,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Links HalLinks `json:"_links,omitempty"`
}
type InvitationPermission ¶
InvitationPermission is an environment type role in a project invitation.
type NameAttr ¶
type NameAttr struct {
OID string `json:"oid"`
Alias string `json:"alias"`
Value string `json:"value"`
}
NameAttr is an attribute of an X.509 name, such as the certificate issuer.
type Org ¶
type Org struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
Label string `json:"label"`
Owner string `json:"owner_id"`
Capabilities []string `json:"capabilities"`
Links HalLinks `json:"_links,omitempty"`
BillingLegacy *bool `json:"billing_legacy,omitempty"`
BillingProfileID string `json:"billing_profile_id,omitempty"`
}
func (Org) MarshalJSON ¶
MarshalJSON outputs an empty list of capabilities instead of null.
type OrgInvitation ¶
type OrgMember ¶
type OrgMember struct {
OrganizationID string `json:"organization_id"`
UserID string `json:"user_id"`
Permissions []string `json:"permissions"`
Owner bool `json:"owner"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
OrgMember is a user in an organization. Its ID is the user ID.
type OrgProject ¶
type OrgProject struct {
ID string `json:"id"`
OrganizationID string `json:"organization_id"`
Title string `json:"title"`
Region string `json:"region"`
Vendor string `json:"vendor"`
Status string `json:"status"`
SubscriptionID string `json:"subscription_id,omitempty"`
ProjectUI string `json:"project_ui,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Links HalLinks `json:"_links"`
}
OrgProject is a project in an organization's project list.
type Project ¶
type Project struct {
ID string `json:"id"`
Title string `json:"title"`
Region string `json:"region"`
Organization string `json:"organization"`
Owner string `json:"owner,omitempty"`
Vendor string `json:"vendor"`
Repository ProjectRepository `json:"repository"`
DefaultBranch string `json:"default_branch"`
Links HalLinks `json:"_links,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Subscription ProjectSubscriptionInfo `json:"subscription,omitempty"`
SubscriptionID string `json:"-"`
// ProjectUI is the Console URL served by the Projects API.
ProjectUI string `json:"-"`
// Settings are served at the project's /settings path, if set.
Settings map[string]any `json:"-"`
}
func (*Project) AsRef ¶
func (p *Project) AsRef() *ProjectRef
type ProjectInvitation ¶
type ProjectRef ¶
type ProjectRef struct {
ID string `json:"id"`
Region string `json:"region"`
Title string `json:"title"`
Status string `json:"status"`
OrganizationID string `json:"organization_id"`
SubscriptionID string `json:"subscription_id"`
Vendor string `json:"vendor,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ProjectRepository ¶
type ProjectRepository struct {
URL string `json:"url"`
}
type ProjectSubscriptionInfo ¶
type ProjectSubscriptionInfo struct {
LicenseURI string `json:"license_uri,omitempty"`
Plan string `json:"plan,omitempty"`
Environments int `json:"environments,omitempty"`
Storage int `json:"storage,omitempty"`
IncludedUsers int `json:"included_users,omitempty"`
UserLicenses int `json:"user_licenses,omitempty"`
ManagementURI string `json:"subscription_management_uri,omitempty"`
Restricted bool `json:"restricted,omitempty"`
Suspended bool `json:"suspended,omitempty"`
}
type ProjectUserGrant ¶
type SSHKey ¶
SSHKey is an SSH public key in the current user's account. Keys from the Accounts API have numeric IDs.
type Service ¶
type Service struct {
Type string `json:"type"`
Size string `json:"size,omitempty"`
Disk int `json:"disk,omitempty"`
}
Service is a service in a deployment.
type Subscription ¶
type Team ¶
type Team struct {
ID string `json:"id"`
OrganizationID string `json:"organization_id"`
Label string `json:"label"`
ProjectPermissions []string `json:"project_permissions"`
Counts TeamCounts `json:"counts"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Links HalLinks `json:"_links,omitempty"`
}
type TeamCounts ¶
type TeamCounts struct {
MemberCount int `json:"member_count"`
ProjectCount int `json:"project_count"`
}
TeamCounts is calculated from the team's members and projects.
type TeamMember ¶
type TeamProjectAccess ¶
type TeamProjectAccess struct {
TeamID string `json:"team_id"`
OrganizationID string `json:"organization_id"`
ProjectID string `json:"project_id"`
ProjectTitle string `json:"project_title"`
GrantedAt time.Time `json:"granted_at"`
UpdatedAt time.Time `json:"updated_at"`
Links HalLinks `json:"_links,omitempty"`
}
type User ¶
type User struct {
ID string `json:"id"`
Deactivated bool `json:"deactivated"`
Namespace string `json:"namespace"`
Username string `json:"username"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
Picture string `json:"picture"`
Country string `json:"country,omitempty"`
PhoneNumberVerified bool `json:"phone_number_verified"`
MFAEnabled bool `json:"mfa_enabled"`
SSOEnabled bool `json:"sso_enabled"`
ConsentMethod string `json:"consent_method,omitempty"`
ConsentedAt time.Time `json:"consented_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type UserGrant ¶
type UserGrant struct {
ResourceID string `json:"resource_id"`
ResourceType string `json:"resource_type"`
OrganizationID string `json:"organization_id"`
UserID string `json:"user_id"`
Permissions []string `json:"permissions"`
GrantedAt time.Time `json:"granted_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Variable ¶
type Variable struct {
ID string `json:"id"`
Name string `json:"name"`
Value string `json:"value,omitempty"`
Attributes map[string]string `json:"attributes"`
IsJSON bool `json:"is_json"`
IsSensitive bool `json:"is_sensitive"`
VisibleBuild bool `json:"visible_build"`
VisibleRuntime bool `json:"visible_runtime"`
ApplicationScope []string `json:"application_scope"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Links HalLinks `json:"_links,omitempty"`
}
type Worker ¶
type Worker struct {
App
Worker WorkerInfo `json:"worker"`
}
type WorkerInfo ¶
type WorkerInfo struct {
Commands Commands `json:"commands"`
}
Source Files
¶
- activities.go
- api_server.go
- auth_server.go
- backups.go
- billing.go
- certificates.go
- domains.go
- environment_lifecycle.go
- environments.go
- faults.go
- id.go
- integrations.go
- logger.go
- model.go
- openapi.go
- org_subscriptions.go
- orgs.go
- pagination.go
- projects.go
- requests.go
- routes_project_resources.go
- settings.go
- ssh_keys.go
- store.go
- subscriptions.go
- teams.go
- user_access.go
- users.go
- variables.go