def do_dimension_value_list(mc, args):
    '''List names of metric dimensions.'''
    fields = {}
    fields['dimension_name'] = args.dimension_name
    if args.metric_name:
        fields['metric_name'] = args.metric_name
    if args.limit:
        fields['limit'] = args.limit
    if args.offset:
        fields['offset'] = args.offset
    if args.tenant_id:
        fields['tenant_id'] = args.tenant_id

    try:
        dimension_values = mc.metrics.list_dimension_values(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))

    if args.json:
        print(utils.json_formatter(dimension_values))
        return

    if isinstance(dimension_values, list):
        utils.print_list(dimension_values, ['Dimension Values'], formatters={
            'Dimension Values': lambda x: x['dimension_value']})
def do_dimension_value_list ( mc , args ) : fields = { } fields [ 'dimension_name' ] = args . dimension_name if args . metric_name : fields [ 'metric_name' ] = args . metric_name if args . limit : fields [ 'limit' ] = args . limit if args . offset : fields [ 'offset' ] = args . offset if args . tenant_id : fields [ 'tenant_id' ] = args . tenant_id try : dimension_values = mc . metrics . list_dimension_values ( ** fields ) except ( osc_exc . ClientException , k_exc . HttpError ) as he : raise osc_exc . CommandError ( '%s\n%s' % ( he . message , he . details ) ) if args . json : print ( utils . json_formatter ( dimension_values ) ) return if isinstance ( dimension_values , list ) : utils . print_list ( dimension_values , [ 'Dimension Values' ] , formatters = { 'Dimension Values' : lambda x : x [ 'dimension_value' ] } )
List names of metric dimensions.