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

Moved IAMbic imports to local imports #122

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/starfleet/worker_ships/plugins/iam/role_ship.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
make_iambic_variables,
)
from starfleet.worker_ships.ship_schematics import StarfleetWorkerShip, FanOutStrategy, AlertPriority
from starfleet.worker_ships.plugins.iam.iambic_imports import AWSAccount, AwsIamRoleTemplate, iambic_ctx


class IambicFailedError(Exception):
Expand Down Expand Up @@ -65,13 +64,17 @@ def render_iambic_template(self, commit: bool = False) -> Dict[str, Any]:
"""This will render the iambic template and return it back out."""
return render_iambic_template(self.payload, IambicTemplateTypes.IAM_ROLE, commit)

def prepare_iambic_template(self, rendered_template: Dict[str, Any]) -> AwsIamRoleTemplate:
def prepare_iambic_template(self, rendered_template: Dict[str, Any]) -> "AwsIamRoleTemplate":
"""This will perform the additional validation that is needed to load and generate the iambic template."""
from starfleet.worker_ships.plugins.iam.iambic_imports import AwsIamRoleTemplate

AwsIamRoleTemplate.update_forward_refs()
return AwsIamRoleTemplate(**rendered_template)

def execute(self, commit: bool = False) -> None:
"""Execute the payload to sync out."""
from starfleet.worker_ships.plugins.iam.iambic_imports import AWSAccount, iambic_ctx

config = self.configuration_template_class().load(STARFLEET_CONFIGURATION.config[self.worker_ship_name])

# Pull out the payload details for this account:
Expand Down
4 changes: 2 additions & 2 deletions src/starfleet/worker_ships/plugins/iam/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from starfleet.utils.logging import LOGGER
from starfleet.worker_ships.base_payload_schemas import IncludeAccountsSpecificationSchema, AccountsSpecificationSchema, BaseAccountPayloadTemplate
from starfleet.worker_ships.ship_schematics import WorkerShipBaseConfigurationTemplate
from starfleet.worker_ships.plugins.iam.iambic_imports import Variable


class IambicTemplateTypes(Enum):
Expand Down Expand Up @@ -69,8 +68,9 @@ def render_iambic_template(template: Dict[str, Any], template_type: IambicTempla
return rendered_template


def make_iambic_variables(template_variables: List[Dict[str, str]]) -> List[Variable]:
def make_iambic_variables(template_variables: List[Dict[str, str]]) -> List["Variable"]:
"""This will make the iambic variable objects from the Starfleet template variables."""
from starfleet.worker_ships.plugins.iam.iambic_imports import Variable

iambic_variables = []
for variable in template_variables:
Expand Down
Loading