remove reliance on iam_backends
This commit is contained in:
parent
7d3af65f22
commit
894906e0ee
@ -8,7 +8,6 @@ from moto.compat import OrderedDict
|
|||||||
from moto.core import BaseBackend, BaseModel
|
from moto.core import BaseBackend, BaseModel
|
||||||
from moto.core.utils import iso_8601_datetime_with_milliseconds
|
from moto.core.utils import iso_8601_datetime_with_milliseconds
|
||||||
from moto.ec2 import ec2_backends
|
from moto.ec2 import ec2_backends
|
||||||
from moto.iam import iam_backends
|
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
ClusterNotFoundError,
|
ClusterNotFoundError,
|
||||||
ClusterParameterGroupNotFoundError,
|
ClusterParameterGroupNotFoundError,
|
||||||
@ -196,14 +195,6 @@ class Cluster(TaggableResourceMixin, BaseModel):
|
|||||||
def resource_id(self):
|
def resource_id(self):
|
||||||
return self.cluster_identifier
|
return self.cluster_identifier
|
||||||
|
|
||||||
@property
|
|
||||||
def iam_roles(self):
|
|
||||||
return [
|
|
||||||
iam_role for iam_role
|
|
||||||
in self.redshift_backend.iam_backend.get_roles()
|
|
||||||
if iam_role.arn in self.iam_roles_arn
|
|
||||||
]
|
|
||||||
|
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
return {
|
return {
|
||||||
"MasterUsername": self.master_username,
|
"MasterUsername": self.master_username,
|
||||||
@ -242,8 +233,8 @@ class Cluster(TaggableResourceMixin, BaseModel):
|
|||||||
"Tags": self.tags,
|
"Tags": self.tags,
|
||||||
"IamRoles": [{
|
"IamRoles": [{
|
||||||
"ApplyStatus": "in-sync",
|
"ApplyStatus": "in-sync",
|
||||||
"IamRoleArn": iam_role.arn
|
"IamRoleArn": iam_role_arn
|
||||||
} for iam_role in self.iam_roles]
|
} for iam_role_arn in self.iam_roles_arn]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -397,7 +388,10 @@ class Snapshot(TaggableResourceMixin, BaseModel):
|
|||||||
'NumberOfNodes': self.cluster.number_of_nodes,
|
'NumberOfNodes': self.cluster.number_of_nodes,
|
||||||
'DBName': self.cluster.db_name,
|
'DBName': self.cluster.db_name,
|
||||||
'Tags': self.tags,
|
'Tags': self.tags,
|
||||||
'IamRoles': self.iam_roles_arn
|
"IamRoles": [{
|
||||||
|
"ApplyStatus": "in-sync",
|
||||||
|
"IamRoleArn": iam_role_arn
|
||||||
|
} for iam_role_arn in self.iam_roles_arn]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -427,7 +421,6 @@ class RedshiftBackend(BaseBackend):
|
|||||||
'snapshot': self.snapshots,
|
'snapshot': self.snapshots,
|
||||||
'subnetgroup': self.subnet_groups
|
'subnetgroup': self.subnet_groups
|
||||||
}
|
}
|
||||||
self.iam_backend = iam_backends['global']
|
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
ec2_backend = self.ec2_backend
|
ec2_backend = self.ec2_backend
|
||||||
|
Loading…
Reference in New Issue
Block a user