This reference does not cover the protobuf payload supplied to each endpoint.
Instead, it illustrates calls to the API via the Golang bbs.Client
interface.
Each method on that Client
interface takes a lager.Logger
as the first argument to log errors generated within the client.
This first Logger
argument will not be duplicated on the descriptions of the method arguments.
For detailed information on the types referred to below, see the godoc documentation for the BBS models.
Returns all ActualLRPGroups matching the given ActualLRPFilter.
POST an ActualLRPGroupsRequest
to /v1/actual_lrp_groups/list
and receive an ActualLRPGroupsResponse.
ActualLRPGroups(lager.Logger, models.ActualLRPFilter) ([]*models.ActualLRPGroup, error)
models.ActualLRPFilter
:Domain string
: If non-empty, filter to only ActualLRPGroups in this domain.CellId string
: If non-empty, filter to only ActualLRPs with this cell ID.
[]*models.ActualLRPGroup
: Slice of ActualLRPGroups. Either theInstance
or theEvacuating
*models.ActualLRP
may be present depending on the state of the LRP instances.error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
actualLRPGroups, err := client.ActualLRPGroups(logger, &models.ActualLRPFilter{
Domain: "some-domain",
CellId: "some-cell",
})
if err != nil {
log.Printf("failed to retrieve actual lrps: " + err.Error())
}
Returns all ActualLRPGroups for the given process guid.
POST an ActualLRPGroupsByProcessGuidRequest
to /v1/actual_lrp_groups/list_by_process_guid
and receive an ActualLRPGroupsResponse.
ActualLRPGroupsByProcessGuid(logger lager.Logger, processGuid string) ([]*models.ActualLRPGroup, error)
processGuid string
: The process guid of the LRP.
[]*models.ActualLRPGroup
: Slice of ActualLRPGroups. Either theInstance
or theEvacuating
*models.ActualLRP
may be present depending on the state of the LRP instances.error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
actualLRPGroups, err := client.ActualLRPGroupsByProcessGuid(logger, "my-guid")
if err != nil {
log.Printf("failed to retrieve actual lrps: " + err.Error())
}
Returns the ActualLRPGroup with the given process guid and instance index.
POST an ActualLRPGroupByProcessGuidAndIndexRequest
to
/v1/actual_lrp_groups/get_by_process_guid_and_index
and receive an ActualLRPGroupResponse.
ActualLRPGroupByProcessGuidAndIndex(logger lager.Logger, processGuid string, index int) (*models.ActualLRPGroup, error)
processGuid string
: The process guid to retrieve.index int
: The instance index to retrieve.
*models.ActualLRPGroup
: ActualLRPGroup for this LRP at this index. Either theInstance
or theEvacuating
*models.ActualLRP
may be present depending on the state of the LRP instances.error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
actualLRPGroup, err := client.ActualLRPGroupByProcessGuidAndIndex(logger, "my-guid", 0)
if err != nil {
log.Printf("failed to retrieve actual lrps: " + err.Error())
}
Stops the ActualLRP matching the given ActualLRPKey, but does not modify the desired state.
POST a RetireActualLRPRequest
to /v1/actual_lrps/retire
and receive an ActualLRPLifecycleResponse.
RetireActualLRP(logger lager.Logger, key *models.ActualLRPKey) error
key *models.ActualLRPKey
: ActualLRPKey for the instance. Includes the LRP process guid, index, and LRP domain.
error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
err := client.RetireActualLRP(logger, &models.ActualLRPKey{
ProcessGuid: "some-process-guid",
Index: 0,
Domain: "cf-apps",
})
if err != nil {
log.Printf("failed to retire actual lrps: " + err.Error())
}
Lists all DesiredLRPs that match the given DesiredLRPFilter.
POST a DesiredLRPsRequest to /v1/desired_lrps/list.r2
and receive a DesiredLRPsResponse with V2 DesiredLRPs.
- POST a DesiredLRPsRequest to
/v1/desired_lrps/list.r1
and receive a DesiredLRPsResponse with V1 DesiredLRPs. - POST a DesiredLRPsRequest to
/v1/desired_lrps/list
and receive a DesiredLRPsResponse with V0 DesiredLRPs.
DesiredLRPs(logger lager.Logger, filter models.DesiredLRPFilter) ([]*models.DesiredLRP, error)
filter models.DesiredLRPFilter
: DesiredLRPFilter to restrict the DesiredLRPs returned.Domain string
: If non-empty, filter to only DesiredLRPs in this domain.
[]*models.DesiredLRP
: List of DesiredLRPs.error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
desiredLRPS, err := client.DesiredLRPs(logger, &models.DesiredLRPFilter{
Domain: "cf-apps",
})
if err != nil {
log.Printf("failed to retrieve desired lrps: " + err.Error())
}
Returns the DesiredLRP with the given process guid.
POST a DesiredLRPByProcessGuidRequest to /v1/desired_lrps/get_by_process_guid.r2
and receive a DesiredLRPResponse with a V2 DesiredLRP.
- POST a DesiredLRPByProcessGuidRequest to
/v1/desired_lrps/get_by_process_guid.r1
and receive a DesiredLRPResponse with a V1 DesiredLRP. - POST a DesiredLRPByProcessGuidRequest to
/v1/desired_lrps/get_by_process_guid
and receive an DesiredLRPResponse with a V0 DesiredLRP.
DesiredLRPByProcessGuid(logger lager.Logger, processGuid string) (*models.DesiredLRP, error)
processGuid string
: The GUID for the DesiredLRP.
*models.DesiredLRP
: The requested DesiredLRP.error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
desiredLRP, err := client.DesiredLRPByProcessGuid(logger, "some-processs-guid")
if err != nil {
log.Printf("failed to retrieve desired lrp: " + err.Error())
}
Returns all DesiredLRPSchedulingInfos that match the given DesiredLRPFilter.
POST a DesiredLRPsRequest
to /v1/desired_lrp_scheduling_infos/list
and receive a DesiredLRPSchedulingInfosResponse.
DesiredLRPSchedulingInfos(logger lager.Logger, filter models.DesiredLRPFilter) ([]*models.DesiredLRPSchedulingInfo, error)
filter models.DesiredLRPFilter
: DesiredLRPFilter to restrict the DesiredLRPs returned.Domain string
: If non-empty, filter to only DesiredLRPs in this domain.
[]*models.DesiredLRPSchedulingInfo
: List of DesiredLRPSchedulingInfo records.error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
info, err := client.DesiredLRPSchedulingInfos(logger, &models.DesiredLRPFilter{
Domain: "cf-apps",
})
if err != nil {
log.Printf("failed to retrieve desired lrp scheduling info: " + err.Error())
}
Create a DesiredLRP and its corresponding associated ActualLRPs.
POST a DesireLRPRequest
to /v1/desired_lrp/desire.r1
and receive a DesiredLRPLifecycleResponse.
- POST a DesireLRPRequest with a V0 or V1 DesiredLRP to
/v1/desired_lrp/desire
and receive a DesiredLRPLifecycleResponse.
DesireLRP(logger lager.Logger, desiredLRP *models.DesiredLRP) error
desiredLRP *models.DesiredLRP
: DesiredLRP to create.
error
: Non-nil if an error occurred.
See the LRP Examples page.
Updates the DesiredLRP with the given process GUID.
POST a UpdateDesiredLRPRequest
to /v1/desired_lrp/update
and receive a DesiredLRPLifecycleResponse.
UpdateDesiredLRP(logger lager.Logger, processGuid string, update *models.DesiredLRPUpdate) error
processGuid string
: The GUID for the DesiredLRP to update.update *models.DesiredLRPUpdate
: DesiredLRPUpdate struct containing fields to update, if any.Instances *int32
: Optional. The number of instances.Routes *Routes
: Optional. Map of routing information.Annotation *string
: Optional. The annotation string on the DesiredLRP.
error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
instances := 4
annotation := "My annotation"
err := client.UpdateDesiredLRP(logger, "some-process-guid", &models.DesiredLRPUpdate{
Instances: &instances,
Routes: &models.Routes{},
Annotation: &annotation,
})
if err != nil {
log.Printf("failed to update desired lrp: " + err.Error())
}
Removes the DesiredLRP with the given process GUID.
POST a RemoveDesiredLRPRequest
to /v1/desired_lrp/remove
and receive a DesiredLRPLifecycleResponse.
RemoveDesiredLRP(logger lager.Logger, processGuid string) error
processGuid string
: The GUID for the DesiredLRP to remove.
error
: Non-nil if an error occurred.
client := bbs.NewClient(url)
err := client.RemoveDesiredLRP(logger, "some-process-guid")
if err != nil {
log.Printf("failed to remove desired lrp: " + err.Error())
}