{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53.CreateHostedZone
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new public or private hosted zone. You create records in a
-- public hosted zone to define how you want to route traffic on the
-- internet for a domain, such as example.com, and its subdomains
-- (apex.example.com, acme.example.com). You create records in a private
-- hosted zone to define how you want to route traffic for a domain and its
-- subdomains within one or more Amazon Virtual Private Clouds (Amazon
-- VPCs).
--
-- You can\'t convert a public hosted zone to a private hosted zone or vice
-- versa. Instead, you must create a new hosted zone with the same name and
-- create new resource record sets.
--
-- For more information about charges for hosted zones, see
-- <http://aws.amazon.com/route53/pricing/ Amazon Route 53 Pricing>.
--
-- Note the following:
--
-- -   You can\'t create a hosted zone for a top-level domain (TLD) such as
--     .com.
--
-- -   For public hosted zones, Route 53 automatically creates a default
--     SOA record and four NS records for the zone. For more information
--     about SOA and NS records, see
--     <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html NS and SOA Records that Route 53 Creates for a Hosted Zone>
--     in the /Amazon Route 53 Developer Guide/.
--
--     If you want to use the same name servers for multiple public hosted
--     zones, you can optionally associate a reusable delegation set with
--     the hosted zone. See the @DelegationSetId@ element.
--
-- -   If your domain is registered with a registrar other than Route 53,
--     you must update the name servers with your registrar to make Route
--     53 the DNS service for the domain. For more information, see
--     <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html Migrating DNS Service for an Existing Domain to Amazon Route 53>
--     in the /Amazon Route 53 Developer Guide/.
--
-- When you submit a @CreateHostedZone@ request, the initial status of the
-- hosted zone is @PENDING@. For public hosted zones, this means that the
-- NS and SOA records are not yet available on all Route 53 DNS servers.
-- When the NS and SOA records are available, the status of the zone
-- changes to @INSYNC@.
--
-- The @CreateHostedZone@ request requires the caller to have an
-- @ec2:DescribeVpcs@ permission.
module Amazonka.Route53.CreateHostedZone
  ( -- * Creating a Request
    CreateHostedZone (..),
    newCreateHostedZone,

    -- * Request Lenses
    createHostedZone_delegationSetId,
    createHostedZone_vpc,
    createHostedZone_hostedZoneConfig,
    createHostedZone_name,
    createHostedZone_callerReference,

    -- * Destructuring the Response
    CreateHostedZoneResponse (..),
    newCreateHostedZoneResponse,

    -- * Response Lenses
    createHostedZoneResponse_vpc,
    createHostedZoneResponse_httpStatus,
    createHostedZoneResponse_hostedZone,
    createHostedZoneResponse_changeInfo,
    createHostedZoneResponse_delegationSet,
    createHostedZoneResponse_location,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53.Types

-- | A complex type that contains information about the request to create a
-- public or private hosted zone.
--
-- /See:/ 'newCreateHostedZone' smart constructor.
data CreateHostedZone = CreateHostedZone'
  { -- | If you want to associate a reusable delegation set with this hosted
    -- zone, the ID that Amazon Route 53 assigned to the reusable delegation
    -- set when you created it. For more information about reusable delegation
    -- sets, see
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateReusableDelegationSet.html CreateReusableDelegationSet>.
    CreateHostedZone -> Maybe ResourceId
delegationSetId :: Prelude.Maybe ResourceId,
    -- | (Private hosted zones only) A complex type that contains information
    -- about the Amazon VPC that you\'re associating with this hosted zone.
    --
    -- You can specify only one Amazon VPC when you create a private hosted
    -- zone. To associate additional Amazon VPCs with the hosted zone, use
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_AssociateVPCWithHostedZone.html AssociateVPCWithHostedZone>
    -- after you create a hosted zone.
    CreateHostedZone -> Maybe VPC
vpc :: Prelude.Maybe VPC,
    -- | (Optional) A complex type that contains the following optional values:
    --
    -- -   For public and private hosted zones, an optional comment
    --
    -- -   For private hosted zones, an optional @PrivateZone@ element
    --
    -- If you don\'t specify a comment or the @PrivateZone@ element, omit
    -- @HostedZoneConfig@ and the other elements.
    CreateHostedZone -> Maybe HostedZoneConfig
hostedZoneConfig :: Prelude.Maybe HostedZoneConfig,
    -- | The name of the domain. Specify a fully qualified domain name, for
    -- example, /www.example.com/. The trailing dot is optional; Amazon Route
    -- 53 assumes that the domain name is fully qualified. This means that
    -- Route 53 treats /www.example.com/ (without a trailing dot) and
    -- /www.example.com./ (with a trailing dot) as identical.
    --
    -- If you\'re creating a public hosted zone, this is the name you have
    -- registered with your DNS registrar. If your domain name is registered
    -- with a registrar other than Route 53, change the name servers for your
    -- domain to the set of @NameServers@ that @CreateHostedZone@ returns in
    -- @DelegationSet@.
    CreateHostedZone -> Text
name :: Prelude.Text,
    -- | A unique string that identifies the request and that allows failed
    -- @CreateHostedZone@ requests to be retried without the risk of executing
    -- the operation twice. You must use a unique @CallerReference@ string
    -- every time you submit a @CreateHostedZone@ request. @CallerReference@
    -- can be any unique string, for example, a date\/time stamp.
    CreateHostedZone -> Text
callerReference :: Prelude.Text
  }
  deriving (CreateHostedZone -> CreateHostedZone -> Bool
(CreateHostedZone -> CreateHostedZone -> Bool)
-> (CreateHostedZone -> CreateHostedZone -> Bool)
-> Eq CreateHostedZone
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHostedZone -> CreateHostedZone -> Bool
$c/= :: CreateHostedZone -> CreateHostedZone -> Bool
== :: CreateHostedZone -> CreateHostedZone -> Bool
$c== :: CreateHostedZone -> CreateHostedZone -> Bool
Prelude.Eq, ReadPrec [CreateHostedZone]
ReadPrec CreateHostedZone
Int -> ReadS CreateHostedZone
ReadS [CreateHostedZone]
(Int -> ReadS CreateHostedZone)
-> ReadS [CreateHostedZone]
-> ReadPrec CreateHostedZone
-> ReadPrec [CreateHostedZone]
-> Read CreateHostedZone
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHostedZone]
$creadListPrec :: ReadPrec [CreateHostedZone]
readPrec :: ReadPrec CreateHostedZone
$creadPrec :: ReadPrec CreateHostedZone
readList :: ReadS [CreateHostedZone]
$creadList :: ReadS [CreateHostedZone]
readsPrec :: Int -> ReadS CreateHostedZone
$creadsPrec :: Int -> ReadS CreateHostedZone
Prelude.Read, Int -> CreateHostedZone -> ShowS
[CreateHostedZone] -> ShowS
CreateHostedZone -> String
(Int -> CreateHostedZone -> ShowS)
-> (CreateHostedZone -> String)
-> ([CreateHostedZone] -> ShowS)
-> Show CreateHostedZone
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHostedZone] -> ShowS
$cshowList :: [CreateHostedZone] -> ShowS
show :: CreateHostedZone -> String
$cshow :: CreateHostedZone -> String
showsPrec :: Int -> CreateHostedZone -> ShowS
$cshowsPrec :: Int -> CreateHostedZone -> ShowS
Prelude.Show, (forall x. CreateHostedZone -> Rep CreateHostedZone x)
-> (forall x. Rep CreateHostedZone x -> CreateHostedZone)
-> Generic CreateHostedZone
forall x. Rep CreateHostedZone x -> CreateHostedZone
forall x. CreateHostedZone -> Rep CreateHostedZone x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHostedZone x -> CreateHostedZone
$cfrom :: forall x. CreateHostedZone -> Rep CreateHostedZone x
Prelude.Generic)

-- |
-- Create a value of 'CreateHostedZone' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'delegationSetId', 'createHostedZone_delegationSetId' - If you want to associate a reusable delegation set with this hosted
-- zone, the ID that Amazon Route 53 assigned to the reusable delegation
-- set when you created it. For more information about reusable delegation
-- sets, see
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateReusableDelegationSet.html CreateReusableDelegationSet>.
--
-- 'vpc', 'createHostedZone_vpc' - (Private hosted zones only) A complex type that contains information
-- about the Amazon VPC that you\'re associating with this hosted zone.
--
-- You can specify only one Amazon VPC when you create a private hosted
-- zone. To associate additional Amazon VPCs with the hosted zone, use
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_AssociateVPCWithHostedZone.html AssociateVPCWithHostedZone>
-- after you create a hosted zone.
--
-- 'hostedZoneConfig', 'createHostedZone_hostedZoneConfig' - (Optional) A complex type that contains the following optional values:
--
-- -   For public and private hosted zones, an optional comment
--
-- -   For private hosted zones, an optional @PrivateZone@ element
--
-- If you don\'t specify a comment or the @PrivateZone@ element, omit
-- @HostedZoneConfig@ and the other elements.
--
-- 'name', 'createHostedZone_name' - The name of the domain. Specify a fully qualified domain name, for
-- example, /www.example.com/. The trailing dot is optional; Amazon Route
-- 53 assumes that the domain name is fully qualified. This means that
-- Route 53 treats /www.example.com/ (without a trailing dot) and
-- /www.example.com./ (with a trailing dot) as identical.
--
-- If you\'re creating a public hosted zone, this is the name you have
-- registered with your DNS registrar. If your domain name is registered
-- with a registrar other than Route 53, change the name servers for your
-- domain to the set of @NameServers@ that @CreateHostedZone@ returns in
-- @DelegationSet@.
--
-- 'callerReference', 'createHostedZone_callerReference' - A unique string that identifies the request and that allows failed
-- @CreateHostedZone@ requests to be retried without the risk of executing
-- the operation twice. You must use a unique @CallerReference@ string
-- every time you submit a @CreateHostedZone@ request. @CallerReference@
-- can be any unique string, for example, a date\/time stamp.
newCreateHostedZone ::
  -- | 'name'
  Prelude.Text ->
  -- | 'callerReference'
  Prelude.Text ->
  CreateHostedZone
newCreateHostedZone :: Text -> Text -> CreateHostedZone
newCreateHostedZone Text
pName_ Text
pCallerReference_ =
  CreateHostedZone' :: Maybe ResourceId
-> Maybe VPC
-> Maybe HostedZoneConfig
-> Text
-> Text
-> CreateHostedZone
CreateHostedZone'
    { $sel:delegationSetId:CreateHostedZone' :: Maybe ResourceId
delegationSetId =
        Maybe ResourceId
forall a. Maybe a
Prelude.Nothing,
      $sel:vpc:CreateHostedZone' :: Maybe VPC
vpc = Maybe VPC
forall a. Maybe a
Prelude.Nothing,
      $sel:hostedZoneConfig:CreateHostedZone' :: Maybe HostedZoneConfig
hostedZoneConfig = Maybe HostedZoneConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateHostedZone' :: Text
name = Text
pName_,
      $sel:callerReference:CreateHostedZone' :: Text
callerReference = Text
pCallerReference_
    }

-- | If you want to associate a reusable delegation set with this hosted
-- zone, the ID that Amazon Route 53 assigned to the reusable delegation
-- set when you created it. For more information about reusable delegation
-- sets, see
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateReusableDelegationSet.html CreateReusableDelegationSet>.
createHostedZone_delegationSetId :: Lens.Lens' CreateHostedZone (Prelude.Maybe ResourceId)
createHostedZone_delegationSetId :: (Maybe ResourceId -> f (Maybe ResourceId))
-> CreateHostedZone -> f CreateHostedZone
createHostedZone_delegationSetId = (CreateHostedZone -> Maybe ResourceId)
-> (CreateHostedZone -> Maybe ResourceId -> CreateHostedZone)
-> Lens
     CreateHostedZone
     CreateHostedZone
     (Maybe ResourceId)
     (Maybe ResourceId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZone' {Maybe ResourceId
delegationSetId :: Maybe ResourceId
$sel:delegationSetId:CreateHostedZone' :: CreateHostedZone -> Maybe ResourceId
delegationSetId} -> Maybe ResourceId
delegationSetId) (\s :: CreateHostedZone
s@CreateHostedZone' {} Maybe ResourceId
a -> CreateHostedZone
s {$sel:delegationSetId:CreateHostedZone' :: Maybe ResourceId
delegationSetId = Maybe ResourceId
a} :: CreateHostedZone)

-- | (Private hosted zones only) A complex type that contains information
-- about the Amazon VPC that you\'re associating with this hosted zone.
--
-- You can specify only one Amazon VPC when you create a private hosted
-- zone. To associate additional Amazon VPCs with the hosted zone, use
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_AssociateVPCWithHostedZone.html AssociateVPCWithHostedZone>
-- after you create a hosted zone.
createHostedZone_vpc :: Lens.Lens' CreateHostedZone (Prelude.Maybe VPC)
createHostedZone_vpc :: (Maybe VPC -> f (Maybe VPC))
-> CreateHostedZone -> f CreateHostedZone
createHostedZone_vpc = (CreateHostedZone -> Maybe VPC)
-> (CreateHostedZone -> Maybe VPC -> CreateHostedZone)
-> Lens CreateHostedZone CreateHostedZone (Maybe VPC) (Maybe VPC)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZone' {Maybe VPC
vpc :: Maybe VPC
$sel:vpc:CreateHostedZone' :: CreateHostedZone -> Maybe VPC
vpc} -> Maybe VPC
vpc) (\s :: CreateHostedZone
s@CreateHostedZone' {} Maybe VPC
a -> CreateHostedZone
s {$sel:vpc:CreateHostedZone' :: Maybe VPC
vpc = Maybe VPC
a} :: CreateHostedZone)

-- | (Optional) A complex type that contains the following optional values:
--
-- -   For public and private hosted zones, an optional comment
--
-- -   For private hosted zones, an optional @PrivateZone@ element
--
-- If you don\'t specify a comment or the @PrivateZone@ element, omit
-- @HostedZoneConfig@ and the other elements.
createHostedZone_hostedZoneConfig :: Lens.Lens' CreateHostedZone (Prelude.Maybe HostedZoneConfig)
createHostedZone_hostedZoneConfig :: (Maybe HostedZoneConfig -> f (Maybe HostedZoneConfig))
-> CreateHostedZone -> f CreateHostedZone
createHostedZone_hostedZoneConfig = (CreateHostedZone -> Maybe HostedZoneConfig)
-> (CreateHostedZone -> Maybe HostedZoneConfig -> CreateHostedZone)
-> Lens
     CreateHostedZone
     CreateHostedZone
     (Maybe HostedZoneConfig)
     (Maybe HostedZoneConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZone' {Maybe HostedZoneConfig
hostedZoneConfig :: Maybe HostedZoneConfig
$sel:hostedZoneConfig:CreateHostedZone' :: CreateHostedZone -> Maybe HostedZoneConfig
hostedZoneConfig} -> Maybe HostedZoneConfig
hostedZoneConfig) (\s :: CreateHostedZone
s@CreateHostedZone' {} Maybe HostedZoneConfig
a -> CreateHostedZone
s {$sel:hostedZoneConfig:CreateHostedZone' :: Maybe HostedZoneConfig
hostedZoneConfig = Maybe HostedZoneConfig
a} :: CreateHostedZone)

-- | The name of the domain. Specify a fully qualified domain name, for
-- example, /www.example.com/. The trailing dot is optional; Amazon Route
-- 53 assumes that the domain name is fully qualified. This means that
-- Route 53 treats /www.example.com/ (without a trailing dot) and
-- /www.example.com./ (with a trailing dot) as identical.
--
-- If you\'re creating a public hosted zone, this is the name you have
-- registered with your DNS registrar. If your domain name is registered
-- with a registrar other than Route 53, change the name servers for your
-- domain to the set of @NameServers@ that @CreateHostedZone@ returns in
-- @DelegationSet@.
createHostedZone_name :: Lens.Lens' CreateHostedZone Prelude.Text
createHostedZone_name :: (Text -> f Text) -> CreateHostedZone -> f CreateHostedZone
createHostedZone_name = (CreateHostedZone -> Text)
-> (CreateHostedZone -> Text -> CreateHostedZone)
-> Lens CreateHostedZone CreateHostedZone Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZone' {Text
name :: Text
$sel:name:CreateHostedZone' :: CreateHostedZone -> Text
name} -> Text
name) (\s :: CreateHostedZone
s@CreateHostedZone' {} Text
a -> CreateHostedZone
s {$sel:name:CreateHostedZone' :: Text
name = Text
a} :: CreateHostedZone)

-- | A unique string that identifies the request and that allows failed
-- @CreateHostedZone@ requests to be retried without the risk of executing
-- the operation twice. You must use a unique @CallerReference@ string
-- every time you submit a @CreateHostedZone@ request. @CallerReference@
-- can be any unique string, for example, a date\/time stamp.
createHostedZone_callerReference :: Lens.Lens' CreateHostedZone Prelude.Text
createHostedZone_callerReference :: (Text -> f Text) -> CreateHostedZone -> f CreateHostedZone
createHostedZone_callerReference = (CreateHostedZone -> Text)
-> (CreateHostedZone -> Text -> CreateHostedZone)
-> Lens CreateHostedZone CreateHostedZone Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZone' {Text
callerReference :: Text
$sel:callerReference:CreateHostedZone' :: CreateHostedZone -> Text
callerReference} -> Text
callerReference) (\s :: CreateHostedZone
s@CreateHostedZone' {} Text
a -> CreateHostedZone
s {$sel:callerReference:CreateHostedZone' :: Text
callerReference = Text
a} :: CreateHostedZone)

