octopus

package module
v0.0.0-...-b031a58 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 6 Imported by: 2

README

octopus

Octopus server API for golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatStringList

func FormatStringList(list []string) string

FormatStringList prints a slice of strings

func PrintAppsecReport

func PrintAppsecReport(octo *Client)

PrintAppsecReport prints a CSV format report with just user roles, environments, teams.

func PrintChannels

func PrintChannels(octo *Client)

PrintChannels displays the channels

func PrintEnvironments

func PrintEnvironments(octo *Client)

PrintEnvironments displays the deployment environments

func PrintFeeds

func PrintFeeds(octo *Client)

PrintFeeds displays the feeds

func PrintLifecycles

func PrintLifecycles(octo *Client)

PrintLifecycles displays the lifecycles

func PrintMachineRoles

func PrintMachineRoles(octo *Client)

PrintMachineRoles displays the machines

func PrintMachines

func PrintMachines(octo *Client)

PrintMachines displays the machines

func PrintProjectGroups

func PrintProjectGroups(octo *Client)

PrintProjectGroups displays the deployment project groups

func PrintProjects

func PrintProjects(octo *Client)

PrintProjects displays the deployment projects

func PrintServerReport

func PrintServerReport(octo *Client)

PrintServerReport displays the Octopus server information

func PrintTeamReport

func PrintTeamReport(octo *Client)

TeamReport displays each team, its users, roles, environments, projects, project groups, tenants

All of the parameters are pointers and can be nil, so check before dereferencing!

func PrintTeams

func PrintTeams(octo *Client)

PrintTeams displays the teams

func PrintTenants

func PrintTenants(octo *Client)

PrintTenants displays the tenants

func PrintUserRoles

func PrintUserRoles(octo *Client)

PrintUserRoles displays the user roles

func PrintUsers

func PrintUsers(octo *Client)

PrintUsers displays the users

Types

type Channel

type Channel struct {
	ID          string   `json:"Id"`
	Name        string   `json:"Name"`
	Description string   `json:"Description"`
	ProjectId   string   `json:"ProjectId"`
	LifecycleId string   `json:"LifecycleId"`
	IsDefault   bool     `json:"IsDefault"`
	Rules       []string `json:"Rules"`
	TenantTags  []string `json:"TenantTags"`
	SpaceId     string   `json:"SpaceId"`
}

Channel describes a channel

type Channels

type Channels struct {
	Items []Channel `json:"Items"`
	PagedResults
}

Channels holds octopus channels

type Client

type Client struct {
	Address string
	APIKey  string
	// contains filtered or unexported fields
}

Client is an Octopus Deploy API client

func New

func New(address, apiKey string, httpClient *http.Client) *Client

New creates a new Octopus Deploy API client

func (*Client) DoGetRequest

func (c *Client) DoGetRequest(api string) (*http.Response, error)

DoGetRequest makes a Get API call to Octopus

func (*Client) DoGetRequestParms

func (c *Client) DoGetRequestParms(api string, queryParams map[string]string) (*http.Response, error)

DoGetRequestParms makes a Get API call to Octopus using query parameters (can be empty)

func (*Client) GetAll

func (c *Client) GetAll() (*[]Task, error)

GetAll gets all tasks

func (*Client) GetAllChannels

func (c *Client) GetAllChannels() ([]Channel, error)

GetAllChannels fetches all Octopus channels and related data

note: channels does not support the /all route (it does in newer Octopus versions)

func (*Client) GetAllEnvironments

func (c *Client) GetAllEnvironments() ([]Environment, error)

GetAllEnvironments fetches the Octopus environments

func (*Client) GetAllFeeds

func (c *Client) GetAllFeeds() ([]Feed, error)

GetFeeds gets all Octopus feeds

func (*Client) GetAllLifecycles

func (c *Client) GetAllLifecycles() ([]Lifecycle, error)

GetLifecycles gets all Octopus lifecycles

func (*Client) GetAllMachineRoles

func (c *Client) GetAllMachineRoles() ([]MachineRole, error)

GetMachines gets all Octopus machines

func (*Client) GetAllMachines

func (c *Client) GetAllMachines() ([]Machine, error)

GetMachines gets all Octopus machines

func (*Client) GetAllProjectGroups

func (c *Client) GetAllProjectGroups() ([]ProjectGroup, error)

GetProjectGroups gets all Octopus project groups

func (*Client) GetAllProjects

func (c *Client) GetAllProjects() ([]Project, error)

GetAllProjects gets all Octopus projects

func (*Client) GetAllTeams

func (c *Client) GetAllTeams() ([]Team, error)

GetAllTeams fetches all Octopus teams and related data

func (*Client) GetAllTenants

func (c *Client) GetAllTenants() ([]Tenant, error)

GetTenants gets all Octopus tenants

func (*Client) GetAllUserRoles

func (c *Client) GetAllUserRoles() ([]UserRole, error)

GetUserRoles fetches the Octopus roles

func (*Client) GetAllUsers

func (c *Client) GetAllUsers() ([]User, error)

