Class: AWSCDK::ServiceDiscovery::ServiceProps

Inherits:
DNSServiceProps
  • Object
show all
Defined in:
service_discovery/service_props.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(custom_health_check: nil, description: nil, health_check: nil, name: nil, discovery_type: nil, dns_record_type: nil, dns_ttl: nil, load_balancer: nil, routing_policy: nil, namespace:) ⇒ ServiceProps

Returns a new instance of ServiceProps.

Parameters:

  • custom_health_check (AWSCDK::ServiceDiscovery::HealthCheckCustomConfig, nil) (defaults to: nil)

    Structure containing failure threshold for a custom health checker.

  • description (String, nil) (defaults to: nil)

    A description of the service.

  • health_check (AWSCDK::ServiceDiscovery::HealthCheckConfig, nil) (defaults to: nil)

    Settings for an optional health check.

  • name (String, nil) (defaults to: nil)

    A name for the Service.

  • discovery_type (AWSCDK::ServiceDiscovery::DiscoveryType, nil) (defaults to: nil)

    Controls how instances within this service can be discovered.

  • dns_record_type (AWSCDK::ServiceDiscovery::DNSRecordType, nil) (defaults to: nil)

    The DNS type of the record that you want AWS Cloud Map to create.

  • dns_ttl (AWSCDK::Duration, nil) (defaults to: nil)

    The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.

  • load_balancer (Boolean, nil) (defaults to: nil)

    Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance.

  • routing_policy (AWSCDK::ServiceDiscovery::RoutingPolicy, nil) (defaults to: nil)

    The routing policy that you want to apply to all DNS records that AWS Cloud Map creates when you register an instance and specify this service.

  • namespace (AWSCDK::ServiceDiscovery::INamespace)

    The namespace that you want to use for DNS configuration.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'service_discovery/service_props.rb', line 16