instance Core.AWSRequest CreateHostedZone where
  type
    AWSResponse CreateHostedZone =
      CreateHostedZoneResponse
  request :: CreateHostedZone -> Request CreateHostedZone
request = Service -> CreateHostedZone -> Request CreateHostedZone
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateHostedZone
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateHostedZone)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse CreateHostedZone))
-> Logger
-> Service
-> Proxy CreateHostedZone
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateHostedZone)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe VPC
-> Int
-> HostedZone
-> ChangeInfo
-> DelegationSet
-> Text
-> CreateHostedZoneResponse
CreateHostedZoneResponse'
            (Maybe VPC
 -> Int
 -> HostedZone
 -> ChangeInfo
 -> DelegationSet
 -> Text
 -> CreateHostedZoneResponse)
-> Either String (Maybe VPC)
-> Either
     String
     (Int
      -> HostedZone
      -> ChangeInfo
      -> DelegationSet
      -> Text
      -> CreateHostedZoneResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe VPC)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VPC")
            Either
  String
  (Int
   -> HostedZone
   -> ChangeInfo
   -> DelegationSet
   -> Text
   -> CreateHostedZoneResponse)
-> Either String Int
-> Either
     String
     (HostedZone
      -> ChangeInfo -> DelegationSet -> Text -> CreateHostedZoneResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String
  (HostedZone
   -> ChangeInfo -> DelegationSet -> Text -> CreateHostedZoneResponse)
-> Either String HostedZone
-> Either
     String
     (ChangeInfo -> DelegationSet -> Text -> CreateHostedZoneResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String HostedZone
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HostedZone")
            Either
  String
  (ChangeInfo -> DelegationSet -> Text -> CreateHostedZoneResponse)
-> Either String ChangeInfo
-> Either
     String (DelegationSet -> Text -> CreateHostedZoneResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ChangeInfo
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ChangeInfo")
            Either String (DelegationSet -> Text -> CreateHostedZoneResponse)
-> Either String DelegationSet
-> Either String (Text -> CreateHostedZoneResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String DelegationSet
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"DelegationSet")
            Either String (Text -> CreateHostedZoneResponse)
-> Either String Text -> Either String CreateHostedZoneResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String Text
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String a
Core..# HeaderName
"Location")
      )

instance Prelude.Hashable CreateHostedZone

instance Prelude.NFData CreateHostedZone

instance Core.ToElement CreateHostedZone where
  toElement :: CreateHostedZone -> Element
toElement =
    Name -> CreateHostedZone -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
      Name
"{https://route53.amazonaws.com/doc/2013-04-01/}CreateHostedZoneRequest"

instance Core.ToHeaders CreateHostedZone where
  toHeaders :: CreateHostedZone -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateHostedZone -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath CreateHostedZone where
  toPath :: CreateHostedZone -> ByteString
toPath = ByteString -> CreateHostedZone -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2013-04-01/hostedzone"

instance Core.ToQuery CreateHostedZone where
  toQuery :: CreateHostedZone -> QueryString
toQuery = QueryString -> CreateHostedZone -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

instance Core.ToXML CreateHostedZone where
  toXML :: CreateHostedZone -> XML
toXML CreateHostedZone' {Maybe ResourceId
Maybe HostedZoneConfig
Maybe VPC
Text
callerReference :: Text
name :: Text
hostedZoneConfig :: Maybe HostedZoneConfig
vpc :: Maybe VPC
delegationSetId :: Maybe ResourceId
$sel:callerReference:CreateHostedZone' :: CreateHostedZone -> Text
$sel:name:CreateHostedZone' :: CreateHostedZone -> Text
$sel:hostedZoneConfig:CreateHostedZone' :: CreateHostedZone -> Maybe HostedZoneConfig
$sel:vpc:CreateHostedZone' :: CreateHostedZone -> Maybe VPC
$sel:delegationSetId:CreateHostedZone' :: CreateHostedZone -> Maybe ResourceId
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"DelegationSetId" Name -> Maybe ResourceId -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ResourceId
delegationSetId,
        Name
"VPC" Name -> Maybe VPC -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe VPC
vpc,
        Name
"HostedZoneConfig" Name -> Maybe HostedZoneConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe HostedZoneConfig
hostedZoneConfig,
        Name
"Name" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
name,
        Name
"CallerReference" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
callerReference
      ]

