# Path: monasca_api/v2/reference/helpers.py
# LOG = log.getLogger(__name__)
# CONF = conf.CONF
# def from_json(req):
# def to_json(data):
# def validate_json_content_type(req):
# def validate_authorization(http_request, authorized_rules_list):
# def validate_payload_size(content_length):
# def get_x_tenant_or_tenant_id(http_request, delegate_authorized_rules_list):
# def get_query_param(req, param_name, required=False, default_val=None):
# def get_query_name(req, name_required=False):
# def get_query_dimensions(req, param_key='dimensions'):
# def get_query_starttime_timestamp(req, required=True):
# def get_query_endtime_timestamp(req, required=True):
# def validate_start_end_timestamps(start_timestamp, end_timestamp=None):
# def _convert_time_string(date_time_string):
# def get_query_statistics(req):
# def get_query_period(req):
# def get_query_group_by(req):
# def validate_query_name(name):
# def validate_query_dimensions(dimensions):
# def paginate(resource, uri, limit):
# def paginate_with_no_id(dictionary_list, uri, offset, limit):
# def _truncate_with_offset(resource, value_list, offset):
# def paginate_alarming(resource, uri, limit):
# def paginate_dimension_values(dimvals, uri, offset, limit):
# def _truncate_dimension_values(values, limit, offset):
# def paginate_measurements(measurements, uri, limit):
# def _get_old_query_params(parsed_uri):
# def _get_old_query_params_except_offset(new_query_params, parsed_uri):
# def paginate_statistics(statistics, uri, limit):
# def create_alarms_count_next_link(uri, offset, limit):
# def build_base_uri(parsed_uri):
# def get_link(uri, resource_id, rel='self'):
# def add_links_to_resource(resource, uri, rel='self'):
# def add_links_to_resource_list(resourcelist, uri):
# def raise_not_found_exception(resource_name, resource_id, tenant_id):
# def str_2_bool(s):


from oslo_utils import encodeutils
from monasca_api.v2.reference import helpers
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class Version2(object):
    def __init__(self):
        super(Version2, self).__init__()

    def on_get(self, req, res):
        helpers.validate_authorization(req,
                                       ['api:versions'])
        result = {
            'id': 'v2.0',
            'links': [{
                'rel': 'self',
                'href': encodeutils.safe_decode(req.uri, 'utf-8')
            }],
            'status': 'CURRENT',
            'updated': "2013-03-06T00:00:00.000Z"
        }

# Path: monasca_api/v2/reference/helpers.py
# LOG = log.getLogger(__name__)
# CONF = conf.CONF
# def from_json(req):
# def to_json(data):
# def validate_json_content_type(req):
# def validate_authorization(http_request, authorized_rules_list):
# def validate_payload_size(content_length):
# def get_x_tenant_or_tenant_id(http_request, delegate_authorized_rules_list):
# def get_query_param(req, param_name, required=False, default_val=None):
# def get_query_name(req, name_required=False):
# def get_query_dimensions(req, param_key='dimensions'):
# def get_query_starttime_timestamp(req, required=True):
# def get_query_endtime_timestamp(req, required=True):
# def validate_start_end_timestamps(start_timestamp, end_timestamp=None):
# def _convert_time_string(date_time_string):
# def get_query_statistics(req):
# def get_query_period(req):
# def get_query_group_by(req):
# def validate_query_name(name):
# def validate_query_dimensions(dimensions):
# def paginate(resource, uri, limit):
# def paginate_with_no_id(dictionary_list, uri, offset, limit):
# def _truncate_with_offset(resource, value_list, offset):
# def paginate_alarming(resource, uri, limit):
# def paginate_dimension_values(dimvals, uri, offset, limit):
# def _truncate_dimension_values(values, limit, offset):
# def paginate_measurements(measurements, uri, limit):
# def _get_old_query_params(parsed_uri):
# def _get_old_query_params_except_offset(new_query_params, parsed_uri):
# def paginate_statistics(statistics, uri, limit):
# def create_alarms_count_next_link(uri, offset, limit):
# def build_base_uri(parsed_uri):
# def get_link(uri, resource_id, rel='self'):
# def add_links_to_resource(resource, uri, rel='self'):
# def add_links_to_resource_list(resourcelist, uri):
# def raise_not_found_exception(resource_name, resource_id, tenant_id):
# def str_2_bool(s):


# Path: monasca_api/v2/reference/version_2_0.py
from oslo_utils import encodeutils
from monasca_api.v2.reference import helpers

# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class Version2(object):
    def __init__(self):
        super(Version2, self).__init__()

    def on_get(self, req, res):
        helpers.validate_authorization(req,
                                       ['api:versions'])
        result = {
            'id': 'v2.0',
            'links': [{
                'rel': 'self',
                'href': encodeutils.safe_decode(req.uri, 'utf-8')
            }],
            'status': 'CURRENT',
            'updated': "2013-03-06T00:00:00.000Z"
        }

        res.body = helpers.to_json(result)