# Path: aodh/keystone_client.py
# CFG_GROUP = "service_credentials"
# OPTS = [
#     cfg.StrOpt('region-name',
#                default=os.environ.get('OS_REGION_NAME'),
#                deprecated_name="os-region-name",
#                help='Region name to use for OpenStack service endpoints.'),
#     cfg.StrOpt('interface',
#                default=os.environ.get(
#                    'OS_INTERFACE', os.environ.get('OS_ENDPOINT_TYPE',
#                                                   'public')),
#                deprecated_name="os-endpoint-type",
#                choices=('public', 'internal', 'admin', 'auth', 'publicURL',
#                         'internalURL', 'adminURL'),
#                help='Type of endpoint in Identity service catalog to use for '
#                     'communication with OpenStack services.'),
# ]
# def get_session(conf):
# def get_client(conf):
# def get_trusted_client(conf, trust_id):
# def get_auth_token(client):
# def get_client_on_behalf_user(conf, auth_plugin):
# def create_trust_id(conf, trustor_user_id, trustor_project_id, roles,
#                     auth_plugin):
# def delete_trust_id(conf, trust_id, auth_plugin):
# def url_for(conf, **kwargs):
# def get_heat_client_from_trust(conf, trust_id):
# def register_keystoneauth_opts(conf):
# 
# Path: aodh/notifier/rest.py
# LOG = log.getLogger(__name__)
# OPTS = [
#     cfg.StrOpt('rest_notifier_certificate_file',
#                default='',
#                help='SSL Client certificate file for REST notifier.'
#                ),
#     cfg.StrOpt('rest_notifier_certificate_key',
#                default='',
#                help='SSL Client private key file for REST notifier.'
#                ),
#     cfg.StrOpt('rest_notifier_ca_bundle_certificate_path',
#                help='SSL CA_BUNDLE certificate for REST notifier',
#                ),
#     cfg.BoolOpt('rest_notifier_ssl_verify',
#                 default=True,
#                 help='Whether to verify the SSL Server certificate when '
#                 'calling alarm action.'
#                 ),
#     cfg.IntOpt('rest_notifier_max_retries',
#                default=0,
#                help='Number of retries for REST notifier',
#                ),
# 
# ]
# class RestAlarmNotifier(notifier.AlarmNotifier):
#     def __init__(self, conf):
#     def notify(self, action, alarm_id, alarm_name, severity, previous,
#                current, reason, reason_data, headers=None):


from urllib import parse
from aodh import keystone_client
from aodh.notifier import rest
# Copyright 2014 eNovance
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# 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.
"""Rest alarm notifier with trusted authentication."""




class TrustAlarmNotifierMixin(object):
    """Mixin class to add Keystone trust support to an AlarmNotifier.

    Provides a notify() method that interprets the trust ID and then calls
    the parent class's notify(), passing the necessary authentication data in
    the headers.
    """

    def notify(self, action, alarm_id, alarm_name, severity, previous, current,
               reason, reason_data):
        trust_id = action.username


# Path: aodh/keystone_client.py
# CFG_GROUP = "service_credentials"
# OPTS = [
#     cfg.StrOpt('region-name',
#                default=os.environ.get('OS_REGION_NAME'),
#                deprecated_name="os-region-name",
#                help='Region name to use for OpenStack service endpoints.'),
#     cfg.StrOpt('interface',
#                default=os.environ.get(
#                    'OS_INTERFACE', os.environ.get('OS_ENDPOINT_TYPE',
#                                                   'public')),
#                deprecated_name="os-endpoint-type",
#                choices=('public', 'internal', 'admin', 'auth', 'publicURL',
#                         'internalURL', 'adminURL'),
#                help='Type of endpoint in Identity service catalog to use for '
#                     'communication with OpenStack services.'),
# ]
# def get_session(conf):
# def get_client(conf):
# def get_trusted_client(conf, trust_id):
# def get_auth_token(client):
# def get_client_on_behalf_user(conf, auth_plugin):
# def create_trust_id(conf, trustor_user_id, trustor_project_id, roles,
#                     auth_plugin):
# def delete_trust_id(conf, trust_id, auth_plugin):
# def url_for(conf, **kwargs):
# def get_heat_client_from_trust(conf, trust_id):
# def register_keystoneauth_opts(conf):
# 
# Path: aodh/notifier/rest.py
# LOG = log.getLogger(__name__)
# OPTS = [
#     cfg.StrOpt('rest_notifier_certificate_file',
#                default='',
#                help='SSL Client certificate file for REST notifier.'
#                ),
#     cfg.StrOpt('rest_notifier_certificate_key',
#                default='',
#                help='SSL Client private key file for REST notifier.'
#                ),
#     cfg.StrOpt('rest_notifier_ca_bundle_certificate_path',
#                help='SSL CA_BUNDLE certificate for REST notifier',
#                ),
#     cfg.BoolOpt('rest_notifier_ssl_verify',
#                 default=True,
#                 help='Whether to verify the SSL Server certificate when '
#                 'calling alarm action.'
#                 ),
#     cfg.IntOpt('rest_notifier_max_retries',
#                default=0,
#                help='Number of retries for REST notifier',
#                ),
# 
# ]
# class RestAlarmNotifier(notifier.AlarmNotifier):
#     def __init__(self, conf):
#     def notify(self, action, alarm_id, alarm_name, severity, previous,
#                current, reason, reason_data, headers=None):


# Path: aodh/notifier/trust.py
from urllib import parse
from aodh import keystone_client
from aodh.notifier import rest

# Copyright 2014 eNovance
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# 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.
"""Rest alarm notifier with trusted authentication."""




class TrustAlarmNotifierMixin(object):
    """Mixin class to add Keystone trust support to an AlarmNotifier.

    Provides a notify() method that interprets the trust ID and then calls
    the parent class's notify(), passing the necessary authentication data in
    the headers.
    """

    def notify(self, action, alarm_id, alarm_name, severity, previous, current,
               reason, reason_data):
        trust_id = action.username


        client = keystone_client.get_trusted_client(self.conf, trust_id)