Skip to content

DNS v2: Zone Transfer Request/Accept#2041

Merged
jtopjian merged 7 commits intogophercloud:masterfrom
cloudification-io:feature/add_zone_transfer_request
Nov 10, 2020
Merged

DNS v2: Zone Transfer Request/Accept#2041
jtopjian merged 7 commits intogophercloud:masterfrom
cloudification-io:feature/add_zone_transfer_request

Conversation

@GlaciErrDev
Copy link
Copy Markdown
Contributor

Mike Durnosvystov added 2 commits October 16, 2020 11:37
  * Added CRUD operations
  * Added unittests
  * Added CRUD operations
  * Added unittests
@GlaciErrDev GlaciErrDev changed the title Feature/add zone transfer request WIP: DNS v2: Zone Transfer Request/Accept Oct 17, 2020
@GlaciErrDev GlaciErrDev changed the title WIP: DNS v2: Zone Transfer Request/Accept #2040 WIP: DNS v2: Zone Transfer Request/Accept Oct 17, 2020
@GlaciErrDev GlaciErrDev changed the title #2040 WIP: DNS v2: Zone Transfer Request/Accept WIP: DNS v2: Zone Transfer Request/Accept Oct 17, 2020
@coveralls
Copy link
Copy Markdown

coveralls commented Oct 17, 2020

Coverage Status

Coverage increased (+0.05%) to 79.638% when pulling e7059b7 on cloudification-io:feature/add_zone_transfer_request into 0e6f9ce on gophercloud:master.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Oct 17, 2020

Build succeeded.

@GlaciErrDev GlaciErrDev changed the title WIP: DNS v2: Zone Transfer Request/Accept DNS v2: Zone Transfer Request/Accept Oct 20, 2020
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Oct 20, 2020

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Oct 21, 2020

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Oct 22, 2020

Build succeeded.

@jtopjian
Copy link
Copy Markdown
Contributor

@GlaciErrDev Thank you for submitting this. Is this ready for a review or are you still working on it?

At first glance, it looks like we might need some additional code references. For example, where are the fields in the TransferAccept struct defined (how do we know that zone_transfer_request_id is a valid field?), and how do we know that target_project_id is a valid field of the Transfer Request CreateOpts?

Once we're able to fully confirm the fields used in the request and result structs, a review of this PR should be fairly easy.

Thanks again for your work and let me know if you have any questions.

@GlaciErrDev
Copy link
Copy Markdown
Contributor Author

@jtopjian Thank you for your review and comments.

Yes, it is a completely working API layer. Tested it on the deployed setup.

Left here some additional reference links ->

API Zone Transfer Request:
https://docs.openstack.org/api-ref/dns/#zone-ownership-transfers-requests

Reference to target_project_id field -> https://github.com/openstack/designate/blob/056ceb7f4b/designate/objects/adapters/api_v2/zone_transfer_request.py#L37

API Zone Transfer Accept:
https://docs.openstack.org/api-ref/dns/#zone-ownership-transfers-accepts

Reference to zone_transfer_request_id field -> https://github.com/openstack/designate/blob/056ceb7f4b/designate/objects/adapters/api_v2/zone_transfer_accept.py#L26

If these will need to be added to the Issue description, just mention it :)

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.

@GlaciErrDev Thanks for the additional information.

I've made some comments for your review. The majority of them are just spacing issues related to the godoc code. They're nits, but semi-important as they get rendered as formatted code on godoc.org.

The other comment is about the version field.

One thing to note is that the DNS acceptance tests don't run by default on here. However, I've run them in a devstack environment and, short of the missing version field, everything else looks good.

Please let me know if you have any questions.


Example to List Zone Transfer Accepts

// Optionaly you can provide Status as query parameter for filtering the 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.

nit: spacing

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.

It's strange, but the spacing is ok in the raw file. Maybe some issues with rendering in the diff?

Example to Create a Zone Transfer Accept

zoneTransferRequestID := "99d10f68-5623-4491-91a0-6daafa32b60e"
key := "JKHGD2F7"
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.

nit: spacing

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.

It's strange, but the spacing is ok in the raw file. Maybe some issues with rendering in the diff?

key := "JKHGD2F7"
createOpts := transferAccepts.CreateOpts{
ZoneTransferRequestID: zoneTransferRequestID,
Key: key,
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.

nit: spacing

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.

It's strange, but the spacing is ok in the raw file. Maybe some issues with rendering in the diff?

Example to Create a Zone Transfer Request

zoneID := "99d10f68-5623-4491-91a0-6daafa32b60e"
targetProjectID := "f977bd7c-6485-4385-b04f-b5af0d186fcc"
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.

nit: spacing

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.

It's strange, but the spacing is ok in the raw file. Maybe some issues with rendering in the diff?

zoneID := "99d10f68-5623-4491-91a0-6daafa32b60e"
targetProjectID := "f977bd7c-6485-4385-b04f-b5af0d186fcc"
createOpts := transferRequests.CreateOpts{
TargetProjectID: targetProjectID,
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.

nit: spacing

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.

It's strange, but the spacing is ok in the raw file. Maybe some issues with rendering in the diff?

Status string `json:"status"`

// Version of the resource.
Version int `json:"version"`
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.

I'm not seeing this field being included in the JSON response:

{
  "created_at": "2020-11-03T17:11:34.000000",
  "description": "Test transfer request",
  "id": "349fdc2c-8578-4640-95df-4d40d4c6d720",
  "key": "94JG7AK2",
  "links": {
    "self": "http://example.com/v2/zones/tasks/transfer_requests/349fdc2c-8578-4640-95df-4d40d4c6d720"
  },
  "project_id": "c212707a4ec34f43ac88e3c1a43ee7b0",
  "status": "ACTIVE",
  "target_project_id": "123",
  "updated_at": null,
  "zone_id": "3a749024-dde1-421e-b81d-08e1d27d6f66",
  "zone_name": "ACPTTESTtu4ihjze.com."
}

I also don't see version listed here: https://github.com/openstack/designate/blob/056ceb7f4b/designate/objects/adapters/api_v2/zone_transfer_request.py

Note that this is the main reason we rely on the actual Python code to understand how API interaction works - the docs are sometimes out of sync with the real result.

However, I see that you included version in your test fixtures. Did you pull your fixtures from an actual environment? If so, that means version is an old field and I'm okay with keeping it.

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.

Removed it with new commit

@GlaciErrDev
Copy link
Copy Markdown
Contributor Author

@jtopjian Thanks for the comments!

Seems that version leaves only in the API documentation and not in actual code...
https://docs.openstack.org/api-ref/dns/?expanded=list-zone-transfer-requests-detail,create-zone-transfer-request-detail#id54
https://github.com/openstack/designate/blob/056ceb7f4ba4a4b86fe212aa31a7506ac1b27f20/api-ref/source/parameters.yaml#L672

So I will remove it from fields and from fixtures.

@GlaciErrDev
Copy link
Copy Markdown
Contributor Author

@jtopjian I left a comment about spacing issues.

In the raw files, spacing is Ok. Maybe there is some strange rendering behavior in diffs?

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Nov 6, 2020

Build failed.

@GlaciErrDev GlaciErrDev requested a review from jtopjian November 6, 2020 11:14
@jtopjian
Copy link
Copy Markdown
Contributor

jtopjian commented Nov 6, 2020

@GlaciErrDev Please see the attached image. This is what I see when I open the file in vim. There's a mix of tabs and spaces which are causing the misalignment.

Normally go fmt would resolve this, but since these blocks of code are embedded in comments, go fmt ignores them. If you normalize the file to either use tabs or spaces for the code blocks, it should all be good after that.

You should also be able to see the misalignment if you run:

$ go doc openstack/dns/v2/transfer/accept

Screen Shot 2020-11-06 at 8 47 48 AM

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci bot commented Nov 9, 2020

Build succeeded.

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!

There's still one small spacing issue, but I'll fix it post-commit :)

Thank you for your work and for contributing this.

@jtopjian jtopjian merged commit 35a020f into gophercloud:master Nov 10, 2020
@GlaciErrDev GlaciErrDev deleted the feature/add_zone_transfer_request branch November 30, 2020 15:59
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