client

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const PipelineCompleteKey = "pipeline.complete"

PipelineCompleteKey for pipeline complete

View Source
const PipelineFailedKey = "pipeline.failed"

PipelineFailedKey for pipeline failed

View Source
const PipelineStartingKey = "pipeline.starting"

PipelineStartingKey for pipeline starting

View Source
const StageCompleteKey = "stage.complete"

StageCompleteKey for stage complete

View Source
const StageFailedKey = "stage.failed"

StageFailedKey for stage failed

View Source
const StageStartingKey = "stage.starting"

StageStartingKey for pipeline starting

Variables

View Source
var ErrInvalidApplicationName = errors.New("Invalid application name")

ErrInvalidApplicationName invalid application name

View Source
var ErrInvalidDecodeResponseParameter = errors.New("nil interface provided to decodeResponse")

ErrInvalidDecodeResponseParameter invalid parameter for decodeResponse

View Source
var ErrInvalidNotificatoinLevel = errors.New("Invalid notification level")

ErrInvalidNotificatoinLevel invalid notification level

View Source
var ErrParameterNotFound = errors.New("could not find parameter")

ErrParameterNotFound parameter not found

View Source
var ErrPipelineNotFound = errors.New("Could not find pipeline")

ErrPipelineNotFound pipeline not found

View Source
var ErrPipelineNotificationNotFound = errors.New("notification not found")

ErrPipelineNotificationNotFound notification not found

View Source
var ErrStageNotFound = errors.New("Could not find stage")

ErrStageNotFound stage not found

View Source
var ErrTriggerNotFound = errors.New("could not find trigger")

ErrTriggerNotFound trigger not found

Functions

This section is empty.

Types

type Application

type Application struct {
	CloudProviders   string            `json:"cloudProviders"`
	InstancePort     int               `json:"instancePort"`
	ProviderSettings *ProviderSettings `json:"providerSettings"`
	Name             string            `json:"name"`
	Email            string            `json:"email"`
}

Application Settings for Application

func NewApplication

func NewApplication() *Application

NewApplication return Application object with default values

type ApplicationService

type ApplicationService struct {
	*Client
}

ApplicationService for interacting with spinnaker applications

func (*ApplicationService) CreateApplication

func (service *ApplicationService) CreateApplication(app *Application) error

CreateApplication create an application

func (*ApplicationService) DeleteApplication

func (service *ApplicationService) DeleteApplication(app *Application) error

DeleteApplication delete an application

func (*ApplicationService) GetApplications

func (service *ApplicationService) GetApplications() (*[]*Application, error)

GetApplications get all applications

type AwsProviderSettings

type AwsProviderSettings struct {
	UseAmiBlockDeviceMappings bool `json:"useAmiBlockDeviceMappings"`
}

AwsProviderSettings Settings for AWS Provider

func NewAwsProviderSettings

func NewAwsProviderSettings() *AwsProviderSettings

NewAwsProviderSettings return Aws provider settings with default values

type BakeStage

type BakeStage struct {
	Notifications *[]*Notification `json:"notifications"`
	// contains filtered or unexported fields
}

BakeStage for pipeline

func NewBakeStage

func NewBakeStage() *BakeStage

NewBakeStage for pipeline

func (*BakeStage) GetName

func (s *BakeStage) GetName() string

GetName for Stage interface

func (*BakeStage) GetRefID

func (s *BakeStage) GetRefID() string

GetRefID for Stage interface

func (*BakeStage) GetType

func (s *BakeStage) GetType() StageType

GetType for Stage interface

type Capacity

type Capacity struct {
	Desired int `json:"desired"`
	Max     int `json:"max"`
	Min     int `json:"min"`
}

Capacity capacity for cluster

type Client

type Client struct {
	Config Config
	// contains filtered or unexported fields
}

Client to talk to Spinnaker

func NewClient

func NewClient(config Config) *Client

NewClient Return a new client with loaded configuration

func (*Client) Do

func (client *Client) Do(req *http.Request) (*http.Response, error)

Do send http request

