io.cloudshiftdev.awscdk.services.route53.ARecord.kt Maven / Gradle / Ivy
The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")
package io.cloudshiftdev.awscdk.services.route53
import io.cloudshiftdev.awscdk.Duration
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import kotlin.Boolean
import kotlin.Number
import kotlin.String
import kotlin.Unit
import kotlin.jvm.JvmName
import io.cloudshiftdev.constructs.Construct as CloudshiftdevConstructsConstruct
import software.constructs.Construct as SoftwareConstructsConstruct
/**
* A DNS A record.
*
* Example:
*
* ```
* import io.cloudshiftdev.awscdk.services.apigateway.*;
* HostedZone zone;
* LambdaRestApi restApi;
* ARecord.Builder.create(this, "AliasRecord")
* .zone(zone)
* .target(RecordTarget.fromAlias(new ApiGateway(restApi)))
* .build();
* ```
*/
public open class ARecord(
cdkObject: software.amazon.awscdk.services.route53.ARecord,
) : RecordSet(cdkObject) {
public constructor(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: ARecordProps,
) :
this(software.amazon.awscdk.services.route53.ARecord(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
id, props.let(ARecordProps.Companion::unwrap))
)
public constructor(
scope: CloudshiftdevConstructsConstruct,
id: String,
props: ARecordProps.Builder.() -> Unit,
) : this(scope, id, ARecordProps(props)
)
/**
* A fluent builder for [io.cloudshiftdev.awscdk.services.route53.ARecord].
*/
@CdkDslMarker
public interface Builder {
/**
* A comment to add on the record.
*
* Default: no comment
*
* @param comment A comment to add on the record.
*/
public fun comment(comment: String)
/**
* Whether to delete the same record set in the hosted zone if it already exists (dangerous!).
*
* This allows to deploy a new record set while minimizing the downtime because the
* new record set will be created immediately after the existing one is deleted. It
* also avoids "manual" actions to delete existing record sets.
*
*
* **N.B.:** this feature is dangerous, use with caution! It can only be used safely when
* `deleteExisting` is set to `true` as soon as the resource is added to the stack. Changing
* an existing Record Set's `deleteExisting` property from `false -> true` after deployment
* will delete the record!
*
*
* Default: false
*
* @param deleteExisting Whether to delete the same record set in the hosted zone if it already
* exists (dangerous!).
*/
public fun deleteExisting(deleteExisting: Boolean)
/**
* The geographical origin for this record to return DNS records based on the user's location.
*
* @param geoLocation The geographical origin for this record to return DNS records based on the
* user's location.
*/
public fun geoLocation(geoLocation: GeoLocation)
/**
* A string used to distinguish between different records with the same combination of DNS name
* and type.
*
* It can only be set when either weight or geoLocation is defined.
*
* This parameter must be between 1 and 128 characters in length.
*
* Default: - Auto generated string
*
* @param setIdentifier A string used to distinguish between different records with the same
* combination of DNS name and type.
*/
public fun identifier(setIdentifier: String)
/**
* Whether to return multiple values, such as IP addresses for your web servers, in response to
* DNS queries.
*
* Default: false
*
* @param multiValueAnswer Whether to return multiple values, such as IP addresses for your web
* servers, in response to DNS queries.
*/
public fun multiValueAnswer(multiValueAnswer: Boolean)
/**
* The subdomain name for this record. This should be relative to the zone root name.
*
* For example, if you want to create a record for acme.example.com, specify
* "acme".
*
* You can also specify the fully qualified domain name which terminates with a
* ".". For example, "acme.example.com.".
*
* Default: zone root
*
* @param recordName The subdomain name for this record. This should be relative to the zone
* root name.
*/
public fun recordName(recordName: String)
/**
* The Amazon EC2 Region where you created the resource that this resource record set refers to.
*
* The resource typically is an AWS resource, such as an EC2 instance or an ELB load balancer,
* and is referred to by an IP address or a DNS domain name, depending on the record type.
*
* When Amazon Route 53 receives a DNS query for a domain name and type for which you have
* created latency resource record sets,
* Route 53 selects the latency resource record set that has the lowest latency between the end
* user and the associated Amazon EC2 Region.
* Route 53 then returns the value that is associated with the selected resource record set.
*
* Default: - Do not set latency based routing
*
* [Documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-recordset.html#cfn-route53-recordset-region)
* @param region The Amazon EC2 Region where you created the resource that this resource record
* set refers to.
*/
public fun region(region: String)
/**
* The target.
*
* @param target The target.
*/
public fun target(target: RecordTarget)
/**
* The resource record cache time to live (TTL).
*
* Default: Duration.minutes(30)
*
* @param ttl The resource record cache time to live (TTL).
*/
public fun ttl(ttl: Duration)
/**
* Among resource record sets that have the same combination of DNS name and type, a value that
* determines the proportion of DNS queries that Amazon Route 53 responds to using the current
* resource record set.
*
* Route 53 calculates the sum of the weights for the resource record sets that have the same
* combination of DNS name and type.
* Route 53 then responds to queries based on the ratio of a resource's weight to the total.
*
* This value can be a number between 0 and 255.
*
* Default: - Do not set weighted routing
*
* [Documentation](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy-weighted.html)
* @param weight Among resource record sets that have the same combination of DNS name and type,
* a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the
* current resource record set.
*/
public fun weight(weight: Number)
/**
* The hosted zone in which to define the new record.
*
* @param zone The hosted zone in which to define the new record.
*/
public fun zone(zone: IHostedZone)
}
private class BuilderImpl(
scope: SoftwareConstructsConstruct,
id: String,
) : Builder {
private val cdkBuilder: software.amazon.awscdk.services.route53.ARecord.Builder =
software.amazon.awscdk.services.route53.ARecord.Builder.create(scope, id)
/**
* A comment to add on the record.
*
* Default: no comment
*
* @param comment A comment to add on the record.
*/
override fun comment(comment: String) {
cdkBuilder.comment(comment)
}
/**
* Whether to delete the same record set in the hosted zone if it already exists (dangerous!).
*
* This allows to deploy a new record set while minimizing the downtime because the
* new record set will be created immediately after the existing one is deleted. It
* also avoids "manual" actions to delete existing record sets.
*
*
* **N.B.:** this feature is dangerous, use with caution! It can only be used safely when
* `deleteExisting` is set to `true` as soon as the resource is added to the stack. Changing
* an existing Record Set's `deleteExisting` property from `false -> true` after deployment
* will delete the record!
*
*
* Default: false
*
* @param deleteExisting Whether to delete the same record set in the hosted zone if it already
* exists (dangerous!).
*/
override fun deleteExisting(deleteExisting: Boolean) {
cdkBuilder.deleteExisting(deleteExisting)
}
/**
* The geographical origin for this record to return DNS records based on the user's location.
*
* @param geoLocation The geographical origin for this record to return DNS records based on the
* user's location.
*/
override fun geoLocation(geoLocation: GeoLocation) {
cdkBuilder.geoLocation(geoLocation.let(GeoLocation.Companion::unwrap))
}
/**
* A string used to distinguish between different records with the same combination of DNS name
* and type.
*
* It can only be set when either weight or geoLocation is defined.
*
* This parameter must be between 1 and 128 characters in length.
*
* Default: - Auto generated string
*
* @param setIdentifier A string used to distinguish between different records with the same
* combination of DNS name and type.
*/
override fun identifier(setIdentifier: String) {
cdkBuilder.setIdentifier(setIdentifier)
}
/**
* Whether to return multiple values, such as IP addresses for your web servers, in response to
* DNS queries.
*
* Default: false
*
* @param multiValueAnswer Whether to return multiple values, such as IP addresses for your web
* servers, in response to DNS queries.
*/
override fun multiValueAnswer(multiValueAnswer: Boolean) {
cdkBuilder.multiValueAnswer(multiValueAnswer)
}
/**
* The subdomain name for this record. This should be relative to the zone root name.
*
* For example, if you want to create a record for acme.example.com, specify
* "acme".
*
* You can also specify the fully qualified domain name which terminates with a
* ".". For example, "acme.example.com.".
*
* Default: zone root
*
* @param recordName The subdomain name for this record. This should be relative to the zone
* root name.
*/
override fun recordName(recordName: String) {
cdkBuilder.recordName(recordName)
}
/**
* The Amazon EC2 Region where you created the resource that this resource record set refers to.
*
* The resource typically is an AWS resource, such as an EC2 instance or an ELB load balancer,
* and is referred to by an IP address or a DNS domain name, depending on the record type.
*
* When Amazon Route 53 receives a DNS query for a domain name and type for which you have
* created latency resource record sets,
* Route 53 selects the latency resource record set that has the lowest latency between the end
* user and the associated Amazon EC2 Region.
* Route 53 then returns the value that is associated with the selected resource record set.
*
* Default: - Do not set latency based routing
*
* [Documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-recordset.html#cfn-route53-recordset-region)
* @param region The Amazon EC2 Region where you created the resource that this resource record
* set refers to.
*/
override fun region(region: String) {
cdkBuilder.region(region)
}
/**
* The target.
*
* @param target The target.
*/
override fun target(target: RecordTarget) {
cdkBuilder.target(target.let(RecordTarget.Companion::unwrap))
}
/**
* The resource record cache time to live (TTL).
*
* Default: Duration.minutes(30)
*
* @param ttl The resource record cache time to live (TTL).
*/
override fun ttl(ttl: Duration) {
cdkBuilder.ttl(ttl.let(Duration.Companion::unwrap))
}
/**
* Among resource record sets that have the same combination of DNS name and type, a value that
* determines the proportion of DNS queries that Amazon Route 53 responds to using the current
* resource record set.
*
* Route 53 calculates the sum of the weights for the resource record sets that have the same
* combination of DNS name and type.
* Route 53 then responds to queries based on the ratio of a resource's weight to the total.
*
* This value can be a number between 0 and 255.
*
* Default: - Do not set weighted routing
*
* [Documentation](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy-weighted.html)
* @param weight Among resource record sets that have the same combination of DNS name and type,
* a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the
* current resource record set.
*/
override fun weight(weight: Number) {
cdkBuilder.weight(weight)
}
/**
* The hosted zone in which to define the new record.
*
* @param zone The hosted zone in which to define the new record.
*/
override fun zone(zone: IHostedZone) {
cdkBuilder.zone(zone.let(IHostedZone.Companion::unwrap))
}
public fun build(): software.amazon.awscdk.services.route53.ARecord = cdkBuilder.build()
}
public companion object {
public fun fromARecordAttributes(
scope: CloudshiftdevConstructsConstruct,
id: String,
attrs: ARecordAttrs,
): ARecord =
software.amazon.awscdk.services.route53.ARecord.fromARecordAttributes(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
id, attrs.let(ARecordAttrs.Companion::unwrap)).let(ARecord::wrap)
@kotlin.Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("dfb74397583ea19fd99b28a04f32e76433a9ff9f1c6ae13b61258264ce797208")
public fun fromARecordAttributes(
scope: CloudshiftdevConstructsConstruct,
id: String,
attrs: ARecordAttrs.Builder.() -> Unit,
): ARecord = fromARecordAttributes(scope, id, ARecordAttrs(attrs))
public operator fun invoke(
scope: CloudshiftdevConstructsConstruct,
id: String,
block: Builder.() -> Unit = {},
): ARecord {
val builderImpl = BuilderImpl(CloudshiftdevConstructsConstruct.unwrap(scope), id)
return ARecord(builderImpl.apply(block).build())
}
internal fun wrap(cdkObject: software.amazon.awscdk.services.route53.ARecord): ARecord =
ARecord(cdkObject)
internal fun unwrap(wrapped: ARecord): software.amazon.awscdk.services.route53.ARecord =
wrapped.cdkObject as software.amazon.awscdk.services.route53.ARecord
}
}