diff --git a/LICENSE b/LICENSE index f0e5afd..78279ed 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2018 Thomas Labarussias - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +MIT License + +Copyright (c) 2019 Thomas Labarussias + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 321e7cc..b2ce7c9 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,13 @@ Install `session-manager-plugin` : https://docs.aws.amazon.com/systems-manager/l ## Usage ```bash -Usage of sshm: - -profile string - Profile from ~/.aws/config (if empty, a list of your profiles is displayed) - -region string - Region (default "eu-west-1") +Usage of ./sshm: + -i string + Instance-ID for direct connection + -p string + Profile from ~/.aws/config + -r string + Region (only to create session), default is eu-west-1 (default "eu-west-1") ``` You can select your instance by ←, ↑, → ↓ and filter by *Tag:Name*, *InstanceId*, *Hostname*, *PrivateIp*, *PublicIp*, etc. **Enter** key to validate. diff --git a/main.go b/main.go index 733ca64..281db84 100644 --- a/main.go +++ b/main.go @@ -188,14 +188,12 @@ func listManagedInstances(sess *session.Session) []instance { for _, i := range info.InstanceInformationList { var e instance e.InstanceID = *i.InstanceId - e.ComputerName = *i.ComputerName - e.PrivateIPAddress = *i.IPAddress - e.PlatformType = *i.PlatformType - e.PlatformName = *i.PlatformName + " " + *i.PlatformVersion - if *i.PingStatus != "Online" { - e.AgentState = "Offline" - } else { - e.AgentState = *i.PingStatus + e.AgentState = *i.PingStatus + if *i.PingStatus == "Online" { + e.ComputerName = *i.ComputerName + e.PrivateIPAddress = *i.IPAddress + e.PlatformType = *i.PlatformType + e.PlatformName = *i.PlatformName + " " + *i.PlatformVersion } for _, j := range allInstances { if *i.InstanceId == j.InstanceID {