events

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: BSD-3-Clause Imports: 8 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// TypeOperationProvisioned represents a provision operation
	TypeOperationProvisioned Type = "operation.provisioned"

	// TypeOperationDeprovisioned represents a deprovision operation
	TypeOperationDeprovisioned Type = "operation.deprovisioned"

	// TypeOperationResized represents a provision operation
	TypeOperationResized Type = "operation.resized"

	// TypeResourceProjectChanged represents a move operation
	TypeResourceProjectChanged Type = "resource.project.changed"

	// TypeResourceOwnerChanged represents a transfer operation
	TypeResourceOwnerChanged Type = "resource.owner.changed"

	// TypeOperationFailed represents a failed operation
	TypeOperationFailed Type = "operation.failed"

	// TypeResourceMeasuresAdded represents a change on resource usage
	TypeResourceMeasuresAdded = "resource.measures.added"

	// TypeResourceMeasuresFailed represents a failed change to resource usage
	TypeResourceMeasuresFailed = "resource.measures.failed"

	// TypeAccountStatusUpdated represents an account state update
	TypeAccountStatusUpdated = "account.status.updated"

	// TypeAccountUpdated represents an account update
	TypeAccountUpdated = "account.updated"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountStatusUpdated added in v0.9.5

type AccountStatusUpdated struct {
	BaseBody
	Data *AccountStatusUpdatedData `json:"data"`
}

AccountStatusUpdated represents an account state change

type AccountStatusUpdatedData added in v0.9.5

type AccountStatusUpdatedData struct {
	Reason   string `json:"reason,omitempty"`
	OldState string `json:"old_state"`
	NewState string `json:"new_state"`
}

AccountStatusUpdatedData holds the event specific data.

type AccountUpdated added in v0.9.9

type AccountUpdated struct {
	BaseBody
	Data *AccountUpdatedData `json:"data"`
}

AccountUpdated represents an account update by an actor other than the user

type AccountUpdatedData added in v0.9.9

type AccountUpdatedData struct {
	Reason   string  `json:"reason"`
	OldName  *string `json:"old_name,omitempty"`
	Name     string  `json:"name"`
	OldEmail *string `json:"old_email,omitempty"`
	Email    string  `json:"email"`
	GDPR     bool    `json:"gdpr"`
}

AccountUpdatedData holds the event specific data

type Actor

type Actor struct {
	ID    manifold.ID `json:"id"`
	Name  string      `json:"name"`
	Email string      `json:"email,omitempty"`
}

Actor represents a simplified version of either a user or a team.

func (Actor) Validate

func (Actor) Validate(v interface{}) error

Validate returns whether or not the given Actor is valid

type BaseBody

type BaseBody struct {
	EventType       Type        `json:"type"`
	StructActor     *Actor      `json:"actor,omitempty"`
	StructScope     *Scope      `json:"scope,omitempty"`
	StructRefID     manifold.ID `json:"ref_id"`
	StructCreatedAt time.Time   `json:"created_at"`
	StructSource    SourceType  `json:"source"`
	StructIPAddress string      `json:"ip_address"`
}

BaseBody contains data associated with all events.

func (*BaseBody) Actor

func (b *BaseBody) Actor() *Actor

Actor returns the body's Actor

func (*BaseBody) CreatedAt

func (b *BaseBody) CreatedAt() *strfmt.DateTime

CreatedAt returns the body's CreatedAt

func (*BaseBody) IPAddress

func (b *BaseBody) IPAddress() string

IPAddress returns the body's IPAddress

func (*BaseBody) RefID

func (b *BaseBody) RefID() manifold.ID

RefID returns the body's RefID

func (*BaseBody) Scope

func (b *BaseBody) Scope() *Scope

Scope returns the body's Scope

func (*BaseBody) SetActor

func (b *BaseBody) SetActor(a *Actor)

SetActor returns the body's Actor

func (*BaseBody) SetCreatedAt

func (b *BaseBody) SetCreatedAt(t *strfmt.DateTime)

SetCreatedAt sets the body's CreatedAt

func (*BaseBody) SetIPAddress

func (b *BaseBody) SetIPAddress(ip string)

SetIPAddress sets the body's IPAddress

func (*BaseBody) SetRefID

func (b *BaseBody) SetRefID(id manifold.ID)

SetRefID sets the body's RefID

func (*BaseBody) SetScope

func (b *BaseBody) SetScope(s *Scope)

SetScope returns the body's Scope

func (*BaseBody) SetSource

func (b *BaseBody) SetSource(s *string)

SetSource sets the body's Source

func (*BaseBody) SetType

func (b *BaseBody) SetType(s string)

SetType sets the body's EventType

func (*BaseBody) Source

func (b *BaseBody) Source() *string

Source returns the body's Source

func (*BaseBody) Type

func (b *BaseBody) Type() Type

Type returns the body's EventType

func (*BaseBody) Validate

func (b *BaseBody) Validate(v interface{}) error

Validate returns an error if the BaseEventBody is not valid

type Body

type Body interface {
	Validate(interface{}) error

	Type() Type
	SetType(string)

	Actor() *Actor
	SetActor(*Actor)

	Scope() *Scope
	SetScope(*Scope)

	RefID() manifold.ID
	SetRefID(manifold.ID)

	CreatedAt() *strfmt.DateTime
	SetCreatedAt(*strfmt.DateTime)

	Source() *string
	SetSource(*string)

	IPAddress() string
	SetIPAddress(string)
}

Body represents methods all Events must implement.

type Error added in v0.9.5

type Error struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

Error represents an error message.

func (Error) Validate added in v0.9.5

func (e Error) Validate(v interface{}) error

Validate returns whether or not the given Error is valid

type Event

type Event struct {
	ID            manifold.ID `json:"id"`
	StructType    string      `json:"type"`
	StructVersion int         `json:"version"`
	Body          Body        `json:"body"`
}

Event represents meaningful activities performed on the system.

func New added in v0.9.5

func New() (*Event, error)

New returns a new event without a body.

func (*Event) Analytics

func (e *Event) Analytics() map[string]interface{}

Analytics returns a property map for analytics consumption.

func (*Event) GetID

func (e *Event) GetID() manifold.ID

GetID returns the ID associated with this event

func (*Event) StateType

func (e *Event) StateType() string

StateType returns the event state type as a string

func (*Event) Type

func (e *Event) Type() idtype.Type

Type returns the idtype object for this struct type

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for an event

func (*Event) Validate

func (e *Event) Validate(v strfmt.Registry) error

Validate returns whether or not the given Event is valid

func (*Event) Version

func (e *Event) Version() int

Version returns the data structure version of this event

type Operation

type Operation struct {
	ID        manifold.ID `json:"id"`
	Type      string      `json:"type"`
	State     string      `json:"state"`
	CreatedAt time.Time   `json:"created_at"`
	UpdatedAt time.Time   `json:"updated_at"`
}

Operation is a simplified version for events data.

func (Operation) Validate

func (Operation) Validate(v interface{}) error

Validate returns whether or not the given Operation is valid

type OperationDeprovisioned

type OperationDeprovisioned struct {
	BaseBody
	Data *OperationDeprovisionedData `json:"data"`
}

OperationDeprovisioned represents a deprovision operation event.

type OperationDeprovisionedData

type OperationDeprovisionedData struct {
	Operation Operation `json:"operation"`
	Source    string    `json:"source" analytics:"type"`
	Resource  Resource  `json:"resource"`
	Project   *Project  `json:"project,omitempty"`
	Provider  *Provider `json:"provider,omitempty"`
	Product   *Product  `json:"product,omitempty"`
	Plan      *Plan     `json:"plan,omitempty"`
	Region    *Region   `json:"region,omitempty"`
}

OperationDeprovisionedData holds the event specific data.

type OperationError

type OperationError struct {
	Message   string    `json:"message"`
	Code      int       `json:"code"`
	Attempt   int       `json:"count"`
	CreatedAt time.Time `json:"created_at"`
}

OperationError represents an error message.

func (OperationError) Validate

func (OperationError) Validate(v interface{}) error

Validate returns whether or not the given OperationError is valid

type OperationFailed

type OperationFailed struct {
	BaseBody
	Data *OperationFailedData `json:"data"`
}

OperationFailed represents a resize operation event.

type OperationFailedData

