{-# 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.CodeDeploy.DeregisterOnPremisesInstance
-- 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)
--
-- Deregisters an on-premises instance.
module Amazonka.CodeDeploy.DeregisterOnPremisesInstance
  ( -- * Creating a Request
    DeregisterOnPremisesInstance (..),
    newDeregisterOnPremisesInstance,

    -- * Request Lenses
    deregisterOnPremisesInstance_instanceName,

    -- * Destructuring the Response
    DeregisterOnPremisesInstanceResponse (..),
    newDeregisterOnPremisesInstanceResponse,
  )
where

import Amazonka.CodeDeploy.Types
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

-- | Represents the input of a @DeregisterOnPremisesInstance@ operation.
--
-- /See:/ 'newDeregisterOnPremisesInstance' smart constructor.
data DeregisterOnPremisesInstance = DeregisterOnPremisesInstance'
  { -- | The name of the on-premises instance to deregister.
    DeregisterOnPremisesInstance -> Text
instanceName :: Prelude.Text
  }
  deriving (DeregisterOnPremisesInstance
-> DeregisterOnPremisesInstance -> Bool
(DeregisterOnPremisesInstance
 -> DeregisterOnPremisesInstance -> Bool)
-> (DeregisterOnPremisesInstance
    -> DeregisterOnPremisesInstance -> Bool)
-> Eq DeregisterOnPremisesInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterOnPremisesInstance
-> DeregisterOnPremisesInstance -> Bool
$c/= :: DeregisterOnPremisesInstance
-> DeregisterOnPremisesInstance -> Bool
== :: DeregisterOnPremisesInstance
-> DeregisterOnPremisesInstance -> Bool
$c== :: DeregisterOnPremisesInstance
-> DeregisterOnPremisesInstance -> Bool
Prelude.Eq, ReadPrec [DeregisterOnPremisesInstance]
ReadPrec DeregisterOnPremisesInstance
Int -> ReadS DeregisterOnPremisesInstance
ReadS [DeregisterOnPremisesInstance]
(Int -> ReadS DeregisterOnPremisesInstance)
-> ReadS [DeregisterOnPremisesInstance]
-> ReadPrec DeregisterOnPremisesInstance
-> ReadPrec [DeregisterOnPremisesInstance]
-> Read DeregisterOnPremisesInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterOnPremisesInstance]
$creadListPrec :: ReadPrec [DeregisterOnPremisesInstance]
readPrec :: ReadPrec DeregisterOnPremisesInstance
$creadPrec :: ReadPrec DeregisterOnPremisesInstance
readList :: ReadS [DeregisterOnPremisesInstance]
$creadList :: ReadS [DeregisterOnPremisesInstance]
readsPrec :: Int -> ReadS DeregisterOnPremisesInstance
$creadsPrec :: Int -> ReadS DeregisterOnPremisesInstance
Prelude.Read, Int -> DeregisterOnPremisesInstance -> ShowS
[DeregisterOnPremisesInstance] -> ShowS
DeregisterOnPremisesInstance -> String
(Int -> DeregisterOnPremisesInstance -> ShowS)
-> (DeregisterOnPremisesInstance -> String)
-> ([DeregisterOnPremisesInstance] -> ShowS)
-> Show DeregisterOnPremisesInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterOnPremisesInstance] -> ShowS
$cshowList :: [DeregisterOnPremisesInstance] -> ShowS
show :: DeregisterOnPremisesInstance -> String
$cshow :: DeregisterOnPremisesInstance -> String
showsPrec :: Int -> DeregisterOnPremisesInstance -> ShowS
$cshowsPrec :: Int -> DeregisterOnPremisesInstance -> ShowS
Prelude.Show, (forall x.
 DeregisterOnPremisesInstance -> Rep DeregisterOnPremisesInstance x)
-> (forall x.
    Rep DeregisterOnPremisesInstance x -> DeregisterOnPremisesInstance)
-> Generic DeregisterOnPremisesInstance
forall x.
Rep DeregisterOnPremisesInstance x -> DeregisterOnPremisesInstance
forall x.
DeregisterOnPremisesInstance -> Rep DeregisterOnPremisesInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterOnPremisesInstance x -> DeregisterOnPremisesInstance
$cfrom :: forall x.
DeregisterOnPremisesInstance -> Rep DeregisterOnPremisesInstance x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterOnPremisesInstance' 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:
--
-- 'instanceName', 'deregisterOnPremisesInstance_instanceName' - The name of the on-premises instance to deregister.
newDeregisterOnPremisesInstance ::
  -- | 'instanceName'
  Prelude.Text ->
  DeregisterOnPremisesInstance
newDeregisterOnPremisesInstance :: Text -> DeregisterOnPremisesInstance
newDeregisterOnPremisesInstance Text
pInstanceName_ =
  DeregisterOnPremisesInstance' :: Text -> DeregisterOnPremisesInstance
DeregisterOnPremisesInstance'
    { $sel:instanceName:DeregisterOnPremisesInstance' :: Text
instanceName =
        Text
pInstanceName_
    }

-- | The name of the on-premises instance to deregister.
deregisterOnPremisesInstance_instanceName :: Lens.Lens' DeregisterOnPremisesInstance Prelude.Text
deregisterOnPremisesInstance_instanceName :: (Text -> f Text)
-> DeregisterOnPremisesInstance -> f DeregisterOnPremisesInstance
deregisterOnPremisesInstance_instanceName = (DeregisterOnPremisesInstance -> Text)
-> (DeregisterOnPremisesInstance
    -> Text -> DeregisterOnPremisesInstance)
-> Lens
     DeregisterOnPremisesInstance DeregisterOnPremisesInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterOnPremisesInstance' {Text
instanceName :: Text
$sel:instanceName:DeregisterOnPremisesInstance' :: DeregisterOnPremisesInstance -> Text
instanceName} -> Text
instanceName) (\s :: DeregisterOnPremisesInstance
s@DeregisterOnPremisesInstance' {} Text
a -> DeregisterOnPremisesInstance
s {$sel:instanceName:DeregisterOnPremisesInstance' :: Text
instanceName = Text
a} :: DeregisterOnPremisesInstance)

instance Core.AWSRequest DeregisterOnPremisesInstance where
  type
    AWSResponse DeregisterOnPremisesInstance =
      DeregisterOnPremisesInstanceResponse
  request :: DeregisterOnPremisesInstance
-> Request DeregisterOnPremisesInstance
request = Service
-> DeregisterOnPremisesInstance
-> Request DeregisterOnPremisesInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeregisterOnPremisesInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeregisterOnPremisesInstance)))
response =
    AWSResponse DeregisterOnPremisesInstance
-> Logger
-> Service
-> Proxy DeregisterOnPremisesInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeregisterOnPremisesInstance)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeregisterOnPremisesInstance
DeregisterOnPremisesInstanceResponse
DeregisterOnPremisesInstanceResponse'

instance
  Prelude.Hashable
    DeregisterOnPremisesInstance

instance Prelude.NFData DeregisterOnPremisesInstance

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

instance Core.ToJSON DeregisterOnPremisesInstance where
  toJSON :: DeregisterOnPremisesInstance -> Value
toJSON DeregisterOnPremisesInstance' {Text
instanceName :: Text
$sel:instanceName:DeregisterOnPremisesInstance' :: DeregisterOnPremisesInstance -> 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
"instanceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceName)]
      )

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

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

