{-# 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.Route53Domains.DisableDomainTransferLock
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This operation removes the transfer lock on the domain (specifically the
-- @clientTransferProhibited@ status) to allow domain transfers. We
-- recommend you refrain from performing this action unless you intend to
-- transfer the domain to a different registrar. Successful submission
-- returns an operation ID that you can use to track the progress and
-- completion of the action. If the request is not completed successfully,
-- the domain registrant will be notified by email.
module Amazonka.Route53Domains.DisableDomainTransferLock
  ( -- * Creating a Request
    DisableDomainTransferLock (..),
    newDisableDomainTransferLock,

    -- * Request Lenses
    disableDomainTransferLock_domainName,

    -- * Destructuring the Response
    DisableDomainTransferLockResponse (..),
    newDisableDomainTransferLockResponse,

    -- * Response Lenses
    disableDomainTransferLockResponse_operationId,
    disableDomainTransferLockResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53Domains.Types

-- | The DisableDomainTransferLock request includes the following element.
--
-- /See:/ 'newDisableDomainTransferLock' smart constructor.
data DisableDomainTransferLock = DisableDomainTransferLock'
  { -- | The name of the domain that you want to remove the transfer lock for.
    DisableDomainTransferLock -> Text
domainName :: Prelude.Text
  }
  deriving (DisableDomainTransferLock -> DisableDomainTransferLock -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableDomainTransferLock -> DisableDomainTransferLock -> Bool
$c/= :: DisableDomainTransferLock -> DisableDomainTransferLock -> Bool
== :: DisableDomainTransferLock -> DisableDomainTransferLock -> Bool
$c== :: DisableDomainTransferLock -> DisableDomainTransferLock -> Bool
Prelude.Eq, ReadPrec [DisableDomainTransferLock]
ReadPrec DisableDomainTransferLock
Int -> ReadS DisableDomainTransferLock
ReadS [DisableDomainTransferLock]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableDomainTransferLock]
$creadListPrec :: ReadPrec [DisableDomainTransferLock]
readPrec :: ReadPrec DisableDomainTransferLock
$creadPrec :: ReadPrec DisableDomainTransferLock
readList :: ReadS [DisableDomainTransferLock]
$creadList :: ReadS [DisableDomainTransferLock]
readsPrec :: Int -> ReadS DisableDomainTransferLock
$creadsPrec :: Int -> ReadS DisableDomainTransferLock
Prelude.Read, Int -> DisableDomainTransferLock -> ShowS
[DisableDomainTransferLock] -> ShowS
DisableDomainTransferLock -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableDomainTransferLock] -> ShowS
$cshowList :: [DisableDomainTransferLock] -> ShowS
show :: DisableDomainTransferLock -> String
$cshow :: DisableDomainTransferLock -> String
showsPrec :: Int -> DisableDomainTransferLock -> ShowS
$cshowsPrec :: Int -> DisableDomainTransferLock -> ShowS
Prelude.Show, forall x.
Rep DisableDomainTransferLock x -> DisableDomainTransferLock
forall x.
DisableDomainTransferLock -> Rep DisableDomainTransferLock x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisableDomainTransferLock x -> DisableDomainTransferLock
$cfrom :: forall x.
DisableDomainTransferLock -> Rep DisableDomainTransferLock x
Prelude.Generic)

-- |
-- Create a value of 'DisableDomainTransferLock' 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:
--
-- 'domainName', 'disableDomainTransferLock_domainName' - The name of the domain that you want to remove the transfer lock for.
newDisableDomainTransferLock ::
  -- | 'domainName'
  Prelude.Text ->
  DisableDomainTransferLock
newDisableDomainTransferLock :: Text -> DisableDomainTransferLock
newDisableDomainTransferLock Text
pDomainName_ =
  DisableDomainTransferLock'
    { $sel:domainName:DisableDomainTransferLock' :: Text
domainName =
        Text
pDomainName_
    }

-- | The name of the domain that you want to remove the transfer lock for.
disableDomainTransferLock_domainName :: Lens.Lens' DisableDomainTransferLock Prelude.Text
disableDomainTransferLock_domainName :: Lens' DisableDomainTransferLock Text
disableDomainTransferLock_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableDomainTransferLock' {Text
domainName :: Text
$sel:domainName:DisableDomainTransferLock' :: DisableDomainTransferLock -> Text
domainName} -> Text
domainName) (\s :: DisableDomainTransferLock
s@DisableDomainTransferLock' {} Text
a -> DisableDomainTransferLock
s {$sel:domainName:DisableDomainTransferLock' :: Text
domainName = Text
a} :: DisableDomainTransferLock)

instance Core.AWSRequest DisableDomainTransferLock where
  type
    AWSResponse DisableDomainTransferLock =
      DisableDomainTransferLockResponse
  request :: (Service -> Service)
-> DisableDomainTransferLock -> Request DisableDomainTransferLock
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisableDomainTransferLock
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableDomainTransferLock)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> DisableDomainTransferLockResponse
DisableDomainTransferLockResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"OperationId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DisableDomainTransferLock where
  hashWithSalt :: Int -> DisableDomainTransferLock -> Int
hashWithSalt Int
_salt DisableDomainTransferLock' {Text
domainName :: Text
$sel:domainName:DisableDomainTransferLock' :: DisableDomainTransferLock -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName

instance Prelude.NFData DisableDomainTransferLock where
  rnf :: DisableDomainTransferLock -> ()
rnf DisableDomainTransferLock' {Text
domainName :: Text
$sel:domainName:DisableDomainTransferLock' :: DisableDomainTransferLock -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
domainName

