# Copyright (c) 2012-2017, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.

from . import AWSObject, AWSProperty


class Instance(AWSObject):
    resource_type = "AWS::ServiceDiscovery::Instance"

    props = {
        'InstanceAttributes': (dict, True),
        'InstanceId': (basestring, False),
        'ServiceId': (basestring, True),
    }


class PrivateDnsNamespace(AWSObject):
    resource_type = "AWS::ServiceDiscovery::PrivateDnsNamespace"

    props = {
        'Description': (basestring, False),
        'Name': (basestring, True),
        'Vpc': (basestring, True),
    }


class PublicDnsNamespace(AWSObject):
    resource_type = "AWS::ServiceDiscovery::PublicDnsNamespace"

    props = {
        'Description': (basestring, False),
        'Name': (basestring, True),
    }


class HealthCheckConfig(AWSProperty):
    props = {
        'FailureThreshold': (float, False),
        'ResourcePath': (basestring, False),
        'Type': (basestring, True),
    }


class HealthCheckCustomConfig(AWSProperty):
    props = {
        'FailureThreshold': (float, True)
    }


class DnsRecord(AWSProperty):
    props = {
        'TTL': (basestring, True),
        'Type': (basestring, True),
    }


class DnsConfig(AWSProperty):
    props = {
        'DnsRecords': ([DnsRecord], True),
        'NamespaceId': (basestring, True),
    }


class Service(AWSObject):
    resource_type = "AWS::ServiceDiscovery::Service"

    props = {
        'Description': (basestring, False),
        'DnsConfig': (DnsConfig, True),
        'HealthCheckConfig': (HealthCheckConfig, False),
        'HealthCheckCustomConfig': (HealthCheckCustomConfig, False),
        'Name': (basestring, False),
    }

@@ -1363,32 +1363,78 @@
 estring, True),%0A
+        'RoutingPolicy': (basestring, False),%0A
     %7D%0A%0A%0Aclass Se
@@ -1750,30 +1750,268 @@
 ': (basestring, False),%0A
+        'NamespaceId': (basestring, False),%0A    %7D%0A%0A%0Aclass HttpNamespace(AWSObject):%0A    resource_type = %22AWS::ServiceDiscovery::HttpNamespace%22%0A%0A    props = %7B%0A        'Description': (basestring, False),%0A        'Name': (basestring, True),%0A
     %7D%0A

Add new HttpNamespace resource & various servicediscovery props, per Nov 28 2018 update (#1237)