-- | A complex type containing the response information for the hosted zone.
--
-- /See:/ 'newCreateHostedZoneResponse' smart constructor.
data CreateHostedZoneResponse = CreateHostedZoneResponse'
  { -- | A complex type that contains information about an Amazon VPC that you
    -- associated with this hosted zone.
    CreateHostedZoneResponse -> Maybe VPC
vpc :: Prelude.Maybe VPC,
    -- | The response's http status code.
    CreateHostedZoneResponse -> Int
httpStatus :: Prelude.Int,
    -- | A complex type that contains general information about the hosted zone.
    CreateHostedZoneResponse -> HostedZone
hostedZone :: HostedZone,
    -- | A complex type that contains information about the @CreateHostedZone@
    -- request.
    CreateHostedZoneResponse -> ChangeInfo
changeInfo :: ChangeInfo,
    -- | A complex type that describes the name servers for this hosted zone.
    CreateHostedZoneResponse -> DelegationSet
delegationSet :: DelegationSet,
    -- | The unique URL representing the new hosted zone.
    CreateHostedZoneResponse -> Text
location :: Prelude.Text
  }
  deriving (CreateHostedZoneResponse -> CreateHostedZoneResponse -> Bool
(CreateHostedZoneResponse -> CreateHostedZoneResponse -> Bool)
-> (CreateHostedZoneResponse -> CreateHostedZoneResponse -> Bool)
-> Eq CreateHostedZoneResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHostedZoneResponse -> CreateHostedZoneResponse -> Bool
$c/= :: CreateHostedZoneResponse -> CreateHostedZoneResponse -> Bool
== :: CreateHostedZoneResponse -> CreateHostedZoneResponse -> Bool
$c== :: CreateHostedZoneResponse -> CreateHostedZoneResponse -> Bool
Prelude.Eq, ReadPrec [CreateHostedZoneResponse]
ReadPrec CreateHostedZoneResponse
Int -> ReadS CreateHostedZoneResponse
ReadS [CreateHostedZoneResponse]
(Int -> ReadS CreateHostedZoneResponse)
-> ReadS [CreateHostedZoneResponse]
-> ReadPrec CreateHostedZoneResponse
-> ReadPrec [CreateHostedZoneResponse]
-> Read CreateHostedZoneResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHostedZoneResponse]
$creadListPrec :: ReadPrec [CreateHostedZoneResponse]
readPrec :: ReadPrec CreateHostedZoneResponse
$creadPrec :: ReadPrec CreateHostedZoneResponse
readList :: ReadS [CreateHostedZoneResponse]
$creadList :: ReadS [CreateHostedZoneResponse]
readsPrec :: Int -> ReadS CreateHostedZoneResponse
$creadsPrec :: Int -> ReadS CreateHostedZoneResponse
Prelude.Read, Int -> CreateHostedZoneResponse -> ShowS
[CreateHostedZoneResponse] -> ShowS
CreateHostedZoneResponse -> String
(Int -> CreateHostedZoneResponse -> ShowS)
-> (CreateHostedZoneResponse -> String)
-> ([CreateHostedZoneResponse] -> ShowS)
-> Show CreateHostedZoneResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHostedZoneResponse] -> ShowS
$cshowList :: [CreateHostedZoneResponse] -> ShowS
show :: CreateHostedZoneResponse -> String
$cshow :: CreateHostedZoneResponse -> String
showsPrec :: Int -> CreateHostedZoneResponse -> ShowS
$cshowsPrec :: Int -> CreateHostedZoneResponse -> ShowS
Prelude.Show, (forall x.
 CreateHostedZoneResponse -> Rep CreateHostedZoneResponse x)
-> (forall x.
    Rep CreateHostedZoneResponse x -> CreateHostedZoneResponse)