def initialize(custom_health_check: nil, description: nil, health_check: nil, name: nil, discovery_type: nil, dns_record_type: nil, dns_ttl: nil, load_balancer: nil, routing_policy: nil, namespace:)
  @custom_health_check = custom_health_check.is_a?(Hash) ? ::AWSCDK::ServiceDiscovery::HealthCheckCustomConfig.new(**custom_health_check.transform_keys(&:to_sym)) : custom_health_check
  Jsii::Type.check_type(@custom_health_check, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5IZWFsdGhDaGVja0N1c3RvbUNvbmZpZyJ9")), "customHealthCheck") unless @custom_health_check.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @health_check = health_check.is_a?(Hash) ? ::AWSCDK::ServiceDiscovery::HealthCheckConfig.new(**health_check.transform_keys(&:to_sym)) : health_check
  Jsii::Type.check_type(@health_check, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5IZWFsdGhDaGVja0NvbmZpZyJ9")), "healthCheck") unless @health_check.nil?
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil?
  @discovery_type = discovery_type
  Jsii::Type.check_type(@discovery_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5EaXNjb3ZlcnlUeXBlIn0=")), "discoveryType") unless @discovery_type.nil?
  @dns_record_type = dns_record_type
  Jsii::Type.check_type(@dns_record_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5EbnNSZWNvcmRUeXBlIn0=")), "dnsRecordType") unless @dns_record_type.nil?
  @dns_ttl = dns_ttl
  Jsii::Type.check_type(@dns_ttl, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "dnsTtl") unless @dns_ttl.nil?
  @load_balancer = load_balancer
  Jsii::Type.check_type(@load_balancer, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "loadBalancer") unless @load_balancer.nil?
  @routing_policy = routing_policy
  Jsii::Type.check_type(@routing_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5Sb3V0aW5nUG9saWN5In0=")), "routingPolicy") unless @routing_policy.nil?
  @namespace = namespace
  Jsii::Type.check_type(@namespace, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VydmljZWRpc2NvdmVyeS5JTmFtZXNwYWNlIn0=")), "namespace")
end

Instance Attribute Details

#custom_health_checkAWSCDK::ServiceDiscovery::HealthCheckCustomConfig? (readonly)

Note:

Default: none

Structure containing failure threshold for a custom health checker.

Only one of healthCheckConfig or healthCheckCustomConfig can be specified. See: https://docs.aws.amazon.com/cloud-map/latest/api/API_HealthCheckCustomConfig.html



46
47
48
# File 'service_discovery/service_props.rb', line 46

def custom_health_check
  @custom_health_check
end

#descriptionString? (readonly)

Note:

Default: none

A description of the service.

Returns:

  • (String, nil)


51
52
53
# File 'service_discovery/service_props.rb', line 51

def description
  @description
end

#discovery_typeAWSCDK::ServiceDiscovery::DiscoveryType? (readonly)

Note:

Default: DNS_AND_API

Controls how instances within this service can be discovered.



71
72
73
# File 'service_discovery/service_props.rb', line 71

def discovery_type
  @discovery_type
end

#dns_record_typeAWSCDK::ServiceDiscovery::DNSRecordType? (readonly)

Note:

Default: A

The DNS type of the record that you want AWS Cloud Map to create.

Supported record types include A, AAAA, A and AAAA (A_AAAA), CNAME, and SRV.



79
80
81
# File 'service_discovery/service_props.rb', line 79

def dns_record_type
  @dns_record_type
end

#dns_ttlAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(1)

The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.

Returns:



84
85
86
# File 'service_discovery/service_props.rb', line 84

def dns_ttl
  @dns_ttl
end

#health_checkAWSCDK::ServiceDiscovery::HealthCheckConfig? (readonly)

Note:

Default: none

Settings for an optional health check.

If you specify health check settings, AWS Cloud Map associates the health check with the records that you specify in DnsConfig. Only one of healthCheckConfig or healthCheckCustomConfig can be specified. Not valid for PrivateDnsNamespaces. If you use healthCheck, you can only register IP instances to this service.



61
62
63
# File 'service_discovery/service_props.rb', line 61

def health_check
  @health_check
end

#load_balancerBoolean? (readonly)

Note:

Default: false

Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance.

Setting this to true correctly configures the routing_policy and performs some additional validation.

Returns:

  • (Boolean, nil)


92
93
94
# File 'service_discovery/service_props.rb', line 92

def load_balancer
  @load_balancer
end

#nameString? (readonly)

Note:

Default: CloudFormation-generated name

A name for the Service.

Returns:

  • (String, nil)


66
67
68
# File 'service_discovery/service_props.rb', line 66

def name
  @name
end

#namespaceAWSCDK::ServiceDiscovery::INamespace (readonly)

The namespace that you want to use for DNS configuration.



101
102
103
# File 'service_discovery/service_props.rb', line 101

def namespace
  @namespace
end

#routing_policyAWSCDK::ServiceDiscovery::RoutingPolicy? (readonly)

Note:

Default: WEIGHTED for CNAME records and when loadBalancer is true, MULTIVALUE otherwise

The routing policy that you want to apply to all DNS records that AWS Cloud Map creates when you register an instance and specify this service.



97
98
99
# File 'service_discovery/service_props.rb', line 97

def routing_policy
  @routing_policy
end

Class Method Details

.jsii_propertiesObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'service_discovery/service_props.rb', line 103

def self.jsii_properties
  {
    :custom_health_check => "customHealthCheck",
    :description => "description",
    :health_check => "healthCheck",
    :name => "name",
    :discovery_type => "discoveryType",
    :dns_record_type => "dnsRecordType",
    :dns_ttl => "dnsTtl",
    :load_balancer => "loadBalancer",
    :routing_policy => "routingPolicy",
    :namespace => "namespace",
  }
end

Instance Method Details

#to_jsiiObject



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'service_discovery/service_props.rb', line 118

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "customHealthCheck" => @custom_health_check,
    "description" => @description,
    "healthCheck" => @health_check,
    "name" => @name,
    "discoveryType" => @discovery_type,
    "dnsRecordType" => @dns_record_type,
    "dnsTtl" => @dns_ttl,
    "loadBalancer" => @load_balancer,
    "routingPolicy" => @routing_policy,
    "namespace" => @namespace,
  })
  result.compact
end