ltaas

package
v1.4.33 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Account added in v1.3.1

type Account struct {
	ID string `json:"id"`
}

Account represents an LTaaS account +genie:model_response

type Agreement

type Agreement struct {
	Version   string `json:"version"`
	Agreement string `json:"agreement"`
}

Agreement represents an authorisation agreement +genie:model_response

type AgreementNotFoundError

type AgreementNotFoundError struct {
	Type AgreementType
}

AgreementNotFoundError indicates a agreement was not found

func (*AgreementNotFoundError) Error

func (e *AgreementNotFoundError) Error() string

type AgreementType

type AgreementType string
const (
	AgreementTypeSingle    AgreementType = "single"
	AgreementTypeRecurring AgreementType = "recurring"
)

func ParseAgreementType added in v1.3.1

func ParseAgreementType(s string) (AgreementType, error)

ParseAgreementType attempts to parse a AgreementType from string

func (AgreementType) String

func (s AgreementType) String() string

type CreateDomainRequest

type CreateDomainRequest struct {
	connection.APIRequestBodyDefaultValidator

	Name               string                   `json:"name" validate:"required"`
	VerificationMethod DomainVerificationMethod `json:"verification_method" validate:"required"`
}

CreateDomainRequest represents a request to create a domain

func (*CreateDomainRequest) Validate

Validate returns an error if struct properties are missing/invalid

type CreateJobRequest

type CreateJobRequest struct {
	connection.APIRequestBodyDefaultValidator

	TestID             string              `json:"test_id" validate:"required"`
	ScheduledTimestamp connection.DateTime `json:"scheduled_timestamp,omitempty"`
	RunNow             bool                `json:"run_now"`
}

CreateJobRequest represents a request to create a job

func (*CreateJobRequest) Validate

Validate returns an error if struct properties are missing/invalid

type CreateTestAuthorisation

type CreateTestAuthorisation struct {
	AgreementVersion string `json:"agreement_version" validate:"required"`
	Name             string `json:"name" validate:"required"`
	Position         string `json:"position" validate:"required"`
	Company          string `json:"company" validate:"required"`
}

CreateTestAuthorisation represents the test authorisation payload

type CreateTestRequest

type CreateTestRequest struct {
	connection.APIRequestBodyDefaultValidator

	DomainID      string                  `json:"domain_id" validate:"required"`
	Name          string                  `json:"name" validate:"required"`
	ScenarioID    string                  `json:"scenario_id"`
	ScriptID      string                  `json:"script_id,omitempty"`
	Protocol      TestProtocol            `json:"protocol"`
	Path          string                  `json:"path,omitempty"`
	NumberOfUsers int                     `json:"number_of_users"`
	Duration      TestDuration            `json:"duration"`
	Authorisation CreateTestAuthorisation `json:"authorisation" validate:"required"`
	Thresholds    []CreateTestThreshold   `json:"thresholds"`
}

CreateTestRequest represents a request to create a test

func (*CreateTestRequest) Validate

Validate returns an error if struct properties are missing/invalid

type CreateTestThreshold

type CreateTestThreshold struct {
	ThresholdID string  `json:"threshold_id"`
	Values      *string `json:"values"`
	Warn        *int    `json:"warn"`
	Fail        *int    `json:"fail"`
}

CreateTestThreshold represents the test threshold payload

type Domain

type Domain struct {
	ID                 string                   `json:"id"`
	Name               string                   `json:"name"`
	VerificationMethod DomainVerificationMethod `json:"verification_method"`
	VerifyHash         string                   `json:"verify_hash"`
	Status             DomainStatus             `json:"status"`
	CreatedAt          connection.DateTime      `json:"created_at"`
	UpdatedAt          connection.DateTime      `json:"updated_at"`
}

Domain represents an LTaaS domain +genie:model_response +genie:model_paginated

type DomainNotFoundError

type DomainNotFoundError struct {
	ID string
}

DomainNotFoundError indicates a domain was not found

func (*DomainNotFoundError) Error

func (e *DomainNotFoundError) Error() string

type DomainStatus

type DomainStatus string
const (
	DomainStatusVerified    DomainStatus = "Verified"
	DomainStatusNotVerified DomainStatus = "Not verified"
)

func (DomainStatus) String

func (s DomainStatus) String() string

type DomainVerificationMethod

type DomainVerificationMethod string
const (
	DomainVerificationMethodDNS        DomainVerificationMethod = "DNS"
	DomainVerificationMethodFileUpload DomainVerificationMethod = "File upload"
)

