TheJumpCloud / jcapi-go

Go
18 stars 11 forks source link

v1 - list systems - expose EC2 instance ID #24

Closed sparkacus closed 5 years ago

sparkacus commented 5 years ago

Hi,

Would it be possible to expose the EC2 instance ID when listing systems?

I have a need to find a system based on it's EC2 instance ID, but I don't think I'm able to do that via the API. Please correct me if I'm wrong.

scottd3v commented 5 years ago

The amazonInstanceID is populated for systems hosted in amazon see an example output of the JSON object for a system below:

systemToken : REMOVED rganization : REMOVED created : 1/2/18 10:21:00 PM lastContact : 11/1/18 4:53:20 PM os : Ubuntu version : 16.04 arch : x86_64 networkInterfaces : {@{address=172.31.34.140; family=IPv4; internal=False; name=eth0}, @{address=fe80::c98:aeff:feb3:fd60; family=IPv6; internal=False; name=eth0}, @{address=127.0.0.1; family=IPv4; internal=True; name=lo}, @{address=::1; family=IPv6; internal=True; name=lo}} hostname : ip-172-31-34-140 displayName : ip-172-31-34-140 systemTimezone : 0 templateName : ubuntu-16.04-x86_64 remoteIP : 54.174.23.213 amazonInstanceID : i-0aad3fa40a1ba30ed active : True sshdParams : {@{name=ChallengeResponseAuthentication; value=no}, @{name=UsePAM; value=yes}, @{name=PubkeyAuthentication; value=no}, @{name=PermitRootLogin; value=yes}...} allowSshPasswordAuthentication : True allowSshRootLogin : True allowMultiFactorAuthentication : True allowPublicKeyAuthentication : False modifySSHDConfig : True agentVersion : 0.10.22 connectionHistory : {} serialNumber : REMOVED _id : REMOVED

sparkacus commented 5 years ago

How can I access the 'amazonInstanceID' key using the V1 api?

It's not something listed in this struct as far as I can tell - https://github.com/TheJumpCloud/jcapi-go/blob/master/v1/system.go

I'm rather new to GO, so apologies if it's something simple that I've missed.

bbawn commented 5 years ago

This should be fixed in #27 . amazonInstanceIID is now part of the JumpCloud API and is thus included in the generated SDK