common

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const (
	OrderStatusCreated = iota + 1
	OrderStatusProcessing
	OrderStatusSucceeded
	OrderStatusFailed
)

Variables

View Source
var ErrOrderFailed = errors.New("order failed")

Functions

This section is empty.

Types

type BriefProduct added in v0.1.0

type BriefProduct struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type DeploymentFee

type DeploymentFee struct {
	Location        Location `json:"location"`
	Price           float64  `json:"price"`
	FreeDeployments int      `json:"free_deployments"`
}

type Location

type Location struct {
	ID      int      `json:"id"`
	Name    string   `json:"name"`
	Key     string   `json:"key"`
	City    string   `json:"city"`
	Modules []Module `json:"available_modules"`
}

type LocationList

type LocationList struct {
	goclient.Pagination
	Items []Location
}

type LocationService

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

func NewLocationService

func NewLocationService(client goclient.Client) LocationService

func (LocationService) Get

func (l LocationService) Get(ctx context.Context, id int) (location Location, err error)

func (LocationService) List

func (l LocationService) List(ctx context.Context, cursor goclient.Cursor) (list LocationList, err error)

type Module

type Module struct {
	ID        int        `json:"id"`
	Name      string     `json:"name"`
	Parent    *Module    `json:"parent"`
	Sorting   int        `json:"sorting"`
	Locations []Location `json:"locations"`
}

type ModuleList

type ModuleList struct {
	goclient.Pagination
	Items []Module
}

type ModuleService

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

func NewModuleService

func NewModuleService(client goclient.Client) ModuleService

func (ModuleService) Get

func (l ModuleService) Get(ctx context.Context, id int) (module Module, err error)

func (ModuleService) List

func (l ModuleService) List(ctx context.Context, cursor goclient.Cursor) (list ModuleList, err error)

type Order

type Order struct {
	ID        int         `json:"id"`
	Status    OrderStatus `json:"status"`
	Product   Product     `json:"product_instance"`
	CreatedAt Time        `json:"created_at"`
}

type OrderService

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

func NewOrderService

func NewOrderService(client goclient.Client) OrderService

func (OrderService) Get

func (o OrderService) Get(ctx context.Context, id int) (order Order, err error)

func (OrderService) WaitForCompletion deprecated

func (o OrderService) WaitForCompletion(ctx context.Context, ordering Ordering) error

Deprecated: use WaitUntilProcessed instead

func (OrderService) WaitUntilProcessed added in v0.2.6

func (o OrderService) WaitUntilProcessed(ctx context.Context, ordering Ordering) (order Order, err error)

type OrderStatus

type OrderStatus struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type Ordering

type Ordering struct {
	Ref string `json:"ref"`
}

func (Ordering) ExtractIdentifier

func (o Ordering) ExtractIdentifier() (int, error)

type Product

type Product struct {
	ID             int                   `json:"id"`
	Name           string                `json:"product_name"`
	Type           ProductType           `json:"type"`
	Visibility     string                `json:"visibility"`
	UsageCycle     ProductUsageCycle     `json:"usage_cycle"`
	Items          []ProductItem         `json:"items"`
	Price          float64               `json:"price"`
	Availability   []ProductAvailability `json:"availability"`
	Category       string                `json:"category"`
	DeploymentFees []DeploymentFee       `json:"deployment_fees"`
}

type ProductAvailability

type ProductAvailability struct {
	Location  Location `json:"location"`
	Available int      `json:"available"`
}

type ProductItem

type ProductItem struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Amount      int    `json:"amount"`
}

type ProductList

type ProductList struct {
	Items      []Product
	Pagination goclient.Pagination
}

type ProductService

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

func NewProductService

func NewProductService(client goclient.Client) ProductService

func (ProductService) Get

func (p ProductService) Get(ctx context.Context, id int) (product Product, err error)

func (ProductService) List

func (p ProductService) List(ctx context.Context, cursor goclient.Cursor) (list ProductList, err error)

func (ProductService) ListByType

func (p ProductService) ListByType(ctx context.Context, productType string, cursor goclient.Cursor) (list ProductList, err error)

func (ProductService) ListTypes added in v0.1.0

func (p ProductService) ListTypes(ctx context.Context, cursor goclient.Cursor) (list ProductTypeList, err error)

type ProductType

type ProductType struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Key  string `json:"key"`
}

type ProductTypeList added in v0.1.0

type ProductTypeList struct {
	Items      []ProductType
	Pagination goclient.Pagination
}

type ProductUsageCycle

type ProductUsageCycle struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Duration int    `json:"duration"`
}

type Time

type Time time.Time

func (Time) AsTime

func (t Time) AsTime() time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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