func (*Client) DoWithResponse

func (client *Client) DoWithResponse(req *http.Request, v interface{}) (*http.Response, error)

DoWithResponse send http request and parse response body

func (*Client) DoWithRetry

func (client *Client) DoWithRetry(createReq func() (*http.Request, error)) (*http.Response, error)

DoWithRetry send http request with retry

func (*Client) NewRequest

func (client *Client) NewRequest(method string, path string) (*http.Request, error)

NewRequest create http request

func (*Client) NewRequestWithBody

func (client *Client) NewRequestWithBody(method string, path string, data interface{}) (*http.Request, error)

NewRequestWithBody create http request with data as body

type Config

type Config struct {
	Address   string
	CertPath  string
	KeyPath   string
	UserEmail string
}

Config for Client

type CreatePipelineRequest

type CreatePipelineRequest struct {
	Application string `json:"application"`
	Name        string `json:"name"`
}

CreatePipelineRequest used to create pipeline

type DeployStage

type DeployStage struct {
	Notifications *[]*Notification `json:"notifications"`
	// contains filtered or unexported fields
}

DeployStage for pipeline

func NewDeployStage

func NewDeployStage() *DeployStage

NewDeployStage for pipeline

func (*DeployStage) GetName

func (s *DeployStage) GetName() string

GetName for Stage interface

func (*DeployStage) GetRefID

func (s *DeployStage) GetRefID() string

GetRefID for Stage interface

func (*DeployStage) GetType

func (s *DeployStage) GetType() StageType

GetType for Stage interface

type DeployStageCluster

type DeployStageCluster struct {
	Account                             string                 `json:"account"`
	Application                         string                 `json:"application"`
	AvailabilityZones                   map[string][]string    `json:"availabilityZones"`
	Capacity                            *Capacity              `json:"capacity"`
	CloudProvider                       string                 `json:"cloudProvider"`
	Cooldown                            int                    `json:"cooldown"`
	CopySourceCustomBlockDeviceMappings bool                   `json:"copySourceCustomBlockDeviceMappings"`
	DelayBeforeDisableSec               int                    `json:"delayBeforeDisableSec"`
	DelayBeforeScaleDownSec             int                    `json:"delayBeforeDisableSec"`
	Dirty                               map[string]interface{} `json:"dirty"`
	EBSOptimized                        bool                   `json:"ebsOptimized"`
	EnabledMetrics                      []string               `json:"enabledMetrics"`
	FreeFormDetails                     string                 `json:"freeFormDetails"`
	HealthCheckGracePeriod              string                 `json:"healthCheckGracePeriod"`
	HealthCheckType                     string                 `json:"healthCheckType"`
	IAMRole                             string                 `json:"iamRole"`
	InstanceMonitoring                  bool                   `json:"instanceMonitoring"`
	InstanceType                        string                 `json:"instanceType"`
	KeyPair                             string                 `json:"keyPair"`
	LoadBalancers                       []string               `json:"loadBalancers"`
	MaxRemainingAsgs                    int                    `json:"maxRemainingAsgs"`
	Moniker                             *Moniker               `json:"moniker"`
	Provider                            string                 `json:"provider"`
	Rollback                            *Rollback              `json:"rollback"`
	ScaleDown                           bool                   `json:"scaleDown"`
	SecurityGroups                      []string               `json:"securityGroups"`
	SpelLoadBalancers                   []string               `json:"spelLoadBalancers"`
	SpelTargetGroups                    []string               `json:"spelTargetGroups"`
	SpotPrice                           string                 `json:"spotPrice"`
	Stack                               string                 `json:"stack"`
	Strategy                            string                 `json:"strategy"`
	SubnetType                          string                 `json:"subnetType"`
	SuspendedProcesses                  []string               `json:"suspendedProcesses"`
	Tags                                map[string]string      `json:"tags"`
	TargetGroups                        []string               `json:"targetGroups"`
	TargetHealthyDeployPercentage       int                    `json:"targetHealthyDeployPercentage"`
	TerminationPolicies                 []string               `json:"terminationPolicies"`
	UseAmiBlockDeviceMappings           bool                   `json:"useAmiBlockDeviceMappings"`
	UseSourceCapacity                   bool                   `json:"useSourceCapacity"`
}

