provide SpotRequestBackend with model accessor
This commit is contained in:
parent
76a6a86eac
commit
fa8485b599
@ -7,6 +7,7 @@ from boto.ec2.spotinstancerequest import SpotInstanceRequest as BotoSpotRequest
|
|||||||
from boto.ec2.launchspecification import LaunchSpecification
|
from boto.ec2.launchspecification import LaunchSpecification
|
||||||
|
|
||||||
from moto.core import BaseBackend
|
from moto.core import BaseBackend
|
||||||
|
from moto.core.models import Model
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
InvalidIdError,
|
InvalidIdError,
|
||||||
DependencyViolationError,
|
DependencyViolationError,
|
||||||
@ -933,6 +934,8 @@ class SpotInstanceRequest(BotoSpotRequest):
|
|||||||
|
|
||||||
|
|
||||||
class SpotRequestBackend(object):
|
class SpotRequestBackend(object):
|
||||||
|
__metaclass__ = Model
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.spot_instance_requests = {}
|
self.spot_instance_requests = {}
|
||||||
super(SpotRequestBackend, self).__init__()
|
super(SpotRequestBackend, self).__init__()
|
||||||
@ -955,6 +958,7 @@ class SpotRequestBackend(object):
|
|||||||
requests.append(request)
|
requests.append(request)
|
||||||
return requests
|
return requests
|
||||||
|
|
||||||
|
@Model.prop('SpotInstanceRequest')
|
||||||
def describe_spot_instance_requests(self):
|
def describe_spot_instance_requests(self):
|
||||||
return self.spot_instance_requests.values()
|
return self.spot_instance_requests.values()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user