type OperationFailedData struct {
	Operation Operation      `json:"operation"`
	Resource  *Resource      `json:"resource,omitempty"`
	Project   *Project       `json:"project,omitempty"`
	Provider  *Provider      `json:"provider,omitempty"`
	Product   *Product       `json:"product,omitempty"`
	Plan      *Plan          `json:"plan,omitempty"`
	Region    *Region        `json:"region,omitempty"`
	Error     OperationError `json:"error"`
}

OperationFailedData holds the event specific data.

type OperationProvisioned

type OperationProvisioned struct {
	BaseBody
	Data *OperationProvisionedData `json:"data"`
}

OperationProvisioned represents a provision operation event.

type OperationProvisionedData

type OperationProvisionedData struct {
	Operation Operation `json:"operation"`
	Source    string    `json:"source" analytics:"type"`
	Resource  Resource  `json:"resource"`
	Project   *Project  `json:"project,omitempty"`
	Provider  *Provider `json:"provider,omitempty"`
	Product   *Product  `json:"product,omitempty"`
	Plan      *Plan     `json:"plan,omitempty"`
	Region    *Region   `json:"region,omitempty"`
}

OperationProvisionedData holds the event specific data.

type OperationResized

type OperationResized struct {
	BaseBody
	Data *OperationResizedData `json:"data"`
}

OperationResized represents a resize operation event.

type OperationResizedData

type OperationResizedData struct {
	Operation Operation `json:"operation"`
	Source    string    `json:"source" analytics:"type"`
	Resource  Resource  `json:"resource"`
	Project   *Project  `json:"project,omitempty"`
	Provider  *Provider `json:"provider,omitempty"`
	Product   *Product  `json:"product,omitempty"`
	OldPlan   *Plan     `json:"old_plan,omitempty"`
	NewPlan   *Plan     `json:"new_plan,omitempty"`
	Region    *Region   `json:"region,omitempty"`
}

OperationResizedData holds the event specific data.

type Plan

type Plan struct {
	ID   manifold.ID `json:"id" analytics:"plan_id"`
	Name string      `json:"name" analytics:"plan_name"`
	Cost int         `json:"cost" analytics:"plan_cost"`
}

Plan is a simplified version for events data.

func (Plan) Validate

func (Plan) Validate(v interface{}) error

Validate returns whether or not the given Plan is valid

type Product

type Product struct {
	ID   manifold.ID `json:"id" analytics:"product_id"`
	Name string      `json:"name" analytics:"product_name"`
}

Product is a simplified version for events data.

func (Product) Validate

func (Product) Validate(v interface{}) error

Validate returns whether or not the given Product is valid

type Project

type Project struct {
	ID   manifold.ID `json:"id" analytics:"project_id"`
	Name string      `json:"name" analytics:"project_name"`
}

Project is a simplified version for events data.

func (Project) Validate

func (Project) Validate(v interface{}) error

Validate returns whether or not the given Project is valid

type Provider

type Provider struct {
	ID   manifold.ID `json:"id" analytics:"provider_id"`
	Name string      `json:"name" analytics:"provider_name"`
}

Provider is a simplified version for events data.

func (Provider) Validate

func (Provider) Validate(v interface{}) error

Validate returns whether or not the given Provider is valid

type Region

type Region struct {
	ID       manifold.ID `json:"id" analytics:"region_id"`
	Name     string      `json:"name" analytics:"region_name"`
	Platform string      `json:"platform" analytics:"region_platform"`
	Location string      `json:"location" analytics:"region_location"`
	Priority float64     `json:"priority" analytics:"region_priority"`
}

Region is a simplified version for events data.

func (Region) Validate

func (Region) Validate(v interface{}) error

Validate returns whether or not the given Region is valid

type Resource

type Resource struct {
	ID   manifold.ID `json:"id" analytics:"resource_id"`
	Name string      `json:"name" analytics:"resource_name"`
}

Resource is a simplified version for events data.

func (Resource) Validate

func (Resource) Validate(v interface{}) error

Validate returns whether or not the given Resource is valid

type ResourceMeasuresAdded

type ResourceMeasuresAdded struct {
	BaseBody
	Data *ResourceMeasuresAddedData `json:"data"`
}

ResourceMeasuresAdded represents a change on resource usage.

type ResourceMeasuresAddedData

type ResourceMeasuresAddedData struct {
	Resource Resource         `json:"resource"`
	Project  *Project         `json:"project,omitempty"`
	Provider Provider         `json:"provider"`
	Product  Product          `json:"product"`
	Plan     Plan             `json:"plan"`
	Region   Region           `json:"region"`
	Measures map[string]int64 `json:"measures"`
}

