Skip to content

feat: [M3-7412] - Add new Parent/Child api-v4 endpoints#9944

Merged
jaalah-akamai merged 29 commits intolinode:developfrom
jaalah-akamai:M3-7412
Dec 3, 2023
Merged

feat: [M3-7412] - Add new Parent/Child api-v4 endpoints#9944
jaalah-akamai merged 29 commits intolinode:developfrom
jaalah-akamai:M3-7412

Conversation

@jaalah-akamai
Copy link
Contributor

@jaalah-akamai jaalah-akamai commented Nov 29, 2023

Description 📝

New Parent/Child @linode/api-v4 endpoints:

  • getChildAccounts
  • getChildAccount
  • createChildAccountPersonalAccessToken

Changes 🔄

  • Fixed our request.tsx to not override headers that are explicitly passed in via setHeaders().
  • New endpoints use a destructured syntax so we can explicitly state which properties we're interested in, without having to define unused arguments, i.e.: const { data: linodes } = useLinodesQuery({}, {}, shouldCheckLinodeCount);

Preview 📷

Screenshot 2023-11-30 at 9 11 26 PM

How to test 🧪

Test for Request.test.tsx

  1. Checkout branch
  2. Run yarn test src/request.test.tsx
  3. Observe passing tests

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@jaalah-akamai jaalah-akamai self-assigned this Nov 29, 2023
@jaalah-akamai jaalah-akamai requested a review from a team as a code owner November 29, 2023 17:51
@jaalah-akamai jaalah-akamai requested review from carrillo-erik and coliu-akamai and removed request for a team November 29, 2023 17:51
@mjac0bs mjac0bs self-requested a review November 29, 2023 17:59
@mjac0bs mjac0bs added the @linode/api-v4 Changes are made to the @linode/api-v4 package label Nov 29, 2023
@jaalah-akamai jaalah-akamai changed the title feat: [M3-7412] - Add new Parent/Child @linode/api-v4 endpoints feat: [M3-7412] - Add new Parent/Child api-v4 endpoints Nov 29, 2023
@jaalah-akamai
Copy link
Contributor Author

Actually I will be added a unit test to Request.test.tsx, but everything else is ready for review - I'll get that done in a bit

…85057.md

Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
jaalah-akamai and others added 2 commits November 29, 2023 17:02
…1547.md

Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
…85057.md

Co-authored-by: Dajahi Wiley <114682940+dwiley-akamai@users.noreply.github.com>
@jaalah-akamai
Copy link
Contributor Author

jaalah-akamai commented Nov 29, 2023

Is the goal here to store a child token in the React Query cache for often re-use

Exactly

@jaalah-akamai
Copy link
Contributor Author

@bnussman-akamai We're going to update this to a mutation due to a recent ask of needing to revoke tokens 👍

}: ChildAccountPayload) =>
useMutation<Token, APIError[], ChildAccountPayload>(() =>
createChildAccountPersonalAccessToken({ euuid, headers })
);
Copy link
Contributor Author

@jaalah-akamai jaalah-akamai Nov 30, 2023

Choose a reason for hiding this comment

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

The way this will work is from the Parent, we'll create an ephemeral token for the child account in order to log in. While in the Proxy account, we'll be able revoke this the typical way by hitting /profile/tokens/{tokenId}.

jaalah-akamai and others added 7 commits November 30, 2023 14:18
Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
@jaalah-akamai
Copy link
Contributor Author

Unit test added 🚀 This should be good now

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Thanks for the unit test. CI looks good; that one e2e failure on rescue-linode is unrelated.

Let's 🚢 !

@mjac0bs mjac0bs added the Approved Multiple approvals and ready to merge! label Dec 1, 2023
Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Dec 2, 2023

Coverage Report:
Base Coverage: 85.46%
Current Coverage: 85.46%

@jaalah-akamai jaalah-akamai merged commit 0989de5 into linode:develop Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Multiple approvals and ready to merge! @linode/api-v4 Changes are made to the @linode/api-v4 package Parent / Child Account

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants