# Path: ec2stack/services.py
# USERS = UsersService()
# 
# Path: ec2stack/errors.py
# def invalid_snapshot_id():
# def invalid_image_id():
# def invalid_instance_id():
# def invalid_zone():
# def invalid_volume_id():
# def invalid_volume_attached():
# def invalid_volume_detached():
# def invalid_disk_offering_name():
# def invalid_service_offering_name():
# def invalid_keypair_name():
# def duplicate_keypair_name():
# def invalid_resource_id():
# def invalid_vpc_range():
# def invalid_vpc_id():
# def duplicate_security_group():
# def invalid_security_group():
# def invalid_permission():
# def invalid_request(message):
# def missing_parameter(parameter):
# def invalid_parameter_value(message):
# def apikey_not_found(apikey):
# def authentication_failure():


import os
import hmac
import hashlib
from uuid import uuid1 as uuid
from base64 import b64encode
from urllib import urlencode
from functools import wraps
from flask import request, make_response, render_template
from ec2stack.services import USERS
from ec2stack import errors
            'Unknown signature method.' % signature_method
        )


def _valid_signature_version():
    """
    Checks that the given signature version is correct.

    @raise Ec2stackError: if the signature version is invalid.
    """
    signature_version = get('SignatureVersion')
    if signature_version != '2':
        errors.invalid_parameter_value(
            'Value (%s) for parameter SignatureVersion is invalid.'
            'Valid Signature versions are 2.'
            % signature_version
        )


def _valid_signature():
    """
    Checks that the given signature matches the signature generated.

    @raise Ec2stackError: if the signature does not match the generated
                          signature.
    """
    signature = get('Signature')
    generated_signature = generate_signature()

    if signature != generated_signature:

# Path: ec2stack/services.py
# USERS = UsersService()
# 
# Path: ec2stack/errors.py
# def invalid_snapshot_id():
# def invalid_image_id():
# def invalid_instance_id():
# def invalid_zone():
# def invalid_volume_id():
# def invalid_volume_attached():
# def invalid_volume_detached():
# def invalid_disk_offering_name():
# def invalid_service_offering_name():
# def invalid_keypair_name():
# def duplicate_keypair_name():
# def invalid_resource_id():
# def invalid_vpc_range():
# def invalid_vpc_id():
# def duplicate_security_group():
# def invalid_security_group():
# def invalid_permission():
# def invalid_request(message):
# def missing_parameter(parameter):
# def invalid_parameter_value(message):
# def apikey_not_found(apikey):
# def authentication_failure():


# Path: ec2stack/helpers.py
import os
import hmac
import hashlib
from uuid import uuid1 as uuid
from base64 import b64encode
from urllib import urlencode
from functools import wraps
from flask import request, make_response, render_template
from ec2stack.services import USERS
from ec2stack import errors

            'Unknown signature method.' % signature_method
        )


def _valid_signature_version():
    """
    Checks that the given signature version is correct.

    @raise Ec2stackError: if the signature version is invalid.
    """
    signature_version = get('SignatureVersion')
    if signature_version != '2':
        errors.invalid_parameter_value(
            'Value (%s) for parameter SignatureVersion is invalid.'
            'Valid Signature versions are 2.'
            % signature_version
        )


def _valid_signature():
    """
    Checks that the given signature matches the signature generated.

    @raise Ec2stackError: if the signature does not match the generated
                          signature.
    """
    signature = get('Signature')
    generated_signature = generate_signature()

    if signature != generated_signature:

        errors.authentication_failure()