GetUsers gets all Octopus users

func (*Client) GetByID

func (c *Client) GetByID(ID string) (*Task, error)

GetByID gets a task by its ID

func (*Client) GetFiltered

func (c *Client) GetFiltered(qp map[string]string) ([]Task, error)

GetFiltered gets all tasks matched by the specified query parameters

func (*Client) GetStats

func (c *Client) GetStats() (*Tasks, error)

GetStats gets metrics on all tasks

func (*Client) Version

func (c *Client) Version() (string, error)

Version health checks the root API and gets the Octopus Deploy version

type Endpoint

type Endpoint struct {
	CommunicationStyle            string                 `json:"CommunicationStyle"`
	URI                           string                 `json:"Uri"`
	ProxyID                       string                 `json:"ProxyID"`
	Thumbprint                    string                 `json:"Thumbprint"`
	TentacleVersionDetails        TentacleVersionDetails `json:"TentacleVersionDetails"`
	CertificateSignatureAlgorithm string                 `json:"CertificateSignatureAlgorithm"`
	ID                            string                 `json:"Id"`
	LastModifiedOn                string                 `json:"LastModifiedOn"`
	LastModifiedBy                string                 `json:"LastModifiedBy"`
}

type Environment

type Environment struct {
	ID                         string `json:"Id"`
	SpaceId                    string
	Name                       string
	Description                string
	SortOrder                  int
	UseGuidedFailure           bool
	AllowDynamicInfrastructure bool
	ExtensionSettings          []Extension
	Links                      Links
}

Environment describes an octopus deployment environment, such as dev, test, prod

type Extension

type Extension struct {
	ExtensionId string
	Values      map[string]string
}

Extension defines a particular Octopus extension, such as Jira

type Feed

type Feed struct {
	ID                                string   `json:"Id"`
	Name                              string   `json:"Name"`
	FeedType                          string   `json:"FeedType"`
	ApiVersion                        string   `json:"ApiVersion"`
	RegistryPath                      string   `json:"RegistryPath"`
	FeedUrl                           string   `json:"FeedUrl"`
	Username                          string   `json:"Username"`
	Password                          string   `json:"Password"`
	PackageAcquisitionLocationOptions []string `json:"PackageAcquisitionLocationOptions"`
	SpaceId                           string   `json:"SpaceId"`
	LastModifiedOn                    string   `json:"LastModifiedOn"`
	LastModifiedBy                    string   `json:"LastModifiedBy"`
}

Feed describes a feed

type Lifecycle

type Lifecycle struct {
	ID                      string          `json:"Id"`
	Name                    string          `json:"Name"`
	Description             string          `json:"Description"`
	SpaceId                 string          `json:"SpaceId"`
	Phases                  []Phase         `json:"Phases"`
	ReleaseRetentionPolicy  RetentionPolicy `json:"ReleaseRetentionPolicy"`
	TentacleRetentionPolicy RetentionPolicy `json:"TentacleRetentionPolicy"`
}

Lifecycle describes a lifecycle

type Links map[string]string

Links are part of each JSON response, used for pagination

type Machine

type Machine struct {
	ID                string   `json:"Id"`
	Name              string   `json:"Name"`
	Thumbprint        string   `json:"Thumbprint"`
	URI               string   `json:"Uri"`
	IsDisabled        bool     `json:"IsDisabled"`
	EnvironmentIDs    []string `json:"EnvironmentIds"`
	Roles             []string `json:"Roles"`
	MachinePolicyId   string   `json:"MachinePolicyId"`
	TenantIDs         []string `json:"TenantIds"`
	TenantTags        []string `json:"TenantTags"`
	Status            string   `json:"Status"`
	HealthStatus      string   `json:"HealthStatus"`
	HasLatestCalamari bool     `json:"HasLatestCalamari"`
	StatusSummary     string   `json:"StatusSummary"`
	IsInProcess       bool     `json:"IsInProcess"`
	Endpoint          Endpoint `json:"Endpoint"`
}

Machine describes a machine

type MachineRole

type MachineRole string

MachineRole holds a machine role

type PagedResults

type PagedResults struct {
	ItemType       string `json:"ItemType"`
	TotalResults   int    `json:"TotalResults"`
	ItemsPerPage   int    `json:"ItemsPerPage"`
	NumberOfPages  int    `json:"NumberOfPages"`
	LastPageNumber int    `json:"LastPageNumber"`
	IsStale        bool   `json:"IsStale"`
	Links          Links  `json:"Links"`
}

PagedResults is used in most API calls

type Phase

type Phase struct {
	ID                                 string   `json:"Id"`
	Name                               string   `json:"Name"`
	AutomaticDeploymentTargets         []string `json:"AutomaticDeploymentTargets"`
	OptionalDeploymentTargets          []string `json:"OptionalDeploymentTargets"`
	MinimumEnvironmentsBeforePromotion int      `json:"MinimumEnvironmentsBeforePromotion"`
	IsOptionalPhase                    bool     `json:"IsOptionalPhase"`
}

Phase describes a lifecycle phase

type Project