func ParseDomainVerificationMethod

func ParseDomainVerificationMethod(s string) (DomainVerificationMethod, error)

ParseDomainVerificationMethod attempts to parse a DomainVerificationMethod from string

func (DomainVerificationMethod) String

func (s DomainVerificationMethod) String() string

type GetAccountResponseBody added in v1.3.1

type GetAccountResponseBody struct {
	connection.APIResponseBody
	Data Account `json:"data"`
}

GetAccountResponseBody represents an API response body containing Account data

type GetAccountSliceResponseBody added in v1.3.17

type GetAccountSliceResponseBody struct {
	connection.APIResponseBody
	Data []Account `json:"data"`
}

GetAccountSliceResponseBody represents an API response body containing []Account data

type GetAgreementResponseBody

type GetAgreementResponseBody struct {
	connection.APIResponseBody
	Data Agreement `json:"data"`
}

GetAgreementResponseBody represents an API response body containing Agreement data

type GetAgreementSliceResponseBody added in v1.3.17

type GetAgreementSliceResponseBody struct {
	connection.APIResponseBody
	Data []Agreement `json:"data"`
}

GetAgreementSliceResponseBody represents an API response body containing []Agreement data

type GetDomainResponseBody

type GetDomainResponseBody struct {
	connection.APIResponseBody
	Data Domain `json:"data"`
}

GetDomainResponseBody represents an API response body containing Domain data

type GetDomainSliceResponseBody added in v1.3.17

type GetDomainSliceResponseBody struct {
	connection.APIResponseBody
	Data []Domain `json:"data"`
}

GetDomainSliceResponseBody represents an API response body containing []Domain data

type GetJobResponseBody

type GetJobResponseBody struct {
	connection.APIResponseBody
	Data Job `json:"data"`
}

GetJobResponseBody represents an API response body containing Job data

type GetJobResultsResponseBody

type GetJobResultsResponseBody struct {
	connection.APIResponseBody
	Data JobResults `json:"data"`
}

GetJobResultsResponseBody represents an API response body containing JobResults data

type GetJobResultsSliceResponseBody added in v1.3.17

type GetJobResultsSliceResponseBody struct {
	connection.APIResponseBody
	Data []JobResults `json:"data"`
}

GetJobResultsSliceResponseBody represents an API response body containing []JobResults data

type GetJobSettingsResponseBody

type GetJobSettingsResponseBody struct {
	connection.APIResponseBody
	Data JobSettings `json:"data"`
}

GetJobSettingsResponseBody represents an API response body containing JobSettings data

type GetJobSettingsSliceResponseBody added in v1.3.17

type GetJobSettingsSliceResponseBody struct {
	connection.APIResponseBody
	Data []JobSettings `json:"data"`
}

GetJobSettingsSliceResponseBody represents an API response body containing []JobSettings data

type GetJobSliceResponseBody added in v1.3.17

type GetJobSliceResponseBody struct {
	connection.APIResponseBody
	Data []Job `json:"data"`
}

GetJobSliceResponseBody represents an API response body containing []Job data

type GetScenarioResponseBody added in v1.3.17

type GetScenarioResponseBody struct {
	connection.APIResponseBody
	Data Scenario `json:"data"`
}

GetScenarioResponseBody represents an API response body containing Scenario data

type GetScenarioSliceResponseBody added in v1.3.17

type GetScenarioSliceResponseBody struct {
	connection.APIResponseBody
	Data []Scenario `json:"data"`
}

GetScenarioSliceResponseBody represents an API response body containing []Scenario data

type GetTestResponseBody

type GetTestResponseBody struct {
	connection.APIResponseBody
	Data Test `json:"data"`
}

GetTestResponseBody represents an API response body containing Test data

type GetTestSliceResponseBody added in v1.3.17

type GetTestSliceResponseBody struct {
	connection.APIResponseBody
	Data []Test `json:"data"`
}

GetTestSliceResponseBody represents an API response body containing []Test data

type GetThresholdResponseBody

type GetThresholdResponseBody struct {
	connection.APIResponseBody
	Data Threshold `json:"data"`
}

GetThresholdResponseBody represents an API response body containing Threshold data

type GetThresholdSliceResponseBody added in v1.3.17

type GetThresholdSliceResponseBody struct {
	connection.APIResponseBody
	Data []Threshold `json:"data"`
}

GetThresholdSliceResponseBody represents an API response body containing []Threshold data

type Job

