Skip to content

feat(cli): enable customized env resources while initialization#1243

Merged
mergify[bot] merged 7 commits intoaws:masterfrom
iamhopaul123:env-init/enable-customized-resources-ui-change
Aug 11, 2020
Merged

feat(cli): enable customized env resources while initialization#1243
mergify[bot] merged 7 commits intoaws:masterfrom
iamhopaul123:env-init/enable-customized-resources-ui-change

Conversation

@iamhopaul123
Copy link
Copy Markdown
Contributor

Last part of #1192. Update env init UI to enable create customized env resources in an interactive way.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@iamhopaul123 iamhopaul123 requested a review from efekarakus August 7, 2020 00:28
@iamhopaul123 iamhopaul123 requested a review from a team as a code owner August 7, 2020 00:28
@iamhopaul123 iamhopaul123 removed the request for review from seongm-1 August 7, 2020 00:37
@iamhopaul123 iamhopaul123 force-pushed the env-init/enable-customized-resources-ui-change branch from 68807a4 to 438f3f9 Compare August 7, 2020 00:50
Copy link
Copy Markdown
Contributor

@efekarakus efekarakus left a comment

Choose a reason for hiding this comment

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

Awesome, I can't wait for this to be merged :D

Comment thread internal/pkg/cli/validate.go
Comment thread internal/pkg/cli/validate.go Outdated
Comment thread internal/pkg/cli/validate.go Outdated
Comment thread internal/pkg/term/selector/selector.go Outdated
Comment thread internal/pkg/term/selector/selector.go Outdated
Comment thread internal/pkg/cli/env_init.go Outdated
Comment thread internal/pkg/cli/env_init.go Outdated
Comment thread internal/pkg/cli/env_init.go Outdated
Comment thread internal/pkg/cli/env_init.go Outdated
Comment thread internal/pkg/cli/env_init.go
@efekarakus efekarakus changed the title chore(cli): UI changes to env init for cus tomized env resources feat(cli): enable customized env resources while initialization Aug 10, 2020
@iamhopaul123 iamhopaul123 requested a review from a team August 10, 2020 20:42
Copy link
Copy Markdown
Contributor

@efekarakus efekarakus left a comment

Choose a reason for hiding this comment

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

Looks good! Only tiny things

Comment thread internal/pkg/cli/validate.go Outdated
Comment thread internal/pkg/term/selector/ec2.go Outdated
Comment thread internal/pkg/cli/env_init.go Outdated
Comment thread internal/pkg/cli/env_init.go Outdated
if o.NoCustomResources {
return nil
}
adjustOrImport, err := o.prompt.SelectOne(
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.

We should try to use the WithFinalMessage option while prompting to provide a consistent experience but, in this situation it's a bit tricky since the options are a bit verbose. Just something to keep in mind :)

}
_, vpcCIDR, err := net.ParseCIDR(vpcCIDRString)
if err != nil {
return fmt.Errorf("parse VPC CIDR: %w", err)
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.

should we include the input in the error msg? or is that returned by the std library already?

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 believe the input is included

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.

Actually just carefully looked at it, this error ideally should never be triggered because we already have validation for the input. this is just because our Get method only return a string instead of IPNet method (we could make this change in the future), so that we need to parse the string to IPNet again...

@iamhopaul123 iamhopaul123 requested a review from a team August 10, 2020 22:32
Copy link
Copy Markdown
Contributor

@kohidave kohidave 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! One follow up we can do is include the name of the Subnets/VPCs - not just the IDs.

}

// ListVPC returns IDs of all VPCs.
func (c *EC2) ListVPC() ([]string, error) {
Copy link
Copy Markdown
Contributor

@kohidave kohidave Aug 11, 2020

Choose a reason for hiding this comment

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

One thing that might be nice to do is return a struct with the VPC ID and the value of the "Name" tag if it exists. This is what the console does.

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.

Looks great! One follow up we can do is include the name of the Subnets/VPCs - not just the IDs.

i'll cut an issue for it!


// ListVPCSubnets lists all subnets given a VPC ID.
func (c *EC2) ListVPCSubnets(vpcID string) (*Subnets, error) {
func (c *EC2) ListVPCSubnets(vpcID string, opts ...ListVPCSubnetsOpts) ([]string, error) {
Copy link
Copy Markdown
Contributor

@kohidave kohidave Aug 11, 2020

Choose a reason for hiding this comment

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

Same advice regarding the "Name" tag - so that customers can see the names if they exist.

@mergify mergify bot merged commit e9e3114 into aws:master Aug 11, 2020
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.

4 participants