Skip to content

Commit ac182fa

Browse files
Remove deprecated devops REST API
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 <[email protected]>
1 parent 0f959c0 commit ac182fa

File tree

5 files changed

+3
-236
lines changed

5 files changed

+3
-236
lines changed

bddtests/.behaverc

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ tags=~@issue_767
77
~@issue_RBAC_TCERT_With_Attributes
88
~@sdk
99
~@TLS
10+
~@devops

bddtests/peer_basic.feature

+1
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ Feature: Network of Peers
349349

350350
# @doNotDecompose
351351
# @wip
352+
@devops
352353
Scenario: chaincode map single peer content generated ID
353354
Given we compose "docker-compose-1.yml"
354355
When requesting "/chain" from "vp0"

core/rest/rest_api.go

-5
Original file line numberDiff line numberDiff line change
@@ -1734,11 +1734,6 @@ func buildOpenchainRESTRouter() *web.Router {
17341734
router.Get("/chain", (*ServerOpenchainREST).GetBlockchainInfo)
17351735
router.Get("/chain/blocks/:id", (*ServerOpenchainREST).GetBlockByNumber)
17361736

1737-
// The /devops endpoint is now considered deprecated and superseded by the /chaincode endpoint
1738-
router.Post("/devops/deploy", (*ServerOpenchainREST).Deploy)
1739-
router.Post("/devops/invoke", (*ServerOpenchainREST).Invoke)
1740-
router.Post("/devops/query", (*ServerOpenchainREST).Query)
1741-
17421737
// The /chaincode endpoint which superceedes the /devops endpoint from above
17431738
router.Post("/chaincode", (*ServerOpenchainREST).ProcessChaincode)
17441739

core/rest/rest_api.json

-99
Original file line numberDiff line numberDiff line change
@@ -100,105 +100,6 @@
100100
}
101101
}
102102
},
103-
"/devops/deploy": {
104-
"post": {
105-
"summary": "[DEPRECATED] Service endpoint for deploying Chaincode [DEPRECATED]",
106-
"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.",
107-
"tags": [
108-
"Chaincode"
109-
],
110-
"operationId": "chaincodeDeploy",
111-
"parameters": [{
112-
"name": "ChaincodeSpec",
113-
"in": "body",
114-
"description": "Chaincode specification message",
115-
"required": true,
116-
"schema": {
117-
"$ref": "#/definitions/ChaincodeSpec"
118-
}
119-
}],
120-
"responses": {
121-
"200": {
122-
"description": "Successfully deployed chainCode",
123-
"schema": {
124-
"$ref": "#/definitions/OK"
125-
}
126-
},
127-
"default": {
128-
"description": "Unexpected error",
129-
"schema": {
130-
"$ref": "#/definitions/Error"
131-
}
132-
}
133-
}
134-
}
135-
},
136-
"/devops/invoke": {
137-
"post": {
138-
"summary": "[DEPRECATED] Service endpoint for invoking Chaincode functions [DEPRECATED]",
139-
"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.",
140-
"tags": [
141-
"Chaincode"
142-
],
143-
"operationId": "chaincodeInvoke",
144-
"parameters": [{
145-
"name": "ChaincodeInvocationSpec",
146-
"in": "body",
147-
"description": "Chaincode invocation message",
148-
"required": true,
149-
"schema": {
150-
"$ref": "#/definitions/ChaincodeInvocationSpec"
151-
}
152-
}],
153-
"responses": {
154-
"200": {
155-
"description": "Successfully invoked transaction",
156-
"schema": {
157-
"$ref": "#/definitions/OK"
158-
}
159-
},
160-
"default": {
161-
"description": "Unexpected error",
162-
"schema": {
163-
"$ref": "#/definitions/Error"
164-
}
165-
}
166-
}
167-
}
168-
},
169-
"/devops/query": {
170-
"post": {
171-
"summary": "[DEPRECATED] Service endpoint for querying Chaincode state [DEPRECATED]",
172-
"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.",
173-
"tags": [
174-
"Chaincode"
175-
],
176-
"operationId": "chaincodeQuery",
177-
"parameters": [{
178-
"name": "ChaincodeInvocationSpec",
179-
"in": "body",
180-
"description": "Chaincode invocation message",
181-
"required": true,
182-
"schema": {
183-
"$ref": "#/definitions/ChaincodeInvocationSpec"
184-
}
185-
}],
186-
"responses": {
187-
"200": {
188-
"description": "Successfully queried chaincode",
189-
"schema": {
190-
"$ref": "#/definitions/OK"
191-
}
192-
},
193-
"default": {
194-
"description": "Unexpected error",
195-
"schema": {
196-
"$ref": "#/definitions/Error"
197-
}
198-
}
199-
}
200-
}
201-
},
202103
"/chaincode": {
203104
"post": {
204105
"summary": "Service endpoint for Chaincode operations",

docs/API/CoreAPI.md

+1-132
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,6 @@ To learn about the REST API through Swagger, please take a look at the Swagger d
160160
* GET /chain/blocks/{Block}
161161
* [Blockchain](#blockchain)
162162
* GET /chain
163-
* [Devops](#devops-deprecated) [DEPRECATED]
164-
* POST /devops/deploy
165-
* POST /devops/invoke
166-
* POST /devops/query
167163
* [Chaincode](#chaincode)
168164
* POST /chaincode
169165
* [Network](#network)
@@ -207,138 +203,11 @@ message BlockchainInfo {
207203
}
208204
```
209205

210-
#### Devops [DEPRECATED]
211-
212-
* **POST /devops/deploy**
213-
* **POST /devops/invoke**
214-
* **POST /devops/query**
215-
216-
**[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]**
217-
218-
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).
219-
220-
```
221-
message ChaincodeSpec {
222-
223-
enum Type {
224-
UNDEFINED = 0;
225-
GOLANG = 1;
226-
NODE = 2;
227-
}
228-
229-
Type type = 1;
230-
ChaincodeID chaincodeID = 2;
231-
ChaincodeInput ctorMsg = 3;
232-
int32 timeout = 4;
233-
string secureContext = 5;
234-
ConfidentialityLevel confidentialityLevel = 6;
235-
}
236-
```
237-
238-
```
239-
message ChaincodeInvocationSpec {
240-
ChaincodeSpec chaincodeSpec = 1;
241-
//ChaincodeInput message = 2;
242-
}
243-
```
244-
245-
**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.
246-
247-
```
248-
message ChaincodeID {
249-
//deploy transaction will use the path
250-
string path = 1;
251-
252-
//all other requests will use the name (really a hashcode) generated by
253-
//the deploy transaction
254-
string name = 2;
255-
}
256-
```
257-
258-
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.
259-
260-
```
261-
{
262-
"type": "GOLANG",
263-
"chaincodeID":{
264-
"path":"github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
265-
},
266-
"ctorMsg": {
267-
"function":"init",
268-
"args":["a", "100", "b", "200"]
269-
}
270-
}
271-
```
272-
273-
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.
274-
275-
```
276-
{
277-
"chaincodeSpec":{
278-
"type": "GOLANG",
279-
"chaincodeID":{
280-
"name":"mycc"
281-
},
282-
"ctorMsg":{
283-
"function":"invoke",
284-
"args":["a", "b", "10"]
285-
}
286-
}
287-
}
288-
```
289-
290-
With security enabled, modify each of the above payloads to include the secureContext element, passing the enrollmentID of a logged in user as follows:
291-
292-
```
293-
{
294-
"chaincodeSpec":{
295-
"type": "GOLANG",
296-
"chaincodeID":{
297-
"name":"mycc"
298-
},
299-
"ctorMsg":{
300-
"function":"invoke",
301-
"args":["a", "b", "10"]
302-
},
303-
"secureContext": "jim"
304-
}
305-
}
306-
```
307-
308-
**Note:** The deployment transaction will take a little time as the docker image is being created.
309-
310-
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:
311-
312-
```
313-
{
314-
"OK": "Successfully deployed chainCode.",
315-
"message": "3940678a8dff854c5ca4365fe0e29771edccb16b2103578c9d9207fea56b10559b43ff5c3025e68917f5a959f2a121d6b19da573016401d9a028b4211e10b20a"
316-
}
317-
```
318-
319-
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:
320-
321-
```
322-
{
323-
"OK": "Successfully invoked chainCode.",
324-
"message": "1ca30d0c-0153-46b4-8826-26dc7cfff852"
325-
}
326-
```
327-
328-
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:
329-
330-
```
331-
{
332-
"OK": "80"
333-
}
334-
335-
```
336-
337206
#### Chaincode
338207

339208
* **POST /chaincode**
340209

341-
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`.
210+
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`.
342211

343212
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.
344213

0 commit comments

Comments
 (0)