DeployStageCluster cluster to deploy

func NewDeployStageCluster

func NewDeployStageCluster() *DeployStageCluster

type DestroyServerGroupStage

type DestroyServerGroupStage struct {
	Notifications *[]*Notification `json:"notifications"`
	// contains filtered or unexported fields
}

DestroyServerGroupStage for pipeline

func NewDestroyServerGroupStage

func NewDestroyServerGroupStage() *DestroyServerGroupStage

NewDestroyServerGroupStage for pipeline

func (*DestroyServerGroupStage) GetName

func (s *DestroyServerGroupStage) GetName() string

GetName for Stage interface

func (*DestroyServerGroupStage) GetRefID

func (s *DestroyServerGroupStage) GetRefID() string

GetRefID for Stage interface

func (*DestroyServerGroupStage) GetType

func (s *DestroyServerGroupStage) GetType() StageType

GetType for Stage interface

type JenkinsStage

type JenkinsStage struct {
	Notifications *[]*Notification `json:"notifications"`
	// contains filtered or unexported fields
}

JenkinsStage for pipeline

func NewJenkinsStage

func NewJenkinsStage() *JenkinsStage

NewJenkinsStage for pipeline

func (*JenkinsStage) GetName

func (s *JenkinsStage) GetName() string

GetName for Stage interface

func (*JenkinsStage) GetRefID

func (s *JenkinsStage) GetRefID() string

GetRefID for Stage interface

func (*JenkinsStage) GetType

func (s *JenkinsStage) GetType() StageType

GetType for Stage interface

type Job

type Job struct {
	Type        string       `json:"type"`
	Application *Application `json:"application"`
	User        string       `json:"user"`
}

Job a job to run

type Message

type Message interface {
	SetCompleteText(string)
	CompleteText() string

	SetFailedText(string)
	FailedText() string

	SetStartingText(string)
	StartingText() string
}

Message for Notification

func NewMessage

func NewMessage(level NotificationLevel) (Message, error)

NewMessage new message

type MessageText

type MessageText struct {
	Text string `json:"text"`
}

MessageText for Pipeline Notification

type Moniker

type Moniker struct {
	App      string `json:"app,omitempty"`
	Cluster  string `json:"cluster,omitempty"`
	Detail   string `json:"detail,omitempty"`
	Stack    string `json:"stack,omitempty"`
	Sequence string `json:"sequence,omitempty"`
}

Moniker for cluster

type Notification

type Notification struct {
	SerializableNotification
	Message Message `json:"message"`
}

Notification for pipeline

type NotificationLevel

type NotificationLevel string

NotificationLevel level of notification

const NotificationLevelPipeline NotificationLevel = "pipeline"

NotificationLevelPipeline pipeline level notifaction

const NotificationLevelStage NotificationLevel = "stage"

NotificationLevelStage stage level notifaction

type Pipeline

type Pipeline struct {
	SerializablePipeline

	Notifications *[]*Notification `json:"notifications"`
	Stages        *[]Stage         `json:"stages"`
}

Pipeline deploy pipeline in application

func NewPipeline

func NewPipeline() *Pipeline

NewPipeline Pipeline with default values

func (*Pipeline) AppendNotification

func (pipeline *Pipeline) AppendNotification(notification *Notification)

AppendNotification append notification

func (*Pipeline) AppendParameter

func (p *Pipeline) AppendParameter(parameter *PipelineParameter)

AppendParameter append parameter

func (*Pipeline) AppendStage

func (pipeline *Pipeline) AppendStage(stage Stage)

AppendStage append stage

func (*Pipeline) AppendTrigger

func (pipeline *Pipeline) AppendTrigger(trigger *Trigger)

AppendTrigger append trigger

func (*Pipeline) DeleteNotification

func (pipeline *Pipeline) DeleteNotification(notificationID string) error

