How to use update_alias method in localstack

Best Python code snippet using localstack_python

create_index.py

Source:create_index.py Github

copy

Full Screen

...103 {"add": {"alias": f"{index_alias}", "index": f"{index_name}",}},104 ]105 }106 )107def clone_index_and_update_alias(index_name, index_to_clone, update_alias=False):108 """109 clone an index and if update_alias is True then update the alias to point to it (default is False)110 """111 date = datetime.today().strftime("%Y-%m-%d")112 exists = es.indices.exists(f"{index_name}-{date}")113 if not exists:114 es.indices.create(f"{index_name}-{date}")115 es.reindex(116 body={117 "source": {"index": f"{index_to_clone}"},118 "dest": {"index": f"{index_name}-{date}"},119 }120 )121 print(f"Cloned index {index_to_clone} to index {index_name}-{date}")...

Full Screen

Full Screen

cli.py

Source:cli.py Github

copy

Full Screen

...107 clone = args.clone108 return index_name, clone, update_alias109def clone_main(args):110 index_name, clone, update_alias = parse_args_clone(args)111 clone_index_and_update_alias(index_name, clone, update_alias=update_alias)112def _get_arg_parser_populate(parser):113 parser.add_argument(114 "-s",115 "--store",116 type=str,117 required=True,118 help="Name of local store to use to populate elasticsearch index, can be one of fix, character, analysis, fix-proposal",119 )120 parser.add_argument(121 "-i", "--index", type=str, required=True, help=f"Name of index to populate",122 )123 return parser124def parse_args_populate(args):125 store = args.store...

Full Screen

Full Screen

rollback.py

Source:rollback.py Github

copy

Full Screen

...11 return lambda_client.delete_function(12 FunctionName=env_vars['name'],13 Qualifier=version,14 )15def update_alias(version):16 print('Updating alias to point to version ' + version)17 return lambda_client.update_alias(18 Name=const['alias'],19 FunctionName=env_vars['name'],20 FunctionVersion=version,21 )22def get_latest_versions():23 versions = lambda_client.list_versions_by_function(24 FunctionName=env_vars['name'],25 )['Versions']26 versions = list(filter(lambda x: x['Version'] != '$LATEST', versions))27 versions.sort(key=lambda x: int(x['Version']), reverse=True)28 return (versions[0]['Version'], versions[1]['Version'])29if __name__ == "__main__":30 os.environ['AWS_DEFAULT_REGION'] = const['region']31 lambda_client = boto3.client('lambda')32 env_vars = env[argv[1]]33 cur, prev = get_latest_versions()34 update_alias(prev)35 delete_version(cur)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful