# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
#    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.

from oslo_config import cfg


service_option = [cfg.BoolOpt('ceilometer',
                              default=True,
                              help="Whether or not Ceilometer is expected to"
                                   "be available"),
                  cfg.BoolOpt('panko',
                              default=True,
                              help="Whether or not Panko is expected to be"
                                   "available"),
                  cfg.BoolOpt("aodh",
                              default=True,
                              help="Whether or not Aodh is expected to be"
                                   "available",
                              deprecated_opts=[cfg.DeprecatedOpt(
                                  'aodh_plugin',
                                  group='service_available')]),
                  cfg.BoolOpt('gnocchi',
                              default=True,
                              help="Whether or not Gnocchi is expected to be"
                                   "available")]

telemetry_group = cfg.OptGroup(name='telemetry',
                               title='Telemetry Service Options')

event_group = cfg.OptGroup(name='event',
                           title='Event Service Options')

alarming_group = cfg.OptGroup(name='alarming_plugin',
                              title='Alarming Service Options')

metric_group = cfg.OptGroup(name='metric',
                            title='Metric Service Options')

TelemetryGroup = [
    cfg.IntOpt('notification_wait',
               default=120,
               help="The seconds to wait for notifications which "
                    "containers and objects sent to swift."),
    cfg.IntOpt('notification_sleep',
               default=1,
               help="The seconds to sleep after an unsuccessful "
                    "notification received."),
    cfg.IntOpt('alarm_granularity',
               default=300,
               help="Granularity to use for aodh alarms. This must match the "
                    "configured Gnocchi archive policy"),
    cfg.StrOpt('alarm_metric_name',
               default="cpu",
               help="Name of the metric to create an alarm on."),
    cfg.StrOpt('alarm_aggregation_method',
               default="rate:mean",
               help="Aggregation method to use for alarm."),
    cfg.IntOpt('alarm_threshold',
               default=10,
               help="Threshold to cross for the alarm to trigger."),
]

event_opts = [
    cfg.StrOpt('catalog_type',
               default='event',
               help="Catalog type of the Event service."),
    cfg.StrOpt('endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for the event service."),
]

AlarmingGroup = [
    cfg.StrOpt('catalog_type',
               default='alarming',
               help="Catalog type of the Alarming service."),
    cfg.StrOpt('endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for the alarming service."),
    cfg.BoolOpt('create_alarms',
                default=True,
                help="If create alarms dynamically before testing."),
]

metric_opts = [
    cfg.StrOpt('catalog_type',
               default='metric',
               help="Catalog type of the Metric service."),
    cfg.StrOpt('endpoint_type',
               default='publicURL',
               choices=['public', 'admin', 'internal',
                        'publicURL', 'adminURL', 'internalURL'],
               help="The endpoint type to use for the metric service."),
]