-- | /See:/ 'newDeregisterOnPremisesInstanceResponse' smart constructor.
data DeregisterOnPremisesInstanceResponse = DeregisterOnPremisesInstanceResponse'
  {
  }
  deriving (DeregisterOnPremisesInstanceResponse
-> DeregisterOnPremisesInstanceResponse -> Bool
(DeregisterOnPremisesInstanceResponse
 -> DeregisterOnPremisesInstanceResponse -> Bool)
-> (DeregisterOnPremisesInstanceResponse
    -> DeregisterOnPremisesInstanceResponse -> Bool)
-> Eq DeregisterOnPremisesInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterOnPremisesInstanceResponse
-> DeregisterOnPremisesInstanceResponse -> Bool
$c/= :: DeregisterOnPremisesInstanceResponse
-> DeregisterOnPremisesInstanceResponse -> Bool
== :: DeregisterOnPremisesInstanceResponse
-> DeregisterOnPremisesInstanceResponse -> Bool
$c== :: DeregisterOnPremisesInstanceResponse
-> DeregisterOnPremisesInstanceResponse -> Bool
Prelude.Eq, ReadPrec [DeregisterOnPremisesInstanceResponse]
ReadPrec DeregisterOnPremisesInstanceResponse
Int -> ReadS DeregisterOnPremisesInstanceResponse
ReadS [DeregisterOnPremisesInstanceResponse]
(Int -> ReadS DeregisterOnPremisesInstanceResponse)
-> ReadS [DeregisterOnPremisesInstanceResponse]
-> ReadPrec DeregisterOnPremisesInstanceResponse
-> ReadPrec [DeregisterOnPremisesInstanceResponse]
-> Read DeregisterOnPremisesInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterOnPremisesInstanceResponse]
$creadListPrec :: ReadPrec [DeregisterOnPremisesInstanceResponse]
readPrec :: ReadPrec DeregisterOnPremisesInstanceResponse
$creadPrec :: ReadPrec DeregisterOnPremisesInstanceResponse
readList :: ReadS [DeregisterOnPremisesInstanceResponse]
$creadList :: ReadS [DeregisterOnPremisesInstanceResponse]
readsPrec :: Int -> ReadS DeregisterOnPremisesInstanceResponse
$creadsPrec :: Int -> ReadS DeregisterOnPremisesInstanceResponse
Prelude.Read, Int -> DeregisterOnPremisesInstanceResponse -> ShowS
[DeregisterOnPremisesInstanceResponse] -> ShowS
DeregisterOnPremisesInstanceResponse -> String
(Int -> DeregisterOnPremisesInstanceResponse -> ShowS)
-> (DeregisterOnPremisesInstanceResponse -> String)
-> ([DeregisterOnPremisesInstanceResponse] -> ShowS)
-> Show DeregisterOnPremisesInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterOnPremisesInstanceResponse] -> ShowS
$cshowList :: [DeregisterOnPremisesInstanceResponse] -> ShowS
show :: DeregisterOnPremisesInstanceResponse -> String
$cshow :: DeregisterOnPremisesInstanceResponse -> String
showsPrec :: Int -> DeregisterOnPremisesInstanceResponse -> ShowS
$cshowsPrec :: Int -> DeregisterOnPremisesInstanceResponse -> ShowS
Prelude.Show, (forall x.
 DeregisterOnPremisesInstanceResponse
 -> Rep DeregisterOnPremisesInstanceResponse x)
-> (forall x.
    Rep DeregisterOnPremisesInstanceResponse x
    -> DeregisterOnPremisesInstanceResponse)
-> Generic DeregisterOnPremisesInstanceResponse
forall x.
Rep DeregisterOnPremisesInstanceResponse x
-> DeregisterOnPremisesInstanceResponse
forall x.
DeregisterOnPremisesInstanceResponse
-> Rep DeregisterOnPremisesInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterOnPremisesInstanceResponse x
-> DeregisterOnPremisesInstanceResponse
$cfrom :: forall x.
DeregisterOnPremisesInstanceResponse
-> Rep DeregisterOnPremisesInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterOnPremisesInstanceResponse' 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.
newDeregisterOnPremisesInstanceResponse ::
  DeregisterOnPremisesInstanceResponse
newDeregisterOnPremisesInstanceResponse :: DeregisterOnPremisesInstanceResponse
newDeregisterOnPremisesInstanceResponse =
  DeregisterOnPremisesInstanceResponse
DeregisterOnPremisesInstanceResponse'

instance
  Prelude.NFData
    DeregisterOnPremisesInstanceResponse