Skip to content
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

Implemented new middleware system #571

Merged

Conversation

ezilber-akamai
Copy link
Contributor

📝 Description

Implemented new middleware system that no longer relies on resty.

✔️ How to Test

make testunit

@ezilber-akamai ezilber-akamai requested a review from a team as a code owner August 22, 2024 19:35
@ezilber-akamai ezilber-akamai requested review from ykim-akamai and yec-akamai and removed request for a team August 22, 2024 19:35
@ezilber-akamai ezilber-akamai force-pushed the TPT-2963-new-middleware-system branch from 18d4753 to b3b7008 Compare August 22, 2024 19:40
@ezilber-akamai ezilber-akamai added the improvement for improvements in existing functionality in the changelog. label Aug 26, 2024
@@ -136,7 +136,7 @@ type RequestParams struct {
// Generic helper to execute HTTP requests using the net/http package
//
// nolint:unused, funlen, gocognit
func (c *httpClient) doRequest(ctx context.Context, method, url string, params RequestParams, mutators ...func(req *http.Request) error) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Looks great, nice work!

Copy link
Contributor

@ykim-akamai ykim-akamai left a comment

Choose a reason for hiding this comment

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

LGTM, good unit test coverage and passing locally! Nice work!

@ezilber-akamai ezilber-akamai merged commit fef1ad4 into linode:main Sep 3, 2024
4 checks passed
@ezilber-akamai ezilber-akamai deleted the TPT-2963-new-middleware-system branch September 3, 2024 15:40
AniJ98 pushed a commit to AniJ98/ajagadis-akamai-linode that referenced this pull request Sep 16, 2024
yec-akamai added a commit that referenced this pull request Sep 17, 2024
* added reserved field to InstanceIP struct for IP Reservation response

* Reserved IP resource for handling IP reservation API's

* Added integration test covering multiple scenarios of reserving IP addresses

* The fixture files for different scenarios of IP Reservation - EndToEnd, InsuffecientPermission, ReserveIP, GetReservedIP, getReservedIPs, DeleteReservedIPs

* Updated the fixture files with responses after the user has permissions to reserve IP

* Changed the error message to relay invalid token for insufficient permission tests

* Updated the error message for Insufficient Permission tests to display appropriate error message along with code

* Made changes to Delete, List, Get, Reserve, EndtoEnd fixtures to record user with adequate permissions

* changed variable name from id to address to keep it consistent with other functions

* Made changes to variable names, achanged logf statements to errorf and fatalf wherever necessary

* changed fixture file names to improve consistency, re-recorded fixtures with latest error messages

* removed debugging fmt statement

* Made changes to reserve IP addresses before listing them using fitler feature. Removed for loop to reserve IPs till limit is reached.

* uncommenting unaffected tests

* Made changes to error messages, added mandatory checks and re-recorded fixtures to reflect new error messages

* Added new middleware system (#571)

* build(deps): bump golang.org/x/oauth2 from 0.22.0 to 0.23.0 (#574)

* build(deps): bump golang.org/x/oauth2 from 0.22.0 to 0.23.0

Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.22.0 to 0.23.0.
- [Commits](golang/oauth2@v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Ran make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ezilber-akamai <ezilber@akamai.com>

* build(deps): bump golang.org/x/text from 0.17.0 to 0.18.0 (#575)

* build(deps): bump golang.org/x/text from 0.17.0 to 0.18.0

Bumps [golang.org/x/text](https://github.com/golang/text) from 0.17.0 to 0.18.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](golang/text@v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ye Chen <yechen@akamai.com>

* new: Add support LKE, Volume, NodeBalancer, and network transfer pricing endpoints  (#573)

* Add LKE types endpoints

* Support base struct; add NB types endpoints

* Add volume types

* Add network transfer prices

* Add price and region price structs

* Revert IPv6 fixtures

* Add missing fixtures

* Add test case for ip limit exceed

* add cleanup for TestReservedIPAddresses_ExceedLimit

* added interactions to fixture and changed the ecpected error message

* Added note indicating feature is currently not available to all users

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Erik Zilber <ezilber@akamai.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ye Chen <yechen@akamai.com>
Co-authored-by: Lena Garber <114949949+lgarber-akamai@users.noreply.github.com>
Co-authored-by: ykim-1 <ykim@akamai.com>
lgarber-akamai added a commit that referenced this pull request Nov 25, 2024
…(instance, network_ips) (#610)

* added reserved field to InstanceIP struct for IP Reservation response

* Reserved IP resource for handling IP reservation API's

* Added integration test covering multiple scenarios of reserving IP addresses

* The fixture files for different scenarios of IP Reservation - EndToEnd, InsuffecientPermission, ReserveIP, GetReservedIP, getReservedIPs, DeleteReservedIPs

* Updated the fixture files with responses after the user has permissions to reserve IP

* Changed the error message to relay invalid token for insufficient permission tests

* Updated the error message for Insufficient Permission tests to display appropriate error message along with code

* Made changes to Delete, List, Get, Reserve, EndtoEnd fixtures to record user with adequate permissions

* changed variable name from id to address to keep it consistent with other functions

* Made changes to variable names, achanged logf statements to errorf and fatalf wherever necessary

* changed fixture file names to improve consistency, re-recorded fixtures with latest error messages

* removed debugging fmt statement

* Made changes to reserve IP addresses before listing them using fitler feature. Removed for loop to reserve IPs till limit is reached.

* uncommenting unaffected tests

* Made changes to error messages, added mandatory checks and re-recorded fixtures to reflect new error messages

* Added new middleware system (#571)

* build(deps): bump golang.org/x/oauth2 from 0.22.0 to 0.23.0 (#574)

* build(deps): bump golang.org/x/oauth2 from 0.22.0 to 0.23.0

Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.22.0 to 0.23.0.
- [Commits](golang/oauth2@v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Ran make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: ezilber-akamai <ezilber@akamai.com>

* build(deps): bump golang.org/x/text from 0.17.0 to 0.18.0 (#575)

* build(deps): bump golang.org/x/text from 0.17.0 to 0.18.0

Bumps [golang.org/x/text](https://github.com/golang/text) from 0.17.0 to 0.18.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](golang/text@v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* make tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ye Chen <yechen@akamai.com>

* new: Add support LKE, Volume, NodeBalancer, and network transfer pricing endpoints  (#573)

* Add LKE types endpoints

* Support base struct; add NB types endpoints

* Add volume types

* Add network transfer prices

* Add price and region price structs

* Revert IPv6 fixtures

* Add missing fixtures

* Add test case for ip limit exceed

* add cleanup for TestReservedIPAddresses_ExceedLimit

* added interactions to fixture and changed the ecpected error message

* Added note indicating feature is currently not available to all users

* added support for creating a linode with reserved IP address along with associated tests

* Added support for adding additional reserved IP to linodes along with the corresponding tests and fixtures

* added ipv4 field in the InstanceCreateOptions struct

* moved InstanceReservedIPOptions and the method to AddReservedIPToInsatance to instance_ips.go

* Split the variants tests of createInstanceWithReservedIP into individual test funcitons and removed debugging log statements

* Re-recorded fixtures after splitting variants test into individual test functions, made changes to error messages

* added teardown funcitnality to handle accidental instance creations

* removed unnecessary defer keyword from test functions

* moved tests related to creating a linode with reserved IP and adding additonal reserved IPs to a linode to a separate file

* Removing the sensitive token from the previous commit

* made changes to maintain consistency and improve readability

* added tests for deletion of linode created with reserved IP address

* added test for verifying the status of the reserved field when listing addresses of a linode

* Added support for existing resources to support reserved IP feature and corresponding tests

* Updated fixtures with required interactions for reserved IP feature and recorded new ones for allocating and assigning reserved IPs

* changed the name of the test function to keeop it more succinct

* setting reserved as an optional field

* Made change to make reserved a part of the update IP address functionality

* Removed test for exceeding IP MAX and changed the type of the reserved field in the IPAddressUpdateOptions struct

* Changed struct name from LinodeReserveIPOptions to AllocateReserveIPOptions

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Erik Zilber <ezilber@akamai.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ye Chen <yechen@akamai.com>
Co-authored-by: Lena Garber <114949949+lgarber-akamai@users.noreply.github.com>
Co-authored-by: ykim-1 <ykim@akamai.com>
Co-authored-by: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement for improvements in existing functionality in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants