diff --git a/_modules/gnocchiv1/__init__.py b/_modules/gnocchiv1/__init__.py
new file mode 100644
index 0000000..16edda5
--- /dev/null
+++ b/_modules/gnocchiv1/__init__.py
@@ -0,0 +1,33 @@
+try:
+    import os_client_config
+    from keystoneauth1 import exceptions as ka_exceptions
+    REQUIREMENTS_MET = True
+except ImportError:
+    REQUIREMENTS_MET = False
+
+from gnocchiv1 import archive_policy
+
+archive_policy_create = archive_policy.archive_policy_create
+archive_policy_delete = archive_policy.archive_policy_delete
+archive_policy_list = archive_policy.archive_policy_list
+archive_policy_update = archive_policy.archive_policy_update
+archive_policy_read = archive_policy.archive_policy_read
+
+archive_policy_rule_create = archive_policy.archive_policy_rule_create
+archive_policy_rule_delete = archive_policy.archive_policy_rule_delete
+archive_policy_rule_list = archive_policy.archive_policy_rule_list
+archive_policy_rule_read = archive_policy.archive_policy_rule_read
+
+__all__ = (
+    'archive_policy_update', 'archive_policy_create', 'archive_policy_list', 'archive_policy_delete',
+    'archive_policy_read', 'archive_policy_rule_create', 'archive_policy_rule_delete', 'archive_policy_rule_list',
+    'archive_policy_rule_read'
+)
+
+def __virtual__():
+    """Only load gnocchiv1 if requirements are available."""
+    if REQUIREMENTS_MET:
+        return 'gnocchiv1'
+    else:
+        return False, ("The gnocchiv1 execution module cannot be loaded: "
+                       "os_client_config or keystoneauth are unavailable.")
diff --git a/_modules/gnocchiv1/archive_policy.py b/_modules/gnocchiv1/archive_policy.py
new file mode 100644
index 0000000..b5d78a2
--- /dev/null
+++ b/_modules/gnocchiv1/archive_policy.py
@@ -0,0 +1,55 @@
+try:
+    from urllib.parse import urlencode
+except ImportError:
+    from urllib import urlencode
+import hashlib
+
+from gnocchiv1.common import send, get_raw_client
+
+@send('get')
+def archive_policy_list(**kwargs):
+    url = '/archive_policy?{}'.format(urlencode(kwargs))
+    return url, {}
+
+
+@send('post')
+def archive_policy_create(**kwargs):
+     url = '/archive_policy'
+     return url, {'json': kwargs}
+
+@send('get')
+def archive_policy_read(policy_name, **kwargs):
+    url = '/archive_policy/{}'.format(policy_name)
+    return url, {}
+
+
+@send('patch')
+def archive_policy_update(policy_name, **kwargs):
+    url = '/archive_policy/{}'.format(policy_name)
+    return url, {'json': kwargs}
+
+
+@send('delete')
+def archive_policy_delete(policy_name, **kwargs):
+     url = '/archive_policy/{}'.format(policy_name)
+     return url, {}
+
+@send('get')
+def archive_policy_rule_list(**kwargs):
+    url = '/archive_policy_rule?{}'.format(urlencode(kwargs))
+    return url, {}
+
+@send('post')
+def archive_policy_rule_create(**kwargs):
+     url = '/archive_policy_rule'
+     return url, {'json': kwargs}
+
+@send('get')
+def archive_policy_rule_read(rule_name, **kwargs):
+    url = '/archive_policy_rule/{}'.format(rule_name)
+    return url, {}
+
+@send('delete')
+def archive_policy_rule_delete(rule_name, **kwargs):
+     url = '/archive_policy_rule/{}'.format(rule_name)
+     return url, {}
diff --git a/_modules/gnocchiv1/common.py b/_modules/gnocchiv1/common.py
new file mode 100644
index 0000000..7364c2c
--- /dev/null
+++ b/_modules/gnocchiv1/common.py
@@ -0,0 +1,120 @@
+import logging
+import os_client_config
+from uuid import UUID
+
+log = logging.getLogger(__name__)
+
+
+class GnocchiException(Exception):
+
+    _msg = "Gnocchi module exception occured."
+
+    def __init__(self, message=None, **kwargs):
+        super(GnocchiException, self).__init__(message or self._msg)
+
+
+class NoGnocchiEndpoint(GnocchiException):
+    _msg = "Gnocchi endpoint not found in keystone catalog."
+
+
+class NoAuthPluginConfigured(GnocchiException):
+    _msg = ("You are using keystoneauth auth plugin that does not support "
+            "fetching endpoint list from token (noauth or admin_token).")
+
+
+class NoCredentials(GnocchiException):
+    _msg = "Please provide cloud name present in clouds.yaml."
+
+
+class ResourceNotFound(GnocchiException):
+    _msg = "Uniq resource: {resource} with name: {name} not found."
+
+    def __init__(self, resource, name, **kwargs):
+        super(GnocchiException, self).__init__(
+            self._msg.format(resource=resource, name=name))
+
+
+class MultipleResourcesFound(GnocchiException):
+    _msg = "Multiple resource: {resource} with name: {name} found."
+
+    def __init__(self, resource, name, **kwargs):
+        super(GnocchiException, self).__init__(
+            self._msg.format(resource=resource, name=name))
+
+
+def get_raw_client(cloud_name):
+    service_type = 'metric'
+    config = os_client_config.OpenStackConfig()
+    cloud = config.get_one_cloud(cloud_name)
+    adapter = cloud.get_session_client(service_type)
+    adapter.version = '1'
+    try:
+        access_info = adapter.session.auth.get_access(adapter.session)
+        endpoints = access_info.service_catalog.get_endpoints()
+    except (AttributeError, ValueError) as exc:
+        log.exception('%s' % exc)
+        e = NoAuthPluginConfigured()
+        log.exception('%s' % e)
+        raise e
+    if service_type not in endpoints:
+        if not service_type:
+            e = NoGnocchiEndpoint()
+            log.error('%s' % e)
+            raise e
+    return adapter
+
+
+def send(method):
+    def wrap(func):
+        def wrapped_f(*args, **kwargs):
+            cloud_name = kwargs.pop('cloud_name')
+            if not cloud_name:
+                e = NoCredentials()
+                log.error('%s' % e)
+                raise e
+            adapter = get_raw_client(cloud_name)
+            # Remove salt internal kwargs
+            kwarg_keys = list(kwargs.keys())
+            for k in kwarg_keys:
+                if k.startswith('__'):
+                    kwargs.pop(k)
+            url, request_kwargs = func(*args, **kwargs)
+            response = getattr(adapter, method)(url, **request_kwargs)
+            if not response.content:
+                return {}
+            return response.json()
+        return wrapped_f
+    return wrap
+
+
+def _check_uuid(val):
+    try:
+        return str(UUID(val)).replace('-', '') == val.replace('-', '')
+    except (TypeError, ValueError, AttributeError):
+        return False
+
+
+def get_by_name_or_uuid(resource_list, resp_key):
+    def wrap(func):
+        def wrapped_f(*args, **kwargs):
+            if 'name' in kwargs:
+                ref = kwargs.pop('name', None)
+                start_arg = 0
+            else:
+                start_arg = 1
+                ref = args[0]
+            if _check_uuid(ref):
+                uuid = ref
+            else:
+                # Then we have name not uuid
+                cloud_name = kwargs['cloud_name']
+                resp = resource_list(
+                    name=ref, cloud_name=cloud_name)[resp_key]
+                if len(resp) == 0:
+                    raise ResourceNotFound(resp_key, ref)
+                elif len(resp) > 1:
+                    raise MultipleResourcesFound(resp_key, ref)
+                uuid = resp[0]['id']
+            return func(uuid, *args[start_arg:], **kwargs)
+        return wrapped_f
+    return wrap
