capi-to-syslog: github.com/mxplusb/capi-to-syslog/types Index | Files

package types

import "github.com/mxplusb/capi-to-syslog/types"

Index

Package Files

types.go

Variables

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.

type AppCrashEvent Uses

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 Uses

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 Uses

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

type AppEntity Uses

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 Uses

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

func (*AppEntityEnv) String Uses

func (a *AppEntityEnv) String() string

func (*AppEntityEnv) UnmarshalJSON Uses

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

type AppEvent Uses

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 Uses

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

type AppStopEvent Uses

type AppStopEvent struct{}

type AppUpdateEvent Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

type Resource Uses

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

Package types imports 4 packages (graph) and is imported by 1 packages. Updated 2017-07-04. Refresh now. Tools for package owners.