Documentation
¶
Overview ¶
Package api provides a client for the Pantheon API.
Index ¶
- Constants
- func DecodeResponse(resp *http.Response, target interface{}) error
- func EnsureSiteUUID(ctx context.Context, client *Client, siteIdentifier string) (string, error)
- func IsConflict(err error) bool
- func IsNotFound(err error) bool
- func IsUUID(s string) bool
- func ResolveSiteNameToID(ctx context.Context, client *Client, siteName string) (string, error)
- type AddTeamMemberRequest
- type AuthService
- type BackupsService
- func (s *BackupsService) Create(ctx context.Context, siteID, envID string, req *CreateBackupRequest) (*models.Workflow, error)
- func (s *BackupsService) CreateElement(ctx context.Context, siteID, envID, element string) (*models.Workflow, error)
- func (s *BackupsService) Download(ctx context.Context, siteID, envID, backupID, element, outputPath string) error
- func (s *BackupsService) Get(ctx context.Context, siteID, envID, backupID string) (*models.Backup, error)
- func (s *BackupsService) GetDownloadURL(ctx context.Context, siteID, envID, backupID, element string) (string, error)
- func (s *BackupsService) GetSchedule(ctx context.Context, siteID, envID string) (map[string]interface{}, error)
- func (s *BackupsService) List(ctx context.Context, siteID, envID string) ([]*models.Backup, error)
- func (s *BackupsService) Restore(ctx context.Context, siteID, envID, backupID string) (*models.Workflow, error)
- func (s *BackupsService) SetSchedule(ctx context.Context, siteID, envID string, enabled bool, day int) error
- type Client
- func (c *Client) Delete(ctx context.Context, path string) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, path string) (*http.Response, error)
- func (c *Client) GetPaged(ctx context.Context, basePath string) ([]json.RawMessage, error)
- func (c *Client) Patch(ctx context.Context, path string, body interface{}) (*http.Response, error)
- func (c *Client) Post(ctx context.Context, path string, body interface{}) (*http.Response, error)
- func (c *Client) Put(ctx context.Context, path string, body interface{}) (*http.Response, error)
- func (c *Client) Request(ctx context.Context, method, path string, body interface{}) (*http.Response, error)
- func (c *Client) SetToken(token string)
- type ClientOption
- type CloneContentRequest
- type CommitRequest
- type CreateBackupRequest
- type CreateMultidevRequest
- type CreateSiteRequest
- type DefaultLogger
- func (l *DefaultLogger) Debug(msg string, args ...interface{})
- func (l *DefaultLogger) Error(msg string, args ...interface{})
- func (l *DefaultLogger) GetVerbosity() VerbosityLevel
- func (l *DefaultLogger) Info(msg string, args ...interface{})
- func (l *DefaultLogger) IsTraceEnabled() bool
- func (l *DefaultLogger) LogHTTPRequest(method, url string, headers map[string][]string, body string)
- func (l *DefaultLogger) LogHTTPResponse(statusCode int, status string, headers map[string][]string, body string)
- func (l *DefaultLogger) Trace(msg string, args ...interface{})
- func (l *DefaultLogger) Warn(msg string, args ...interface{})
- type DeployRequest
- type DomainsService
- func (s *DomainsService) Add(ctx context.Context, siteID, envID, domain string) (*models.Domain, error)
- func (s *DomainsService) Get(ctx context.Context, siteID, envID, domainID string) (*models.Domain, error)
- func (s *DomainsService) GetDNS(ctx context.Context, siteID, envID, domainID string) ([]*models.DNSRecord, error)
- func (s *DomainsService) List(ctx context.Context, siteID, envID string) ([]*models.Domain, error)
- func (s *DomainsService) Remove(ctx context.Context, siteID, envID, domainID string) error
- type EnvironmentsService
- func (s *EnvironmentsService) ApplyUpstreamUpdates(ctx context.Context, siteID, envID string, updateDB, acceptUpstream bool) (*models.Workflow, error)
- func (s *EnvironmentsService) ChangeConnectionMode(ctx context.Context, siteID, envID, mode string) (*models.Workflow, error)
- func (s *EnvironmentsService) ClearCache(ctx context.Context, siteID, envID string) (*models.Workflow, error)
- func (s *EnvironmentsService) CloneContent(ctx context.Context, siteID, envID string, req *CloneContentRequest) (*models.Workflow, error)
- func (s *EnvironmentsService) Commit(ctx context.Context, siteID, envID string, req *CommitRequest) (*models.Workflow, error)
- func (s *EnvironmentsService) Deploy(ctx context.Context, siteID, envID string, req *DeployRequest) (*models.Workflow, error)
- func (s *EnvironmentsService) Get(ctx context.Context, siteID, envID string) (*models.Environment, error)
- func (s *EnvironmentsService) GetConnectionInfo(ctx context.Context, siteID, envID string) (*models.ConnectionInfo, error)
- func (s *EnvironmentsService) GetLock(ctx context.Context, siteID, envID string) (*models.Lock, error)
- func (s *EnvironmentsService) GetMetrics(ctx context.Context, siteIdentifier, envID, duration string) ([]*models.Metrics, error)
- func (s *EnvironmentsService) GetUpstreamUpdates(ctx context.Context, siteID, envID string) (*models.UpstreamUpdate, error)
- func (s *EnvironmentsService) List(ctx context.Context, siteIdentifier string) ([]*models.Environment, error)
- func (s *EnvironmentsService) RemoveLock(ctx context.Context, siteID, envID string) error
- func (s *EnvironmentsService) SetLock(ctx context.Context, siteID, envID, username, password string) error
- func (s *EnvironmentsService) Wipe(ctx context.Context, siteID, envID string) (*models.Workflow, error)
- type Error
- type HTTPLogger
- type Logger
- type LoginRequest
- type MultidevService
- func (s *MultidevService) Create(ctx context.Context, siteID, envName, fromEnv string) (*models.Workflow, error)
- func (s *MultidevService) Delete(ctx context.Context, siteID, envID string, deleteBranch bool) (*models.Workflow, error)
- func (s *MultidevService) List(ctx context.Context, siteID string) ([]*models.Environment, error)
- func (s *MultidevService) MergeFromDev(ctx context.Context, siteID, envID string, updateDB bool) (*models.Workflow, error)
- func (s *MultidevService) MergeToDev(ctx context.Context, siteID, envID string, updateDB bool) (*models.Workflow, error)
- type OrganizationsService
- func (s *OrganizationsService) Get(ctx context.Context, orgID string) (*models.Organization, error)
- func (s *OrganizationsService) List(ctx context.Context, userID string) ([]*models.Organization, error)
- func (s *OrganizationsService) ListMembers(ctx context.Context, orgID string) ([]*models.User, error)
- func (s *OrganizationsService) ListUpstreams(ctx context.Context, orgID string) ([]*models.Upstream, error)
- type RedisService
- type SessionResponse
- type SitesService
- func (s *SitesService) AddTag(ctx context.Context, siteIdentifier, orgID, tagName string) error
- func (s *SitesService) AddTeamMember(ctx context.Context, siteIdentifier string, req *AddTeamMemberRequest) (*models.TeamMember, error)
- func (s *SitesService) Create(ctx context.Context, userID string, req *CreateSiteRequest) (*models.Site, error)
- func (s *SitesService) Delete(ctx context.Context, siteIdentifier string) error
- func (s *SitesService) Get(ctx context.Context, siteIdentifier string) (*models.Site, error)
- func (s *SitesService) GetPlan(ctx context.Context, siteIdentifier string) (*models.Plan, error)
- func (s *SitesService) GetPlans(ctx context.Context, siteIdentifier string) ([]*models.Plan, error)
- func (s *SitesService) GetTags(ctx context.Context, siteIdentifier, orgID string) ([]*models.Tag, error)
- func (s *SitesService) GetTeam(ctx context.Context, siteIdentifier string) ([]*models.TeamMember, error)
- func (s *SitesService) List(ctx context.Context, userID string) ([]*models.Site, error)
- func (s *SitesService) ListBranches(ctx context.Context, siteIdentifier string) ([]*models.Branch, error)
- func (s *SitesService) ListByOrganization(ctx context.Context, orgID string) ([]*models.Site, error)
- func (s *SitesService) ListOrganizations(ctx context.Context, siteIdentifier string) ([]*models.SiteOrganizationMembership, error)
- func (s *SitesService) RemoveTag(ctx context.Context, siteIdentifier, orgID, tagName string) error
- func (s *SitesService) RemoveTeamMember(ctx context.Context, siteIdentifier, userID string) error
- func (s *SitesService) Update(ctx context.Context, siteIdentifier string, req *UpdateRequest) (*models.Site, error)
- type UpdateRequest
- type UpstreamsService
- func (s *UpstreamsService) Get(ctx context.Context, upstreamID string) (*models.Upstream, error)
- func (s *UpstreamsService) List(ctx context.Context, userID string) ([]*models.Upstream, error)
- func (s *UpstreamsService) ListUpdates(ctx context.Context, siteID, envID string) ([]*models.UpstreamUpdateCommit, error)
- func (s *UpstreamsService) ResolveToID(ctx context.Context, upstreamIdentifier, userID string) (string, error)
- type UsersService
- func (s *UsersService) ListMachineTokens(ctx context.Context, userID string) ([]*models.MachineToken, error)
- func (s *UsersService) ListPaymentMethods(ctx context.Context, userID string) ([]*models.PaymentMethod, error)
- func (s *UsersService) ListSSHKeys(ctx context.Context, userID string) ([]*models.SSHKey, error)
- type VerbosityLevel
- type WaitOptions
- type WatchOptions
- type WorkflowsService
- func (s *WorkflowsService) CreateForSite(ctx context.Context, siteID, workflowType string, ...) (*models.Workflow, error)
- func (s *WorkflowsService) CreateForUser(ctx context.Context, userID, workflowType string, ...) (*models.Workflow, error)
- func (s *WorkflowsService) Get(ctx context.Context, siteID, workflowID string) (*models.Workflow, error)
- func (s *WorkflowsService) GetForUser(ctx context.Context, userID, workflowID string) (*models.Workflow, error)
- func (s *WorkflowsService) List(ctx context.Context, siteID string) ([]*models.Workflow, error)
- func (s *WorkflowsService) ListForEnvironment(ctx context.Context, siteID, envID string) ([]*models.Workflow, error)
- func (s *WorkflowsService) Wait(ctx context.Context, siteID, workflowID string, opts *WaitOptions) (*models.Workflow, error)
- func (s *WorkflowsService) WaitForUser(ctx context.Context, userID, workflowID string, opts *WaitOptions) (*models.Workflow, error)
- func (s *WorkflowsService) Watch(ctx context.Context, siteID, workflowID string, opts *WatchOptions) error
Constants ¶
const ( // DefaultBaseURL is the base URL for the Pantheon API DefaultBaseURL = "https://terminus.pantheon.io:443/api" // DefaultTimeout is the default timeout for HTTP requests DefaultTimeout = 86400 * time.Second // MaxRetries is the maximum number of retry attempts MaxRetries = 5 // InitialBackoff is the initial backoff duration for retries InitialBackoff = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func DecodeResponse ¶
DecodeResponse decodes a JSON response into a target struct
func EnsureSiteUUID ¶
EnsureSiteUUID converts a site identifier (name or UUID) to a UUID
func IsConflict ¶
IsConflict returns true if the error is a 409 Conflict
func IsNotFound ¶
IsNotFound returns true if the error is a 404 Not Found
Types ¶
type AddTeamMemberRequest ¶
AddTeamMemberRequest represents a request to add a team member
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
AuthService handles authentication operations
func NewAuthService ¶
func NewAuthService(client *Client) *AuthService
NewAuthService creates a new auth service
func (*AuthService) Login ¶
func (s *AuthService) Login(ctx context.Context, machineToken string) (*SessionResponse, error)
Login authenticates using a machine token and returns a session
func (*AuthService) ValidateSession ¶
ValidateSession checks if the current session is valid
type BackupsService ¶
type BackupsService struct {
// contains filtered or unexported fields
}
BackupsService handles backup-related operations
func NewBackupsService ¶
func NewBackupsService(client *Client) *BackupsService
NewBackupsService creates a new backups service
func (*BackupsService) Create ¶
func (s *BackupsService) Create(ctx context.Context, siteID, envID string, req *CreateBackupRequest) (*models.Workflow, error)
Create creates a new backup
func (*BackupsService) CreateElement ¶
func (s *BackupsService) CreateElement(ctx context.Context, siteID, envID, element string) (*models.Workflow, error)
CreateElement creates a backup of a specific element (code, database, files)
func (*BackupsService) Download ¶
func (s *BackupsService) Download(ctx context.Context, siteID, envID, backupID, element, outputPath string) error
Download downloads a backup element to a file
func (*BackupsService) Get ¶
func (s *BackupsService) Get(ctx context.Context, siteID, envID, backupID string) (*models.Backup, error)
Get returns a specific backup
func (*BackupsService) GetDownloadURL ¶
func (s *BackupsService) GetDownloadURL(ctx context.Context, siteID, envID, backupID, element string) (string, error)
GetDownloadURL returns the download URL for a backup element
func (*BackupsService) GetSchedule ¶
func (s *BackupsService) GetSchedule(ctx context.Context, siteID, envID string) (map[string]interface{}, error)
GetSchedule returns the backup schedule for an environment
func (*BackupsService) Restore ¶
func (s *BackupsService) Restore(ctx context.Context, siteID, envID, backupID string) (*models.Workflow, error)
Restore restores a backup
func (*BackupsService) SetSchedule ¶
func (s *BackupsService) SetSchedule(ctx context.Context, siteID, envID string, enabled bool, day int) error
SetSchedule sets the backup schedule for an environment
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the HTTP client for the Pantheon API
func (*Client) GetPaged ¶
GetPaged makes paginated GET requests using cursor-based pagination and returns all results The Pantheon API uses cursor-based pagination with 'start' parameter (ID of last item) rather than page-based pagination
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that configures a Client
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets a custom HTTP client
type CloneContentRequest ¶
type CloneContentRequest struct {
FromEnvironment string `json:"from_environment"`
Database bool `json:"db,omitempty"`
Files bool `json:"files,omitempty"`
}
CloneContentRequest represents a clone content request
type CommitRequest ¶
type CommitRequest struct {
Message string `json:"message"`
}
CommitRequest represents a commit request
type CreateBackupRequest ¶
type CreateBackupRequest struct {
KeepFor int `json:"ttl,omitempty"` // TTL in days
}
CreateBackupRequest represents a backup creation request
type CreateMultidevRequest ¶
type CreateMultidevRequest struct {
FromEnvironment string `json:"from_environment"`
CloudDevelopmentEnvironmentID string `json:"cloud_development_environment_id"`
}
CreateMultidevRequest represents a multidev creation request
type CreateSiteRequest ¶
type CreateSiteRequest struct {
SiteName string `json:"site_name"`
Label string `json:"label,omitempty"`
UpstreamID string `json:"upstream_id"`
Organization string `json:"organization_id,omitempty"`
Region string `json:"preferred_zone,omitempty"`
}
CreateSiteRequest represents a site creation request
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
DefaultLogger is a default implementation of the Logger interface
func NewLogger ¶
func NewLogger(verbosity VerbosityLevel) *DefaultLogger
NewLogger creates a new logger with the specified verbosity level
func NewLoggerWithWriter ¶
func NewLoggerWithWriter(verbosity VerbosityLevel, w io.Writer) *DefaultLogger
NewLoggerWithWriter creates a new logger with a custom writer
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(msg string, args ...interface{})
Debug logs a debug message
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(msg string, args ...interface{})
Error logs an error message
func (*DefaultLogger) GetVerbosity ¶
func (l *DefaultLogger) GetVerbosity() VerbosityLevel
GetVerbosity returns the current verbosity level
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(msg string, args ...interface{})
Info logs an info message
func (*DefaultLogger) IsTraceEnabled ¶
func (l *DefaultLogger) IsTraceEnabled() bool
IsTraceEnabled returns true if trace logging is enabled
func (*DefaultLogger) LogHTTPRequest ¶
func (l *DefaultLogger) LogHTTPRequest(method, url string, headers map[string][]string, body string)
LogHTTPRequest logs HTTP request details at trace level
func (*DefaultLogger) LogHTTPResponse ¶
func (l *DefaultLogger) LogHTTPResponse(statusCode int, status string, headers map[string][]string, body string)
LogHTTPResponse logs HTTP response details at trace level
func (*DefaultLogger) Trace ¶
func (l *DefaultLogger) Trace(msg string, args ...interface{})
Trace logs a trace message (only at highest verbosity)
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(msg string, args ...interface{})
Warn logs a warning message
type DeployRequest ¶
type DeployRequest struct {
UpdateDB bool `json:"updatedb,omitempty"`
Note string `json:"annotation,omitempty"`
ClearCache bool `json:"clear_cache,omitempty"`
}
DeployRequest represents a deploy request
type DomainsService ¶
type DomainsService struct {
// contains filtered or unexported fields
}
DomainsService handles domain-related operations
func NewDomainsService ¶
func NewDomainsService(client *Client) *DomainsService
NewDomainsService creates a new domains service
func (*DomainsService) Add ¶
func (s *DomainsService) Add(ctx context.Context, siteID, envID, domain string) (*models.Domain, error)
Add adds a domain to an environment
func (*DomainsService) Get ¶
func (s *DomainsService) Get(ctx context.Context, siteID, envID, domainID string) (*models.Domain, error)
Get returns a specific domain
func (*DomainsService) GetDNS ¶
func (s *DomainsService) GetDNS(ctx context.Context, siteID, envID, domainID string) ([]*models.DNSRecord, error)
GetDNS returns DNS recommendations for a domain
type EnvironmentsService ¶
type EnvironmentsService struct {
// contains filtered or unexported fields
}
EnvironmentsService handles environment-related operations
func NewEnvironmentsService ¶
func NewEnvironmentsService(client *Client) *EnvironmentsService
NewEnvironmentsService creates a new environments service
func (*EnvironmentsService) ApplyUpstreamUpdates ¶
func (s *EnvironmentsService) ApplyUpstreamUpdates(ctx context.Context, siteID, envID string, updateDB, acceptUpstream bool) (*models.Workflow, error)
ApplyUpstreamUpdates applies upstream updates
func (*EnvironmentsService) ChangeConnectionMode ¶
func (s *EnvironmentsService) ChangeConnectionMode(ctx context.Context, siteID, envID, mode string) (*models.Workflow, error)
ChangeConnectionMode changes the connection mode (git or sftp)
func (*EnvironmentsService) ClearCache ¶
func (s *EnvironmentsService) ClearCache(ctx context.Context, siteID, envID string) (*models.Workflow, error)
ClearCache clears the cache for an environment
func (*EnvironmentsService) CloneContent ¶
func (s *EnvironmentsService) CloneContent(ctx context.Context, siteID, envID string, req *CloneContentRequest) (*models.Workflow, error)
CloneContent clones database and/or files from one environment to another
func (*EnvironmentsService) Commit ¶
func (s *EnvironmentsService) Commit(ctx context.Context, siteID, envID string, req *CommitRequest) (*models.Workflow, error)
Commit commits changes in an environment
func (*EnvironmentsService) Deploy ¶
func (s *EnvironmentsService) Deploy(ctx context.Context, siteID, envID string, req *DeployRequest) (*models.Workflow, error)
Deploy deploys code to an environment
func (*EnvironmentsService) Get ¶
func (s *EnvironmentsService) Get(ctx context.Context, siteID, envID string) (*models.Environment, error)
Get returns a specific environment
func (*EnvironmentsService) GetConnectionInfo ¶
func (s *EnvironmentsService) GetConnectionInfo(ctx context.Context, siteID, envID string) (*models.ConnectionInfo, error)
GetConnectionInfo returns connection information for an environment
func (*EnvironmentsService) GetLock ¶
func (s *EnvironmentsService) GetLock(ctx context.Context, siteID, envID string) (*models.Lock, error)
GetLock returns lock information for an environment
func (*EnvironmentsService) GetMetrics ¶ added in v0.6.0
func (s *EnvironmentsService) GetMetrics(ctx context.Context, siteIdentifier, envID, duration string) ([]*models.Metrics, error)
GetMetrics returns traffic metrics for an environment
func (*EnvironmentsService) GetUpstreamUpdates ¶
func (s *EnvironmentsService) GetUpstreamUpdates(ctx context.Context, siteID, envID string) (*models.UpstreamUpdate, error)
GetUpstreamUpdates returns upstream update information
func (*EnvironmentsService) List ¶
func (s *EnvironmentsService) List(ctx context.Context, siteIdentifier string) ([]*models.Environment, error)
List returns all environments for a site
func (*EnvironmentsService) RemoveLock ¶
func (s *EnvironmentsService) RemoveLock(ctx context.Context, siteID, envID string) error
RemoveLock removes the lock from an environment
type HTTPLogger ¶
type HTTPLogger interface {
Logger
LogHTTPRequest(method, url string, headers map[string][]string, body string)
LogHTTPResponse(statusCode int, status string, headers map[string][]string, body string)
IsTraceEnabled() bool
}
HTTPLogger is an interface for logging HTTP requests and responses
func AsHTTPLogger ¶
func AsHTTPLogger(logger Logger) (HTTPLogger, bool)
AsHTTPLogger safely converts a Logger to HTTPLogger if possible
type Logger ¶
type Logger interface {
Debug(msg string, args ...interface{})
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
}
Logger is an interface for logging
type LoginRequest ¶
type LoginRequest struct {
MachineToken string `json:"machine_token"`
Client string `json:"client"`
}
LoginRequest represents a machine token login request
type MultidevService ¶
type MultidevService struct {
// contains filtered or unexported fields
}
MultidevService handles multidev environment operations
func NewMultidevService ¶
func NewMultidevService(client *Client) *MultidevService
NewMultidevService creates a new multidev service
func (*MultidevService) Create ¶
func (s *MultidevService) Create(ctx context.Context, siteID, envName, fromEnv string) (*models.Workflow, error)
Create creates a new multidev environment
func (*MultidevService) Delete ¶
func (s *MultidevService) Delete(ctx context.Context, siteID, envID string, deleteBranch bool) (*models.Workflow, error)
Delete deletes a multidev environment
func (*MultidevService) List ¶
func (s *MultidevService) List(ctx context.Context, siteID string) ([]*models.Environment, error)
List returns multidev environments for a site (excludes dev, test, live)
func (*MultidevService) MergeFromDev ¶
func (s *MultidevService) MergeFromDev(ctx context.Context, siteID, envID string, updateDB bool) (*models.Workflow, error)
MergeFromDev merges dev into a multidev
func (*MultidevService) MergeToDev ¶
func (s *MultidevService) MergeToDev(ctx context.Context, siteID, envID string, updateDB bool) (*models.Workflow, error)
MergeToDev merges a multidev to dev
type OrganizationsService ¶
type OrganizationsService struct {
// contains filtered or unexported fields
}
OrganizationsService handles organization-related operations
func NewOrganizationsService ¶
func NewOrganizationsService(client *Client) *OrganizationsService
NewOrganizationsService creates a new organizations service
func (*OrganizationsService) Get ¶
func (s *OrganizationsService) Get(ctx context.Context, orgID string) (*models.Organization, error)
Get returns a specific organization
func (*OrganizationsService) List ¶
func (s *OrganizationsService) List(ctx context.Context, userID string) ([]*models.Organization, error)
List returns all organizations for the authenticated user
func (*OrganizationsService) ListMembers ¶
func (s *OrganizationsService) ListMembers(ctx context.Context, orgID string) ([]*models.User, error)
ListMembers returns members of an organization
func (*OrganizationsService) ListUpstreams ¶
func (s *OrganizationsService) ListUpstreams(ctx context.Context, orgID string) ([]*models.Upstream, error)
ListUpstreams returns upstreams for an organization
type RedisService ¶
type RedisService struct {
// contains filtered or unexported fields
}
RedisService handles Redis-related operations
func NewRedisService ¶
func NewRedisService(client *Client) *RedisService
NewRedisService creates a new Redis service
type SessionResponse ¶
type SessionResponse struct {
Session string `json:"session"`
UserID string `json:"user_id"`
ExpiresAt int64 `json:"expires_at"`
}
SessionResponse represents the session response from login
type SitesService ¶
type SitesService struct {
// contains filtered or unexported fields
}
SitesService handles site-related operations
func NewSitesService ¶
func NewSitesService(client *Client) *SitesService
NewSitesService creates a new sites service
func (*SitesService) AddTag ¶
func (s *SitesService) AddTag(ctx context.Context, siteIdentifier, orgID, tagName string) error
AddTag adds a tag to a site
func (*SitesService) AddTeamMember ¶
func (s *SitesService) AddTeamMember(ctx context.Context, siteIdentifier string, req *AddTeamMemberRequest) (*models.TeamMember, error)
AddTeamMember adds a team member to a site
func (*SitesService) Create ¶
func (s *SitesService) Create(ctx context.Context, userID string, req *CreateSiteRequest) (*models.Site, error)
Create creates a new site using workflows
func (*SitesService) Delete ¶
func (s *SitesService) Delete(ctx context.Context, siteIdentifier string) error
Delete deletes a site using the delete_site workflow
func (*SitesService) GetTags ¶
func (s *SitesService) GetTags(ctx context.Context, siteIdentifier, orgID string) ([]*models.Tag, error)
GetTags returns tags for a site
func (*SitesService) GetTeam ¶
func (s *SitesService) GetTeam(ctx context.Context, siteIdentifier string) ([]*models.TeamMember, error)
GetTeam returns team members for a site
func (*SitesService) ListBranches ¶
func (s *SitesService) ListBranches(ctx context.Context, siteIdentifier string) ([]*models.Branch, error)
ListBranches returns git branches for a site
func (*SitesService) ListByOrganization ¶
func (s *SitesService) ListByOrganization(ctx context.Context, orgID string) ([]*models.Site, error)
ListByOrganization returns sites for a specific organization
func (*SitesService) ListOrganizations ¶
func (s *SitesService) ListOrganizations(ctx context.Context, siteIdentifier string) ([]*models.SiteOrganizationMembership, error)
ListOrganizations returns organizations that a site belongs to
func (*SitesService) RemoveTag ¶
func (s *SitesService) RemoveTag(ctx context.Context, siteIdentifier, orgID, tagName string) error
RemoveTag removes a tag from a site
func (*SitesService) RemoveTeamMember ¶
func (s *SitesService) RemoveTeamMember(ctx context.Context, siteIdentifier, userID string) error
RemoveTeamMember removes a team member from a site
func (*SitesService) Update ¶
func (s *SitesService) Update(ctx context.Context, siteIdentifier string, req *UpdateRequest) (*models.Site, error)
Update updates a site
type UpdateRequest ¶
type UpdateRequest struct {
Label string `json:"label,omitempty"`
ServiceLevel string `json:"service_level,omitempty"`
}
UpdateRequest represents a site update request
type UpstreamsService ¶
type UpstreamsService struct {
// contains filtered or unexported fields
}
UpstreamsService handles upstream-related operations
func NewUpstreamsService ¶
func NewUpstreamsService(client *Client) *UpstreamsService
NewUpstreamsService creates a new upstreams service
func (*UpstreamsService) ListUpdates ¶
func (s *UpstreamsService) ListUpdates(ctx context.Context, siteID, envID string) ([]*models.UpstreamUpdateCommit, error)
ListUpdates returns the list of upstream update commits for a site environment
func (*UpstreamsService) ResolveToID ¶
func (s *UpstreamsService) ResolveToID(ctx context.Context, upstreamIdentifier, userID string) (string, error)
ResolveToID converts an upstream identifier (machine name or UUID) to a UUID
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
UsersService handles user-related operations
func NewUsersService ¶
func NewUsersService(client *Client) *UsersService
NewUsersService creates a new users service
func (*UsersService) ListMachineTokens ¶
func (s *UsersService) ListMachineTokens(ctx context.Context, userID string) ([]*models.MachineToken, error)
ListMachineTokens returns machine tokens for the authenticated user
func (*UsersService) ListPaymentMethods ¶
func (s *UsersService) ListPaymentMethods(ctx context.Context, userID string) ([]*models.PaymentMethod, error)
ListPaymentMethods returns payment methods for the authenticated user
func (*UsersService) ListSSHKeys ¶
ListSSHKeys returns SSH keys for the authenticated user
type VerbosityLevel ¶
type VerbosityLevel int
VerbosityLevel represents the logging verbosity level
const ( // VerbosityNone disables all logging VerbosityNone VerbosityLevel = 0 // VerbosityInfo enables info level logging (-v) VerbosityInfo VerbosityLevel = 1 // VerbosityDebug enables debug level logging (-vv) VerbosityDebug VerbosityLevel = 2 // VerbosityTrace enables trace level logging including HTTP details (-vvv) VerbosityTrace VerbosityLevel = 3 )
type WaitOptions ¶
type WaitOptions struct {
// PollInterval is how often to check workflow status
PollInterval time.Duration
// Timeout is the maximum time to wait
Timeout time.Duration
// OnProgress is called on each poll with the current workflow state
OnProgress func(*models.Workflow)
}
WaitOptions configures workflow wait behavior
func DefaultWaitOptions ¶
func DefaultWaitOptions() *WaitOptions
DefaultWaitOptions returns default wait options
type WatchOptions ¶
WatchOptions configures workflow watch behavior
type WorkflowsService ¶
type WorkflowsService struct {
// contains filtered or unexported fields
}
WorkflowsService handles workflow-related operations
func NewWorkflowsService ¶
func NewWorkflowsService(client *Client) *WorkflowsService
NewWorkflowsService creates a new workflows service
func (*WorkflowsService) CreateForSite ¶
func (s *WorkflowsService) CreateForSite(ctx context.Context, siteID, workflowType string, params map[string]interface{}) (*models.Workflow, error)
CreateForSite creates a workflow for a site
func (*WorkflowsService) CreateForUser ¶
func (s *WorkflowsService) CreateForUser(ctx context.Context, userID, workflowType string, params map[string]interface{}) (*models.Workflow, error)
CreateForUser creates a workflow for a user
func (*WorkflowsService) Get ¶
func (s *WorkflowsService) Get(ctx context.Context, siteID, workflowID string) (*models.Workflow, error)
Get returns a specific workflow
func (*WorkflowsService) GetForUser ¶
func (s *WorkflowsService) GetForUser(ctx context.Context, userID, workflowID string) (*models.Workflow, error)
GetForUser gets a workflow for a user
func (*WorkflowsService) ListForEnvironment ¶
func (s *WorkflowsService) ListForEnvironment(ctx context.Context, siteID, envID string) ([]*models.Workflow, error)
ListForEnvironment returns workflows for a specific environment
func (*WorkflowsService) Wait ¶
func (s *WorkflowsService) Wait(ctx context.Context, siteID, workflowID string, opts *WaitOptions) (*models.Workflow, error)
Wait waits for a workflow to complete
func (*WorkflowsService) WaitForUser ¶
func (s *WorkflowsService) WaitForUser(ctx context.Context, userID, workflowID string, opts *WaitOptions) (*models.Workflow, error)
WaitForUser waits for a user workflow to complete
func (*WorkflowsService) Watch ¶
func (s *WorkflowsService) Watch(ctx context.Context, siteID, workflowID string, opts *WatchOptions) error
Watch watches a workflow and calls OnUpdate on each status change