@utils.arg('<STR_LIT:name>', metavar='<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>@utils.arg('<STR_LIT>', metavar='<STR_LIT>',<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>action='<STR_LIT>')<EOL>@utils.arg('<STR_LIT>', metavar='<STR_LIT>',<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>action='<STR_LIT>')<EOL>@utils.arg('<STR_LIT>', metavar='<STR_LIT>',<EOL>default=time.time() * <NUM_LIT:1000>, type=int,<EOL>help='<STR_LIT>')<EOL>@utils.arg('<STR_LIT>', metavar='<STR_LIT>',<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>')<EOL>@utils.arg('<STR_LIT:value>', metavar='<STR_LIT>',<EOL>type=float,<EOL>help='<STR_LIT>')<EOL>def do_metric_create(mc, args):
fields = {}<EOL>fields['<STR_LIT:name>'] = args.name<EOL>if args.dimensions:<EOL><INDENT>fields['<STR_LIT>'] = utils.format_parameters(args.dimensions)<EOL><DEDENT>fields['<STR_LIT>'] = args.time<EOL>fields['<STR_LIT:value>'] = args.value<EOL>if args.value_meta:<EOL><INDENT>fields['<STR_LIT>'] = utils.format_parameters(args.value_meta)<EOL><DEDENT>if args.project_id:<EOL><INDENT>fields['<STR_LIT>'] = args.project_id<EOL><DEDENT>try:<EOL><INDENT>mc.metrics.create(**fields)<EOL><DEDENT>except (osc_exc.ClientException, k_exc.HttpError) as he:<EOL><INDENT>raise osc_exc.CommandError('<STR_LIT>' % (he.message, he.details))<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>
Create metric.