From 8214ad72004c8b9c0a5906c36b491dbaf2c7f902 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Mon, 26 Mar 2018 23:52:23 -0400 Subject: [PATCH] Add VPC to kops toolbox dump --- pkg/resources/aws/vpc.go | 7 +++++++ pkg/resources/dumpmodel.go | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/pkg/resources/aws/vpc.go b/pkg/resources/aws/vpc.go index 21bd17f2eb..9c5b305061 100644 --- a/pkg/resources/aws/vpc.go +++ b/pkg/resources/aws/vpc.go @@ -53,6 +53,13 @@ func DumpVPC(op *resources.DumpOperation, r *resources.Resource) error { data["type"] = ec2.ResourceTypeVpc data["raw"] = r.Obj op.Dump.Resources = append(op.Dump.Resources, data) + + ec2VPC := r.Obj.(*ec2.Vpc) + vpc := &resources.VPC{ + ID: aws.StringValue(ec2VPC.VpcId), + } + op.Dump.VPC = vpc + return nil } diff --git a/pkg/resources/dumpmodel.go b/pkg/resources/dumpmodel.go index 4210a510a2..85898d6798 100644 --- a/pkg/resources/dumpmodel.go +++ b/pkg/resources/dumpmodel.go @@ -29,9 +29,15 @@ type Subnet struct { Zone string `json:"zone,omitempty"` } +// VPC is the type for an VPC in a dump +type VPC struct { + ID string `json:"id,omitempty"` +} + // Dump is the type for a dump result type Dump struct { Resources []interface{} `json:"resources,omitempty"` Instances []*Instance `json:"instances,omitempty"` Subnets []*Subnet `json:"subnets,omitempty"` + VPC *VPC `json:"vpc,omitempty"` }