rest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartOpenchainRESTServer

func StartOpenchainRESTServer(server *oc.ServerOpenchain, devops *oc.Devops)

StartOpenchainRESTServer initializes the REST service and adds the required middleware and routes.

Types

type ServerOpenchainREST

type ServerOpenchainREST struct {
	// contains filtered or unexported fields
}

ServerOpenchainREST defines the Openchain REST service object. It exposes the methods available on the ServerOpenchain service and the Devops service through a REST API.

func (*ServerOpenchainREST) DeleteEnrollmentID

func (s *ServerOpenchainREST) DeleteEnrollmentID(rw web.ResponseWriter, req *web.Request)

DeleteEnrollmentID removes the login token of the specified user from the Devops server. Once the login token is removed, the specified user will no longer be able to transact without logging in again. On the REST interface, this method may be used as a means of logging out an active client.

func (*ServerOpenchainREST) Deploy

func (s *ServerOpenchainREST) Deploy(rw web.ResponseWriter, req *web.Request)

Deploy first builds the chaincode package and subsequently deploys it to the blockchain.

func (*ServerOpenchainREST) GetBlockByNumber

func (s *ServerOpenchainREST) GetBlockByNumber(rw web.ResponseWriter, req *web.Request)

GetBlockByNumber returns the data contained within a specific block in the blockchain. The genesis block is block zero.

func (*ServerOpenchainREST) GetBlockchainInfo

func (s *ServerOpenchainREST) GetBlockchainInfo(rw web.ResponseWriter, req *web.Request)

GetBlockchainInfo returns information about the blockchain ledger such as height, current block hash, and previous block hash.

func (*ServerOpenchainREST) GetEnrollmentCert

func (s *ServerOpenchainREST) GetEnrollmentCert(rw web.ResponseWriter, req *web.Request)

GetEnrollmentCert retrieves the enrollment certificate for a given user.

func (*ServerOpenchainREST) GetEnrollmentID

func (s *ServerOpenchainREST) GetEnrollmentID(rw web.ResponseWriter, req *web.Request)

GetEnrollmentID checks whether a given user has already registered with the Devops server.

func (*ServerOpenchainREST) GetPeers

func (s *ServerOpenchainREST) GetPeers(rw web.ResponseWriter, req *web.Request)

GetPeers returns a list of all peer nodes currently connected to the target peer.

func (*ServerOpenchainREST) GetTransactionByUUID

func (s *ServerOpenchainREST) GetTransactionByUUID(rw web.ResponseWriter, req *web.Request)

GetTransactionByUUID returns a transaction matching the specified UUID

func (*ServerOpenchainREST) Invoke

func (s *ServerOpenchainREST) Invoke(rw web.ResponseWriter, req *web.Request)

Invoke executes a specified function within a target Chaincode.

func (*ServerOpenchainREST) NotFound

func (s *ServerOpenchainREST) NotFound(rw web.ResponseWriter, r *web.Request)

NotFound returns a custom landing page when a given openchain end point had not been defined.

func (*ServerOpenchainREST) Query

func (s *ServerOpenchainREST) Query(rw web.ResponseWriter, req *web.Request)

Query performs the requested query on the target Chaincode.

func (*ServerOpenchainREST) Register

func (s *ServerOpenchainREST) Register(rw web.ResponseWriter, req *web.Request)

Register confirms the enrollmentID and secret password of the client with the CA and stores the enrollment certificate and key in the Devops server.

func (*ServerOpenchainREST) SetOpenchainServer

func (s *ServerOpenchainREST) SetOpenchainServer(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

SetOpenchainServer is a middleware function that sets the pointer to the underlying ServerOpenchain object and the undeflying Devops object.

func (*ServerOpenchainREST) SetResponseType

func (s *ServerOpenchainREST) SetResponseType(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

SetResponseType is a middleware function that sets the appropriate response headers. Currently, it is setting the "Content-Type" to "application/json" as well as the necessary headers in order to enable CORS for Swagger usage.

Jump to

Keyboard shortcuts

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