DeleteNotification delete notification

func (*Pipeline) DeleteParameter

func (p *Pipeline) DeleteParameter(parameterID string) error

DeleteParameter in pipeline

func (*Pipeline) DeleteStage

func (pipeline *Pipeline) DeleteStage(stageID string) error

DeleteStage delete stage

func (*Pipeline) DeleteTrigger

func (p *Pipeline) DeleteTrigger(triggerID string) error

DeleteTrigger in pipeline

func (*Pipeline) GetNotification

func (pipeline *Pipeline) GetNotification(notificationID string) (*Notification, error)

GetNotification Get notification by id

func (*Pipeline) GetParameter

func (p *Pipeline) GetParameter(parameterID string) (*PipelineParameter, error)

GetParameter by ID

func (*Pipeline) GetStage

func (pipeline *Pipeline) GetStage(stageID string) (Stage, error)

GetStage get stage

func (*Pipeline) GetTrigger

func (p *Pipeline) GetTrigger(triggerID string) (*Trigger, error)

GetTrigger by ID

func (*Pipeline) UpdateNotification

func (pipeline *Pipeline) UpdateNotification(notification *Notification) error

UpdateNotification update notification

func (*Pipeline) UpdateParameter

func (p *Pipeline) UpdateParameter(parameter *PipelineParameter) error

UpdateParameter in pipeline

func (*Pipeline) UpdateStage

func (pipeline *Pipeline) UpdateStage(stage Stage) error

UpdateStage update stage

func (*Pipeline) UpdateTrigger

func (p *Pipeline) UpdateTrigger(trigger *Trigger) error

UpdateTrigger in pipeline

type PipelineMessage

type PipelineMessage struct {
	Complete *MessageText `json:"pipeline.complete" mapstructure:"pipeline.complete"`
	Failed   *MessageText `json:"pipeline.failed" mapstructure:"pipeline.failed"`
	Starting *MessageText `json:"pipeline.starting" mapstructure:"pipeline.starting"`
}

PipelineMessage for Pipeline Notification

func (*PipelineMessage) CompleteText

func (m *PipelineMessage) CompleteText() string

CompleteText for Message interface

func (*PipelineMessage) FailedText

func (m *PipelineMessage) FailedText() string

FailedText for Message interface

func (*PipelineMessage) SetCompleteText

func (m *PipelineMessage) SetCompleteText(text string)

SetCompleteText for Message interface

func (*PipelineMessage) SetFailedText

func (m *PipelineMessage) SetFailedText(text string)

SetFailedText for Message interface

func (*PipelineMessage) SetStartingText

func (m *PipelineMessage) SetStartingText(text string)

SetStartingText for Message interface

func (*PipelineMessage) StartingText

func (m *PipelineMessage) StartingText() string

StartingText for Message interface

type PipelineParameter

type PipelineParameter struct {
	ID          string                      `json:"id"`
	Default     string                      `json:"default"`
	Description string                      `json:"description"`
	HasOptions  bool                        `json:"hasOptions"`
	Label       string                      `json:"label"`
	Name        string                      `json:"name"`
	Options     *[]*PipelineParameterOption `json:"options"`
	Required    bool                        `json:"required"`
}

type PipelineParameterOption

type PipelineParameterOption struct {
	Value string `json:"value"`
}

type PipelineService

type PipelineService struct {
	*Client
}

PipelineService used to manage pipelines

func (*PipelineService) CreatePipeline

func (service *PipelineService) CreatePipeline(pipeline *CreatePipelineRequest) error

CreatePipeline in application

func (*PipelineService) DeletePipeline

func (service *PipelineService) DeletePipeline(pipeline *Pipeline) error

DeletePipeline in application

func (*PipelineService) GetApplicationPipelines

func (service *PipelineService) GetApplicationPipelines(applicationName string) (*[]*Pipeline, error)

GetApplicationPipelines get all pipelines for an application

func (*PipelineService) GetPipeline

func (service *PipelineService) GetPipeline(applicationName string, pipelineName string) (*Pipeline, error)

