Skip to content

Commit

Permalink
Remove deprecated devops REST API
Browse files Browse the repository at this point in the history
Remove deprecated devops API. Skipped one behave test that still used
it. Will open separate issue to deal with that. Update API docs.

Fixes FAB-258

rebased

Change-Id: Iba55fb271aca5a1d1d8e895ecc6ff34c69f59ac2
Signed-off-by: Christopher Ferris <chrisfer@us.ibm.com>
  • Loading branch information
christo4ferris committed Sep 5, 2016
1 parent 0f959c0 commit ac182fa
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 236 deletions.
1 change: 1 addition & 0 deletions bddtests/.behaverc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ tags=~@issue_767
~@issue_RBAC_TCERT_With_Attributes
~@sdk
~@TLS
~@devops
1 change: 1 addition & 0 deletions bddtests/peer_basic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ Feature: Network of Peers

# @doNotDecompose
# @wip
@devops
Scenario: chaincode map single peer content generated ID
Given we compose "docker-compose-1.yml"
When requesting "/chain" from "vp0"
Expand Down
5 changes: 0 additions & 5 deletions core/rest/rest_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1734,11 +1734,6 @@ func buildOpenchainRESTRouter() *web.Router {
router.Get("/chain", (*ServerOpenchainREST).GetBlockchainInfo)
router.Get("/chain/blocks/:id", (*ServerOpenchainREST).GetBlockByNumber)

// The /devops endpoint is now considered deprecated and superseded by the /chaincode endpoint
router.Post("/devops/deploy", (*ServerOpenchainREST).Deploy)
router.Post("/devops/invoke", (*ServerOpenchainREST).Invoke)
router.Post("/devops/query", (*ServerOpenchainREST).Query)

// The /chaincode endpoint which superceedes the /devops endpoint from above
router.Post("/chaincode", (*ServerOpenchainREST).ProcessChaincode)

Expand Down
99 changes: 0 additions & 99 deletions core/rest/rest_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,105 +100,6 @@
}
}
},
"/devops/deploy": {
"post": {
"summary": "[DEPRECATED] Service endpoint for deploying Chaincode [DEPRECATED]",
"description": "The /devops/deploy endpoint receives Chaincode deployment requests. The ChaincodTXand the required entities are first packaged into a container and subsequently deployed to the blockchain. If the Chaincode build and deployment are successful, a confirmation message is returned. Otherwise, an error is displayed alongside with a reason for the failure. This service endpoint is being deprecated, please use the /chaincode endpoint instead.",
"tags": [
"Chaincode"
],
"operationId": "chaincodeDeploy",
"parameters": [{
"name": "ChaincodeSpec",
"in": "body",
"description": "Chaincode specification message",
"required": true,
"schema": {
"$ref": "#/definitions/ChaincodeSpec"
}
}],
"responses": {
"200": {
"description": "Successfully deployed chainCode",
"schema": {
"$ref": "#/definitions/OK"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/devops/invoke": {
"post": {
"summary": "[DEPRECATED] Service endpoint for invoking Chaincode functions [DEPRECATED]",
"description": "The /devops/invoke endpoint receives requests for invoking functions in deployed Chaincodes. If the Chaincode function is invoked sucessfully, a transaction id is returned. Otherwise, an error is displayed alongside with a reason for the failure. This service endpoint is being deprecated, please use the /chaincode endpoint instead.",
"tags": [
"Chaincode"
],
"operationId": "chaincodeInvoke",
"parameters": [{
"name": "ChaincodeInvocationSpec",
"in": "body",
"description": "Chaincode invocation message",
"required": true,
"schema": {
"$ref": "#/definitions/ChaincodeInvocationSpec"
}
}],
"responses": {
"200": {
"description": "Successfully invoked transaction",
"schema": {
"$ref": "#/definitions/OK"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/devops/query": {
"post": {
"summary": "[DEPRECATED] Service endpoint for querying Chaincode state [DEPRECATED]",
"description": "The /devops/query endpoint receives requests to query Chaincode state. The request triggers a query method on the target Chaincode, both identified in the required payload. If the query method is successful, the response defined within the method is returned. Otherwise, an error is displayed alongside with a reason for the failure. This service endpoint is being deprecated, please use the /chaincode endpoint instead.",
"tags": [
"Chaincode"
],
"operationId": "chaincodeQuery",
"parameters": [{
"name": "ChaincodeInvocationSpec",
"in": "body",
"description": "Chaincode invocation message",
"required": true,
"schema": {
"$ref": "#/definitions/ChaincodeInvocationSpec"
}
}],
"responses": {
"200": {
"description": "Successfully queried chaincode",
"schema": {
"$ref": "#/definitions/OK"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/chaincode": {
"post": {
"summary": "Service endpoint for Chaincode operations",
Expand Down
133 changes: 1 addition & 132 deletions docs/API/CoreAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ To learn about the REST API through Swagger, please take a look at the Swagger d
* GET /chain/blocks/{Block}
* [Blockchain](#blockchain)
* GET /chain
* [Devops](#devops-deprecated) [DEPRECATED]
* POST /devops/deploy
* POST /devops/invoke
* POST /devops/query
* [Chaincode](#chaincode)
* POST /chaincode
* [Network](#network)
Expand Down Expand Up @@ -207,138 +203,11 @@ message BlockchainInfo {
}
```

#### Devops [DEPRECATED]

* **POST /devops/deploy**
* **POST /devops/invoke**
* **POST /devops/query**

**[DEPRECATED] The /devops endpoints have been deprecated and are superseded by the [/chaincode](#chaincode) endpoint. Please use the [/chaincode](#chaincode) endpoint to deploy, invoke, and query a chaincode. [DEPRECATED]**

Use the Devops APIs to deploy, invoke, and query a chaincode. The required [ChaincodeSpec](https://github.com/hyperledger/fabric/blob/master/protos/chaincode.proto#L60) and [ChaincodeInvocationSpec](https://github.com/hyperledger/fabric/blob/master/protos/chaincode.proto#L89) payloads are defined in [chaincode.proto](https://github.com/hyperledger/fabric/blob/master/protos/chaincode.proto).

```
message ChaincodeSpec {
enum Type {
UNDEFINED = 0;
GOLANG = 1;
NODE = 2;
}
Type type = 1;
ChaincodeID chaincodeID = 2;
ChaincodeInput ctorMsg = 3;
int32 timeout = 4;
string secureContext = 5;
ConfidentialityLevel confidentialityLevel = 6;
}
```

```
message ChaincodeInvocationSpec {
ChaincodeSpec chaincodeSpec = 1;
//ChaincodeInput message = 2;
}
```

**Note:** The deploy transaction requires a 'path' parameter to locate the chaincode source-code in the file system, build it, and deploy it to the validating peers. On the other hand, invoke and query transactions require a 'name' parameter to reference the chaincode that has already been deployed. These 'path' and 'name' parameters are specified in the ChaincodeID, defined in [chaincode.proto](https://github.com/hyperledger/fabric/blob/master/protos/chaincode.proto#L41). The only exception to the aforementioned rule is when the peer is running in chaincode development mode (as opposed to production mode), i.e. the user starts the peer with `--peer-chaincodedev` and runs the chaincode manually in a separate terminal window. In that case, the deploy transaction requires a 'name' parameter that is specified by the end user.

```
message ChaincodeID {
//deploy transaction will use the path
string path = 1;
//all other requests will use the name (really a hashcode) generated by
//the deploy transaction
string name = 2;
}
```

An example of a valid ChaincodeSpec message for a deployment transaction is shown below. The 'path' parameter specifies the location of the chaincode in the filesystem. Eventually, we imagine that the 'path' will represent a location on GitHub.

```
{
"type": "GOLANG",
"chaincodeID":{
"path":"github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
},
"ctorMsg": {
"function":"init",
"args":["a", "100", "b", "200"]
}
}
```

An example of a valid ChaincodeInvocationSpec message for an invocation transaction is shown below. Consult [chaincode.proto](https://github.com/hyperledger/fabric/blob/master/protos/chaincode.proto#L89) for more information.

```
{
"chaincodeSpec":{
"type": "GOLANG",
"chaincodeID":{
"name":"mycc"
},
"ctorMsg":{
"function":"invoke",
"args":["a", "b", "10"]
}
}
}
```

With security enabled, modify each of the above payloads to include the secureContext element, passing the enrollmentID of a logged in user as follows:

```
{
"chaincodeSpec":{
"type": "GOLANG",
"chaincodeID":{
"name":"mycc"
},
"ctorMsg":{
"function":"invoke",
"args":["a", "b", "10"]
},
"secureContext": "jim"
}
}
```

**Note:** The deployment transaction will take a little time as the docker image is being created.

The response to a deploy request is either a message containing a confirmation of successful execution or an error, containing a reason for the failure. The response to a successful deployment request also contains the assigned chaincode name (hash), which is to be used in subsequent invocation and query transactions. An example is below:

```
{
"OK": "Successfully deployed chainCode.",
"message": "3940678a8dff854c5ca4365fe0e29771edccb16b2103578c9d9207fea56b10559b43ff5c3025e68917f5a959f2a121d6b19da573016401d9a028b4211e10b20a"
}
```

The response to an invoke request is either a message containing a confirmation of successful execution or an error, containing a reason for the failure. The response to an invoke request also contains the transaction identifier (UUID). An example is below:

```
{
"OK": "Successfully invoked chainCode.",
"message": "1ca30d0c-0153-46b4-8826-26dc7cfff852"
}
```

The response to a successful query request depends on the chaincode implementation. It may contain a string formatted value of a state variable, any string message, or not have an output. An example is below:

```
{
"OK": "80"
}
```

#### Chaincode

* **POST /chaincode**

Use the /chaincode endpoint to deploy, invoke, and query a target chaincode. This endpoint supersedes the [/devops](#devops-deprecated) endpoints and should be used for all chaincode operations. This service endpoint implements the [JSON RPC 2.0 specification](http://www.jsonrpc.org/specification) with the payload identifying the desired chaincode operation within the `method` field. The supported methods are `deploy`, `invoke`, and `query`.
Use the /chaincode endpoint to deploy, invoke, and query a target chaincode. This service endpoint implements the [JSON RPC 2.0 specification](http://www.jsonrpc.org/specification) with the payload identifying the desired chaincode operation within the `method` field. The supported methods are `deploy`, `invoke`, and `query`.

The /chaincode endpoint implements the [JSON RPC 2.0 specification](http://www.jsonrpc.org/specification) and as such, must have the required fields of `jsonrpc`, `method`, and in our case `params` supplied within the payload. The client should also add the `id` element within the payload if they wish to receive a response to the request. If the `id` element is missing from the request payload, the request is assumed to be a notification and the server will not produce a response.

Expand Down

0 comments on commit ac182fa

Please sign in to comment.