From 2d5234a1ef65aa8b6471bd21c3d070f53c27a094 Mon Sep 17 00:00:00 2001 From: TangBin Date: Wed, 17 Oct 2018 12:01:11 +0800 Subject: [PATCH] add get instances --- pkg/util/aws/instance.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pkg/util/aws/instance.go b/pkg/util/aws/instance.go index 01ed092909..c9730b8e32 100644 --- a/pkg/util/aws/instance.go +++ b/pkg/util/aws/instance.go @@ -372,12 +372,34 @@ func (self *SRegion) GetInstances(zoneId string, ids []string, offset int, limit instances := make([]SInstance, 0) for _, reservation := range res.Reservations { for _, instance := range reservation.Instances { - // todo :implement me later instances = append(instances, SInstance{ + RegionId: self.RegionId, + ZoneId: *instance.Placement.AvailabilityZone, InstanceId: *instance.InstanceId, ImageId: *instance.ImageId, + InstanceName: "// todo:xx", + InstanceType: *instance.InstanceType, + Cpu: int8(*instance.CpuOptions.CoreCount), // CoreCount? + Memory: 0, // todo:? get from instance type + IoOptimized: *instance.EbsOptimized, + KeyPairName: *instance.KeyName, + CreationTime: *instance.LaunchTime, + // ExpiredTime: + // ProductCodes: *instance.ProductCodes + PublicDNSName: *instance.PublicDnsName, InnerIpAddress: SIpAddress{[]string{*instance.PrivateIpAddress}}, PublicIpAddress: SIpAddress{[]string{*instance.PublicIpAddress}}, + RootDeviceName: *instance.RootDeviceName, + Status: *instance.State.Name, + // VlanId: + // VpcAttributes: + // SecurityGroupIds: + // NetworkInterfaces: + // EipAddress: + // Disks: + // OSName: + // OSType: + // Description: }) } }