type Job struct {
	ID                 string              `json:"id"`
	TestID             string              `json:"test_id"`
	DomainID           string              `json:"domain_id"`
	ScheduledTimestamp connection.DateTime `json:"scheduled_timestamp"`
	JobStartTimestamp  connection.DateTime `json:"job_start_timestamp"`
	JobEndTimestamp    connection.DateTime `json:"job_end_timestamp"`
	Status             JobStatus           `json:"status"`
	FailType           JobFailType         `json:"fail_type"`
	CreatedAt          connection.DateTime `json:"created_at"`
	UpdatedAt          connection.DateTime `json:"updated_at"`
}

Job represents an LTaaS job +genie:model_response +genie:model_paginated

type JobFailType

type JobFailType string
const (
	JobFailTypeTest           JobFailType = "Test"
	JobFailTypeInfrastructure JobFailType = "Infrastructure"
)

func (JobFailType) String

func (s JobFailType) String() string

type JobNotFoundError

type JobNotFoundError struct {
	ID string
}

JobNotFoundError indicates a job was not found

func (*JobNotFoundError) Error

func (e *JobNotFoundError) Error() string

type JobResults

type JobResults struct {
	VirtualUsers       []JobResultsAxis `json:"virtual_users"`
	SuccessfulRequests []JobResultsAxis `json:"successful_requests"`
	FailedRequests     []JobResultsAxis `json:"failed_requests"`
	Latency            []JobResultsAxis `json:"latency"`
}

JobResults represents the results of an LTaaS job +genie:model_response

type JobResultsAxis

type JobResultsAxis struct {
	X connection.DateTime `json:"x"`
	Y float64             `json:"y"`
}

type JobSettings

type JobSettings struct {
	Date     connection.DateTime `json:"date"`
	Type     string              `json:"type"`
	Name     string              `json:"name"`
	Duration TestDuration        `json:"duration"`
	MaxUsers int                 `json:"max_users"`
	Protocol TestProtocol        `json:"protocol"`
	Domain   string              `json:"domain"`
	Path     string              `json:"path"`
}

JobSettings represents the settings of an LTaaS job +genie:model_response

type JobStatus

type JobStatus string
const (
	JobStatusPending  JobStatus = "Pending"
	JobStatusRunning  JobStatus = "Running"
	JobStatusFailed   JobStatus = "Failed"
	JobStatusStopped  JobStatus = "Stopped"
	JobStatusComplete JobStatus = "Complete"
)

func (JobStatus) String

func (s JobStatus) String() string

type LTaaSService

type LTaaSService interface {
	CreateAccount() (string, error)

	GetDomains(parameters connection.APIRequestParameters) ([]Domain, error)
	GetDomainsPaginated(parameters connection.APIRequestParameters) (*PaginatedDomain, error)
	GetDomain(domainID string) (Domain, error)
	CreateDomain(req CreateDomainRequest) (string, error)
	DeleteDomain(domainID string) error
	VerifyDomainFile(domainID string) error
	VerifyDomainDNS(domainID string) error

	GetTests(parameters connection.APIRequestParameters) ([]Test, error)
	GetTestsPaginated(parameters connection.APIRequestParameters) (*PaginatedTest, error)
	GetTest(testID string) (Test, error)
	CreateTest(req CreateTestRequest) (string, error)
	DeleteTest(testID string) error

	GetJobs(parameters connection.APIRequestParameters) ([]Job, error)
	GetJobsPaginated(parameters connection.APIRequestParameters) (*PaginatedJob, error)
	GetJob(testID string) (Job, error)
	GetJobResults(jobID string) (JobResults, error)
	GetJobSettings(jobID string) (JobSettings, error)
	CreateJob(req CreateJobRequest) (string, error)
	DeleteJob(jobID string) error
	StopJob(jobID string) error

	GetThresholds(parameters connection.APIRequestParameters) ([]Threshold, error)
	GetThresholdsPaginated(parameters connection.APIRequestParameters) (*PaginatedThreshold, error)
	GetThreshold(thresholdID string) (Threshold, error)

	GetScenarios(parameters connection.APIRequestParameters) ([]Scenario, error)
	GetScenariosPaginated(parameters connection.APIRequestParameters) (*PaginatedScenario, error)

	GetLatestAgreement(agreementType AgreementType) (Agreement, error)
}

LTaaSService is an interface for managing LTaaS

type PaginatedDomain

type PaginatedDomain struct {
	*connection.PaginatedBase
	Items []Domain
}

PaginatedDomain represents a paginated collection of Domain