GetPipeline get pipeline by name and application

func (*PipelineService) GetPipelineByID

func (service *PipelineService) GetPipelineByID(id string) (*Pipeline, error)

GetPipelineByID get pipeline by id

func (*PipelineService) UpdatePipeline

func (service *PipelineService) UpdatePipeline(pipeline *Pipeline) error

UpdatePipeline in application

type PipelineStage

type PipelineStage struct {
	Notifications *[]*Notification `json:"notifications"`
	// contains filtered or unexported fields
}

PipelineStage for pipeline

func NewPipelineStage

func NewPipelineStage() *PipelineStage

NewPipelineStage for pipeline

func (*PipelineStage) GetName

func (s *PipelineStage) GetName() string

GetName for Stage interface

func (*PipelineStage) GetRefID

func (s *PipelineStage) GetRefID() string

GetRefID for Stage interface

func (*PipelineStage) GetType

func (s *PipelineStage) GetType() StageType

GetType for Stage interface

type ProviderSettings

type ProviderSettings struct {
	AWS *AwsProviderSettings `json:"aws"`
}

ProviderSettings Settings for Provider

type ResizeServerGroupStage

type ResizeServerGroupStage struct {
	Notifications *[]*Notification `json:"notifications"`
	// contains filtered or unexported fields
}

ResizeServerGroupStage for pipeline

func NewResizeServerGroupStage

func NewResizeServerGroupStage() *ResizeServerGroupStage

NewResizeServerGroupStage for pipeline

func (*ResizeServerGroupStage) GetName

func (s *ResizeServerGroupStage) GetName() string

GetName for Stage interface

func (*ResizeServerGroupStage) GetRefID

func (s *ResizeServerGroupStage) GetRefID() string

GetRefID for Stage interface

func (*ResizeServerGroupStage) GetType

func (s *ResizeServerGroupStage) GetType() StageType

GetType for Stage interface

type Rollback

type Rollback struct {
	OnFailure bool `json:"onFailure"`
}

func NewRollback

func NewRollback() *Rollback

type RollbackClusterStage

type RollbackClusterStage struct {
	Notifications *[]*Notification `json:"notifications"`
	// contains filtered or unexported fields
}

RollbackClusterStage for pipeline

func NewRollbackClusterStage

func NewRollbackClusterStage() *RollbackClusterStage

NewRollbackClusterStage for pipeline

func (*RollbackClusterStage) GetName

func (s *RollbackClusterStage) GetName() string

GetName for Stage interface

func (*RollbackClusterStage) GetRefID

func (s *RollbackClusterStage) GetRefID() string

GetRefID for Stage interface

func (*RollbackClusterStage) GetType

func (s *RollbackClusterStage) GetType() StageType

GetType for Stage interface

type SerializableNotification

type SerializableNotification struct {
	ID      string            `json:"id,omitempty"`
	Address string            `json:"address"`
	Level   NotificationLevel `json:"level"`
	Type    string            `json:"type"`
	When    []string          `json:"when"`
}

SerializableNotification for pipeline

type SerializablePipeline

type SerializablePipeline struct {
	Application          string                 `json:"application"`
	AppConfig            map[string]interface{} `json:"appConfig"`
	Disabled             bool                   `json:"disabled"`
	ID                   string                 `json:"id"`
	Index                int                    `json:"index"`
	KeepWaitingPipelines bool                   `json:"keepWaitingPipelines"`
	LimitConcurrent      bool                   `json:"limitConcurrent"`
	Name                 string                 `json:"name"`
	ParameterConfig      *[]*PipelineParameter  `json:"parameterConfig"`
	Roles                *[]string              `json:"roles"`
	ServiceAccount       string                 `json:"serviceAccount,omitempty"`
	Triggers             []*Trigger             `json:"triggers"`
}

SerializablePipeline deploy pipeline in application

func NewSerializablePipeline

func NewSerializablePipeline() SerializablePipeline

NewSerializablePipeline Pipeline with default values

type SpinnakerError

