Innablr / revolver

AWS Powercycle Facility
MIT License
2 stars 2 forks source link

InstrumentedEc2 seems to contain random EBS code? #322

Closed lyricnz closed 1 month ago

lyricnz commented 1 month ago

Why does the InstrumentedEC2 resource get created with an EBS-volume-looking ARN? Rather than using this.resource()?

https://github.com/Innablr/revolver/blob/develop/drivers/ec2.ts#L230

    return ec2Instances.map(
      (xi) =>
        new InstrumentedEc2(xi, `arn:aws:ec2:${this.accountConfig.region}:${this.accountId}:volume/${xi.InstanceId}`),
    );
  }

  resource(obj: InstrumentedResource): ToolingInterface {
    return new InstrumentedEc2(obj.resource, obj.resourceArn);
  }
}

Also, what is point of ebsTag() method? Seems duplicate of tag()? And unused?

class InstrumentedEc2 extends ToolingInterface {
...
  tag(key: string) {
    const tag = this.resource.Tags.find((xt: Tag) => xt.Key === key);
    if (tag !== undefined) {
      return tag.Value;
    }
  }

  ebsTag(key: string) {
    const tag = this.resource.Tags.find((xt: Tag) => xt.Key === key);
    if (tag !== undefined) {
      return tag.Value;
    }
  }