instance Data.ToHeaders DisableDomainTransferLock where
  toHeaders :: DisableDomainTransferLock -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Route53Domains_v20140515.DisableDomainTransferLock" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DisableDomainTransferLock where
  toJSON :: DisableDomainTransferLock -> Value
toJSON DisableDomainTransferLock' {Text
domainName :: Text
$sel:domainName:DisableDomainTransferLock' :: DisableDomainTransferLock -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"DomainName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
domainName)]
      )

instance Data.ToPath DisableDomainTransferLock where
  toPath :: DisableDomainTransferLock -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | The DisableDomainTransferLock response includes the following element.
--
-- /See:/ 'newDisableDomainTransferLockResponse' smart constructor.
data DisableDomainTransferLockResponse = DisableDomainTransferLockResponse'
  { -- | Identifier for tracking the progress of the request. To query the
    -- operation status, use
    -- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_GetOperationDetail.html GetOperationDetail>.
    DisableDomainTransferLockResponse -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DisableDomainTransferLockResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DisableDomainTransferLockResponse
-> DisableDomainTransferLockResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableDomainTransferLockResponse
-> DisableDomainTransferLockResponse -> Bool
$c/= :: DisableDomainTransferLockResponse
-> DisableDomainTransferLockResponse -> Bool
== :: DisableDomainTransferLockResponse
-> DisableDomainTransferLockResponse -> Bool
$c== :: DisableDomainTransferLockResponse
-> DisableDomainTransferLockResponse -> Bool
Prelude.Eq, ReadPrec [DisableDomainTransferLockResponse]
ReadPrec DisableDomainTransferLockResponse
Int -> ReadS DisableDomainTransferLockResponse
ReadS [DisableDomainTransferLockResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableDomainTransferLockResponse]
$creadListPrec :: ReadPrec [DisableDomainTransferLockResponse]
readPrec :: ReadPrec DisableDomainTransferLockResponse
$creadPrec :: ReadPrec DisableDomainTransferLockResponse
readList :: ReadS [DisableDomainTransferLockResponse]
$creadList :: ReadS [DisableDomainTransferLockResponse]
readsPrec :: Int -> ReadS DisableDomainTransferLockResponse
$creadsPrec :: Int -> ReadS DisableDomainTransferLockResponse
Prelude.Read, Int -> DisableDomainTransferLockResponse -> ShowS
[DisableDomainTransferLockResponse] -> ShowS
DisableDomainTransferLockResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableDomainTransferLockResponse] -> ShowS
$cshowList :: [DisableDomainTransferLockResponse] -> ShowS
show :: DisableDomainTransferLockResponse -> String
$cshow :: DisableDomainTransferLockResponse -> String
showsPrec :: Int -> DisableDomainTransferLockResponse -> ShowS
$cshowsPrec :: Int -> DisableDomainTransferLockResponse -> ShowS
Prelude.Show, forall x.
Rep DisableDomainTransferLockResponse x
-> DisableDomainTransferLockResponse
forall x.
DisableDomainTransferLockResponse
-> Rep DisableDomainTransferLockResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisableDomainTransferLockResponse x
-> DisableDomainTransferLockResponse
$cfrom :: forall x.
DisableDomainTransferLockResponse
-> Rep DisableDomainTransferLockResponse x
Prelude.Generic)

-- |
-- Create a value of 'DisableDomainTransferLockResponse' 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:
--
-- 'operationId', 'disableDomainTransferLockResponse_operationId' - Identifier for tracking the progress of the request. To query the
-- operation status, use
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_GetOperationDetail.html GetOperationDetail>.
--
-- 'httpStatus', 'disableDomainTransferLockResponse_httpStatus' - The response's http status code.
newDisableDomainTransferLockResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisableDomainTransferLockResponse
newDisableDomainTransferLockResponse :: Int -> DisableDomainTransferLockResponse
newDisableDomainTransferLockResponse Int
pHttpStatus_ =
  DisableDomainTransferLockResponse'
    { $sel:operationId:DisableDomainTransferLockResponse' :: Maybe Text
operationId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DisableDomainTransferLockResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Identifier for tracking the progress of the request. To query the
-- operation status, use
-- <https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_GetOperationDetail.html GetOperationDetail>.
disableDomainTransferLockResponse_operationId :: Lens.Lens' DisableDomainTransferLockResponse (Prelude.Maybe Prelude.Text)
disableDomainTransferLockResponse_operationId :: Lens' DisableDomainTransferLockResponse (Maybe Text)
disableDomainTransferLockResponse_operationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableDomainTransferLockResponse' {Maybe Text
operationId :: Maybe Text
$sel:operationId:DisableDomainTransferLockResponse' :: DisableDomainTransferLockResponse -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: DisableDomainTransferLockResponse
s@DisableDomainTransferLockResponse' {} Maybe Text
a -> DisableDomainTransferLockResponse
s {$sel:operationId:DisableDomainTransferLockResponse' :: Maybe Text
operationId = Maybe Text
a} :: DisableDomainTransferLockResponse)

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

instance
  Prelude.NFData
    DisableDomainTransferLockResponse
  where
  rnf :: DisableDomainTransferLockResponse -> ()
rnf DisableDomainTransferLockResponse' {Int
Maybe Text
httpStatus :: Int
operationId :: Maybe Text
$sel:httpStatus:DisableDomainTransferLockResponse' :: DisableDomainTransferLockResponse -> Int
$sel:operationId:DisableDomainTransferLockResponse' :: DisableDomainTransferLockResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
operationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus