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

feat: [M3-6723] – VPC Subnet endpoints, validation, & React Query queries #9390

Merged

Conversation

dwiley-akamai
Copy link
Contributor

Description πŸ“

Add initial VPC subnet endpoints, validation, and RQ queries.

Major Changes πŸ”„

  • Add subnet endpoints
  • Add subnet types
  • Add createSubnetSchema and modifySubnetSchema for validation, plus a few constants and a utility function for testing IP validity

How to test πŸ§ͺ

Reach out for detailed testing instructions if you want to work with the queries in alpha.

@dwiley-akamai dwiley-akamai added @linode/api-v4 Changes are made to the @linode/api-v4 package @linode/validation Changes are made to the @linode/validation package VPC Relating to VPC project labels Jul 11, 2023
@dwiley-akamai dwiley-akamai self-assigned this Jul 11, 2023
);
};

export const useCreateSubnetMutation = (vpcID: number) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The invalidation in the onSuccess functions for useCreateSubnetMutation, useUpdateSubnetMutation, and useDeleteSubnetMutation can probably be streamlined/improved, but I'd rather optimize those later in the process in tickets where those queries are made use of as opposed to over-optimizing at this early stage.

@@ -58,6 +59,9 @@ const BaseApp = withFeatureFlagProvider(

const { enqueueSnackbar } = useSnackbar();

// const { data: subnetData } = useSubnetQuery(vpcID, subnetID);
// console.log(subnetData);
Copy link
Contributor Author

@dwiley-akamai dwiley-akamai Jul 11, 2023

Choose a reason for hiding this comment

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

Like last time, all of the changes in this file are temporary for testing purposes and will be removed prior to merging.

You can uncomment out the lines and replace vpcID and subnetID with real IDs to check the data is coming through.

/[a-zA-Z0-9-]+/,
'Must include only ASCII letters, numbers, and dashes'
),
.matches(/[a-zA-Z0-9-]+/, LABEL_REQUIREMENTS),
Copy link
Contributor

@jaalah-akamai jaalah-akamai Jul 12, 2023

Choose a reason for hiding this comment

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

Since the label validation is essentially the same for all the schemas, what do you think about re-using that? const labelValidation = ... then wherever it's used we can tack on .required(...) or .notRequired(...)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also confirm that the regex we're using is sufficient? I think we may need to be more strict by doing /^[a-zA-Z0-9-]+$/.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the cases of "test ", " test ", and " test" I checked to see if the current VLAN validation would catch those and it did, so I think what we have currently should be sufficient

packages/validation/src/vpcs.schema.ts Outdated Show resolved Hide resolved
@cypress
Copy link

cypress bot commented Jul 12, 2023

2 flaky tests on run #4858 β†—οΈŽ

0 181 3 0 Flakiness 2

Details:

Add changesets for Cloud, JS Client, & Validation package
Project: Cloud Manager E2E Commit: 8dbab561a8
Status: Passed Duration: 15:06 πŸ’‘
Started: Jul 12, 2023 5:05 PM Ended: Jul 12, 2023 5:21 PM
FlakinessΒ  firewalls/update-firewall.spec.ts β€’ 1 flaky test

View Output Video

Test Artifacts
update firewall > updates a firewall's linodes and rules Output Screenshots Video
FlakinessΒ  linodes/smoke-linode-landing-table.spec.ts β€’ 1 flaky test

View Output Video

Test Artifacts
linode landing actions > deleting multiple linodes with action menu Output Screenshots Video

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@bnussman-akamai bnussman-akamai added Add'tl Approval Needed Waiting on another approval! and removed Ready for Review labels Jul 12, 2023
@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Jul 14, 2023
@dwiley-akamai dwiley-akamai merged commit 740b334 into linode:develop Jul 14, 2023
@dwiley-akamai dwiley-akamai deleted the M3-6723-vpc-subnet-endpoints branch July 14, 2023 19:11
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 @linode/validation Changes are made to the @linode/validation package VPC Relating to VPC project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants