Esempio n. 1
0
func getGceInstanceID() info.InstanceID {
	instanceID, err := metadata.Get("instance/id")
	if err != nil {
		return info.UnknownInstance
	}
	return info.InstanceID(info.InstanceType(instanceID))
}
Esempio n. 2
0
func getGceInstanceType() info.InstanceType {
	machineType, err := metadata.Get("instance/machine-type")
	if err != nil {
		return info.UnknownInstance
	}

	responseParts := strings.Split(machineType, "/") // Extract the instance name from the machine type.
	return info.InstanceType(responseParts[len(responseParts)-1])
}
Esempio n. 3
0
func getAwsInstanceType() info.InstanceType {
	return info.InstanceType(getAwsMetadata("instance-type"))
}