type SpinnakerError struct {
	ErrorMsg  string `json:"error"`
	Exception string `json:"exception"`
	Message   string `json:"message"`
	Status    int    `json:"status"`
	Timestamp int64  `json:"timestamp"`
	Body      string `json:"body"`
}

SpinnakerError Error response from spinnaker

func (*SpinnakerError) Error

func (r *SpinnakerError) Error() string

For error interface

type Stage

type Stage interface {
	GetName() string
	GetRefID() string
	GetType() StageType
}

Stage interface for Pipeline stages

type StageEnabled

type StageEnabled struct {
	Expression string `json:"expression"`
	Type       string `json:"type"`
}

StageEnabled when stage is enabled

type StageExecutionWindow

type StageExecutionWindow struct {
	Days      []int                             `json:"days"`
	Jitter    *StageExecutionWindowJitter       `json:"jitter"`
	Whitelist *[]*StageExecutionWindowWhitelist `json:"whitelist"`
}

StageExecutionWindow when to execute pipeline stage

type StageExecutionWindowJitter

type StageExecutionWindowJitter struct {
	Enabled    bool `json:"enabled"`
	MaxDelay   int  `json:"maxDelay"`
	MinDelay   int  `json:"minDelay"`
	SkipManual bool `json:"skipManual"`
}

StageExecutionWindowJitter random jitter to add to execution window

type StageExecutionWindowWhitelist

type StageExecutionWindowWhitelist struct {
	EndHour   int `json:"endHour"`
	EndMin    int `json:"endMin"`
	StartHour int `json:"startHour"`
	StartMin  int `json:"startMin"`
}

StageExecutionWindowWhitelist which hours to deploy

type StageMessage

type StageMessage struct {
	Complete *MessageText `json:"stage.complete" mapstructure:"stage.complete"`
	Failed   *MessageText `json:"stage.failed" mapstructure:"stage.failed"`
	Starting *MessageText `json:"stage.starting" mapstructure:"stage.starting"`
}

StageMessage for Stage Notification

func (*StageMessage) CompleteText

func (m *StageMessage) CompleteText() string

CompleteText for Message interface

func (*StageMessage) FailedText

func (m *StageMessage) FailedText() string

FailedText for Message interface

func (*StageMessage) SetCompleteText

func (m *StageMessage) SetCompleteText(text string)

SetCompleteText for Message interface

func (*StageMessage) SetFailedText

func (m *StageMessage) SetFailedText(text string)

SetFailedText for Message interface

func (*StageMessage) SetStartingText

func (m *StageMessage) SetStartingText(text string)

SetStartingText for Message interface

func (*StageMessage) StartingText

func (m *StageMessage) StartingText() string

StartingText for Message interface

type StageType

type StageType string

StageType type of stage

var BakeStageType StageType = "bake"

BakeStageType bake stage

var DeployStageType StageType = "deploy"

DeployStageType deploy stage

var DestroyServerGroupStageType StageType = "destroyServerGroup"

DestroyServerGroupStageType destroy server group stage

var JenkinsStageType StageType = "jenkins"

JenkinsStageType jenkins stage

var PipelineStageType StageType = "pipeline"

PipelineStageType pipeline stage

var ResizeServerGroupStageType StageType = "resizeServerGroup"

ResizeServerGroupStageType resize server group stage

var RollbackClusterStageType StageType = "rollbackCluster"

RollbackClusterStageType rollback cluster stage

func (StageType) String

func (st StageType) String() string

type Task

type Task struct {
	Job         *[]*Job `json:"job"`
	Application string  `json:"application"`
	Description string  `json:"description"`
}

Task a job within an application

type Trigger

type Trigger struct {
	ID           string `json:"id"`
	Enabled      bool   `json:"enabled"`
	Job          string `json:"job"`
	Master       string `json:"master"`
	PropertyFile string `json:"propertyFile"`
	RunAsUser    string `json:"runAsUser,omitempty"`
	Type         string `json:"type"`
}

Trigger for Pipeline

Jump to

Keyboard shortcuts

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