Skip to content
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

Describe Reserved Instances #1780

Closed

Conversation

alecrajeev
Copy link
Contributor

Fixes #1741

Downloads all of the reserved instance offerings and puts them in csv files split up by region. Then adds end points for describe_reserved_instances_offerings, purchase_reserved_instance_offerings, and describe_reserved_instances.

Uses numpy to import the csv files and parses them quickly to match up the instance type with offering id. The generated csv files include the pricing, so that pricing can be returned.

Additional reserved instance classes are created to handle both the model and the backend.

Includes unit tests, so travis-ci can check it.

* Add ec2 ri offerings (#11)

* Fix hash table by region (#9)

* Added describe ri offering end point

* added package to unit test

* added offering class convertible unit test

* added numpy to setup.py

* removed unnecessary print statement

* added unit test for empty offering and put csv files in regional folders

* added folders for regions

* added folders for regions

* added csv files to regional folders

* add all csv files to regional folders

* fixed minor syntax issue

* Fixed unit test by adding a variable

* Added regional files individually

* add back offering table hash

* can find the file name from offering id

* succesfully returns offering info from id

* Split up 20 mb hash table to increase speed

* fixed hash function

* Add for all regions and instance types

* add hash table offering files

* fixed hash table functions within moto/models

* added ri offering id unit tests

* fixed white space2

* fixed unit test for duration int

still need to fix underlying issue with instance type files

* fixed blank line

* Revert "fixed white space2"

This reverts commit b9b37dd.

* Revert "fixed blank line"

This reverts commit 5758e2c.

* fixed blank line2

* reset RI csv files to remove non-existent RI's

* added more logging

* add improved ri info csv tables

* add improved csv tables

* fixed white space

* supports multiple offering ids in input

* fixed white space

* supports unspecified instance tenancy, offering class, etc

* fixed white space

* fixed multiple ri unit test

* removed unnecessary print statements

* fixed instance type in unit test

* Added describe ri offering end point

* added offering class convertible unit test

* added unit test for empty offering and put csv files in regional folders

* added folders for regions

* added folders for regions

* added csv files to regional folders

* add all csv files to regional folders

* Added regional files individually

* add back offering table hash

* can find the file name from offering id

* succesfully returns offering info from id

* Split up 20 mb hash table to increase speed

* fixed hash function

* Add for all regions and instance types

* fixed hash table functions within moto/models

* fixed white space2

* fixed unit test for duration int

still need to fix underlying issue with instance type files

* fixed blank line

* Revert "fixed white space2"

This reverts commit b9b37dd.

* Revert "fixed blank line"

This reverts commit 5758e2c.

* fixed blank line2

* add improved ri info csv tables

* fixed white space

* supports multiple offering ids in input

* fixed white space

* supports unspecified instance tenancy, offering class, etc

* fixed white space

* fixed multiple ri unit test

* removed unnecessary print statements

* fixed instance type in unit test

* adjusted hash table algorithm to group be region

* Added adjustments for hash table by region

* added new hash tables by regions

* added hash tables by regions

* made hash table length smaller

* fixed syntax

* removed unnecessary function

* removed duplicate functions

* fixed hash table in ec2/models

* added additional unit test to check for offering id in wrong region

* fixed typo

* fixed region used in unit test

* fixed offerings to remove false offering ris

* made slight adjustment to unit test

* fixed manifest file

* removed duplicate unit test

* removed duplicate unit tests2

* fixed unit test to count for no instance type in region

* removed unnecessary comment

* added clarifying comment

* Added reserved instance backend (controller) and model

* Added error checkr for valid id. Added random uuid4 for ri-id

* Added all parameters to ReservedInstance

* Added response

* Added ri purchase unit tests

* fixed white space

* fixed unit test to use right parameter

* updated method that returns ri offerings

changed it to fix unit test to make it return an invalid value

* reverted back to the way how valid length ri id's with wrong region are handeld

* fixed which method was being called

* added test ec2 instance types unit tests

* added describe reserved instances response and controller

* Added more unit tests for describe reserved instances

* added implementation coverage

* fixed white space

* added timedelta to account for end date better

* fixed type of seconds

* fixed unit test

* Added unit tests for duration and time

* fixed unit test

* added more unit tests

* fixed region to be region_name

* Added more unit tests

* Added a more specific expection for invalid ri id

* Changed how empty ri offering list is handeled

* reverted how RIId=[] is handeled to allow it

* Fixed get_offering_ids to allow for offering id lists of []

* Removed old unit test

* Fixed random ri id generated to be a string instead of UUID

* Added another unit test

* fixed unit test

* Added Another Unit Test

* changed regions

* fixed unit test

* Added instance count parameter

* fixed unit test

* fixed unit test
@coveralls
Copy link

coveralls commented Aug 15, 2018

Coverage Status

Coverage decreased (-0.1%) to 92.449% when pulling 2b5be59 on alecrajeev:describe-reserved-instances into dfa7935 on spulec:master.

@alecrajeev alecrajeev closed this Oct 8, 2018
@alecrajeev
Copy link
Contributor Author

will fix coveralls and re-submit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants