status

package
Version: v0.0.0-...-f62483c Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2016 License: Apache-2.0 Imports: 4 Imported by: 102

Documentation

Index

Constants

View Source
const (
	Complete = "succeeded"
	Failed   = "failed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlueprintOperation

type BlueprintOperation struct {
	RequestType string `json:"requestType,omitempty"`
	Status      string `json:"status,omitempty"`
	Summary     struct {
		BlueprintID int       `json:"blueprintId,omitempty"`
		LocationID  string    `json:"locationId,omitempty"`
		Links       api.Links `json:"links,omitempty"`
	} `json:"summary,omitempty"`
	Source struct {
		UserName    string    `json:"userName"`
		RequestedAt time.Time `json:"requestedAt,omitempty"`
	} `json:"source,omitempty"`
}
 BlueprintOperation is a status object representing a running blueprint job
    {
      "requestType":"blueprintOperation",
      "status":"succeeded",
      "summary":{
	"blueprintId":51229,
	"locationId":"CA1",
	"links":[
	  {
	    "rel":"network",
	    "href":"/v2-experimental/networks/ZZBB/CA1/6955e7c39b5648df91bfb32e5d0aa24b",
	    "id":"6955e7c39b5648df91bfb32e5d0aa24b"
	  }
	]
      },
      "source":{"userName":"ack","requestedAt":"2016-03-24T16:47:04Z"}
    }

type QueuedOperation

type QueuedOperation struct {
	OperationID string `json:"operationId,omitempty"`
	URI         string `json:"uri,omitempty"`
}

QueuedOperation may be a one-off and/or experimental version of QueuedResponse

eg. add secondary network
{"operationId": "2b70710dba4142dcaf3ab2de68e4f40c", "uri": "..."}

func (*QueuedOperation) GetHref

func (q *QueuedOperation) GetHref() (bool, string)

func (*QueuedOperation) GetStatusID

func (q *QueuedOperation) GetStatusID() (bool, string)

func (*QueuedOperation) Status

func (q *QueuedOperation) Status() *Status

type QueuedResponse

type QueuedResponse struct {
	Server   string    `json:"server,omitempty"`
	IsQueued bool      `json:"isQueued,omitempty"`
	Links    api.Links `json:"links,omitempty"`
	Error    string    `json:"errorMessage,omitempty"`
}

QueuedResponse represents a returned response for an async platform job

eg. create server
{"server":"web", "isQueued":true, "links":[
  {"rel":"status", "href":"...", "id":"wa1-12345"},
  {"rel":"self",  "href":"...", "id":"8134c91a66784c6dada651eba90a5123"}]}

func (*QueuedResponse) GetStatusID

func (q *QueuedResponse) GetStatusID() (bool, string)

type Response

type Response struct {
	Status string `json:"status"`
}

Response represents a running async job result from polling status {"status": "succeeded"}

func (*Response) Complete

func (s *Response) Complete() bool

func (*Response) Failed

func (s *Response) Failed() bool

func (*Response) Running

func (s *Response) Running() bool

type Service

type Service struct {
	PollInterval time.Duration
	// contains filtered or unexported fields
}

func New

func New(client api.HTTP) *Service

func (*Service) Get

func (s *Service) Get(id string) (*Response, error)

func (*Service) GetBlueprint

func (s *Service) GetBlueprint(id string) (*BlueprintOperation, error)

func (*Service) Poll

func (s *Service) Poll(id string, poll chan *Response) error

type Status

type Status struct {
	ID   string `json:"id"`
	Rel  string `json:"rel"`
	Href string `json:"href"`
}

Source Files

Jump to

Keyboard shortcuts

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