func NewPaginatedDomain

NewPaginatedDomain returns a pointer to an initialized PaginatedDomain struct

type PaginatedJob

type PaginatedJob struct {
	*connection.PaginatedBase
	Items []Job
}

PaginatedJob represents a paginated collection of Job

func NewPaginatedJob

NewPaginatedJob returns a pointer to an initialized PaginatedJob struct

type PaginatedScenario

type PaginatedScenario struct {
	*connection.PaginatedBase
	Items []Scenario
}

PaginatedScenario represents a paginated collection of Scenario

func NewPaginatedScenario

NewPaginatedScenario returns a pointer to an initialized PaginatedScenario struct

type PaginatedTest

type PaginatedTest struct {
	*connection.PaginatedBase
	Items []Test
}

PaginatedTest represents a paginated collection of Test

func NewPaginatedTest

NewPaginatedTest returns a pointer to an initialized PaginatedTest struct

type PaginatedThreshold

type PaginatedThreshold struct {
	*connection.PaginatedBase
	Items []Threshold
}

PaginatedThreshold represents a paginated collection of Threshold

func NewPaginatedThreshold

NewPaginatedThreshold returns a pointer to an initialized PaginatedThreshold struct

type Scenario

type Scenario struct {
	ID             string              `json:"id"`
	Name           string              `json:"name"`
	AvailableTrial bool                `json:"available_trial"`
	Formula        string              `json:"formula"`
	Description    string              `json:"description"`
	CreatedAt      connection.DateTime `json:"created_at"`
	UpdatedAt      connection.DateTime `json:"updated_at"`
}

Scenario represents a test scenario +genie:model_response +genie:model_paginated

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements LTaaSService for managing LTaaS via the UKFast API

func NewService

func NewService(connection connection.Connection) *Service

NewService returns a new instance of LTaaSService

func (*Service) CreateAccount added in v1.3.1

func (s *Service) CreateAccount() (string, error)

CreateAccount creates a new account

func (*Service) CreateDomain

func (s *Service) CreateDomain(req CreateDomainRequest) (string, error)

CreateDomain creates a new domain

func (*Service) CreateJob

func (s *Service) CreateJob(req CreateJobRequest) (string, error)

CreateJob creates a new job

func (*Service) CreateTest

func (s *Service) CreateTest(req CreateTestRequest) (string, error)

CreateTest creates a new test

func (*Service) DeleteDomain

func (s *Service) DeleteDomain(domainID string) error

DeleteDomain removes a domain

func (*Service) DeleteJob

func (s *Service) DeleteJob(jobID string) error

DeleteJob removes a job

func (*Service) DeleteTest

func (s *Service) DeleteTest(testID string) error

DeleteTest removes a test

func (*Service) GetDomain

func (s *Service) GetDomain(domainID string) (Domain, error)

GetDomain retrieves a single domain by id

func (*Service) GetDomains

func (s *Service) GetDomains(parameters connection.APIRequestParameters) ([]Domain, error)

GetDomains retrieves a list of domains

func (*Service) GetDomainsPaginated

func (s *Service) GetDomainsPaginated(parameters connection.APIRequestParameters) (*PaginatedDomain, error)

GetDomainsPaginated retrieves a paginated list of domains

func (*Service) GetJob

func (s *Service) GetJob(jobID string) (Job, error)

GetJob retrieves a single job by id

func (*Service) GetJobResults

func (s *Service) GetJobResults(jobID string) (JobResults, error)

GetJobResults retrieves the results of a single job by id

func (*Service) GetJobSettings

func (s *Service) GetJobSettings(jobID string) (JobSettings, error)

GetJobSettings retrieves the settings of a single job by id

func (*Service) GetJobs

func (s *Service) GetJobs(parameters connection.APIRequestParameters) ([]Job, error)

GetJobs retrieves a list of jobs

func (*Service) GetJobsPaginated

func (s *Service) GetJobsPaginated(parameters connection.APIRequestParameters) (*PaginatedJob, error)

GetJobsPaginated retrieves a paginated list of jobs

func (*Service) GetLatestAgreement

func (s *Service) GetLatestAgreement(agreementType AgreementType) (Agreement, error)

GetLatestAgreement retrieves the latest agreement for given type

func (*Service) GetScenarios

func (s *Service) GetScenarios(parameters connection.APIRequestParameters) ([]Scenario, error)

GetScenarios retrieves a list of scenarios

func (*Service) GetScenariosPaginated

func (s *Service) GetScenariosPaginated(parameters connection.APIRequestParameters) (*PaginatedScenario, error)

GetScenariosPaginated retrieves a paginated list of scenarios

func (*Service) GetTest

func (s *Service) GetTest(testID string) (Test, error)

GetTest retrieves a single test by id

func (*Service) GetTests

func (s *Service) GetTests(parameters connection.APIRequestParameters) ([]Test, error)

GetTests retrieves a list of tests

func (*Service) GetTestsPaginated

func (s *Service) GetTestsPaginated(parameters connection.APIRequestParameters) (*PaginatedTest, error)

GetTestsPaginated retrieves a paginated list of tests

func (*Service) GetThreshold

func (s *Service) GetThreshold(thresholdID string) (Threshold, error)

GetThreshold retrieves a single threshold by id

func (*Service) GetThresholds

func (s *Service) GetThresholds(parameters connection.APIRequestParameters) ([]Threshold, error)

GetThresholds retrieves a list of thresholds

func (*Service) GetThresholdsPaginated

func (s *Service) GetThresholdsPaginated(parameters connection.APIRequestParameters) (*PaginatedThreshold, error)

GetThresholdsPaginated retrieves a paginated list of thresholds

func (*Service) StopJob added in v1.3.1

func (s *Service) StopJob(jobID string) error

StopJob stops a running job

func (*Service) VerifyDomainDNS added in v1.3.1

func (s *Service) VerifyDomainDNS(domainID string) error

VerifyDomainDNS verifies a domain by DNS method

func (*Service) VerifyDomainFile added in v1.3.1

func (s *Service) VerifyDomainFile(domainID string) error

VerifyDomainFile verifies a domain by File method

type Test

type Test struct {
	ID            string            `json:"id"`
	Name          string            `json:"name"`
	ScriptID      string            `json:"script_id"`
	ScenarioID    string            `json:"scenario_id"`
	DomainID      string            `json:"domain_id"`
	Protocol      TestProtocol      `json:"protocol"`
	Path          string            `json:"path"`
	NumberOfUsers int               `json:"number_of_users"`
	Duration      TestDuration      `json:"duration"`
	RecurringType TestRecurringType `json:"recurring_type"`
	// TODO: Change back to `int`. Server-side issue causing null/empty value of RecurringValue to be string, not int. #121
	RecurringValue interface{}         `json:"recurring_value"`
	NextRun        connection.DateTime `json:"next_run"`
	CreatedAt      connection.DateTime `json:"created_at"`
	UpdatedAt      connection.DateTime `json:"updated_at"`
}

Test represents an LTaaS test +genie:model_response +genie:model_paginated

type TestDuration

type TestDuration string

TestDuration represents a load test duration

func ParseTestDuration

func ParseTestDuration(s string) (TestDuration, error)

ParseTestDuration parses string s and returns a pointer to an initialised TestDuration

func (*TestDuration) Duration

func (d *TestDuration) Duration() time.Duration

Duration returns the test duration as time.Duration

type TestNotFoundError

type TestNotFoundError struct {
	ID string
}

TestNotFoundError indicates a test was not found

func (*TestNotFoundError) Error

func (e *TestNotFoundError) Error() string

type TestProtocol

type TestProtocol string
const (
	TestProtocolHTTP  TestProtocol = "http"
	TestProtocolHTTPS TestProtocol = "https"
)

func ParseTestProtocol added in v1.3.1

func ParseTestProtocol(s string) (TestProtocol, error)

ParseTestProtocol attempts to parse a TestProtocol from string

func (TestProtocol) String

func (s TestProtocol) String() string

type TestRecurringType

type TestRecurringType string
const (
	TestRecurringTypeDaily  TestRecurringType = "Daily"
	TestRecurringTypeOneOff TestRecurringType = "One off"
	TestRecurringTypeWeekly TestRecurringType = "Weekly"
)

func (TestRecurringType) String

func (s TestRecurringType) String() string

type Threshold

type Threshold struct {
	ID          string              `json:"id"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Query       string              `json:"query"`
	CreatedAt   connection.DateTime `json:"created_at"`
	UpdatedAt   connection.DateTime `json:"updated_at"`
}

Threshold represents a test threshold +genie:model_response +genie:model_paginated

type ThresholdNotFoundError

type ThresholdNotFoundError struct {
	ID string
}

ThresholdNotFoundError indicates a threshold was not found

func (*ThresholdNotFoundError) Error

func (e *ThresholdNotFoundError) Error() string

Jump to

Keyboard shortcuts

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