How to use the chalice.utils.UI function in chalice

To help you get started, we’ve selected a few chalice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / chalice / tests / unit / test_utils.py View on Github external
def setup(self):
        self.out = StringIO()
        self.err = StringIO()
        self.ui = utils.UI(self.out, self.err)
github aws / chalice / tests / aws / test_websockets.py View on Github external
def _deploy_app(temp_dirname):
    factory = CLIFactory(temp_dirname)
    config = factory.create_config_obj(
        chalice_stage_name='dev',
        autogen_policy=True
    )
    session = factory.create_botocore_session()
    d = factory.create_default_deployer(session, config, UI())
    region = session.get_config_variable('region')
    deployed = _deploy_with_retries(d, config)
    application = SmokeTestApplication(
        region=region,
        deployed_values=deployed,
        stage_name='dev',
        app_name=RANDOM_APP_NAME,
        app_dir=temp_dirname,
    )
    return application
github aws / chalice / tests / unit / deploy / test_executor.py View on Github external
def setup_method(self):
        self.mock_client = mock.Mock(spec=TypedAWSClient)
        self.ui = mock.Mock(spec=UI)
        self.executor = Executor(self.mock_client, self.ui)
github aws / chalice / tests / unit / deploy / test_deployer.py View on Github external
def test_can_create_deletion_deployer():
    session = botocore.session.get_session()
    deployer = create_deletion_deployer(TypedAWSClient(session), UI())
    assert isinstance(deployer, Deployer)
github aws / chalice / tests / aws / test_websockets.py View on Github external
def _delete_app(application, temp_dirname):
    factory = CLIFactory(temp_dirname)
    config = factory.create_config_obj(
        chalice_stage_name='dev',
        autogen_policy=True
    )
    session = factory.create_botocore_session()
    d = factory.create_deletion_deployer(session, UI())
    _deploy_with_retries(d, config)
github aws / chalice / tests / unit / deploy / test_newdeployer.py View on Github external
def setup_method(self):
        self.ui = mock.Mock(spec=UI)
        self.reporter = DeploymentReporter(ui=self.ui)
github aws / chalice / chalice / cli / __init__.py View on Github external
def delete(ctx, profile, stage):
    # type: (click.Context, str, str) -> None
    factory = ctx.obj['factory']  # type: CLIFactory
    factory.profile = profile
    config = factory.create_config_obj(chalice_stage_name=stage)
    session = factory.create_botocore_session()
    d = factory.create_deletion_deployer(session=session, ui=UI())
    d.deploy(config, chalice_stage_name=stage)
github aws / chalice / chalice / deploy / deployer.py View on Github external
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),
    )
github aws / chalice / chalice / cli / __init__.py View on Github external
def generate_models(ctx, stage):
    # type: (click.Context, str) -> None
    """Generate a model from Chalice routes.

    Currently only supports generating Swagger 2.0 models.
    """
    factory = ctx.obj['factory']  # type: CLIFactory
    config = factory.create_config_obj(stage)
    if not config.chalice_app.routes:
        click.echo('No REST API found to generate model from.')
        raise click.Abort()
    swagger_generator = TemplatedSwaggerGenerator()
    model = swagger_generator.generate_swagger(
        config.chalice_app,
    )
    ui = UI()
    ui.write(json.dumps(model, indent=4, cls=PlanEncoder))
    ui.write('\n')