Version: v0.0.0-...-75dfb8e Latest Latest

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

Go to latest
Published: Nov 9, 2016 License: BSD-2-Clause Imports: 7 Imported by: 0



Package order manages the bookkeeping and utilies required for users to create an 'order' meaning they have requested delegations for a certain resource.

Copyright (c) 2016 CloudFlare, Inc.



View Source
const (
	NewOrder       = "%s has created an order for the label %s. requesting %d delegations for %s"
	NewOrderLink   = "@%s - https://%s?%s"
	OrderFulfilled = "%s has had order %s fulfilled."
	NewDelegation  = "%s has delegated the label %s to %s (per order %s) for %s"


This section is empty.


func GenerateNum

func GenerateNum() (num string)


type Order

type Order struct {
	Creator string
	Users   []string
	Num     string

	TimeRequested     time.Time
	DurationRequested time.Duration
	Delegated         int
	OwnersDelegated   []string
	Owners            []string
	Labels            []string

func CreateOrder

func CreateOrder(name, orderNum string, time time.Time, duration time.Duration, adminsDelegated, contacts, users, labels []string, numDelegated int) (ord Order)

type OrderIndex

type OrderIndex struct {
	OrderFor string

	OrderId     string
	OrderOwners []string

type Orderer

type Orderer struct {
	Orders        map[string]Order
	Hipchat       hipchat.HipchatClient
	AlternateName string

Orders represents a mapping of Order IDs to Orders. This structure is useful for looking up information about individual Orders and whether or not an order has been fulfilled. Orders that have been fulfilled will be removed from the structure.

func NewOrderer

func NewOrderer(hipchatClient hipchat.HipchatClient) (o Orderer)

NewOrder will create a new map of Orders

func (*Orderer) FindOrder

func (o *Orderer) FindOrder(user string, labels []string) (string, bool)

func (*Orderer) NotifyDelegation

func (o *Orderer) NotifyDelegation(delegator, delegatee, orderNum, duration string, labels []string)

func (*Orderer) NotifyNewOrder

func (o *Orderer) NotifyNewOrder(duration, orderNum string, names, labels []string, uses int, owners map[string]string)

func (*Orderer) NotifyOrderFulfilled

func (o *Orderer) NotifyOrderFulfilled(name, orderNum string)

Source Files

Jump to

Keyboard shortcuts

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