def seed_aws_data(ctx, data):
    """Seeds SWAG from a list of known AWS accounts."""
    swag = create_swag_from_ctx(ctx)
    for k, v in json.loads(data.read()).items():
        for account in v['accounts']:
            data = {
                    'description': 'This is an AWS owned account used for {}'.format(k),
                    'id': account['account_id'],
                    'contacts': [],
                    'owner': 'aws',
                    'provider': 'aws',
                    'sensitive': False,
                    'email': 'support@amazon.com',
                    'name': k + '-' + account['region']
                }

            click.echo(click.style(
                'Seeded Account. AccountName: {}'.format(data['name']), fg='green')
            )

            swag.create(data, dry_run=ctx.dry_run)
def seed_aws_data ( ctx , data ) : swag = create_swag_from_ctx ( ctx ) for k , v in json . loads ( data . read ( ) ) . items ( ) : for account in v [ 'accounts' ] : data = { 'description' : 'This is an AWS owned account used for {}' . format ( k ) , 'id' : account [ 'account_id' ] , 'contacts' : [ ] , 'owner' : 'aws' , 'provider' : 'aws' , 'sensitive' : False , 'email' : 'support@amazon.com' , 'name' : k + '-' + account [ 'region' ] } click . echo ( click . style ( 'Seeded Account. AccountName: {}' . format ( data [ 'name' ] ) , fg = 'green' ) ) swag . create ( data , dry_run = ctx . dry_run )
Seeds SWAG from a list of known AWS accounts.