type Project struct {
	ID                  string `json:"Id"`
	Name                string `json:"Name"`
	Slug                string `json:"Slug"`
	Description         string `json:"Description"`
	VariableSetID       string `json:"VariableSetId"`
	DeploymentProcessID string `json:"DeploymentProcessId"`
	ProjectGroupId      string `json:"ProjectGroupId"`
	LifecycleId         string `json:"LifecycleId"`
}

Project describes a project

type ProjectGroup

type ProjectGroup struct {
	ID                string   `json:"Id"`
	Name              string   `json:"Name"`
	Description       string   `json:"Description"`
	EnvironmentIds    []string `json:"EnvironmentIds"`
	RetentionPolicyId string   `json:"RetentionPolicyId"`
}

ProjectGroup describes a project group

type RetentionPolicy

type RetentionPolicy struct {
	Unit              string `json:"Unit"`
	QuantityToKeep    int    `json:"QuantityToKeep"`
	ShouldKeepForever bool   `json:"ShouldKeepForever"`
}

type Task

type Task struct {
	ID                         string `json:"Id"`
	SpaceID                    string `json:"SpaceId"`
	Name                       string
	Description                string
	Arguments                  map[string]string
	State                      string
	Completed                  time.Time
	QueueTime                  time.Time
	QueueTimeExpiry            time.Time
	StartTime                  time.Time
	LastUpdatedTime            time.Time
	CompletedTime              time.Time
	ServerNode                 string
	Duration                   string
	ErrorMessage               string
	HasBeenPickedUpByProcessor bool
	IsCompleted                bool
	FinishedSuccessfully       bool
	HasPendingInterruptions    bool
	CanRerun                   bool
	HasWarningsOrErrors        bool
	Links                      Links
}

Task describes a deployment task, either running or not

type Tasks

type Tasks struct {
	ItemType       string
	TotalResults   int
	ItemsPerPage   int
	NumberOfPages  int
	LastPageNumber int
	TotalCounts    *TotalCounts
	Items          []Task
	Links          Links
}

Tasks holds metrics on the deployment tasks

type Team

type Team struct {
	ID            string   `json:"Id"`
	Name          string   `json:"Name"`
	MemberUserIds []string `json:"MemberUserIds"`
	// ExternalSecurityGroups []string `json:"ExternalSecurityGroups,omitempty"`
	UserRoleIds      []string `json:"UserRoleIds"`
	ProjectIds       []string `json:"ProjectIds"`
	EnvironmentIds   []string `json:"EnvironmentIds"`
	TenantIds        []string `json:"TenantIds"`
	TenantTags       []string `json:"TenantTags"`
	ProjectGroupIds  []string `json:"ProjectGroupIds"`
	CanBeDeleted     bool     `json:"CanBeDeleted"`
	CanBeRenamed     bool     `json:"CanBeRenamed"`
	CanChangeRoles   bool     `json:"CanChangeRoles"`
	CanChangeMembers bool     `json:"CanChangeMembers"`
}

Team describes a team of users

type Tenant

type Tenant struct {
	ID                                string   `json:"Id"`
	Name                              string   `json:"Name"`
	TenantType                        string   `json:"TenantType"`
	ApiVersion                        string   `json:"ApiVersion"`
	RegistryPath                      string   `json:"RegistryPath"`
	TenantUrl                         string   `json:"TenantUrl"`
	Username                          string   `json:"Username"`
	Password                          string   `json:"Password"`
	PackageAcquisitionLocationOptions []string `json:"PackageAcquisitionLocationOptions"`
	SpaceId                           string   `json:"SpaceId"`
	LastModifiedOn                    string   `json:"LastModifiedOn"`
	LastModifiedBy                    string   `json:"LastModifiedBy"`
}

Tenant describes a feed

type TentacleVersionDetails

type TentacleVersionDetails struct {
	UpgradeLocked    bool   `json:"UpgradeLocked"`
	Version          string `json:"Version"`
	UpgradeSuggested bool   `json:"UpgradeSuggested"`
	UpgradeRequired  bool   `json:"UpgradeRequired"`
}

type TotalCounts

type TotalCounts struct {
	Canceled    int
	Cancelling  int
	Executing   int
	Failed      int
	Queued      int
	Success     int
	TimedOut    int
	Interrupted int
}

TotalCounts holds metrics on currently running deployment tasks

type User

type User struct {
	ID                  string `json:"Id"`
	Username            string `json:"Username"`
	DisplayName         string `json:"DisplayName"`
	IsActive            bool   `json:"IsActive"`
	IsService           bool   `json:"IsService"`
	EmailAddress        string `json:"EmailAddress"`
	CanPasswordBeEdited bool   `json:"CanPasswordBeEdited"`
	IsRequestor         bool   `json:"IsRequestor"`
}

User describes a deployment task, either running or not

type UserRole

type UserRole struct {
	ID          string `json:"Id"`
	Name        string `json:"Name"`
	Description string `json:"Description"`
}

UserRole is the role that binds users and teams

Jump to

Keyboard shortcuts

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