Skip to content

Add ListBGPSpeakers (continued)#2229

Merged
jtopjian merged 7 commits intogophercloud:masterfrom
shhgs:PR-2227
Oct 12, 2021
Merged

Add ListBGPSpeakers (continued)#2229
jtopjian merged 7 commits intogophercloud:masterfrom
shhgs:PR-2227

Conversation

@shhgs
Copy link
Copy Markdown
Contributor

@shhgs shhgs commented Oct 7, 2021

Hi @jtopjian,

I pull rebase this branch against the origin/master, and then run push -f without knowing that will close the original pull request. So I create this one to replace old one.

Thanks
-Jon

For #2208

Jonathan Huang added 2 commits October 7, 2021 13:03
1. Change BGPSpeakerPage to SinglePageBase
2. Change the return type of ListBGPSpeakers to ListBGPSpeakersResult
3. Implement the Extract method of ListBGPSpeakersResult in agents
4. misc: delete unused stuff for now and change the wording of doc.go
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Oct 7, 2021

Build failed.

@shhgs shhgs changed the title Pr 2227 Add ListBGPSpeakers Oct 7, 2021
@shhgs shhgs changed the title Add ListBGPSpeakers Add ListBGPSpeakers (continued) Oct 7, 2021
Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shhgs Please let me know if you have any questions.

}

// Extract inteprets the ListBGPSpeakersResult into an array of BGP speakers
func (r ListBGPSpeakersResult) Extract() ([]speaker.BGPSpeaker, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming pattern/convention for methods that return slices is ExtractResourceName. So in this case, this method should be ExtractBGPSpeakers. Please ignore the DHCP implementation in this package - there are a lot of errors with it.


// ListBGPSpeakersResult is the respone of agents/{id}/bgp-speakers
type ListBGPSpeakersResult struct {
gophercloud.Result
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a SinglePageBase

@@ -0,0 +1,69 @@
package speaker
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package name should be plural: speakers.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix it.

@shhgs
Copy link
Copy Markdown
Contributor Author

shhgs commented Oct 8, 2021

Hi @jtopjian

Thanks for the review. I've updated the code per your request. Can you have a look at it?

Thanks
-Jon

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Oct 8, 2021

Build failed.

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shhgs Thanks. Just one small change and this is good to go.


Example to List BGP speakers by dragent

pages, err := agents.ListDRAgentHostingBGPSpeakers(client, agentID).AllPages()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original method name for this was correct: ListBGPSpeakers.

To clarify: in a previous PR I suggested the name of something like ListByHostingAgent. This was in the context of if the code was hosted under the speakers package. If you are choosing to continue to host this code under the agents package, then the original ListBGPSpeakers name is correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtopjian
Sorry, my bad. I've fixed it. Please have a look.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Oct 12, 2021

Build failed.

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thank you!

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shhgs I apologize, it looks like there are some formatting errors that the unit tests are reporting:

https://github.com/gophercloud/gophercloud/pull/2229/checks?check_run_id=3872039117

GitHub has implemented a policy where Actions are not automatically run for first-time contributors, which is why this wasn't reported earlier.

Just run go fmt on all of the modified files and that should fix everything. Additionally, go vet might pick up some items, too.

@shhgs
Copy link
Copy Markdown
Contributor Author

shhgs commented Oct 12, 2021

There was an empty line in fixtures.go.

I am using vim-go, which is suppose to call gofmt everytime it writes the file. Anyway it is fixed.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Oct 12, 2021

Build failed.

Copy link
Copy Markdown
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for real this time.

@jtopjian jtopjian merged commit db8771c into gophercloud:master Oct 12, 2021
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.02%) to 79.829% when pulling c51e43b on shhgs:PR-2227 into 3c0eaeb on gophercloud:master.

@shhgs shhgs deleted the PR-2227 branch October 20, 2021 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants