{-# 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-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)
--
-- 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_httpStatus,
    disableDomainTransferLockResponse_operationId,
  )
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.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
(DisableDomainTransferLock -> DisableDomainTransferLock -> Bool)
-> (DisableDomainTransferLock -> DisableDomainTransferLock -> Bool)
-> Eq DisableDomainTransferLock
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]
(Int -> ReadS DisableDomainTransferLock)
-> ReadS [DisableDomainTransferLock]
-> ReadPrec DisableDomainTransferLock
-> ReadPrec [DisableDomainTransferLock]
-> Read 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
(Int -> DisableDomainTransferLock -> ShowS)
-> (DisableDomainTransferLock -> String)
-> ([DisableDomainTransferLock] -> ShowS)
-> Show DisableDomainTransferLock
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.
 DisableDomainTransferLock -> Rep DisableDomainTransferLock x)
-> (forall x.
    Rep DisableDomainTransferLock x -> DisableDomainTransferLock)
-> Generic DisableDomainTransferLock
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' :: Text -> DisableDomainTransferLock
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 :: (Text -> f Text)
-> DisableDomainTransferLock -> f DisableDomainTransferLock
disableDomainTransferLock_domainName = (DisableDomainTransferLock -> Text)
-> (DisableDomainTransferLock -> Text -> DisableDomainTransferLock)
-> Lens
     DisableDomainTransferLock DisableDomainTransferLock Text Text
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 :: DisableDomainTransferLock -> Request DisableDomainTransferLock
request = Service
-> DisableDomainTransferLock -> Request DisableDomainTransferLock
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisableDomainTransferLock
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableDomainTransferLock)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DisableDomainTransferLock))
-> Logger
-> Service
-> Proxy DisableDomainTransferLock
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableDomainTransferLock)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> DisableDomainTransferLockResponse
DisableDomainTransferLockResponse'
            (Int -> Text -> DisableDomainTransferLockResponse)
-> Either String Int
-> Either String (Text -> DisableDomainTransferLockResponse)
forall (f :: * -> *) a b. Functor 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 (Text -> DisableDomainTransferLockResponse)
-> Either String Text
-> Either String DisableDomainTransferLockResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"OperationId")
      )

instance Prelude.Hashable DisableDomainTransferLock

instance Prelude.NFData DisableDomainTransferLock

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

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

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

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

-- | The DisableDomainTransferLock response includes the following element.
--
-- /See:/ 'newDisableDomainTransferLockResponse' smart constructor.
data DisableDomainTransferLockResponse = DisableDomainTransferLockResponse'
  { -- | The response's http status code.
    DisableDomainTransferLockResponse -> Int
httpStatus :: Prelude.Int,
    -- | 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 -> Text
operationId :: Prelude.Text
  }
  deriving (DisableDomainTransferLockResponse
-> DisableDomainTransferLockResponse -> Bool
(DisableDomainTransferLockResponse
 -> DisableDomainTransferLockResponse -> Bool)
-> (DisableDomainTransferLockResponse
    -> DisableDomainTransferLockResponse -> Bool)
-> Eq DisableDomainTransferLockResponse
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]
(Int -> ReadS DisableDomainTransferLockResponse)
-> ReadS [DisableDomainTransferLockResponse]
-> ReadPrec DisableDomainTransferLockResponse
-> ReadPrec [DisableDomainTransferLockResponse]
-> Read 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
(Int -> DisableDomainTransferLockResponse -> ShowS)
-> (DisableDomainTransferLockResponse -> String)
-> ([DisableDomainTransferLockResponse] -> ShowS)
-> Show DisableDomainTransferLockResponse
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.
 DisableDomainTransferLockResponse
 -> Rep DisableDomainTransferLockResponse x)
-> (forall x.
    Rep DisableDomainTransferLockResponse x
    -> DisableDomainTransferLockResponse)
-> Generic DisableDomainTransferLockResponse
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:
--
-- 'httpStatus', 'disableDomainTransferLockResponse_httpStatus' - The response's http status code.
--
-- '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>.
newDisableDomainTransferLockResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'operationId'
  Prelude.Text ->
  DisableDomainTransferLockResponse
newDisableDomainTransferLockResponse :: Int -> Text -> DisableDomainTransferLockResponse
newDisableDomainTransferLockResponse
  Int
pHttpStatus_
  Text
pOperationId_ =
    DisableDomainTransferLockResponse' :: Int -> Text -> DisableDomainTransferLockResponse
DisableDomainTransferLockResponse'
      { $sel:httpStatus:DisableDomainTransferLockResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:operationId:DisableDomainTransferLockResponse' :: Text
operationId = Text
pOperationId_
      }

-- | The response's http status code.
disableDomainTransferLockResponse_httpStatus :: Lens.Lens' DisableDomainTransferLockResponse Prelude.Int
disableDomainTransferLockResponse_httpStatus :: (Int -> f Int)
-> DisableDomainTransferLockResponse
-> f DisableDomainTransferLockResponse
disableDomainTransferLockResponse_httpStatus = (DisableDomainTransferLockResponse -> Int)
-> (DisableDomainTransferLockResponse
    -> Int -> DisableDomainTransferLockResponse)
-> Lens
     DisableDomainTransferLockResponse
     DisableDomainTransferLockResponse
     Int
     Int
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)

-- | 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.Text
disableDomainTransferLockResponse_operationId :: (Text -> f Text)
-> DisableDomainTransferLockResponse
-> f DisableDomainTransferLockResponse
disableDomainTransferLockResponse_operationId = (DisableDomainTransferLockResponse -> Text)
-> (DisableDomainTransferLockResponse
    -> Text -> DisableDomainTransferLockResponse)
-> Lens
     DisableDomainTransferLockResponse
     DisableDomainTransferLockResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableDomainTransferLockResponse' {Text
operationId :: Text
$sel:operationId:DisableDomainTransferLockResponse' :: DisableDomainTransferLockResponse -> Text
operationId} -> Text
operationId) (\s :: DisableDomainTransferLockResponse
s@DisableDomainTransferLockResponse' {} Text
a -> DisableDomainTransferLockResponse
s {$sel:operationId:DisableDomainTransferLockResponse' :: Text
operationId = Text
a} :: DisableDomainTransferLockResponse)

instance
  Prelude.NFData
    DisableDomainTransferLockResponse