-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement 'osnadmin channel info' subcommand and update tests #4890 #4919
Open
Priyansurout
wants to merge
4
commits into
hyperledger:main
Choose a base branch
from
Priyansurout:add-info-command-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4144b2c
Implement 'osnadmin channel info' subcommand and update tests #4892
Priyansurout 77924fc
Merge remote-tracking branch 'origin/main' into add-info-command-v2
Priyansurout 09205c3
Update docs/wrappers/osnadmin_channel_postscript.md
Priyansurout ef7c7c2
Update docs/wrappers/osnadmin_channel_postscript.md
Priyansurout File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ | |||||||||||||||||||||
|
||||||||||||||||||||||
Here's an example of the `osnadmin channel join` command. | ||||||||||||||||||||||
|
||||||||||||||||||||||
* Create and join a sample channel `mychannel` defined by the application channel genesis | ||||||||||||||||||||||
- Create and join a sample channel `mychannel` defined by the application channel genesis | ||||||||||||||||||||||
block contained in file `mychannel-genesis-block.pb`. Use the orderer admin endpoint | ||||||||||||||||||||||
at `orderer.example.com:9443`. | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
@@ -30,8 +30,8 @@ Here's an example of the `osnadmin channel join` command. | |||||||||||||||||||||
|
||||||||||||||||||||||
Here are some examples of the `osnadmin channel list` command. | ||||||||||||||||||||||
|
||||||||||||||||||||||
* Listing all the channels that the orderer has joined. | ||||||||||||||||||||||
Note that the system channel will always be NULL because it is no longer supported from release v3.0 onwards. | ||||||||||||||||||||||
- Listing all the channels that the orderer has joined. | ||||||||||||||||||||||
Note that the system channel will always be NULL because it is no longer supported from release v3.0 onwards. | ||||||||||||||||||||||
|
||||||||||||||||||||||
``` | ||||||||||||||||||||||
osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY | ||||||||||||||||||||||
|
@@ -51,18 +51,40 @@ Note that the system channel will always be NULL because it is no longer support | |||||||||||||||||||||
|
||||||||||||||||||||||
Status 200 and the list of channels are returned. | ||||||||||||||||||||||
|
||||||||||||||||||||||
* Using the `--channelID` flag to list more details for `mychannel`. | ||||||||||||||||||||||
- Using the `--channelID` flag to list more details for `mychannel`. | ||||||||||||||||||||||
|
||||||||||||||||||||||
``` | ||||||||||||||||||||||
osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel | ||||||||||||||||||||||
|
||||||||||||||||||||||
Status: 200 | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
"name": "mychannel", | ||||||||||||||||||||||
"url": "/participation/v1/channels/mychannel", | ||||||||||||||||||||||
"consensusRelation": "consenter", | ||||||||||||||||||||||
"status": "active", | ||||||||||||||||||||||
"height": 3 | ||||||||||||||||||||||
"name": "mychannel", | ||||||||||||||||||||||
"url": "/participation/v1/channels/mychannel", | ||||||||||||||||||||||
"consensusRelation": "consenter", | ||||||||||||||||||||||
"status": "active", | ||||||||||||||||||||||
"height": 3 | ||||||||||||||||||||||
Comment on lines
+61
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
Status 200 and the details of the channels are returned. | ||||||||||||||||||||||
|
||||||||||||||||||||||
### osnadmin channel info example | ||||||||||||||||||||||
|
||||||||||||||||||||||
Here are some examples of the `osnadmin channel info` command. | ||||||||||||||||||||||
|
||||||||||||||||||||||
- Using the `--channel-id` flag to get detailed information for mychannel from the orderer at `orderer.example.com:9443`. | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
``` | ||||||||||||||||||||||
osnadmin channel info -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channel-id mychannel | ||||||||||||||||||||||
Priyansurout marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
|
||||||||||||||||||||||
Status: 200 | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
"name": "mychannel", | ||||||||||||||||||||||
"url": "/participation/v1/channels/mychannel", | ||||||||||||||||||||||
"consensusRelation": "consenter", | ||||||||||||||||||||||
"status": "active", | ||||||||||||||||||||||
"height": 3 | ||||||||||||||||||||||
Priyansurout marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
``` | ||||||||||||||||||||||
|
@@ -73,7 +95,7 @@ Note that the system channel will always be NULL because it is no longer support | |||||||||||||||||||||
|
||||||||||||||||||||||
Here's an example of the `osnadmin channel remove` command. | ||||||||||||||||||||||
|
||||||||||||||||||||||
* Removing channel `mychannel` from the orderer at `orderer.example.com:9443`. | ||||||||||||||||||||||
- Removing channel `mychannel` from the orderer at `orderer.example.com:9443`. | ||||||||||||||||||||||
|
||||||||||||||||||||||
``` | ||||||||||||||||||||||
osnadmin channel remove -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel | ||||||||||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
|
||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package osnadmin | ||
|
||
import ( | ||
"crypto/tls" | ||
"crypto/x509" | ||
"fmt" | ||
"net/http" | ||
) | ||
|
||
// Lists a single channel an OSN is a member of. | ||
func Info(osnURL, channelID string, caCertPool *x509.CertPool, tlsClientCert tls.Certificate) (*http.Response, error) { | ||
url := fmt.Sprintf("%s/participation/v1/channels/%s", osnURL, channelID) | ||
|
||
return httpGet(url, caCertPool, tlsClientCert) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now we have two ways of getting the same information about a channel. Why do we need that?
Renaming the existing API is not a good idea as it might break existing tools that use the current CLI.