services

package
v2.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrItemNotFound = errors.New("cannot find the item")

ErrItemNotFound is an OctopusDeploy error returned an item cannot be found.

Functions

func ApiAdd

func ApiAdd(sling *sling.Sling, inputStruct interface{}, resource interface{}, path string) (interface{}, error)

Generic OctopusDeploy API Add Function. Expects a 201 response.

func ApiAddWithResponseStatus

func ApiAddWithResponseStatus(sling *sling.Sling, inputStruct interface{}, resource interface{}, path string, httpStatus int) (interface{}, error)

ApiAddWithResponseStatus function with defined response.

func ApiDelete

func ApiDelete(sling *sling.Sling, path string) error

Generic OctopusDeploy API Delete Function.

func ApiPost

func ApiPost(sling *sling.Sling, inputStruct interface{}, resource interface{}, path string) (interface{}, error)

ApiPost post to octopus and expect a 200 response code.

func ApiPostNew added in v2.6.0

func ApiPostNew[TResponse any](httpClient *http.Client, absoluteUrl *url.URL, apiKey string, requestPayload any) (*TResponse, error)

ApiPost post some JSON to octopus and expect a 200 response code.

func ApiUpdate

func ApiUpdate(sling *sling.Sling, inputStruct interface{}, resource interface{}, path string) (interface{}, error)

Generic OctopusDeploy API Update Function.

func GetAddPath

func GetAddPath(s IService, resource resources.IResource) (string, error)

func GetAllPath

func GetAllPath(s IService) (string, error)

func GetByIDPath

func GetByIDPath(s IService, id string) (string, error)

func GetByIDsPath

func GetByIDsPath(s IService, ids []string) (string, error)

func GetByNamePath

func GetByNamePath(s IService, name string) (string, error)

func GetByPartialNamePath

func GetByPartialNamePath(s IService, name string) (string, error)

func GetPagedResponse added in v2.3.0

func GetPagedResponse[T any](s IService, path string) ([]*T, error)

func GetPath

func GetPath(s IService) (string, error)

func GetUpdatePath

func GetUpdatePath(s IService, resource resources.IResource) (string, error)

func IsNil

func IsNil(i interface{}) bool

func LoadNextPage

func LoadNextPage(pagedResults resources.PagedResults) (string, bool)

LoadNextPage checks if the next page should be loaded from the API. Returns the new path and a bool if the next page should be checked.

func NewServiceTests

func NewServiceTests(t *testing.T, service IService, uriTemplate string, ServiceName string)

func ValidateInternalState

func ValidateInternalState(s IService) error

Types

type CanDeleteService

type CanDeleteService struct {
	Service
}

func (*CanDeleteService) DeleteByID

func (s *CanDeleteService) DeleteByID(id string) error

DeleteByID deletes the resource that matches the input ID.

type IService

type IService interface {
	GetBasePath() string
	GetClient() *sling.Sling
	GetName() string
	GetPath() string
	GetURITemplate() *uritemplates.UriTemplate
}

IService defines the contract for all services that communicate with the Octopus API.

type Service

type Service struct {
	BasePath    string
	Name        string
	Path        string
	Sling       *sling.Sling
	URITemplate *uritemplates.UriTemplate
}

func NewService

func NewService(name string, sling *sling.Sling, uriTemplate string) Service

func (*Service) GetBasePath

func (s *Service) GetBasePath() string

func (*Service) GetClient

func (s *Service) GetClient() *sling.Sling

func (*Service) GetName

func (s *Service) GetName() string

func (*Service) GetPath

func (s *Service) GetPath() string

func (*Service) GetURITemplate

func (s *Service) GetURITemplate() *uritemplates.UriTemplate

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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