types

package
v0.0.0-...-47f1c69 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeHandler = map[EventKind]func() interface{}{
	AppCreateKind: func() interface{} {

		return &struct {
			Metadata AppCreateMetadata `json:"metadata"`
		}{}
	},
	AppStopKind: func() interface{} {
		return &struct {
			Metadata AppStopEvent `json:"metadata"`
		}{}
	},
	AppDeleteKind: func() interface{} {
		return &struct {
			Metadata AppDeleteEvent `json:"metadata"`
		}{}
	},
	AppUpdateKind: func() interface{} {
		return &struct {
			Metadata AppUpdateEvent `json:"metadata"`
		}{}
	},
	AppSSHKind: func() interface{} {
		return &struct {
			Metadata AppSSHEvent `json:"metadata"`
		}{}
	},
	AppCrashKind: func() interface{} {
		return &struct {
			Metadata AppCrashEvent `json:"metadata"`
		}{}
	},
}

TypeHandler is our interface for typing the events API with the entity metadata by exploiting the JSON interface.

Functions

This section is empty.

Types

type AppCrashEvent

type AppCrashEvent struct {
	Instance        int    `json:"instance"`
	Index           int    `json:"index"`
	ExitStatus      string `json:"exit_status"`
	ExitDescription string `json:"exit_description"`
	Reason          string `json:"reason"`
}

type AppCreateMetadata

type AppCreateMetadata struct {
	Request struct {
		Name                  string `json:"name"`
		Instances             int    `json:"instances"`
		Memory                int    `json:"memory"`
		State                 string `json:"state"`
		EnvironmentJSON       string `json:"environment_json"`
		DockerCredentialsJSON string `json:"docker_credentials_json"`
	} `json:"request"`
}

type AppDeleteEvent

type AppDeleteEvent struct {
	Recursive bool `json:"recursive"`
}

type AppEntity

type AppEntity struct {
	Type             EventKind `json:"type"`
	Actor            string    `json:"actor"`
	ActorType        string    `json:"actor_type"`
	ActorName        string    `json:"actor_name"`
	Actee            string    `json:"actee"`
	ActeeType        string    `json:"actee_type"`
	ActeeName        string    `json:"actee_name"`
	Timestamp        string    `json:"timestamp"`
	SpaceGUID        string    `json:"space_guid"`
	OrganizationGUID string    `json:"organization_guid"`
}

AppEntity contains the common bits of an entity. It is embedded in AppEntityEnv.

type AppEntityEnv

type AppEntityEnv struct {
	AppEntity             // embed this here, so we don't recurse in (*AppEntityEnv).UnmarshalJSON.
	Metadata  interface{} `json:"metadata"`
}

func (*AppEntityEnv) String

func (a *AppEntityEnv) String() string

func (*AppEntityEnv) UnmarshalJSON

func (e *AppEntityEnv) UnmarshalJSON(data []byte) error

type AppEvent

type AppEvent struct {
	TotalResults int        `json:"total_results"`
	TotalPages   int        `json:"total_pages"`
	PrevURL      string     `json:"prev_url,omitempty"`
	NextURL      string     `json:"next_url,omitempty"`
	Resources    []Resource `json:"resources"`
}

AppEvent is the top-level object.

type AppSSHEvent

type AppSSHEvent struct {
	Index int `json:"index"`
}

type AppStopEvent

type AppStopEvent struct{}

type AppUpdateEvent

type AppUpdateEvent struct {
	Name                  string `json:"name"`
	Instances             int    `json:"instances"`
	Memory                int    `json:"memory"`
	State                 string `json:"state"`
	EnvironmentJSON       string `json:"environment_json"`
	DockerCredentialsJSON string `json:"docker_credentials_json"`
}

type EventKind

type EventKind int

EventKind is the type of auditing event from Cloud Foundry.

const (
	AppCreateKind EventKind = iota
	AppStopKind
	AppDeleteKind
	AppUpdateKind
	AppCrashKind
	AppSSHKind
)

func (*EventKind) UnmarshalJSON

func (ev *EventKind) UnmarshalJSON(data []byte) error

UnmarshalJSON maps an event to it's appropriate type so it can be unmarshalled more sanely.

type EventMetadata

type EventMetadata struct {
	GUID      string    `json:"guid"`
	URL       string    `json:"url"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Request

type Request struct {
	Name             string `json:"name"`
	OrganizationGUID string `json:"organization_guid"`
	AllowSSH         bool   `json:"allow_ssh"`
}

type Resource

type Resource struct {
	Metadata EventMetadata `json:"metadata"`
	Entity   AppEntityEnv  `json:"entity"`
}

Jump to

Keyboard shortcuts

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