-> Generic CreateHostedZoneResponse
forall x.
Rep CreateHostedZoneResponse x -> CreateHostedZoneResponse
forall x.
CreateHostedZoneResponse -> Rep CreateHostedZoneResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateHostedZoneResponse x -> CreateHostedZoneResponse
$cfrom :: forall x.
CreateHostedZoneResponse -> Rep CreateHostedZoneResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateHostedZoneResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'vpc', 'createHostedZoneResponse_vpc' - A complex type that contains information about an Amazon VPC that you
-- associated with this hosted zone.
--
-- 'httpStatus', 'createHostedZoneResponse_httpStatus' - The response's http status code.
--
-- 'hostedZone', 'createHostedZoneResponse_hostedZone' - A complex type that contains general information about the hosted zone.
--
-- 'changeInfo', 'createHostedZoneResponse_changeInfo' - A complex type that contains information about the @CreateHostedZone@
-- request.
--
-- 'delegationSet', 'createHostedZoneResponse_delegationSet' - A complex type that describes the name servers for this hosted zone.
--
-- 'location', 'createHostedZoneResponse_location' - The unique URL representing the new hosted zone.
newCreateHostedZoneResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'hostedZone'
  HostedZone ->
  -- | 'changeInfo'
  ChangeInfo ->
  -- | 'delegationSet'
  DelegationSet ->
  -- | 'location'
  Prelude.Text ->
  CreateHostedZoneResponse
newCreateHostedZoneResponse :: Int
-> HostedZone
-> ChangeInfo
-> DelegationSet
-> Text
-> CreateHostedZoneResponse
newCreateHostedZoneResponse
  Int
pHttpStatus_
  HostedZone
pHostedZone_
  ChangeInfo
pChangeInfo_
  DelegationSet
pDelegationSet_
  Text
pLocation_ =
    CreateHostedZoneResponse' :: Maybe VPC
-> Int
-> HostedZone
-> ChangeInfo
-> DelegationSet
-> Text
-> CreateHostedZoneResponse
CreateHostedZoneResponse'
      { $sel:vpc:CreateHostedZoneResponse' :: Maybe VPC
vpc = Maybe VPC
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateHostedZoneResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:hostedZone:CreateHostedZoneResponse' :: HostedZone
hostedZone = HostedZone
pHostedZone_,
        $sel:changeInfo:CreateHostedZoneResponse' :: ChangeInfo
changeInfo = ChangeInfo
pChangeInfo_,
        $sel:delegationSet:CreateHostedZoneResponse' :: DelegationSet
delegationSet = DelegationSet
pDelegationSet_,
        $sel:location:CreateHostedZoneResponse' :: Text
location = Text
pLocation_
      }

-- | A complex type that contains information about an Amazon VPC that you
-- associated with this hosted zone.
createHostedZoneResponse_vpc :: Lens.Lens' CreateHostedZoneResponse (Prelude.Maybe VPC)
createHostedZoneResponse_vpc :: (Maybe VPC -> f (Maybe VPC))
-> CreateHostedZoneResponse -> f CreateHostedZoneResponse
createHostedZoneResponse_vpc = (CreateHostedZoneResponse -> Maybe VPC)
-> (CreateHostedZoneResponse
    -> Maybe VPC -> CreateHostedZoneResponse)
-> Lens
     CreateHostedZoneResponse
     CreateHostedZoneResponse
     (Maybe VPC)
     (Maybe VPC)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZoneResponse' {Maybe VPC
vpc :: Maybe VPC
$sel:vpc:CreateHostedZoneResponse' :: CreateHostedZoneResponse -> Maybe VPC
vpc} -> Maybe VPC
vpc) (\s :: CreateHostedZoneResponse
s@CreateHostedZoneResponse' {} Maybe VPC
a -> CreateHostedZoneResponse
s {$sel:vpc:CreateHostedZoneResponse' :: Maybe VPC
vpc = Maybe VPC
a} :: CreateHostedZoneResponse)

-- | The response's http status code.
createHostedZoneResponse_httpStatus :: Lens.Lens' CreateHostedZoneResponse Prelude.Int
createHostedZoneResponse_httpStatus :: (Int -> f Int)
-> CreateHostedZoneResponse -> f CreateHostedZoneResponse
createHostedZoneResponse_httpStatus = (CreateHostedZoneResponse -> Int)
-> (CreateHostedZoneResponse -> Int -> CreateHostedZoneResponse)
-> Lens CreateHostedZoneResponse CreateHostedZoneResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZoneResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateHostedZoneResponse' :: CreateHostedZoneResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateHostedZoneResponse
s@CreateHostedZoneResponse' {} Int
a -> CreateHostedZoneResponse
s {$sel:httpStatus:CreateHostedZoneResponse' :: Int
httpStatus = Int
a} :: CreateHostedZoneResponse)

