New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial commit for handling of autoscalingEvents #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! Would you also be willing to add the other samples from https://docs.aws.amazon.com/autoscaling/ec2/userguide/cloud-watch-events.html#cloudwatch-event-types to the testdata?
events/autoscaling.go
Outdated
type EventDetails struct { | ||
StatusCode string `json:"StatusCode,omitempty"` //Status code for Event | ||
AutoscalingGroupName string `json:"AutoScalingGroupName,omitempty"` //AutoScalingGroup name | ||
ActivityId string `json:"ActivityId,omitempty"` //ActivityId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to ActivityID
events/autoscaling.go
Outdated
AutoscalingGroupName string `json:"AutoScalingGroupName,omitempty"` //AutoScalingGroup name | ||
ActivityId string `json:"ActivityId,omitempty"` //ActivityId | ||
Details DetailsInfo `json:"Details,omitempty"` //Additional details about event such as AZ and SubnetId of instance | ||
RequestId string `json:"RequestId,omitempty"` //RequestId of Request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to RequestID
events/autoscaling.go
Outdated
RequestId string `json:"RequestId,omitempty"` //RequestId of Request | ||
StatusMessage string `json:"StatusMessage,omitempty"` //StatusMEssage | ||
EndTime time.Time `json:"EndTime,omitempty"` //EndTime of Event | ||
EC2InstanceId string `json:"EC2InstanceId,omitempty"` //InstanceID of ec2 instance impacted by event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to EC2InstanceID
events/autoscaling.go
Outdated
} | ||
|
||
// EventDetails struct is used to parse the nested event Details available within the Autoscaling event | ||
type EventDetails struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to avoid polluting the package with many simple type names, change this to something like AutoScalingEventDetail
events/autoscaling.go
Outdated
} | ||
|
||
// DetailsInfo contains AZ and SubnetId for instance impacted by the autoscaling event // | ||
type DetailsInfo struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to avoid polluting the package with many simple type names, change this to something like AutoScalingEventDetailDetails
… them during encoding when the fields are empty.
Updated the code to have additional test cases for all samples available in the product documentation. Have changed certain fields for AutoScalingEvents to pointer types to allow encoding to effectively handle empty fields which helps with the test cases. |
Thanks for adding the other event samples. After looking at the samples again, this approach creates a weird user experience. The What do you think of having a separate AutoScaling event type for each of the samples in the documents? The alternative would be to only model the generic |
I am in favour of converinting the I will make the changes soon and update the request. |
… for better handling and parsing of event information
* Initial commit for handling of autoscalingEvents * Added additional test files. Changed some field to pointers to ignore them during encoding when the fields are empty. * Updated AutoScalingEvent Details to a map[string]interface{} to allow for better handling and parsing of event information
* Initial commit for handling of autoscalingEvents * Added additional test files. Changed some field to pointers to ignore them during encoding when the fields are empty. * Updated AutoScalingEvent Details to a map[string]interface{} to allow for better handling and parsing of event information
The repo was missing ability to handle asg lifecycle events.
Added functionality to handle autoscaling lifecycle events and action on them.