Documentation
¶
Overview ¶
Package models defines data structures for Pantheon API resources.
Index ¶
- type Backup
- type Branch
- type ConnectionInfo
- type DNSRecord
- type Domain
- type Environment
- type Lock
- type MachineToken
- type Message
- type Metrics
- type MetricsTimeseries
- type NewRelicConfig
- type Operation
- type Organization
- type PaymentMethod
- type Plan
- type RedisConfig
- type SSHKey
- type Site
- type SiteListItem
- type SiteOrganizationMembership
- type SolrConfig
- type Tag
- type Task
- type TeamMember
- type Upstream
- type UpstreamUpdate
- type UpstreamUpdateCommit
- type User
- type UserProfile
- type Workflow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backup ¶
type Backup struct {
ID string `json:"id"`
SiteID string `json:"site_id"`
EnvironmentID string `json:"env_id"`
ArchiveType string `json:"type"`
Timestamp int64 `json:"timestamp"`
FinishTime int64 `json:"finish_time"`
Size int64 `json:"size"`
Folder string `json:"folder"`
TTL int64 `json:"ttl"`
ExpiryTime int64 `json:"expiry_time"`
InitiatorEmail string `json:"initiator_email"`
InitiatorName string `json:"initiator_name"`
}
Backup represents a site backup
type ConnectionInfo ¶
type ConnectionInfo struct {
SFTPHost string `json:"sftp_host"`
SFTPPort int `json:"sftp_port"`
SFTPUsername string `json:"sftp_username"`
SFTPCommand string `json:"sftp_command"`
GitHost string `json:"git_host"`
GitPort int `json:"git_port"`
GitUsername string `json:"git_username"`
GitCommand string `json:"git_command"`
MySQLHost string `json:"mysql_host"`
MySQLPort int `json:"mysql_port"`
MySQLUsername string `json:"mysql_username"`
MySQLDatabase string `json:"mysql_database"`
MySQLCommand string `json:"mysql_command"`
RedisHost string `json:"redis_host"`
RedisPort int `json:"redis_port"`
RedisPassword string `json:"redis_password"`
RedisCommand string `json:"redis_command"`
}
ConnectionInfo represents connection information for an environment
type DNSRecord ¶
type DNSRecord struct {
Type string `json:"type"`
Target string `json:"target"`
Status string `json:"status"`
}
DNSRecord represents a DNS record
type Domain ¶
type Domain struct {
ID string `json:"id"`
Domain string `json:"domain"`
SiteID string `json:"site_id"`
EnvironmentID string `json:"environment"`
Type string `json:"type"`
Status string `json:"status"`
Deletable bool `json:"deletable"`
}
Domain represents a domain attached to an environment
type Environment ¶
type Environment struct {
ID string `json:"id"`
SiteID string `json:"site_id"`
Domain string `json:"domain"`
OnServerDevelopment bool `json:"on_server_development"`
Locked bool `json:"locked"`
Initialized bool `json:"initialized"`
ConnectionMode string `json:"connection_mode"`
PHP string `json:"php_version"`
Drush int `json:"drush_version"`
TargetRef string `json:"target_ref"`
TargetCommit string `json:"target_commit"`
DiffstatCodeCommits int `json:"diffstat_code_commits"`
RancherID string `json:"rancher_id"`
Info map[string]interface{} `json:"info,omitempty"`
}
Environment represents a site environment
type Lock ¶
type Lock struct {
Username string `json:"username"`
Password string `json:"password"`
Locked bool `json:"locked"`
}
Lock represents HTTP basic auth lock
type MachineToken ¶
type MachineToken struct {
ID string `json:"id"`
DeviceName string `json:"device_name"`
Email string `json:"email"`
TokenName string `json:"token_name"`
}
MachineToken represents a machine token
type Message ¶
type Message struct {
Level string `json:"level"`
Message string `json:"message"`
Time float64 `json:"time"`
}
Message represents a workflow message
type Metrics ¶ added in v0.6.0
type Metrics struct {
Timestamp int64 `json:"-"` // Unix timestamp, used as key in JSON output
Datetime string `json:"datetime"`
Visits int64 `json:"visits"`
PagesServed int64 `json:"pages_served"`
CacheHits int64 `json:"cache_hits"`
CacheMisses int64 `json:"cache_misses"`
CacheHitRatio string `json:"cache_hit_ratio"`
}
Metrics represents traffic metrics for an environment
func (*Metrics) DefaultFields ¶ added in v0.6.0
DefaultFields implements the DefaultFielder interface for Metrics.
func (*Metrics) Serialize ¶ added in v0.6.0
func (m *Metrics) Serialize() []output.SerializedField
Serialize implements the Serializer interface for Metrics.
type MetricsTimeseries ¶ added in v0.6.0
type MetricsTimeseries struct {
Metrics []*Metrics
}
MetricsTimeseries wraps a slice of Metrics for JSON output matching PHP terminus format
func (*MetricsTimeseries) GetItems ¶ added in v0.6.0
func (mt *MetricsTimeseries) GetItems() []*Metrics
GetItems returns the metrics slice for table output
func (*MetricsTimeseries) MarshalJSON ¶ added in v0.6.0
func (mt *MetricsTimeseries) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler for MetricsTimeseries Output format: {"timeseries": {"timestamp": {...}, ...}}
type NewRelicConfig ¶
type NewRelicConfig struct {
Enabled bool `json:"enabled"`
AccountID string `json:"account_id"`
APIKey string `json:"api_key"`
}
NewRelicConfig represents New Relic configuration
type Operation ¶
type Operation struct {
ID string `json:"id"`
Type string `json:"type"`
Description string `json:"description"`
Result string `json:"result"`
Duration float64 `json:"duration"`
}
Operation represents a workflow operation
type Organization ¶
type Organization struct {
ID string `json:"id"`
Name string `json:"name"` // Corresponds to machine_name in API
Label string `json:"label"` // Corresponds to name in API
}
Organization represents an organization
func (*Organization) DefaultFields ¶
func (o *Organization) DefaultFields() []string
DefaultFields implements the DefaultFielder interface for Organization.
func (*Organization) Serialize ¶
func (o *Organization) Serialize() []output.SerializedField
Serialize implements the Serializer interface for Organization.
func (*Organization) UnmarshalJSON ¶
func (o *Organization) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom unmarshaling to extract name and label from profile
type PaymentMethod ¶
type PaymentMethod struct {
ID string `json:"id"`
Label string `json:"label"`
Type string `json:"type"`
Last4 string `json:"last4"`
}
PaymentMethod represents a payment method
type Plan ¶
type Plan struct {
ID string `json:"id"`
Name string `json:"name"`
Label string `json:"label"`
SKU string `json:"sku"`
BillingCycle string `json:"billing_cycle"`
Price float64 `json:"price"`
MonthlyPrice float64 `json:"monthly_price"`
AutomatedBackups bool `json:"automated_backups"`
CacheServer bool `json:"cache_server"`
CustomUpstreams bool `json:"custom_upstreams"`
MultidevEnvironments int `json:"multidev_environments"`
NewRelic bool `json:"new_relic"`
SecureRuntimeAccess bool `json:"secure_runtime_access"`
StorageGB int `json:"storage_gb"`
SupportPlan string `json:"support_plan"`
}
Plan represents a service plan
type RedisConfig ¶
type RedisConfig struct {
Enabled bool `json:"enabled"`
Host string `json:"host"`
Port int `json:"port"`
Password string `json:"password"`
}
RedisConfig represents Redis configuration
type Site ¶
type Site struct {
ID string `json:"id"`
Name string `json:"name"`
Label string `json:"label"`
Created int64 `json:"created"`
Framework string `json:"framework"`
Organization string `json:"organization"`
Service string `json:"service_level"`
PlanName string `json:"plan_name"`
Upstream interface{} `json:"upstream"` // Can be string or object
UpstreamLabel string `json:"upstream_label,omitempty"`
PHP string `json:"php_version"`
Holder string `json:"holder_type"`
HolderID string `json:"holder_id"`
Owner string `json:"owner"`
Frozen bool `json:"frozen"`
IsFrozen bool `json:"is_frozen"`
PreferredZone string `json:"preferred_zone"`
PreferredZoneLabel string `json:"preferred_zone_label"`
Info map[string]interface{} `json:"info,omitempty"`
// Membership information (not from API, populated during listing)
MembershipUserID string `json:"-"`
MembershipRole string `json:"-"`
MembershipIsTeam bool `json:"-"` // True if from direct user membership, false if from org
}
Site represents a Pantheon site
func (*Site) DefaultFields ¶
DefaultFields implements the DefaultFielder interface for Site. These are the fields that should be displayed by default, matching PHP Terminus.
func (*Site) Serialize ¶
func (s *Site) Serialize() []output.SerializedField
Serialize implements the Serializer interface for Site. This method returns fields in the same order as PHP Terminus for CSV compatibility.
func (*Site) ToListItem ¶
func (s *Site) ToListItem() *SiteListItem
ToListItem converts a Site to a SiteListItem (excludes upstream)
func (*Site) UnmarshalJSON ¶
UnmarshalJSON implements custom unmarshaling to extract upstream label
type SiteListItem ¶
type SiteListItem struct {
ID string `json:"id"`
Name string `json:"name"`
Label string `json:"label"`
Created int64 `json:"created"`
Framework string `json:"framework"`
Organization string `json:"organization"`
Service string `json:"service_level"`
PlanName string `json:"plan_name"`
PHP string `json:"php_version"`
Holder string `json:"holder_type"`
HolderID string `json:"holder_id"`
Owner string `json:"owner"`
Frozen bool `json:"frozen"`
IsFrozen bool `json:"is_frozen"`
PreferredZone string `json:"preferred_zone"`
PreferredZoneLabel string `json:"preferred_zone_label"`
Info map[string]interface{} `json:"info,omitempty"`
// Membership information (not from API, populated during listing)
MembershipUserID string `json:"-"`
MembershipRole string `json:"-"`
MembershipIsTeam bool `json:"-"` // True if from direct user membership, false if from org
}
SiteListItem represents a site in list output (excludes upstream field)
func (*SiteListItem) DefaultFields ¶
func (s *SiteListItem) DefaultFields() []string
DefaultFields implements the DefaultFielder interface for SiteListItem. These are the fields that should be displayed by default, matching PHP Terminus.
func (*SiteListItem) Serialize ¶
func (s *SiteListItem) Serialize() []output.SerializedField
Serialize implements the Serializer interface for SiteListItem. This method returns fields in the same order as PHP Terminus for CSV compatibility. Note: SiteListItem excludes upstream fields compared to Site.
type SiteOrganizationMembership ¶
type SiteOrganizationMembership struct {
OrgID string `json:"org_id"`
OrgName string `json:"org_name"`
}
SiteOrganizationMembership represents a site's membership in an organization
type SolrConfig ¶
type SolrConfig struct {
Enabled bool `json:"enabled"`
Host string `json:"host"`
Port int `json:"port"`
Path string `json:"path"`
}
SolrConfig represents Solr configuration
type Tag ¶
type Tag struct {
ID string `json:"id"`
Name string `json:"name"`
SiteID string `json:"site_id"`
OrgID string `json:"org_id"`
}
Tag represents a site tag
type Task ¶
type Task struct {
ID string `json:"id"`
Type string `json:"type"`
Description string `json:"description"`
Status string `json:"status"`
Result string `json:"result"`
Messages interface{} `json:"messages,omitempty"`
StartTime float64 `json:"start_time"`
EndTime float64 `json:"end_time"`
Params map[string]interface{} `json:"params,omitempty"`
SiteID string `json:"site_id,omitempty"`
}
Task represents a workflow task
type TeamMember ¶
type TeamMember struct {
ID string `json:"id"`
Email string `json:"email"`
FirstName string `json:"firstname"`
LastName string `json:"lastname"`
Role string `json:"role"`
}
TeamMember represents a team member
type Upstream ¶
type Upstream struct {
ID string `json:"id"`
Label string `json:"label"`
MachineName string `json:"machine_name"`
Type string `json:"type"`
Framework string `json:"framework"`
Organization string `json:"organization_id"`
URL string `json:"url"`
Branch string `json:"branch"`
Product map[string]interface{} `json:"product,omitempty"`
}
Upstream represents an upstream framework
type UpstreamUpdate ¶
type UpstreamUpdate struct {
UpdatesAvailable bool `json:"updates_available"`
BehindBy int `json:"behind_by"`
RemoteHead string `json:"remote_head"`
LocalHead string `json:"local_head"`
}
UpstreamUpdate represents upstream update information
type UpstreamUpdateCommit ¶
type UpstreamUpdateCommit struct {
Hash string `json:"hash"`
Datetime string `json:"datetime"`
Message string `json:"message"`
Author string `json:"author"`
}
UpstreamUpdateCommit represents a commit in upstream updates
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Profile *UserProfile `json:"profile,omitempty"`
FirstName string `json:"firstname"`
LastName string `json:"lastname"`
}
User represents a user
func (*User) UnmarshalJSON ¶
UnmarshalJSON implements custom unmarshaling to flatten profile data
type UserProfile ¶
type UserProfile struct {
FirstName string `json:"firstname"`
LastName string `json:"lastname"`
FullName string `json:"full_name"`
Email string `json:"email"`
}
UserProfile represents a user's profile
type Workflow ¶
type Workflow struct {
ID string `json:"id"`
Type string `json:"type"`
Description string `json:"description"`
SiteID string `json:"site_id"`
EnvironmentID string `json:"environment"`
UserID string `json:"user_id"`
FinishedAt float64 `json:"finished_at"`
StartedAt float64 `json:"started_at"`
CreatedAt float64 `json:"created_at"`
Result string `json:"result"`
TotalTime float64 `json:"total_time"`
CurrentOperation string `json:"current_operation"`
Step int `json:"step"`
FinalTask *Task `json:"final_task,omitempty"`
WaitingForTask *Task `json:"waiting_for_task,omitempty"`
Operations []Operation `json:"operations,omitempty"`
Params map[string]interface{} `json:"params,omitempty"`
Active bool `json:"active"`
HasActiveOps bool `json:"has_active_ops"`
}
Workflow represents an asynchronous operation
func (*Workflow) GetMessage ¶
GetMessage returns the workflow message
func (*Workflow) IsFinished ¶
IsFinished returns true if the workflow has finished
func (*Workflow) IsSuccessful ¶
IsSuccessful returns true if the workflow completed successfully