-- | A complex type that contains general information about the hosted zone.
createHostedZoneResponse_hostedZone :: Lens.Lens' CreateHostedZoneResponse HostedZone
createHostedZoneResponse_hostedZone :: (HostedZone -> f HostedZone)
-> CreateHostedZoneResponse -> f CreateHostedZoneResponse
createHostedZoneResponse_hostedZone = (CreateHostedZoneResponse -> HostedZone)
-> (CreateHostedZoneResponse
    -> HostedZone -> CreateHostedZoneResponse)
-> Lens
     CreateHostedZoneResponse
     CreateHostedZoneResponse
     HostedZone
     HostedZone
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZoneResponse' {HostedZone
hostedZone :: HostedZone
$sel:hostedZone:CreateHostedZoneResponse' :: CreateHostedZoneResponse -> HostedZone
hostedZone} -> HostedZone
hostedZone) (\s :: CreateHostedZoneResponse
s@CreateHostedZoneResponse' {} HostedZone
a -> CreateHostedZoneResponse
s {$sel:hostedZone:CreateHostedZoneResponse' :: HostedZone
hostedZone = HostedZone
a} :: CreateHostedZoneResponse)

-- | A complex type that contains information about the @CreateHostedZone@
-- request.
createHostedZoneResponse_changeInfo :: Lens.Lens' CreateHostedZoneResponse ChangeInfo
createHostedZoneResponse_changeInfo :: (ChangeInfo -> f ChangeInfo)
-> CreateHostedZoneResponse -> f CreateHostedZoneResponse
createHostedZoneResponse_changeInfo = (CreateHostedZoneResponse -> ChangeInfo)
-> (CreateHostedZoneResponse
    -> ChangeInfo -> CreateHostedZoneResponse)
-> Lens
     CreateHostedZoneResponse
     CreateHostedZoneResponse
     ChangeInfo
     ChangeInfo
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZoneResponse' {ChangeInfo
changeInfo :: ChangeInfo
$sel:changeInfo:CreateHostedZoneResponse' :: CreateHostedZoneResponse -> ChangeInfo
changeInfo} -> ChangeInfo
changeInfo) (\s :: CreateHostedZoneResponse
s@CreateHostedZoneResponse' {} ChangeInfo
a -> CreateHostedZoneResponse
s {$sel:changeInfo:CreateHostedZoneResponse' :: ChangeInfo
changeInfo = ChangeInfo
a} :: CreateHostedZoneResponse)

-- | A complex type that describes the name servers for this hosted zone.
createHostedZoneResponse_delegationSet :: Lens.Lens' CreateHostedZoneResponse DelegationSet
createHostedZoneResponse_delegationSet :: (DelegationSet -> f DelegationSet)
-> CreateHostedZoneResponse -> f CreateHostedZoneResponse
createHostedZoneResponse_delegationSet = (CreateHostedZoneResponse -> DelegationSet)
-> (CreateHostedZoneResponse
    -> DelegationSet -> CreateHostedZoneResponse)
-> Lens
     CreateHostedZoneResponse
     CreateHostedZoneResponse
     DelegationSet
     DelegationSet
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZoneResponse' {DelegationSet
delegationSet :: DelegationSet
$sel:delegationSet:CreateHostedZoneResponse' :: CreateHostedZoneResponse -> DelegationSet
delegationSet} -> DelegationSet
delegationSet) (\s :: CreateHostedZoneResponse
s@CreateHostedZoneResponse' {} DelegationSet
a -> CreateHostedZoneResponse
s {$sel:delegationSet:CreateHostedZoneResponse' :: DelegationSet
delegationSet = DelegationSet
a} :: CreateHostedZoneResponse)

-- | The unique URL representing the new hosted zone.
createHostedZoneResponse_location :: Lens.Lens' CreateHostedZoneResponse Prelude.Text
createHostedZoneResponse_location :: (Text -> f Text)
-> CreateHostedZoneResponse -> f CreateHostedZoneResponse
createHostedZoneResponse_location = (CreateHostedZoneResponse -> Text)
-> (CreateHostedZoneResponse -> Text -> CreateHostedZoneResponse)
-> Lens CreateHostedZoneResponse CreateHostedZoneResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHostedZoneResponse' {Text
location :: Text
$sel:location:CreateHostedZoneResponse' :: CreateHostedZoneResponse -> Text
location} -> Text
location) (\s :: CreateHostedZoneResponse
s@CreateHostedZoneResponse' {} Text
a -> CreateHostedZoneResponse
s {$sel:location:CreateHostedZoneResponse' :: Text
location = Text
a} :: CreateHostedZoneResponse)

instance Prelude.NFData CreateHostedZoneResponse