def create_default_deployer(session, config, ui): # type: (Session, Config, UI) -> Deployer client = TypedAWSClient(session) osutils = OSUtils() pip_runner = PipRunner(pip=SubprocessPip(osutils=osutils), osutils=osutils) dependency_builder = PipDependencyBuilder(osutils=osutils, pip_runner=pip_runner) return Deployer( application_builder=ApplicationGraphBuilder(), deps_builder=DependencyBuilder(), build_stage=BuildStage(steps=[ InjectDefaults(), DeploymentPackager(packager=LambdaDeploymentPackager( osutils=osutils, dependency_builder=dependency_builder, ui=UI(), ), ), PolicyGenerator(policy_gen=AppPolicyGenerator(osutils=osutils), ), SwaggerBuilder(swagger_generator=TemplatedSwaggerGenerator(), ) ], ), plan_stage=PlanStage( osutils=osutils, remote_state=RemoteState( client, config.deployed_resources(config.chalice_stage)), ), sweeper=UnreferencedResourcePlanner(), executor=Executor(client, ui), recorder=ResultsRecorder(osutils=osutils), )
def _create_deployer( session, # type: Session config, # type: Config ui, # type: UI executor_cls, # type: Type[BaseExecutor] recorder_cls, # type: Type[ResultsRecorder] ): # type: (...) -> Deployer client = TypedAWSClient(session) osutils = OSUtils() return Deployer( application_builder=ApplicationGraphBuilder(), deps_builder=DependencyBuilder(), build_stage=create_build_stage( osutils, UI(), TemplatedSwaggerGenerator(), ), plan_stage=PlanStage( osutils=osutils, remote_state=RemoteState( client, config.deployed_resources(config.chalice_stage)), ), sweeper=ResourceSweeper(), executor=executor_cls(client, ui), recorder=recorder_cls(osutils=osutils), )
def create_default_deployer(session, config, ui): # type: (Session, Config, UI) -> Deployer client = TypedAWSClient(session) osutils = OSUtils() return Deployer( application_builder=ApplicationGraphBuilder(), deps_builder=DependencyBuilder(), build_stage=create_build_stage( osutils, UI(), TemplatedSwaggerGenerator(), ), plan_stage=PlanStage( osutils=osutils, remote_state=RemoteState( client, config.deployed_resources(config.chalice_stage)), ), sweeper=ResourceSweeper(), executor=Executor(client, ui), recorder=ResultsRecorder(osutils=osutils), )
def determine_plan(self, resource): planner = PlanStage(self.remote_state, self.osutils) self.last_plan = planner.execute([resource]) return self.last_plan.instructions