bbs: code.cloudfoundry.org/bbs Index | Files | Directories

package bbs

import "code.cloudfoundry.org/bbs"

Index

Package Files

client.go package.go routes.go

Constants

const (
    ContentTypeHeader    = "Content-Type"
    XCfRouterErrorHeader = "X-Cf-Routererror"
    ProtoContentType     = "application/x-protobuf"
    KeepContainer        = true
    DeleteContainer      = false
    DefaultRetryCount    = 3
)
const (
    // Ping
    PingRoute_r0 = "Ping"

    // Domains
    DomainsRoute_r0      = "Domains"
    UpsertDomainRoute_r0 = "UpsertDomain"

    // Actual LRPs
    ActualLRPsRoute_r0                          = "ActualLRPs"
    ActualLRPGroupsRoute_r0                     = "ActualLRPGroups"                      // DEPRECATED
    ActualLRPGroupsByProcessGuidRoute_r0        = "ActualLRPGroupsByProcessGuid"         // DEPRECATED
    ActualLRPGroupByProcessGuidAndIndexRoute_r0 = "ActualLRPGroupsByProcessGuidAndIndex" // DEPRECATED

    // Actual LRP Lifecycle
    ClaimActualLRPRoute_r0  = "ClaimActualLRP"
    StartActualLRPRoute_r0  = "StartActualLRP"
    CrashActualLRPRoute_r0  = "CrashActualLRP"
    FailActualLRPRoute_r0   = "FailActualLRP"
    RemoveActualLRPRoute_r0 = "RemoveActualLRP"
    RetireActualLRPRoute_r0 = "RetireActualLRP"

    // Evacuation
    RemoveEvacuatingActualLRPRoute_r0 = "RemoveEvacuatingActualLRP"
    EvacuateClaimedActualLRPRoute_r0  = "EvacuateClaimedActualLRP"
    EvacuateCrashedActualLRPRoute_r0  = "EvacuateCrashedActualLRP"
    EvacuateStoppedActualLRPRoute_r0  = "EvacuateStoppedActualLRP"
    EvacuateRunningActualLRPRoute_r0  = "EvacuateRunningActualLRP"

    // Desired LRPs
    DesiredLRPsRoute_r3               = "DesiredLRPs"
    DesiredLRPSchedulingInfosRoute_r0 = "DesiredLRPSchedulingInfos"
    DesiredLRPByProcessGuidRoute_r3   = "DesiredLRPByProcessGuid"
    DesiredLRPsRoute_r2               = "DesiredLRPs_r2"             // DEPRECATED
    DesiredLRPByProcessGuidRoute_r2   = "DesiredLRPByProcessGuid_r2" // DEPRECATED

    // Desire LRP Lifecycle
    DesireDesiredLRPRoute_r2 = "DesireDesiredLRP"
    UpdateDesiredLRPRoute_r0 = "UpdateDesireLRP"
    RemoveDesiredLRPRoute_r0 = "RemoveDesiredLRP"

    // Tasks
    TasksRoute_r3         = "Tasks"
    TaskByGuidRoute_r3    = "TaskByGuid"
    DesireTaskRoute_r2    = "DesireTask"
    StartTaskRoute_r0     = "StartTask"
    CancelTaskRoute_r0    = "CancelTask"
    FailTaskRoute_r0      = "FailTask" // DEPRECATED
    RejectTaskRoute_r0    = "RejectTask"
    CompleteTaskRoute_r0  = "CompleteTask"
    ResolvingTaskRoute_r0 = "ResolvingTask"
    DeleteTaskRoute_r0    = "DeleteTask"
    TasksRoute_r2         = "Tasks_r2"      // DEPRECATED
    TaskByGuidRoute_r2    = "TaskByGuid_r2" // DEPRECATED

    // Event Streaming
    LRPGroupEventStreamRoute_r1    = "EventStream" // DEPRECATED
    TaskEventStreamRoute_r1        = "TaskEventStream"
    LRPInstanceEventStreamRoute_r1 = "LRPInstanceEventStream"
    EventStreamRoute_r0            = "EventStream_r0"            // DEPRECATED
    TaskEventStreamRoute_r0        = "TaskEventStream_r0"        // DEPRECATED
    LrpInstanceEventStreamRoute_r0 = "LrpInstanceEventStream_r0" // DEPRECATED

    // Cell Presence
    CellsRoute_r0 = "Cells"
)

Variables

var Routes = rata.Routes{

    {Path: "/v1/ping", Method: "POST", Name: PingRoute_r0},

    {Path: "/v1/domains/list", Method: "POST", Name: DomainsRoute_r0},
    {Path: "/v1/domains/upsert", Method: "POST", Name: UpsertDomainRoute_r0},

    {Path: "/v1/actual_lrps/list", Method: "POST", Name: ActualLRPsRoute_r0},
    {Path: "/v1/actual_lrp_groups/list", Method: "POST", Name: ActualLRPGroupsRoute_r0},
    {Path: "/v1/actual_lrp_groups/list_by_process_guid", Method: "POST", Name: ActualLRPGroupsByProcessGuidRoute_r0},
    {Path: "/v1/actual_lrp_groups/get_by_process_guid_and_index", Method: "POST", Name: ActualLRPGroupByProcessGuidAndIndexRoute_r0},

    {Path: "/v1/actual_lrps/claim", Method: "POST", Name: ClaimActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/start", Method: "POST", Name: StartActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/crash", Method: "POST", Name: CrashActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/fail", Method: "POST", Name: FailActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/remove", Method: "POST", Name: RemoveActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/retire", Method: "POST", Name: RetireActualLRPRoute_r0},

    {Path: "/v1/actual_lrps/remove_evacuating", Method: "POST", Name: RemoveEvacuatingActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/evacuate_claimed", Method: "POST", Name: EvacuateClaimedActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/evacuate_crashed", Method: "POST", Name: EvacuateCrashedActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/evacuate_stopped", Method: "POST", Name: EvacuateStoppedActualLRPRoute_r0},
    {Path: "/v1/actual_lrps/evacuate_running", Method: "POST", Name: EvacuateRunningActualLRPRoute_r0},

    {Path: "/v1/desired_lrp_scheduling_infos/list", Method: "POST", Name: DesiredLRPSchedulingInfosRoute_r0},

    {Path: "/v1/desired_lrps/list.r3", Method: "POST", Name: DesiredLRPsRoute_r3},
    {Path: "/v1/desired_lrps/get_by_process_guid.r3", Method: "POST", Name: DesiredLRPByProcessGuidRoute_r3},
    {Path: "/v1/desired_lrps/list.r2", Method: "POST", Name: DesiredLRPsRoute_r2},
    {Path: "/v1/desired_lrps/get_by_process_guid.r2", Method: "POST", Name: DesiredLRPByProcessGuidRoute_r2},

    {Path: "/v1/desired_lrp/desire.r2", Method: "POST", Name: DesireDesiredLRPRoute_r2},
    {Path: "/v1/desired_lrp/update", Method: "POST", Name: UpdateDesiredLRPRoute_r0},
    {Path: "/v1/desired_lrp/remove", Method: "POST", Name: RemoveDesiredLRPRoute_r0},

    {Path: "/v1/tasks/list.r3", Method: "POST", Name: TasksRoute_r3},
    {Path: "/v1/tasks/get_by_task_guid.r3", Method: "POST", Name: TaskByGuidRoute_r3},
    {Path: "/v1/tasks/list.r2", Method: "POST", Name: TasksRoute_r2},
    {Path: "/v1/tasks/get_by_task_guid.r2", Method: "POST", Name: TaskByGuidRoute_r2},

    {Path: "/v1/tasks/desire.r2", Method: "POST", Name: DesireTaskRoute_r2},
    {Path: "/v1/tasks/start", Method: "POST", Name: StartTaskRoute_r0},
    {Path: "/v1/tasks/cancel", Method: "POST", Name: CancelTaskRoute_r0},
    {Path: "/v1/tasks/fail", Method: "POST", Name: FailTaskRoute_r0},
    {Path: "/v1/tasks/reject", Method: "POST", Name: RejectTaskRoute_r0},
    {Path: "/v1/tasks/complete", Method: "POST", Name: CompleteTaskRoute_r0},
    {Path: "/v1/tasks/resolving", Method: "POST", Name: ResolvingTaskRoute_r0},
    {Path: "/v1/tasks/delete", Method: "POST", Name: DeleteTaskRoute_r0},

    {Path: "/v1/events.r1", Method: "GET", Name: LRPGroupEventStreamRoute_r1},
    {Path: "/v1/events/tasks.r1", Method: "POST", Name: TaskEventStreamRoute_r1},
    {Path: "/v1/events/lrp_instances.r1", Method: "POST", Name: LRPInstanceEventStreamRoute_r1},
    {Path: "/v1/events", Method: "GET", Name: EventStreamRoute_r0},
    {Path: "/v1/events/tasks", Method: "POST", Name: TaskEventStreamRoute_r0},
    {Path: "/v1/events/lrp_instances", Method: "POST", Name: LrpInstanceEventStreamRoute_r0},

    {Path: "/v1/cells/list.r1", Method: "POST", Name: CellsRoute_r0},
}

type Client Uses

type Client interface {
    ExternalTaskClient
    ExternalDomainClient
    ExternalActualLRPClient
    ExternalDesiredLRPClient
    ExternalEventClient

    // Returns true if the BBS server is reachable
    Ping(logger lager.Logger) bool

    // Lists all Cells
    Cells(logger lager.Logger) ([]*models.CellPresence, error)
}

The External InternalClient can be used to access the BBS's public functionality. It exposes methods for basic LRP and Task Lifecycles, Domain manipulation, and event subscription.

type ClientConfig Uses

type ClientConfig struct {
    URL                    string
    IsTLS                  bool
    CAFile                 string
    CertFile               string
    KeyFile                string
    ClientSessionCacheSize int
    MaxIdleConnsPerHost    int
    InsecureSkipVerify     bool
    Retries                int
    RequestTimeout         time.Duration // Only affects the http client, not the streaming client
}

type ExternalActualLRPClient Uses

type ExternalActualLRPClient interface {
    // Returns all ActualLRPs matching the given ActualLRPFilter
    ActualLRPs(lager.Logger, models.ActualLRPFilter) ([]*models.ActualLRP, error)

    // DEPRECATED
    // Returns all ActualLRPGroups matching the given ActualLRPFilter
    ActualLRPGroups(lager.Logger, models.ActualLRPFilter) ([]*models.ActualLRPGroup, error)

    // DEPRECATED
    // Returns all ActualLRPGroups that have the given process guid
    ActualLRPGroupsByProcessGuid(logger lager.Logger, processGuid string) ([]*models.ActualLRPGroup, error)

    // DEPRECATED
    // Returns the ActualLRPGroup with the given process guid and instance index
    ActualLRPGroupByProcessGuidAndIndex(logger lager.Logger, processGuid string, index int) (*models.ActualLRPGroup, error)

    // Shuts down the ActualLRP matching the given ActualLRPKey, but does not modify the desired state
    RetireActualLRP(logger lager.Logger, key *models.ActualLRPKey) error
}

The ExternalActualLRPClient is used to access and retire Actual LRPs

type ExternalDesiredLRPClient Uses

type ExternalDesiredLRPClient interface {
    // Lists all DesiredLRPs that match the given DesiredLRPFilter
    DesiredLRPs(lager.Logger, models.DesiredLRPFilter) ([]*models.DesiredLRP, error)

    // Returns the DesiredLRP with the given process guid
    DesiredLRPByProcessGuid(logger lager.Logger, processGuid string) (*models.DesiredLRP, error)

    // Returns all DesiredLRPSchedulingInfos that match the given DesiredLRPFilter
    DesiredLRPSchedulingInfos(lager.Logger, models.DesiredLRPFilter) ([]*models.DesiredLRPSchedulingInfo, error)

    // Creates the given DesiredLRP and its corresponding ActualLRPs
    DesireLRP(lager.Logger, *models.DesiredLRP) error

    // Updates the DesiredLRP matching the given process guid
    UpdateDesiredLRP(logger lager.Logger, processGuid string, update *models.DesiredLRPUpdate) error

    // Removes the DesiredLRP matching the given process guid
    RemoveDesiredLRP(logger lager.Logger, processGuid string) error
}

The ExternalDesiredLRPClient is used to access and manipulate Disired LRPs.

type ExternalDomainClient Uses

type ExternalDomainClient interface {
    // Lists the active domains
    Domains(logger lager.Logger) ([]string, error)

    // Creates a domain or bumps the ttl on an existing domain
    UpsertDomain(logger lager.Logger, domain string, ttl time.Duration) error
}

The ExternalDomainClient is used to access and update Diego's domains.

type ExternalEventClient Uses

type ExternalEventClient interface {
    // DEPRECATED
    SubscribeToEvents(logger lager.Logger) (events.EventSource, error)

    SubscribeToInstanceEvents(logger lager.Logger) (events.EventSource, error)
    SubscribeToTaskEvents(logger lager.Logger) (events.EventSource, error)

    // DEPRECATED
    SubscribeToEventsByCellID(logger lager.Logger, cellId string) (events.EventSource, error)

    SubscribeToInstanceEventsByCellID(logger lager.Logger, cellId string) (events.EventSource, error)
}

The ExternalEventClient is used to subscribe to groups of Events.

type ExternalTaskClient Uses

type ExternalTaskClient interface {
    // Creates a Task from the given TaskDefinition
    DesireTask(logger lager.Logger, guid, domain string, def *models.TaskDefinition) error

    // Lists all Tasks
    Tasks(logger lager.Logger) ([]*models.Task, error)

    // List all Tasks that match filter
    TasksWithFilter(logger lager.Logger, filter models.TaskFilter) ([]*models.Task, error)

    // Lists all Tasks of the given domain
    TasksByDomain(logger lager.Logger, domain string) ([]*models.Task, error)

    // Lists all Tasks on the given cell
    TasksByCellID(logger lager.Logger, cellId string) ([]*models.Task, error)

    // Returns the Task with the given guid
    TaskByGuid(logger lager.Logger, guid string) (*models.Task, error)

    // Cancels the Task with the given task guid
    CancelTask(logger lager.Logger, taskGuid string) error

    // Resolves a Task with the given guid
    ResolvingTask(logger lager.Logger, taskGuid string) error

    // Deletes a completed task with the given guid
    DeleteTask(logger lager.Logger, taskGuid string) error
}

The ExternalTaskClient is used to access Diego's ability to run one-off tasks. More information about this API can be found in the bbs docs:

https://code.cloudfoundry.org/bbs/tree/master/doc/tasks.md

type InternalClient Uses

type InternalClient interface {
    Client

    ClaimActualLRP(logger lager.Logger, key *models.ActualLRPKey, instanceKey *models.ActualLRPInstanceKey) error
    StartActualLRP(logger lager.Logger, key *models.ActualLRPKey, instanceKey *models.ActualLRPInstanceKey, netInfo *models.ActualLRPNetInfo) error
    CrashActualLRP(logger lager.Logger, key *models.ActualLRPKey, instanceKey *models.ActualLRPInstanceKey, errorMessage string) error
    FailActualLRP(logger lager.Logger, key *models.ActualLRPKey, errorMessage string) error
    RemoveActualLRP(logger lager.Logger, key *models.ActualLRPKey, instanceKey *models.ActualLRPInstanceKey) error

    EvacuateClaimedActualLRP(lager.Logger, *models.ActualLRPKey, *models.ActualLRPInstanceKey) (bool, error)
    EvacuateRunningActualLRP(lager.Logger, *models.ActualLRPKey, *models.ActualLRPInstanceKey, *models.ActualLRPNetInfo) (bool, error)
    EvacuateStoppedActualLRP(lager.Logger, *models.ActualLRPKey, *models.ActualLRPInstanceKey) (bool, error)
    EvacuateCrashedActualLRP(lager.Logger, *models.ActualLRPKey, *models.ActualLRPInstanceKey, string) (bool, error)
    RemoveEvacuatingActualLRP(lager.Logger, *models.ActualLRPKey, *models.ActualLRPInstanceKey) error

    StartTask(logger lager.Logger, taskGuid string, cellID string) (bool, error)
    FailTask(logger lager.Logger, taskGuid, failureReason string) error
    RejectTask(logger lager.Logger, taskGuid, failureReason string) error
    CompleteTask(logger lager.Logger, taskGuid, cellId string, failed bool, failureReason, result string) error
}

The InternalClient interface exposes all available endpoints of the BBS server, including private endpoints which should be used exclusively by internal Diego components. To interact with the BBS from outside of Diego, the Client should be used instead.

func NewClient Uses

func NewClient(url, caFile, certFile, keyFile string, clientSessionCacheSize, maxIdleConnsPerHost int) (InternalClient, error)

func NewClientWithConfig Uses

func NewClientWithConfig(cfg ClientConfig) (InternalClient, error)

func NewSecureSkipVerifyClient Uses

func NewSecureSkipVerifyClient(url, certFile, keyFile string, clientSessionCacheSize, maxIdleConnsPerHost int) (InternalClient, error)

Directories

PathSynopsis
cmd/bbs
cmd/bbs/config
cmd/bbs/testrunner
controllers
controllers/fakesCode generated by counterfeiter.
converger
converger/fake_controllersCode generated by counterfeiter.
db
db/dbfakesCode generated by counterfeiter.
db/migrations
db/sqldb
db/sqldb/fakesqldriver
db/sqldb/fakesqldriver/fakesqldriverfakesCode generated by counterfeiter.
db/sqldb/helpers
db/sqldb/helpers/helpersfakesCode generated by counterfeiter.
db/sqldb/helpers/monitor
db/sqldb/helpers/monitor/monitorfakesCode generated by counterfeiter.
encryption
encryption/encryptionfakesCode generated by counterfeiter.
encryptor
events
events/calculator
events/eventfakesCode generated by counterfeiter.
fake_bbsCode generated by counterfeiter.
format
guidprovider
guidprovider/fakesThis file was generated by counterfeiter
guidprovider/guidproviderfakesCode generated by counterfeiter.
handlers
handlers/fake_controllersCode generated by counterfeiter.
handlers/middleware
handlers/middleware/fakesCode generated by counterfeiter.
metrics
metrics/fakesCode generated by counterfeiter.
metrics/metricsfakesCode generated by counterfeiter.
migration
migration/migrationfakesCode generated by counterfeiter.
models
models/fakesThis file was generated by counterfeiter
models/test/matchers
models/test/model_helpers
serviceclient
serviceclient/serviceclientfakesCode generated by counterfeiter.
taskworkpool
taskworkpool/taskworkpoolfakesCode generated by counterfeiter.
test_helpers
test_helpers/sqlrunner

Package bbs imports 18 packages (graph) and is imported by 38 packages. Updated 2020-12-10. Refresh now. Tools for package owners.