ResourceMeasuresAddedData holds the event specific data.

type ResourceMeasuresFailed added in v0.9.5

type ResourceMeasuresFailed struct {
	BaseBody
	Data *ResourceMeasuresFailedData `json:"data"`
}

ResourceMeasuresFailed represents a failed change to resource usage.

type ResourceMeasuresFailedData added in v0.9.5

type ResourceMeasuresFailedData struct {
	Resource Resource `json:"resource"`
	Project  *Project `json:"project,omitempty"`
	Provider Provider `json:"provider"`
	Product  Product  `json:"product"`
	Plan     Plan     `json:"plan"`
	Region   Region   `json:"region"`
	Error    Error    `json:"error"`
}

ResourceMeasuresFailedData holds the event specific data.

type ResourceOwnerChanged added in v0.9.4

type ResourceOwnerChanged struct {
	BaseBody
	Data *ResourceOwnerChangedData `json:"data"`
}

ResourceOwnerChanged records a transfer operation event

type ResourceOwnerChangedData added in v0.9.4

type ResourceOwnerChangedData struct {
	Operation Operation `json:"operation"`
	Source    string    `json:"source" analytics:"type"`
	Resource  Resource  `json:"resource"`
	OldUser   *User     `json:"old_user,omitempty"`
	OldTeam   *Team     `json:"old_team,omitempty"`
	NewUser   *User     `json:"new_user,omitempty"`
	NewTeam   *Team     `json:"new_team,omitempty"`
	Plan      *Plan     `json:"plan,omitempty"`
	Provider  *Provider `json:"provider,omitempty"`
	Product   *Product  `json:"product,omitempty"`
	Project   *Project  `json:"project,omitempty"`
	Region    *Region   `json:"region,omitempty"`
}

ResourceOwnerChangedData holds the specific transfer event data

type ResourceProjectChanged added in v0.9.4

type ResourceProjectChanged struct {
	BaseBody
	Data *ResourceProjectChangedData `json:"data"`
}

ResourceProjectChanged records a move operation event

type ResourceProjectChangedData added in v0.9.4

type ResourceProjectChangedData struct {
	Operation  Operation `json:"operation"`
	Source     string    `json:"source" analytics:"type"`
	Resource   Resource  `json:"resource"`
	Provider   *Provider `json:"provider,omitempty"`
	Product    *Product  `json:"product,omitempty"`
	Plan       *Plan     `json:"plan,omitempty"`
	OldProject *Project  `json:"old_project,omitempty"`
	NewProject *Project  `json:"new_project,omitempty"`
	Region     *Region   `json:"region,omitempty"`
}

ResourceProjectChangedData holds the specific move event details

type Scope

type Scope struct {
	ID    manifold.ID `json:"id"`
	Name  string      `json:"name"`
	Email string      `json:"email,omitempty"`
}

Scope represents a simplified version of either a user or a team.

func (Scope) Validate

func (Scope) Validate(v interface{}) error

Validate returns whether or not the given Scope is valid

type SourceType

type SourceType string

SourceType represents where the request came from.

const (
	// SourceDashboard is a request coming from the dashboard
	SourceDashboard SourceType = "dashboard"

	// SourceCLI is a request coming from the cli
	SourceCLI SourceType = "cli"

	// SourceSystem is an internal request
	SourceSystem SourceType = "system"

	// SourceProvider is a request from provider
	SourceProvider SourceType = "provider"
)

func (SourceType) Validate added in v0.9.5

func (s SourceType) Validate(interface{}) error

Validate whether source type is valid

type Team

type Team struct {
	ID   manifold.ID `json:"id"`
	Name string      `json:"name"`
}

Team is a simplified version for events data.

func (Team) Validate

func (Team) Validate(v interface{}) error

Validate returns whether or not the given Team is valid

type Type

type Type string

Type represents the different types of events.

type User

type User struct {
	ID    manifold.ID `json:"id"`
	Name  string      `json:"name"`
	Email string      `json:"email"`
}

User is a simplified version for events data.

func (User) Validate

func (User) Validate(v interface{}) error

Validate returns whether or not the given User is valid

Jump to

Keyboard shortcuts

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