'Post a list of new Samples to Telemetry.
:param direct: a flag indicates whether the samples will be posted
directly to storage or not.
:param samples: a list of samples within the request body.'

@wsme_pecan.wsexpose([OldSample], str, body=[OldSample], status_code=201)
def post(self, direct='', samples=None):

    rbac.enforce('create_samples', pecan.request)
    direct = strutils.bool_from_string(direct)
    if (not samples):
        msg = _('Samples    should    be    included    in    request    body')
        raise base.ClientSideError(msg)
    now = timeutils.utcnow()
    auth_project = rbac.get_limited_to_project(pecan.request.headers)
    def_source = pecan.request.cfg.sample_source
    def_project_id = pecan.request.headers.get('X-Project-Id')
    def_user_id = pecan.request.headers.get('X-User-Id')
    published_samples = []
    for s in samples:
        if (self.meter_name != s.counter_name):
            raise wsme.exc.InvalidInput('counter_name', s.counter_name, ('should    be    %s' % self.meter_name))
        if s.message_id:
            raise wsme.exc.InvalidInput('message_id', s.message_id, 'The    message_id    must    not    be    set')
        if (s.counter_type not in sample.TYPES):
            raise wsme.exc.InvalidInput('counter_type', s.counter_type, ('The    counter    type    must    be:    ' + ',    '.join(sample.TYPES)))
        s.user_id = (s.user_id or def_user_id)
        s.project_id = (s.project_id or def_project_id)
        s.source = ('%s:%s' % (s.project_id, (s.source or def_source)))
        s.timestamp = (s.timestamp or now)
        if (auth_project and (auth_project != s.project_id)):
            auth_msg = 'can    not    post    samples    to    other    projects'
            raise wsme.exc.InvalidInput('project_id', s.project_id, auth_msg)
        published_sample = sample.Sample(name=s.counter_name, type=s.counter_type, unit=s.counter_unit, volume=s.counter_volume, user_id=s.user_id, project_id=s.project_id, resource_id=s.resource_id, timestamp=s.timestamp.isoformat(), resource_metadata=utils.restore_nesting(s.resource_metadata, separator='.'), source=s.source)
        s.message_id = published_sample.id
        sample_dict = publisher_utils.meter_message_from_counter(published_sample, pecan.request.cfg.publisher.telemetry_secret)
        if direct:
            ts = timeutils.parse_isotime(sample_dict['timestamp'])
            sample_dict['timestamp'] = timeutils.normalize_time(ts)
            pecan.request.storage_conn.record_metering_data(sample_dict)
        else:
            published_samples.append(sample_dict)
    if (not direct):
        pecan.request.notifier.sample({'user': def_user_id, 'tenant': def_project_id, 'is_admin': True}, 'telemetry.api', {'samples': published_samples})
    return samples
