{-# 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.Lightsail.DeleteContainerService
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes your Amazon Lightsail container service.
module Amazonka.Lightsail.DeleteContainerService
  ( -- * Creating a Request
    DeleteContainerService (..),
    newDeleteContainerService,

    -- * Request Lenses
    deleteContainerService_serviceName,

    -- * Destructuring the Response
    DeleteContainerServiceResponse (..),
    newDeleteContainerServiceResponse,

    -- * Response Lenses
    deleteContainerServiceResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteContainerService' smart constructor.
data DeleteContainerService = DeleteContainerService'
  { -- | The name of the container service to delete.
    DeleteContainerService -> Text
serviceName :: Prelude.Text
  }
  deriving (DeleteContainerService -> DeleteContainerService -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteContainerService -> DeleteContainerService -> Bool
$c/= :: DeleteContainerService -> DeleteContainerService -> Bool
== :: DeleteContainerService -> DeleteContainerService -> Bool
$c== :: DeleteContainerService -> DeleteContainerService -> Bool
Prelude.Eq, ReadPrec [DeleteContainerService]
ReadPrec DeleteContainerService
Int -> ReadS DeleteContainerService
ReadS [DeleteContainerService]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteContainerService]
$creadListPrec :: ReadPrec [DeleteContainerService]
readPrec :: ReadPrec DeleteContainerService
$creadPrec :: ReadPrec DeleteContainerService
readList :: ReadS [DeleteContainerService]
$creadList :: ReadS [DeleteContainerService]
readsPrec :: Int -> ReadS DeleteContainerService
$creadsPrec :: Int -> ReadS DeleteContainerService
Prelude.Read, Int -> DeleteContainerService -> ShowS
[DeleteContainerService] -> ShowS
DeleteContainerService -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteContainerService] -> ShowS
$cshowList :: [DeleteContainerService] -> ShowS
show :: DeleteContainerService -> String
$cshow :: DeleteContainerService -> String
showsPrec :: Int -> DeleteContainerService -> ShowS
$cshowsPrec :: Int -> DeleteContainerService -> ShowS
Prelude.Show, forall x. Rep DeleteContainerService x -> DeleteContainerService
forall x. DeleteContainerService -> Rep DeleteContainerService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteContainerService x -> DeleteContainerService
$cfrom :: forall x. DeleteContainerService -> Rep DeleteContainerService x
Prelude.Generic)

-- |
-- Create a value of 'DeleteContainerService' 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:
--
-- 'serviceName', 'deleteContainerService_serviceName' - The name of the container service to delete.
newDeleteContainerService ::
  -- | 'serviceName'
  Prelude.Text ->
  DeleteContainerService
newDeleteContainerService :: Text -> DeleteContainerService
newDeleteContainerService Text
pServiceName_ =
  DeleteContainerService'
    { $sel:serviceName:DeleteContainerService' :: Text
serviceName =
        Text
pServiceName_
    }

-- | The name of the container service to delete.
deleteContainerService_serviceName :: Lens.Lens' DeleteContainerService Prelude.Text
deleteContainerService_serviceName :: Lens' DeleteContainerService Text
deleteContainerService_serviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteContainerService' {Text
serviceName :: Text
$sel:serviceName:DeleteContainerService' :: DeleteContainerService -> Text
serviceName} -> Text
serviceName) (\s :: DeleteContainerService
s@DeleteContainerService' {} Text
a -> DeleteContainerService
s {$sel:serviceName:DeleteContainerService' :: Text
serviceName = Text
a} :: DeleteContainerService)

instance Core.AWSRequest DeleteContainerService where
  type
    AWSResponse DeleteContainerService =
      DeleteContainerServiceResponse
  request :: (Service -> Service)
-> DeleteContainerService -> Request DeleteContainerService
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 DeleteContainerService
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContainerService)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteContainerServiceResponse
DeleteContainerServiceResponse'
            forall (f :: * -> *) a b. Functor 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 DeleteContainerService where
  hashWithSalt :: Int -> DeleteContainerService -> Int
hashWithSalt Int
_salt DeleteContainerService' {Text
serviceName :: Text
$sel:serviceName:DeleteContainerService' :: DeleteContainerService -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serviceName

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

instance Data.ToHeaders DeleteContainerService where
  toHeaders :: DeleteContainerService -> 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
"Lightsail_20161128.DeleteContainerService" ::
                          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 DeleteContainerService where
  toJSON :: DeleteContainerService -> Value
toJSON DeleteContainerService' {Text
serviceName :: Text
$sel:serviceName:DeleteContainerService' :: DeleteContainerService -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"serviceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceName)]
      )

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

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

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

-- |
-- Create a value of 'DeleteContainerServiceResponse' 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', 'deleteContainerServiceResponse_httpStatus' - The response's http status code.
newDeleteContainerServiceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteContainerServiceResponse
newDeleteContainerServiceResponse :: Int -> DeleteContainerServiceResponse
newDeleteContainerServiceResponse Int
pHttpStatus_ =
  DeleteContainerServiceResponse'
    { $sel:httpStatus:DeleteContainerServiceResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DeleteContainerServiceResponse
  where
  rnf :: DeleteContainerServiceResponse -> ()
rnf DeleteContainerServiceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteContainerServiceResponse' :: DeleteContainerServiceResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus